Skip to content

Commit

Permalink
add revert test for KEEP_CURRENT
Browse files Browse the repository at this point in the history
  • Loading branch information
rustboyar committed May 21, 2024
1 parent d1d13e1 commit 493d7d0
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/RiskStewardCapo.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {RiskSteward, IRiskSteward, IEngine, EngineFlags} from 'src/contracts/Ris
import {DeploymentLibrary, UpgradePayload} from 'protocol-v3.1-upgrade/scripts/Deploy.s.sol';
import {IAaveV3ConfigEngine as IEngine} from 'aave-v3-origin/periphery/contracts/v3-config-engine/AaveV3ConfigEngine.sol';
import {GovV3Helpers} from 'aave-helpers/GovV3Helpers.sol';
import {EngineFlags} from 'aave-helpers/v3-config-engine/EngineFlags.sol';
import {ConfigEngineDeployer} from './utils/ConfigEngineDeployer.sol';
import {IPriceCapAdapter} from 'aave-capo/interfaces/IPriceCapAdapter.sol';
import {IPriceCapAdapterStable, IChainlinkAggregator} from 'aave-capo/interfaces/IPriceCapAdapterStable.sol';
Expand Down Expand Up @@ -424,6 +425,28 @@ contract RiskSteward_Capo_Test is Test {
vm.stopPrank();
}

function test_updateStablePriceCap_keepCurrent_revert() public {
uint256 priceCapBefore = IPriceCapAdapterStable(AaveV3EthereumAssets.USDT_ORACLE)
.getPriceCap()
.toUint256();

IRiskSteward.PriceCapStableUpdate[]
memory priceCapUpdates = new IRiskSteward.PriceCapStableUpdate[](1);

priceCapUpdates[0] = IRiskSteward.PriceCapStableUpdate({
oracle: AaveV3EthereumAssets.USDT_ORACLE,
priceCap: EngineFlags.KEEP_CURRENT
});

// expect revert as price cap is out of range
vm.startPrank(riskCouncil);

vm.expectRevert();
steward.updateStablePriceCaps(priceCapUpdates);

vm.stopPrank();
}

function test_updateStablePriceCap_toValueZeroNotAllowed() public {
IRiskSteward.PriceCapStableUpdate[]
memory priceCapUpdates = new IRiskSteward.PriceCapStableUpdate[](1);
Expand Down

0 comments on commit 493d7d0

Please sign in to comment.