-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathAaveV3AvaCaps30-11-2022-ByGuardian.t.sol
100 lines (79 loc) · 3.32 KB
/
AaveV3AvaCaps30-11-2022-ByGuardian.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import 'forge-std/Test.sol';
import {IPoolConfigurator, ConfiguratorInputTypes, IACLManager} from 'aave-address-book/AaveV3.sol';
import {AaveV3Avalanche} from 'aave-address-book/AaveAddressBook.sol';
import {AaveV3AvaCapsSteward} from '../contracts/v3-ava-supply-caps-30-11-2022/AaveV3AvaCapsSteward.sol';
import {AaveV3Helpers, ReserveConfig, ReserveTokens, IERC20} from './helpers/AaveV3Helpers.sol';
contract AaveV3AvaCapsByGuardian is Test {
using stdStorage for StdStorage;
address public constant GUARDIAN_AVALANCHE =
0xa35b76E4935449E33C56aB24b23fcd3246f13470;
string public constant LinkSymbol = 'LINK.e';
string public constant WETHSymbol = 'WETH.e';
string public constant AAVESymbol = 'AAVE.e';
string public constant WAVAXSymbol = 'WAVAX';
string public constant WBTCSymbol = 'WBTC.e';
uint256 public constant WETHe_CAP = 113_000;
uint256 public constant WBTCe_CAP = 5_233;
uint256 public constant LINKe_CAP = 353_000;
uint256 public constant AAVEe_CAP = 4_500;
uint256 public constant WAVAX_CAP = 13_100_000;
function setUp() public {
vm.createSelectFork(vm.rpcUrl('avalanche'), 23032057);
}
function testNewSupplyCaps() public {
ReserveConfig[] memory allConfigsBefore = AaveV3Helpers
._getReservesConfigs(false);
vm.startPrank(GUARDIAN_AVALANCHE);
AaveV3AvaCapsSteward capsSteward = new AaveV3AvaCapsSteward();
IACLManager aclManager = AaveV3Avalanche.ACL_MANAGER;
aclManager.addAssetListingAdmin(address(capsSteward));
aclManager.addRiskAdmin(address(capsSteward));
capsSteward.execute();
vm.stopPrank();
ReserveConfig[] memory allConfigsAfter = AaveV3Helpers
._getReservesConfigs(false);
//LINK
ReserveConfig memory LinkConfig = AaveV3Helpers._findReserveConfig(
allConfigsBefore,
LinkSymbol,
false
);
LinkConfig.supplyCap = LINKe_CAP;
AaveV3Helpers._validateReserveConfig(LinkConfig, allConfigsAfter);
//WETH
ReserveConfig memory WETHConfig = AaveV3Helpers._findReserveConfig(
allConfigsBefore,
WETHSymbol,
false
);
WETHConfig.supplyCap = WETHe_CAP;
AaveV3Helpers._validateReserveConfig(WETHConfig, allConfigsAfter);
//AAVE
ReserveConfig memory AAVEConfig = AaveV3Helpers._findReserveConfig(
allConfigsBefore,
AAVESymbol,
false
);
AAVEConfig.supplyCap = AAVEe_CAP;
AaveV3Helpers._validateReserveConfig(AAVEConfig, allConfigsAfter);
//WAVAX
ReserveConfig memory WAVAXConfig = AaveV3Helpers._findReserveConfig(
allConfigsBefore,
WAVAXSymbol,
false
);
WAVAXConfig.supplyCap = WAVAX_CAP;
AaveV3Helpers._validateReserveConfig(WAVAXConfig, allConfigsAfter);
//WBTC
ReserveConfig memory WBTCConfig = AaveV3Helpers._findReserveConfig(
allConfigsBefore,
WBTCSymbol,
false
);
WBTCConfig.supplyCap = WBTCe_CAP;
AaveV3Helpers._validateReserveConfig(WBTCConfig, allConfigsAfter);
require(capsSteward.owner() == address(0), 'INVALID_OWNER_POST_CAPS');
}
}