forked from bgd-labs/protocol-v3.6-upgrade
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMainnet.t.sol
More file actions
93 lines (68 loc) · 4.08 KB
/
Mainnet.t.sol
File metadata and controls
93 lines (68 loc) · 4.08 KB
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
84
85
86
87
88
89
90
91
92
93
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {AaveV3Ethereum, AaveV3EthereumAssets} from "aave-address-book/AaveV3Ethereum.sol";
import {ReserveConfiguration} from "aave-v3-origin/contracts/protocol/libraries/configuration/ReserveConfiguration.sol";
import {DataTypes} from "aave-v3-origin/contracts/protocol/libraries/types/DataTypes.sol";
import {IATokenWithDelegation} from "aave-v3-origin/contracts/interfaces/IATokenWithDelegation.sol";
import {DeploymentLibrary} from "../script/Deploy.s.sol";
import {UpgradePayloadMainnet, IGhoDirectMinter, IGhoToken} from "../src/UpgradePayloadMainnet.sol";
import {VariableDebtTokenMainnetInstanceGHO} from "../src/VariableDebtTokenMainnetInstanceGHO.sol";
import {UpgradeTest, IERC20} from "./UpgradeTest.t.sol";
contract MainnetTest is UpgradeTest("mainnet", 22331905) {
using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
function test_upgrade() public override {
UpgradePayloadMainnet _payload = UpgradePayloadMainnet(_getTestPayload());
assertGt(IERC20(AaveV3EthereumAssets.GHO_UNDERLYING).balanceOf(AaveV3EthereumAssets.GHO_A_TOKEN), 0);
assertEq(AaveV3Ethereum.POOL.getVirtualUnderlyingBalance(AaveV3EthereumAssets.GHO_UNDERLYING), 0);
(uint256 ghoATokenCapacity, uint256 ghoATokenLevel) =
IGhoToken(AaveV3EthereumAssets.GHO_UNDERLYING).getFacilitatorBucket(AaveV3EthereumAssets.GHO_A_TOKEN);
assertGt(ghoATokenCapacity, 0);
assertGt(ghoATokenLevel, 0);
(uint256 facilitatorCapacity, uint256 facilitatorLevel) =
IGhoToken(AaveV3EthereumAssets.GHO_UNDERLYING).getFacilitatorBucket(_payload.FACILITATOR());
assertEq(facilitatorCapacity, 0);
assertEq(facilitatorLevel, 0);
assertEq(IERC20(AaveV3EthereumAssets.GHO_A_TOKEN).totalSupply(), 0);
assertEq(AaveV3Ethereum.POOL.getReserveNormalizedIncome(AaveV3EthereumAssets.GHO_UNDERLYING), 1e27);
DataTypes.ReserveDataLegacy memory reserveData =
AaveV3Ethereum.POOL.getReserveData(AaveV3EthereumAssets.GHO_UNDERLYING);
assertFalse(reserveData.configuration.getFlashLoanEnabled());
super.test_upgrade();
assertEq(
IERC20(AaveV3EthereumAssets.GHO_UNDERLYING).balanceOf(AaveV3EthereumAssets.GHO_A_TOKEN),
ghoATokenCapacity - ghoATokenLevel
);
assertEq(
AaveV3Ethereum.POOL.getVirtualUnderlyingBalance(AaveV3EthereumAssets.GHO_UNDERLYING),
ghoATokenCapacity - ghoATokenLevel
);
(facilitatorCapacity, facilitatorLevel) =
IGhoToken(AaveV3EthereumAssets.GHO_UNDERLYING).getFacilitatorBucket(_payload.FACILITATOR());
assertEq(facilitatorCapacity, ghoATokenCapacity);
assertEq(facilitatorLevel, ghoATokenCapacity);
assertEq(IERC20(AaveV3EthereumAssets.GHO_A_TOKEN).totalSupply(), ghoATokenCapacity);
(ghoATokenCapacity, ghoATokenLevel) =
IGhoToken(AaveV3EthereumAssets.GHO_UNDERLYING).getFacilitatorBucket(AaveV3EthereumAssets.GHO_A_TOKEN);
assertEq(ghoATokenCapacity, 0);
assertEq(ghoATokenLevel, 0);
assertEq(AaveV3Ethereum.POOL.getReserveNormalizedIncome(AaveV3EthereumAssets.GHO_UNDERLYING), 1e27);
assertTrue(AaveV3Ethereum.ACL_MANAGER.isRiskAdmin(_payload.FACILITATOR()));
reserveData = AaveV3Ethereum.POOL.getReserveData(AaveV3EthereumAssets.GHO_UNDERLYING);
assertEq(reserveData.configuration.getSupplyCap(), 1);
assertEq(reserveData.configuration.getReserveFactor(), 100_00);
assertTrue(reserveData.configuration.getFlashLoanEnabled());
// test updateDiscountDistribution function in the vToken of the GHO aToken
VariableDebtTokenMainnetInstanceGHO(AaveV3EthereumAssets.GHO_V_TOKEN).updateDiscountDistribution(
address(0), address(0), 0, 0, 0
);
// test delegation functionalities in the AAVE aToken
IATokenWithDelegation(AaveV3EthereumAssets.AAVE_A_TOKEN).getDelegates(address(this));
IATokenWithDelegation(AaveV3EthereumAssets.AAVE_A_TOKEN).getPowersCurrent(address(this));
}
function _getPayload() internal virtual override returns (address) {
return DeploymentLibrary._deployMainnet();
}
function _getDeployedPayload() internal virtual override returns (address) {
return address(0);
}
}