forked from aave-dao/aave-v3-origin
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'certora' into certora-stata-adaptation
- Loading branch information
Showing
14 changed files
with
123 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
certora/stata/harness/rewards/TransferStrategyMultiRewardHarness.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
pragma solidity ^0.8.10; | ||
|
||
import {IERC20} from '../../munged/lib/aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol'; | ||
import {TransferStrategyBase} from '../../munged/lib/aave-v3-periphery/contracts/rewards/transfer-strategies/TransferStrategyBase.sol'; | ||
|
||
contract TransferStrategyMultiRewardHarness is TransferStrategyBase{ | ||
|
||
constructor(address incentivesController, address rewardsAdmin) TransferStrategyBase(incentivesController, rewardsAdmin) {} | ||
|
||
IERC20 public REWARD; | ||
IERC20 public REWARD_B; | ||
|
||
// executes the actual transfer of the rewards to the receiver | ||
function performTransfer( | ||
address to, | ||
address reward, | ||
uint256 amount | ||
) external override(TransferStrategyBase) returns (bool){ | ||
|
||
require(reward == address(REWARD) || reward == address(REWARD_B)); | ||
|
||
if (reward == address(REWARD)){ | ||
return REWARD.transfer(to, amount); | ||
} | ||
else if (reward == address(REWARD_B)){ | ||
return REWARD_B.transfer(to, amount); | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule solidity-utils
updated
29 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,37 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity ^0.8.10; | ||
|
||
import {IRescuable} from 'solidity-utils/contracts/utils/Rescuable.sol'; | ||
import {IAToken} from '../../../src/periphery/contracts/static-a-token/StataTokenV2.sol'; | ||
import {BaseTest} from './TestBase.sol'; | ||
|
||
contract StataTokenV2RescuableTest is BaseTest { | ||
function test_whoCanRescue() external view { | ||
assertEq(IRescuable(address(stataTokenV2)).whoCanRescue(), poolAdmin); | ||
} | ||
event ERC20Rescued( | ||
address indexed caller, | ||
address indexed token, | ||
address indexed to, | ||
uint256 amount | ||
); | ||
|
||
function test_rescuable_shouldRevertForInvalidCaller() external { | ||
function test_rescuable_shouldTransferAssetsToCollector() external { | ||
deal(tokenList.usdx, address(stataTokenV2), 1 ether); | ||
vm.expectRevert('ONLY_RESCUE_GUARDIAN'); | ||
IRescuable(address(stataTokenV2)).emergencyTokenTransfer( | ||
tokenList.usdx, | ||
address(this), | ||
1 ether | ||
); | ||
stataTokenV2.emergencyTokenTransfer(tokenList.usdx, 1 ether); | ||
} | ||
|
||
function test_rescuable_shouldSuceedForOwner() external { | ||
deal(tokenList.usdx, address(stataTokenV2), 1 ether); | ||
vm.startPrank(poolAdmin); | ||
IRescuable(address(stataTokenV2)).emergencyTokenTransfer( | ||
tokenList.usdx, | ||
address(this), | ||
1 ether | ||
); | ||
function test_rescuable_shouldWorkForAToken() external { | ||
_fundAToken(1 ether, address(stataTokenV2)); | ||
stataTokenV2.emergencyTokenTransfer(aToken, 1 ether); | ||
} | ||
|
||
function test_rescuable_shouldNotCauseInsolvency(uint256 donation, uint256 stake) external { | ||
vm.assume(donation != 0 && donation <= type(uint96).max); | ||
vm.assume(stake != 0 && stake <= type(uint96).max); | ||
_fundAToken(donation, address(stataTokenV2)); | ||
_fund4626(stake, address(this)); | ||
|
||
address treasury = IAToken(aToken).RESERVE_TREASURY_ADDRESS(); | ||
|
||
vm.expectEmit(true, true, true, true); | ||
emit ERC20Rescued(address(this), aToken, treasury, donation); | ||
stataTokenV2.emergencyTokenTransfer(aToken, donation + stake); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters