From ac8ee9075377fe61ba73c5f778fa4389d75e2e57 Mon Sep 17 00:00:00 2001 From: Harsh Pandey Date: Thu, 14 Mar 2024 22:52:12 +0530 Subject: [PATCH] feat: activate price oracle sentinel on scroll --- ...72cc5e1b223dec2a704662f09ffadd187f3094.svg | 1 + ...leSentinelOnAaveV3Scroll_20240314_after.md | 12 ++++ ...eOracleSentinelOnAaveV3Scroll_20240314.sol | 20 +++++++ ...racleSentinelOnAaveV3Scroll_20240314.t.sol | 41 +++++++++++++ ...tivatePriceOracleSentinelOnAaveV3Scroll.md | 21 +++++++ ...racleSentinelOnAaveV3Scroll_20240314.s.sol | 59 +++++++++++++++++++ .../config.ts | 13 ++++ 7 files changed, 167 insertions(+) create mode 100644 .assets/a572cc5e1b223dec2a704662f09ffadd187f3094.svg create mode 100644 diffs/AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314_before_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314_after.md create mode 100644 src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314.sol create mode 100644 src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314.t.sol create mode 100644 src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/ActivatePriceOracleSentinelOnAaveV3Scroll.md create mode 100644 src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/ActivatePriceOracleSentinelOnAaveV3Scroll_20240314.s.sol create mode 100644 src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/config.ts diff --git a/.assets/a572cc5e1b223dec2a704662f09ffadd187f3094.svg b/.assets/a572cc5e1b223dec2a704662f09ffadd187f3094.svg new file mode 100644 index 000000000..a64e70f4b --- /dev/null +++ b/.assets/a572cc5e1b223dec2a704662f09ffadd187f3094.svg @@ -0,0 +1 @@ + Borrow APR, variableBorrow APR, stableUtilization Rate0%25%50%75%100%0%50%100%Optimal 80%Optimal 80% \ No newline at end of file diff --git a/diffs/AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314_before_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314_after.md b/diffs/AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314_before_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314_after.md new file mode 100644 index 000000000..d470752ad --- /dev/null +++ b/diffs/AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314_before_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314_after.md @@ -0,0 +1,12 @@ +## Raw diff + +```json +{ + "poolConfig": { + "priceOracleSentinel": { + "from": "0x0000000000000000000000000000000000000000", + "to": "0xfD0Ba55775C1e53f50736FA5528d8aa45FBcA391" + } + } +} +``` \ No newline at end of file diff --git a/src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314.sol b/src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314.sol new file mode 100644 index 000000000..9df53f39b --- /dev/null +++ b/src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314.sol @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; +import {AaveV3Scroll} from 'aave-address-book/AaveV3Scroll.sol'; + +/** + * @title Activate Price Oracle Sentinel On Aave V3 Scroll + * @author BGD Labs + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274 + */ +contract AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314 is + IProposalGenericExecutor +{ + address public constant PRICE_ORACLE_SENTINEL = 0xfD0Ba55775C1e53f50736FA5528d8aa45FBcA391; + + function execute() external { + AaveV3Scroll.POOL_ADDRESSES_PROVIDER.setPriceOracleSentinel(PRICE_ORACLE_SENTINEL); + } +} diff --git a/src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314.t.sol b/src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314.t.sol new file mode 100644 index 000000000..0f778a863 --- /dev/null +++ b/src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314.t.sol @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {ProtocolV3TestBase} from 'aave-helpers/ProtocolV3TestBase.sol'; +import {AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314} from './AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314.sol'; +import {AaveV3Scroll} from 'aave-address-book/AaveV3Scroll.sol'; +import {IPriceOracleSentinel} from 'aave-v3-core/contracts/interfaces/IPriceOracleSentinel.sol'; + +/** + * @dev Test for AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314 + * command: make test-contract filter=AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314 + */ +contract AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314_Test is + ProtocolV3TestBase +{ + AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314 internal proposal; + + function setUp() public { + vm.createSelectFork(vm.rpcUrl('scroll'), 4126179); + proposal = new AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314(); + } + + /** + * @dev executes the generic test suite including e2e and config snapshots + */ + function test_defaultProposalExecution() public { + defaultTest( + 'AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314', + AaveV3Scroll.POOL, + address(proposal) + ); + + assertEq( + AaveV3Scroll.POOL_ADDRESSES_PROVIDER.getPriceOracleSentinel(), + proposal.PRICE_ORACLE_SENTINEL() + ); + + assertTrue(IPriceOracleSentinel(proposal.PRICE_ORACLE_SENTINEL()).isLiquidationAllowed()); + assertTrue(IPriceOracleSentinel(proposal.PRICE_ORACLE_SENTINEL()).isBorrowAllowed()); + } +} diff --git a/src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/ActivatePriceOracleSentinelOnAaveV3Scroll.md b/src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/ActivatePriceOracleSentinelOnAaveV3Scroll.md new file mode 100644 index 000000000..01f4382a3 --- /dev/null +++ b/src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/ActivatePriceOracleSentinelOnAaveV3Scroll.md @@ -0,0 +1,21 @@ +--- +title: "Activate Price Oracle Sentinel On Aave V3 Scroll" +author: "BGD Labs" +discussions: "https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274" +--- + +## Simple Summary + +## Motivation + +## Specification + +## References + +- Implementation: [AaveV3Scroll](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314.sol) +- Tests: [AaveV3Scroll](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314.t.sol) +- [Discussion](https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274) // TODO + +## Copyright + +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). diff --git a/src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/ActivatePriceOracleSentinelOnAaveV3Scroll_20240314.s.sol b/src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/ActivatePriceOracleSentinelOnAaveV3Scroll_20240314.s.sol new file mode 100644 index 000000000..bf6754685 --- /dev/null +++ b/src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/ActivatePriceOracleSentinelOnAaveV3Scroll_20240314.s.sol @@ -0,0 +1,59 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {GovV3Helpers, IPayloadsControllerCore, PayloadsControllerUtils} from 'aave-helpers/GovV3Helpers.sol'; +import {AaveV3Scroll} from 'aave-address-book/AaveV3Scroll.sol'; +import {EthereumScript, ScrollScript} from 'aave-helpers/ScriptUtils.sol'; +import {AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314} from './AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314.sol'; + +/** + * @dev Deploy Scroll + * deploy-command: make deploy-ledger contract=src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/ActivatePriceOracleSentinelOnAaveV3Scroll_20240314.s.sol:DeployScroll chain=scroll + * verify-command: npx catapulta-verify -b broadcast/ActivatePriceOracleSentinelOnAaveV3Scroll_20240314.s.sol/534352/run-latest.json + */ +contract DeployScroll is ScrollScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314).creationCode + ); + + // compose action + IPayloadsControllerCore.ExecutionAction[] + memory actions = new IPayloadsControllerCore.ExecutionAction[](1); + actions[0] = GovV3Helpers.buildAction(payload0); + + // register action at payloadsController + GovV3Helpers.createPayload(actions); + } +} + +/** + * @dev Create Proposal + * command: make deploy-ledger contract=src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/ActivatePriceOracleSentinelOnAaveV3Scroll_20240314.s.sol:CreateProposal chain=mainnet + */ +contract CreateProposal is EthereumScript { + function run() external { + // create payloads + PayloadsControllerUtils.Payload[] memory payloads = new PayloadsControllerUtils.Payload[](1); + + // compose actions for validation + IPayloadsControllerCore.ExecutionAction[] + memory actionsScroll = new IPayloadsControllerCore.ExecutionAction[](1); + actionsScroll[0] = GovV3Helpers.buildAction( + type(AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll_20240314).creationCode + ); + payloads[0] = GovV3Helpers.buildScrollPayload(vm, actionsScroll); + + // create proposal + vm.startBroadcast(); + GovV3Helpers.createProposal( + vm, + payloads, + GovV3Helpers.ipfsHashFile( + vm, + 'src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/ActivatePriceOracleSentinelOnAaveV3Scroll.md' + ) + ); + } +} diff --git a/src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/config.ts b/src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/config.ts new file mode 100644 index 000000000..aa02173ff --- /dev/null +++ b/src/20240314_AaveV3Scroll_ActivatePriceOracleSentinelOnAaveV3Scroll/config.ts @@ -0,0 +1,13 @@ +import {ConfigFile} from '../../generator/types'; +export const config: ConfigFile = { + rootOptions: { + pools: ['AaveV3Scroll'], + title: 'Activate Price Oracle Sentinel On Aave V3 Scroll', + shortName: 'ActivatePriceOracleSentinelOnAaveV3Scroll', + date: '20240314', + author: 'BGD Labs', + discussion: 'https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274', + snapshot: '', + }, + poolOptions: {AaveV3Scroll: {configs: {OTHERS: {}}, cache: {blockNumber: 4126179}}}, +};