Skip to content

Commit d9201bb

Browse files
chore: update libs to use new version of stewards (aave-dao#48)
* chore: update libs to use new version of stewards * fix: test
1 parent 6e8fef4 commit d9201bb

File tree

4 files changed

+41
-44
lines changed

4 files changed

+41
-44
lines changed

lib/aave-helpers

package-lock.json

Lines changed: 5 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"prettier": "2.8.7",
2828
"prettier-plugin-solidity": "1.1.3",
2929
"vitest": "^2.1.8",
30-
"@bgd-labs/aave-address-book": "^4.22.0",
30+
"@bgd-labs/aave-address-book": "^4.24.0",
3131
"@bgd-labs/aave-cli": "^1.1.12",
3232
"@bgd-labs/js-utils": "^1.4.7",
3333
"@inquirer/prompts": "^3.3.0",

tests/RiskStewardCapo.t.sol

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ contract RiskSteward_Capo_Test is Test {
2727
uint104 currentRatio;
2828
uint48 delay;
2929

30+
address public wstETH_ORACLE = 0xB4aB0c94159bc2d8C133946E7241368fc2F2a010;
3031
event AddressRestricted(address indexed contractAddress, bool indexed isRestricted);
3132

3233
function setUp() public virtual {
@@ -56,11 +57,11 @@ contract RiskSteward_Capo_Test is Test {
5657
vm.prank(GovernanceV3Ethereum.EXECUTOR_LVL_1);
5758
AaveV3Ethereum.ACL_MANAGER.addRiskAdmin(address(steward));
5859

59-
currentRatio = IPriceCapAdapter(AaveV3EthereumAssets.wstETH_ORACLE)
60+
currentRatio = IPriceCapAdapter(wstETH_ORACLE)
6061
.getRatio()
6162
.toUint256()
6263
.toUint104();
63-
delay = IPriceCapAdapter(AaveV3EthereumAssets.wstETH_ORACLE).MINIMUM_SNAPSHOT_DELAY();
64+
delay = IPriceCapAdapter(wstETH_ORACLE).MINIMUM_SNAPSHOT_DELAY();
6465

6566
PriceCapAdapterStable mockAdapter = new PriceCapAdapterStable(
6667
IPriceCapAdapterStable.CapAdapterStableParams({
@@ -85,14 +86,14 @@ contract RiskSteward_Capo_Test is Test {
8586
/* ----------------------------- LST Price Cap Tests ----------------------------- */
8687

8788
function test_updateLstPriceCap() public virtual {
88-
uint256 maxYearlyGrowthPercentBefore = IPriceCapAdapter(AaveV3EthereumAssets.wstETH_ORACLE)
89+
uint256 maxYearlyGrowthPercentBefore = IPriceCapAdapter(wstETH_ORACLE)
8990
.getMaxYearlyGrowthRatePercent();
9091

9192
IRiskSteward.PriceCapLstUpdate[] memory priceCapUpdates = new IRiskSteward.PriceCapLstUpdate[](
9293
1
9394
);
9495
priceCapUpdates[0] = IRiskSteward.PriceCapLstUpdate({
95-
oracle: AaveV3EthereumAssets.wstETH_ORACLE,
96+
oracle: wstETH_ORACLE,
9697
priceCapUpdateParams: IPriceCapAdapter.PriceCapUpdateParams({
9798
snapshotTimestamp: uint48(block.timestamp - 2 * delay),
9899
snapshotRatio: (currentRatio - 2),
@@ -104,14 +105,14 @@ contract RiskSteward_Capo_Test is Test {
104105
steward.updateLstPriceCaps(priceCapUpdates);
105106

106107
RiskSteward.Debounce memory lastUpdated = steward.getTimelock(
107-
AaveV3EthereumAssets.wstETH_ORACLE
108+
wstETH_ORACLE
108109
);
109110

110-
uint256 snapshotRatioAfter = IPriceCapAdapter(AaveV3EthereumAssets.wstETH_ORACLE)
111+
uint256 snapshotRatioAfter = IPriceCapAdapter(wstETH_ORACLE)
111112
.getSnapshotRatio();
112-
uint256 snapshotTimestampAfter = IPriceCapAdapter(AaveV3EthereumAssets.wstETH_ORACLE)
113+
uint256 snapshotTimestampAfter = IPriceCapAdapter(wstETH_ORACLE)
113114
.getSnapshotTimestamp();
114-
uint256 maxYearlyGrowthPercentAfter = IPriceCapAdapter(AaveV3EthereumAssets.wstETH_ORACLE)
115+
uint256 maxYearlyGrowthPercentAfter = IPriceCapAdapter(wstETH_ORACLE)
115116
.getMaxYearlyGrowthRatePercent();
116117

117118
assertEq(snapshotTimestampAfter, priceCapUpdates[0].priceCapUpdateParams.snapshotTimestamp);
@@ -127,7 +128,7 @@ contract RiskSteward_Capo_Test is Test {
127128
vm.warp(block.timestamp + 5 days + 1);
128129

129130
priceCapUpdates[0] = IRiskSteward.PriceCapLstUpdate({
130-
oracle: AaveV3EthereumAssets.wstETH_ORACLE,
131+
oracle: wstETH_ORACLE,
131132
priceCapUpdateParams: IPriceCapAdapter.PriceCapUpdateParams({
132133
snapshotTimestamp: uint48(block.timestamp - delay),
133134
snapshotRatio: (currentRatio - 1),
@@ -137,12 +138,12 @@ contract RiskSteward_Capo_Test is Test {
137138

138139
steward.updateLstPriceCaps(priceCapUpdates);
139140

140-
lastUpdated = steward.getTimelock(AaveV3EthereumAssets.wstETH_ORACLE);
141+
lastUpdated = steward.getTimelock(wstETH_ORACLE);
141142

142-
snapshotRatioAfter = IPriceCapAdapter(AaveV3EthereumAssets.wstETH_ORACLE).getSnapshotRatio();
143-
snapshotTimestampAfter = IPriceCapAdapter(AaveV3EthereumAssets.wstETH_ORACLE)
143+
snapshotRatioAfter = IPriceCapAdapter(wstETH_ORACLE).getSnapshotRatio();
144+
snapshotTimestampAfter = IPriceCapAdapter(wstETH_ORACLE)
144145
.getSnapshotTimestamp();
145-
maxYearlyGrowthPercentAfter = IPriceCapAdapter(AaveV3EthereumAssets.wstETH_ORACLE)
146+
maxYearlyGrowthPercentAfter = IPriceCapAdapter(wstETH_ORACLE)
146147
.getMaxYearlyGrowthRatePercent();
147148
assertEq(snapshotTimestampAfter, priceCapUpdates[0].priceCapUpdateParams.snapshotTimestamp);
148149
assertEq(snapshotRatioAfter, priceCapUpdates[0].priceCapUpdateParams.snapshotRatio);
@@ -156,14 +157,14 @@ contract RiskSteward_Capo_Test is Test {
156157
}
157158

158159
function test_updateLstPriceCaps_debounceNotRespected() public virtual {
159-
uint256 maxYearlyGrowthPercentBefore = IPriceCapAdapter(AaveV3EthereumAssets.wstETH_ORACLE)
160+
uint256 maxYearlyGrowthPercentBefore = IPriceCapAdapter(wstETH_ORACLE)
160161
.getMaxYearlyGrowthRatePercent();
161162

162163
IRiskSteward.PriceCapLstUpdate[] memory priceCapUpdates = new IRiskSteward.PriceCapLstUpdate[](
163164
1
164165
);
165166
priceCapUpdates[0] = IRiskSteward.PriceCapLstUpdate({
166-
oracle: AaveV3EthereumAssets.wstETH_ORACLE,
167+
oracle: wstETH_ORACLE,
167168
priceCapUpdateParams: IPriceCapAdapter.PriceCapUpdateParams({
168169
snapshotTimestamp: uint48(block.timestamp - 2 * delay),
169170
snapshotRatio: (currentRatio - 2),
@@ -175,7 +176,7 @@ contract RiskSteward_Capo_Test is Test {
175176
steward.updateLstPriceCaps(priceCapUpdates);
176177

177178
priceCapUpdates[0] = IRiskSteward.PriceCapLstUpdate({
178-
oracle: AaveV3EthereumAssets.wstETH_ORACLE,
179+
oracle: wstETH_ORACLE,
179180
priceCapUpdateParams: IPriceCapAdapter.PriceCapUpdateParams({
180181
snapshotTimestamp: uint48(block.timestamp - 1 * delay),
181182
snapshotRatio: (currentRatio - 1),
@@ -191,14 +192,14 @@ contract RiskSteward_Capo_Test is Test {
191192
}
192193

193194
function test_updateLstPriceCap_invalidRatio() public virtual {
194-
uint256 maxYearlyGrowthPercentBefore = IPriceCapAdapter(AaveV3EthereumAssets.wstETH_ORACLE)
195+
uint256 maxYearlyGrowthPercentBefore = IPriceCapAdapter(wstETH_ORACLE)
195196
.getMaxYearlyGrowthRatePercent();
196197

197198
IRiskSteward.PriceCapLstUpdate[] memory priceCapUpdates = new IRiskSteward.PriceCapLstUpdate[](
198199
1
199200
);
200201
priceCapUpdates[0] = IRiskSteward.PriceCapLstUpdate({
201-
oracle: AaveV3EthereumAssets.wstETH_ORACLE,
202+
oracle: wstETH_ORACLE,
202203
priceCapUpdateParams: IPriceCapAdapter.PriceCapUpdateParams({
203204
snapshotTimestamp: uint48(block.timestamp - 2 * delay),
204205
snapshotRatio: (currentRatio + 1),
@@ -215,14 +216,14 @@ contract RiskSteward_Capo_Test is Test {
215216
}
216217

217218
function test_updateLstPriceCap_outOfRange() public virtual {
218-
uint256 maxYearlyGrowthPercentBefore = IPriceCapAdapter(AaveV3EthereumAssets.wstETH_ORACLE)
219+
uint256 maxYearlyGrowthPercentBefore = IPriceCapAdapter(wstETH_ORACLE)
219220
.getMaxYearlyGrowthRatePercent();
220221

221222
IRiskSteward.PriceCapLstUpdate[] memory priceCapUpdates = new IRiskSteward.PriceCapLstUpdate[](
222223
1
223224
);
224225
priceCapUpdates[0] = IRiskSteward.PriceCapLstUpdate({
225-
oracle: AaveV3EthereumAssets.wstETH_ORACLE,
226+
oracle: wstETH_ORACLE,
226227
priceCapUpdateParams: IPriceCapAdapter.PriceCapUpdateParams({
227228
snapshotTimestamp: uint48(block.timestamp - 2 * delay),
228229
snapshotRatio: (currentRatio - 1),
@@ -239,14 +240,14 @@ contract RiskSteward_Capo_Test is Test {
239240
}
240241

241242
function test_updateLstPriceCap_isCapped() public virtual {
242-
uint256 maxYearlyGrowthPercentBefore = IPriceCapAdapter(AaveV3EthereumAssets.wstETH_ORACLE)
243+
uint256 maxYearlyGrowthPercentBefore = IPriceCapAdapter(wstETH_ORACLE)
243244
.getMaxYearlyGrowthRatePercent();
244245

245246
IRiskSteward.PriceCapLstUpdate[] memory priceCapUpdates = new IRiskSteward.PriceCapLstUpdate[](
246247
1
247248
);
248249
priceCapUpdates[0] = IRiskSteward.PriceCapLstUpdate({
249-
oracle: AaveV3EthereumAssets.wstETH_ORACLE,
250+
oracle: wstETH_ORACLE,
250251
priceCapUpdateParams: IPriceCapAdapter.PriceCapUpdateParams({
251252
snapshotTimestamp: uint48(block.timestamp - 2 * delay),
252253
snapshotRatio: (currentRatio / 2),
@@ -263,14 +264,14 @@ contract RiskSteward_Capo_Test is Test {
263264
}
264265

265266
function test_updateLstPriceCap_toValueZeroNotAllowed() public virtual {
266-
uint256 maxYearlyGrowthPercentBefore = IPriceCapAdapter(AaveV3EthereumAssets.wstETH_ORACLE)
267+
uint256 maxYearlyGrowthPercentBefore = IPriceCapAdapter(wstETH_ORACLE)
267268
.getMaxYearlyGrowthRatePercent();
268269

269270
IRiskSteward.PriceCapLstUpdate[] memory priceCapUpdates = new IRiskSteward.PriceCapLstUpdate[](
270271
1
271272
);
272273
priceCapUpdates[0] = IRiskSteward.PriceCapLstUpdate({
273-
oracle: AaveV3EthereumAssets.wstETH_ORACLE,
274+
oracle: wstETH_ORACLE,
274275
priceCapUpdateParams: IPriceCapAdapter.PriceCapUpdateParams({
275276
snapshotTimestamp: 0,
276277
snapshotRatio: (currentRatio / 2),
@@ -284,7 +285,7 @@ contract RiskSteward_Capo_Test is Test {
284285
steward.updateLstPriceCaps(priceCapUpdates);
285286

286287
priceCapUpdates[0] = IRiskSteward.PriceCapLstUpdate({
287-
oracle: AaveV3EthereumAssets.wstETH_ORACLE,
288+
oracle: wstETH_ORACLE,
288289
priceCapUpdateParams: IPriceCapAdapter.PriceCapUpdateParams({
289290
snapshotTimestamp: uint48(block.timestamp - 2 * delay),
290291
snapshotRatio: 0,
@@ -297,7 +298,7 @@ contract RiskSteward_Capo_Test is Test {
297298
steward.updateLstPriceCaps(priceCapUpdates);
298299

299300
priceCapUpdates[0] = IRiskSteward.PriceCapLstUpdate({
300-
oracle: AaveV3EthereumAssets.wstETH_ORACLE,
301+
oracle: wstETH_ORACLE,
301302
priceCapUpdateParams: IPriceCapAdapter.PriceCapUpdateParams({
302303
snapshotTimestamp: uint48(block.timestamp - 2 * delay),
303304
snapshotRatio: (currentRatio / 2),
@@ -314,17 +315,17 @@ contract RiskSteward_Capo_Test is Test {
314315

315316
function test_updateLstPriceCap_oracleRestricted() public virtual {
316317
vm.startPrank(GovernanceV3Ethereum.EXECUTOR_LVL_1);
317-
steward.setAddressRestricted(AaveV3EthereumAssets.wstETH_ORACLE, true);
318+
steward.setAddressRestricted(wstETH_ORACLE, true);
318319
vm.stopPrank();
319320

320-
uint256 maxYearlyGrowthPercentBefore = IPriceCapAdapter(AaveV3EthereumAssets.wstETH_ORACLE)
321+
uint256 maxYearlyGrowthPercentBefore = IPriceCapAdapter(wstETH_ORACLE)
321322
.getMaxYearlyGrowthRatePercent();
322323

323324
IRiskSteward.PriceCapLstUpdate[] memory priceCapUpdates = new IRiskSteward.PriceCapLstUpdate[](
324325
1
325326
);
326327
priceCapUpdates[0] = IRiskSteward.PriceCapLstUpdate({
327-
oracle: AaveV3EthereumAssets.wstETH_ORACLE,
328+
oracle: wstETH_ORACLE,
328329
priceCapUpdateParams: IPriceCapAdapter.PriceCapUpdateParams({
329330
snapshotTimestamp: uint48(block.timestamp - 2 * delay),
330331
snapshotRatio: (currentRatio / 2),
@@ -338,17 +339,17 @@ contract RiskSteward_Capo_Test is Test {
338339
}
339340

340341
function test_updateLstPriceCap_noSameUpdate() public virtual {
341-
uint256 maxYearlyGrowthPercentBefore = IPriceCapAdapter(AaveV3EthereumAssets.wstETH_ORACLE)
342+
uint256 maxYearlyGrowthPercentBefore = IPriceCapAdapter(wstETH_ORACLE)
342343
.getMaxYearlyGrowthRatePercent();
343-
uint256 snapshotTsBefore = IPriceCapAdapter(AaveV3EthereumAssets.wstETH_ORACLE)
344+
uint256 snapshotTsBefore = IPriceCapAdapter(wstETH_ORACLE)
344345
.getSnapshotTimestamp();
345346

346347
vm.startPrank(riskCouncil);
347348
IRiskSteward.PriceCapLstUpdate[] memory priceCapUpdates = new IRiskSteward.PriceCapLstUpdate[](
348349
1
349350
);
350351
priceCapUpdates[0] = IRiskSteward.PriceCapLstUpdate({
351-
oracle: AaveV3EthereumAssets.wstETH_ORACLE,
352+
oracle: wstETH_ORACLE,
352353
priceCapUpdateParams: IPriceCapAdapter.PriceCapUpdateParams({
353354
snapshotTimestamp: uint48(snapshotTsBefore),
354355
snapshotRatio: currentRatio,
@@ -363,7 +364,7 @@ contract RiskSteward_Capo_Test is Test {
363364
steward.updateLstPriceCaps(priceCapUpdates);
364365

365366
priceCapUpdates[0] = IRiskSteward.PriceCapLstUpdate({
366-
oracle: AaveV3EthereumAssets.wstETH_ORACLE,
367+
oracle: wstETH_ORACLE,
367368
priceCapUpdateParams: IPriceCapAdapter.PriceCapUpdateParams({
368369
snapshotTimestamp: uint48(snapshotTsBefore) + 1,
369370
snapshotRatio: currentRatio - 1,

0 commit comments

Comments
 (0)