Skip to content

Commit e7fbd74

Browse files
fix: allow absolute change for discount rate (#44)
* feat: allow absolute change on pendle pt discountRate * fix: docs
1 parent e9f89fd commit e7fbd74

File tree

4 files changed

+19
-11
lines changed

4 files changed

+19
-11
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ The following risk params could be changed by the RiskStewards:
3232
- Optimal point
3333

3434
- Cap parameters for [PriceCapAdapters (CAPO)](https://github.com/bgd-labs/aave-capo/)
35+
- Discount Rate for Pendle PT CAPO
3536

3637
- EMode Collateral params (LTV, Liquidation Threshold, Liquidation Bonus)
3738

@@ -58,6 +59,9 @@ For each risk param, `maxPercentChange` is the maximum percent change allowed (b
5859
- Stable price cap: the `maxPercentChange` is in relative values.
5960
For example, for a current price cap of an oracle configured at 1_10_000000 and `maxPercentChange` configured at `1_00`, the max price cap that can be configured is 1_11_100000 and the minimum 1_08_900000 via the steward.
6061

62+
- Pendle discount rate CAPO: the `maxPercentChange` is in absolute values.
63+
For example, for a current discount rate of an oracle configured at `0.05e18` (5%) and `maxPercentChange` configured at `0.025e18` (2.5%), the max price cap that can be configured is `0.075e18` (7.5%) and the minimum `0.025e18` (2.5%) via the steward.
64+
6165
After the activation proposal, these params could only be changed by the governance by calling the `setRiskConfig()` method.
6266

6367
_Note: The Risk Stewards will not allow setting the values to 0 for supply cap, borrow cap, debt ceiling, LTV, Liquidation Threshold, Liquidation Bonus no matter if the maxPercentChange has been configured to 100%. The Risk Stewards will however allow setting the value to 0 for interest rate param updates._

scripts/deploy/DeployStewards.s.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ library DeployRiskStewards {
7878
priceCapConfig: IRiskSteward.PriceCapConfig({
7979
priceCapLst: IRiskSteward.RiskParamConfig({minDelay: 3 days, maxPercentChange: 5_00}),
8080
priceCapStable: IRiskSteward.RiskParamConfig({minDelay: 3 days, maxPercentChange: 50}),
81-
discountRatePendle: IRiskSteward.RiskParamConfig({minDelay: 2 days, maxPercentChange: 5_00})
81+
discountRatePendle: IRiskSteward.RiskParamConfig({minDelay: 2 days, maxPercentChange: 0.025e18})
8282
})
8383
});
8484
}

src/contracts/RiskSteward.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ contract RiskSteward is Ownable, IRiskSteward {
484484
newValue: discountRateUpdate[i].discountRate,
485485
lastUpdated: _timelocks[oracle].priceCapLastUpdated,
486486
riskConfig: _riskConfig.priceCapConfig.discountRatePendle,
487-
isChangeRelative: true
487+
isChangeRelative: false
488488
})
489489
);
490490
}

tests/RiskStewardCapo.t.sol

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,14 @@ contract RiskSteward_Capo_Test is Test {
3434
minDelay: 5 days,
3535
maxPercentChange: 10_00 // 10%
3636
});
37+
IRiskSteward.RiskParamConfig memory pendleRiskParamConfig = IRiskSteward.RiskParamConfig({
38+
minDelay: 5 days,
39+
maxPercentChange: 0.1e18 // 10%
40+
});
3741
IRiskSteward.Config memory riskConfig;
3842
riskConfig.priceCapConfig.priceCapLst = defaultRiskParamConfig;
3943
riskConfig.priceCapConfig.priceCapStable = defaultRiskParamConfig;
40-
riskConfig.priceCapConfig.discountRatePendle = defaultRiskParamConfig;
44+
riskConfig.priceCapConfig.discountRatePendle = pendleRiskParamConfig;
4145

4246
steward = new RiskSteward(
4347
address(AaveV3Ethereum.POOL),
@@ -70,7 +74,7 @@ contract RiskSteward_Capo_Test is Test {
7074
assetToUsdAggregator: 0x42bc86f2f08419280a99d8fbEa4672e7c30a86ec, // sUSDe capo
7175
pendlePrincipalToken: 0xb7de5dFCb74d25c2f21841fbd6230355C50d9308, // sUSDe PT token
7276
maxDiscountRatePerYear: 1e18, // 100%
73-
discountRatePerYear: 0.1e18, // 10%
77+
discountRatePerYear: 0.2e18, // 20%
7478
aclManager: address(AaveV3Ethereum.ACL_MANAGER),
7579
description: 'sUSDe PT Adapter'
7680
}));
@@ -563,7 +567,7 @@ contract RiskSteward_Capo_Test is Test {
563567

564568
priceCapUpdates[0] = IRiskSteward.DiscountRatePendleUpdate({
565569
oracle: address(pendleAdapter),
566-
discountRate: ((currentDiscount * 110) / 100) // +10% relative change
570+
discountRate: currentDiscount + 0.1e18 // +10% absolute change
567571
});
568572

569573
vm.startPrank(riskCouncil);
@@ -582,7 +586,7 @@ contract RiskSteward_Capo_Test is Test {
582586

583587
priceCapUpdates[0] = IRiskSteward.DiscountRatePendleUpdate({
584588
oracle: address(pendleAdapter),
585-
discountRate: ((currentDiscount * 90) / 100) // -10% relative change
589+
discountRate: currentDiscount - 0.1e18 // -10% absolute change
586590
});
587591

588592
steward.updatePendleDiscountRates(priceCapUpdates);
@@ -603,15 +607,15 @@ contract RiskSteward_Capo_Test is Test {
603607

604608
priceCapUpdates[0] = IRiskSteward.DiscountRatePendleUpdate({
605609
oracle: address(pendleAdapter),
606-
discountRate: ((currentDiscount * 110) / 100) // +10% relative change
610+
discountRate: currentDiscount + 0.1e18 // +10% absolute change
607611
});
608612

609613
vm.startPrank(riskCouncil);
610614
steward.updatePendleDiscountRates(priceCapUpdates);
611615

612616
priceCapUpdates[0] = IRiskSteward.DiscountRatePendleUpdate({
613617
oracle: address(pendleAdapter),
614-
discountRate: ((currentDiscount * 105) / 100) // +10% relative change
618+
discountRate: currentDiscount + 0.1e18 // +10% absolute change
615619
});
616620

617621
// expect revert as minimum time has not passed for next update
@@ -626,7 +630,7 @@ contract RiskSteward_Capo_Test is Test {
626630

627631
priceCapUpdates[0] = IRiskSteward.DiscountRatePendleUpdate({
628632
oracle: address(pendleAdapter),
629-
discountRate: ((currentDiscount * 111) / 100) // +11% relative increase
633+
discountRate: currentDiscount + 0.11e18 // +11% absolute change
630634
});
631635
vm.startPrank(riskCouncil);
632636

@@ -636,7 +640,7 @@ contract RiskSteward_Capo_Test is Test {
636640

637641
priceCapUpdates[0] = IRiskSteward.DiscountRatePendleUpdate({
638642
oracle: address(pendleAdapter),
639-
discountRate: ((currentDiscount * 89) / 100) // -11% relative decrease
643+
discountRate: currentDiscount - 0.11e18 // -11% absolute change
640644
});
641645
vm.expectRevert(IRiskSteward.UpdateNotInRange.selector);
642646
steward.updatePendleDiscountRates(priceCapUpdates);
@@ -682,7 +686,7 @@ contract RiskSteward_Capo_Test is Test {
682686

683687
priceCapUpdates[0] = IRiskSteward.DiscountRatePendleUpdate({
684688
oracle: address(pendleAdapter),
685-
discountRate: ((currentDiscount * 110) / 100) // +10% relative change
689+
discountRate: currentDiscount + 0.1e18 // +10% absolute change
686690
});
687691
vm.prank(riskCouncil);
688692
// expect revert as oracle is restricted

0 commit comments

Comments
 (0)