This repository has been archived by the owner on Nov 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
/
AaveV2_Eth_TUSDOffboardingPlan_20233107.t.sol
83 lines (69 loc) · 2.9 KB
/
AaveV2_Eth_TUSDOffboardingPlan_20233107.t.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
import {GovHelpers} from 'aave-helpers/GovHelpers.sol';
import {AaveGovernanceV2} from 'aave-address-book/AaveGovernanceV2.sol';
import {AaveV2Ethereum, AaveV2EthereumAssets} from 'aave-address-book/AaveV2Ethereum.sol';
import {ProtocolV2TestBase, ReserveConfig} from 'aave-helpers/ProtocolV2TestBase.sol';
import {AaveV2_Eth_TUSDOffboardingPlan_20233107} from './AaveV2_Eth_TUSDOffboardingPlan_20233107.sol';
import {IERC20} from 'lib/solidity-utils/src/contracts/oz-common/interfaces/IERC20.sol';
/**
* @dev Test for AaveV2_Eth_TUSDOffboardingPlan_20233107
* command: make test-contract filter=AaveV2_Eth_TUSDOffboardingPlan_20233107
*/
contract AaveV2_Eth_TUSDOffboardingPlan_20233107_Test is ProtocolV2TestBase {
string public constant TUSD_SYMBOL = 'TUSD';
function setUp() public {
vm.createSelectFork(vm.rpcUrl('mainnet'), 17812148);
}
function testProposalExecution() public {
AaveV2_Eth_TUSDOffboardingPlan_20233107 proposal = new AaveV2_Eth_TUSDOffboardingPlan_20233107();
ReserveConfig[] memory allConfigsBefore = createConfigurationSnapshot(
'preAaveV2_Eth_TUSDOffboardingPlan_20233107',
AaveV2Ethereum.POOL
);
ReserveConfig memory configTUSDBefore = _findReserveConfigBySymbol(
allConfigsBefore,
TUSD_SYMBOL
);
uint256 aTUSDBalanceBefore = IERC20(AaveV2EthereumAssets.TUSD_A_TOKEN).balanceOf(
address(AaveV2Ethereum.COLLECTOR)
);
uint256 TUSDBalanceBefore = IERC20(AaveV2EthereumAssets.TUSD_UNDERLYING).balanceOf(
address(AaveV2Ethereum.COLLECTOR)
);
GovHelpers.executePayload(vm, address(proposal), AaveGovernanceV2.SHORT_EXECUTOR);
// check balances are correct
uint256 aTUSDBalanceAfter = IERC20(AaveV2EthereumAssets.TUSD_A_TOKEN).balanceOf(
address(AaveV2Ethereum.COLLECTOR)
);
uint256 TUSDBalanceAfter = IERC20(AaveV2EthereumAssets.TUSD_UNDERLYING).balanceOf(
address(AaveV2Ethereum.COLLECTOR)
);
assertApproxEqAbs(aTUSDBalanceAfter, 0, 1500 ether, 'aTUSD_LEFTOVER');
assertEq(TUSDBalanceAfter, aTUSDBalanceBefore + TUSDBalanceBefore);
ReserveConfig[] memory allConfigsAfter = createConfigurationSnapshot(
'postAaveV2_Eth_TUSDOffboardingPlan_20233107',
AaveV2Ethereum.POOL
);
// check it's not bricked
ReserveConfig memory configTUSDAfter = _findReserveConfigBySymbol(allConfigsAfter, TUSD_SYMBOL);
_withdraw(
configTUSDAfter,
AaveV2Ethereum.POOL,
0x9FCc67D7DB763787BB1c7f3bC7f34d3C548c19Fe,
1 ether
); // aTUSD whale
// check there are no unexpected changes
_noReservesConfigsChangesApartFrom(
allConfigsBefore,
allConfigsAfter,
configTUSDBefore.underlying
);
e2eTest(AaveV2Ethereum.POOL);
diffReports(
'preAaveV2_Eth_TUSDOffboardingPlan_20233107',
'postAaveV2_Eth_TUSDOffboardingPlan_20233107'
);
}
}