From 8ca5e0eb22878128a69cae5bd6cb583a2d7b36e1 Mon Sep 17 00:00:00 2001 From: efecarranza Date: Sun, 7 Jul 2024 19:28:30 -0400 Subject: [PATCH 01/10] feat: increase facilitator capacity --- ...creaseCCIPFacilitatorCapacity_20240707.sol | 22 +++++++ ...easeCCIPFacilitatorCapacity_20240707.t.sol | 44 ++++++++++++++ .../IncreaseCCIPFacilitatorCapacity.md | 29 +++++++++ ...easeCCIPFacilitatorCapacity_20240707.s.sol | 60 +++++++++++++++++++ .../config.ts | 15 +++++ 5 files changed, 170 insertions(+) create mode 100644 src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.sol create mode 100644 src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol create mode 100644 src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity.md create mode 100644 src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity_20240707.s.sol create mode 100644 src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/config.ts diff --git a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.sol b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.sol new file mode 100644 index 000000000..33d9ff1ed --- /dev/null +++ b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.sol @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; + +interface UpgradeableLockReleaseTokenPool { + function setBridgeLimit(uint256 limit) external; +} + +/** + * @title Increase CCIP Facilitator Capacity + * @author @karpatkey_TokenLogic + * - Snapshot: Direct-to-AIP + * - Discussion: https://governance.aave.com/t/arfc-gho-arb-increase-ccip-facilitator-capacity/18169 + */ +contract AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707 is IProposalGenericExecutor { + address public constant GHO_TOKEN_POOL = 0x5756880B6a1EAba0175227bf02a7E87c1e02B28C; + uint256 public constant NEW_LIMIT = 2_500_000 ether; + function execute() external { + UpgradeableLockReleaseTokenPool(GHO_TOKEN_POOL).setBridgeLimit(NEW_LIMIT); + } +} diff --git a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol new file mode 100644 index 000000000..a2d47c877 --- /dev/null +++ b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol'; + +import {ProtocolV3TestBase} from 'aave-helpers/ProtocolV3TestBase.sol'; +import {AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707} from './AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.sol'; + +interface UpgradeableLockReleaseTokenPool { + function getBridgeLimit() external returns (uint256); + + function setBridgeLimit(uint256 limit) external; +} + +/** + * @dev Test for AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707 + * command: FOUNDRY_PROFILE=mainnet forge test --match-path=src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol -vv + */ +contract AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707_Test is ProtocolV3TestBase { + AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707 internal proposal; + + function setUp() public { + vm.createSelectFork(vm.rpcUrl('mainnet'), 20257789); + proposal = new AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707(); + } + + /** + * @dev executes the generic test suite including e2e and config snapshots + */ + function test_newLimitIsSet() public { + // Current limit is 1M + assertEq( + UpgradeableLockReleaseTokenPool(proposal.GHO_TOKEN_POOL()).getBridgeLimit(), + 1_000_000 ether + ); + + executePayload(vm, address(proposal)); + + assertEq( + UpgradeableLockReleaseTokenPool(proposal.GHO_TOKEN_POOL()).getBridgeLimit(), + proposal.NEW_LIMIT() + ); + } +} diff --git a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity.md b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity.md new file mode 100644 index 000000000..30e029033 --- /dev/null +++ b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity.md @@ -0,0 +1,29 @@ +--- +title: "Increase CCIP Facilitator Capacity" +author: "@karpatkey_TokenLogic" +discussions: "https://governance.aave.com/t/arfc-gho-arb-increase-ccip-facilitator-capacity/18169" +snapshot: "Direct-to-AIP" +--- + +## Simple Summary + +This publication proposes increasing the CCIP Facilitator Capacity on Arbitrum from 1M units to 2.5M units via the Direct-to-AIP process. + +## Motivation + +GHO was successfully launched on Arbitrum and the CCIP GHO Facilitator Bucket Capacity is 65% utilized. With $3.41M of liquidity and a solid peg during launch, there is sufficient depth to facilitate increasing the CCIP GHO Facilitator Bucket Capacity from 1M to 2.5M in line with the initial risk parameters proposed prior to launch 3. + +## Specification + +This proposal will increase the CCIP GHO Facilitator Bucket Capacity from 1M units to 2.5M units via the Direct-to-AIP process. + +## References + +- Implementation: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.sol) +- Tests: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol) +- [Snapshot](Direct-to-AIP) +- [Discussion](https://governance.aave.com/t/arfc-gho-arb-increase-ccip-facilitator-capacity/18169) + +## Copyright + +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). diff --git a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity_20240707.s.sol b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity_20240707.s.sol new file mode 100644 index 000000000..7b514ffe0 --- /dev/null +++ b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity_20240707.s.sol @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {GovV3Helpers, IPayloadsControllerCore, PayloadsControllerUtils} from 'aave-helpers/GovV3Helpers.sol'; +import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; +import {EthereumScript} from 'aave-helpers/ScriptUtils.sol'; +import {AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707} from './AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.sol'; + +/** + * @dev Deploy Ethereum + * deploy-command: make deploy-ledger contract=src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity_20240707.s.sol:DeployEthereum chain=mainnet + * verify-command: FOUNDRY_PROFILE=mainnet npx catapulta-verify -b broadcast/IncreaseCCIPFacilitatorCapacity_20240707.s.sol/1/run-latest.json + */ +contract DeployEthereum is EthereumScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707).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/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity_20240707.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 actionsEthereum = new IPayloadsControllerCore.ExecutionAction[](1); + actionsEthereum[0] = GovV3Helpers.buildAction( + type(AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707).creationCode + ); + payloads[0] = GovV3Helpers.buildMainnetPayload(vm, actionsEthereum); + + // create proposal + vm.startBroadcast(); + GovV3Helpers.createProposal( + vm, + payloads, + GovernanceV3Ethereum.VOTING_PORTAL_ETH_POL, + GovV3Helpers.ipfsHashFile( + vm, + 'src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity.md' + ) + ); + } +} diff --git a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/config.ts b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/config.ts new file mode 100644 index 000000000..8beb08c8e --- /dev/null +++ b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/config.ts @@ -0,0 +1,15 @@ +import {ConfigFile} from '../../generator/types'; +export const config: ConfigFile = { + rootOptions: { + pools: ['AaveV3Ethereum'], + title: 'Increase CCIP Facilitator Capacity', + shortName: 'IncreaseCCIPFacilitatorCapacity', + date: '20240707', + author: '@karpatkey_TokenLogic', + discussion: + 'https://governance.aave.com/t/arfc-gho-arb-increase-ccip-facilitator-capacity/18169', + snapshot: 'Direct-to-AIP', + votingNetwork: 'POLYGON', + }, + poolOptions: {AaveV3Ethereum: {configs: {OTHERS: {}}, cache: {blockNumber: 20257789}}}, +}; From f8c65e9d27cb03bc2f137228c6e53b4221e303d9 Mon Sep 17 00:00:00 2001 From: efecarranza Date: Tue, 9 Jul 2024 11:55:32 -0400 Subject: [PATCH 02/10] feat: add arbitrum side --- lib/aave-helpers | 2 +- lib/ccip | 2 +- lib/gho-core | 2 +- ...creaseCCIPFacilitatorCapacity_20240707.sol | 27 ++++++++++++ ...easeCCIPFacilitatorCapacity_20240707.t.sol | 42 +++++++++++++++++++ ...creaseCCIPFacilitatorCapacity_20240707.sol | 5 ++- 6 files changed, 75 insertions(+), 5 deletions(-) create mode 100644 src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.sol create mode 100644 src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol diff --git a/lib/aave-helpers b/lib/aave-helpers index 8e1340b89..efcdc0c64 160000 --- a/lib/aave-helpers +++ b/lib/aave-helpers @@ -1 +1 @@ -Subproject commit 8e1340b890cef83117a4b319bea395b26991c0aa +Subproject commit efcdc0c64c2bfef1dfa61a034692dc71d737d26b diff --git a/lib/ccip b/lib/ccip index d6cb9dab3..55a0b5939 160000 --- a/lib/ccip +++ b/lib/ccip @@ -1 +1 @@ -Subproject commit d6cb9dab3eb7bff1cd3bfb0e1d2fb634f594f120 +Subproject commit 55a0b5939c7083c61d5651b80454095cb1f6757c diff --git a/lib/gho-core b/lib/gho-core index a9647e1b5..3a3293b17 160000 --- a/lib/gho-core +++ b/lib/gho-core @@ -1 +1 @@ -Subproject commit a9647e1b581c7f781d36ec34fb5174d29a1ec7ba +Subproject commit 3a3293b17eb985ac230a4e3bc6a1aafd682de3d5 diff --git a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.sol b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.sol new file mode 100644 index 000000000..d561ad432 --- /dev/null +++ b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.sol @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {AaveV3ArbitrumAssets} from 'aave-address-book/AaveV3Arbitrum.sol'; +import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; + +interface IGHOToken { + function setFacilitatorBucketCapacity(address facilitator, uint128 limit) external; +} + +/** + * @title Increase CCIP Facilitator Capacity + * @author @karpatkey_TokenLogic + * - Snapshot: Direct-to-AIP + * - Discussion: https://governance.aave.com/t/arfc-gho-arb-increase-ccip-facilitator-capacity/18169 + */ +contract AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707 is IProposalGenericExecutor { + address public constant FACILITATOR = 0xF168B83598516A532a85995b52504a2Fa058C068; + uint128 public constant NEW_LIMIT = 2_500_000 ether; + + function execute() external { + IGHOToken(AaveV3ArbitrumAssets.GHO_UNDERLYING).setFacilitatorBucketCapacity( + FACILITATOR, + NEW_LIMIT + ); + } +} diff --git a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol new file mode 100644 index 000000000..637199c05 --- /dev/null +++ b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {AaveV3ArbitrumAssets} from 'aave-address-book/AaveV3Arbitrum.sol'; + +import {ProtocolV3TestBase} from 'aave-helpers/ProtocolV3TestBase.sol'; +import {AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707} from './AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.sol'; + +interface IGHOToken { + function getFacilitator(address facilitator) external returns (uint128, uint128, string memory); +} + +/** + * @dev Test for AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707 + * command: FOUNDRY_PROFILE=mainnet forge test --match-path=src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol -vv + */ +contract AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707_Test is ProtocolV3TestBase { + AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707 internal proposal; + + function setUp() public { + vm.createSelectFork(vm.rpcUrl('arbitrum'), 230441155); + proposal = new AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707(); + } + + /** + * @dev executes the generic test suite including e2e and config snapshots + */ + function test_newLimitIsSet() public { + (uint128 currentLimit, , ) = IGHOToken(AaveV3ArbitrumAssets.GHO_UNDERLYING).getFacilitator( + proposal.FACILITATOR() + ); + assertEq(currentLimit, 1_000_000 ether); + + executePayload(vm, address(proposal)); + + (uint128 newLimit, , ) = IGHOToken(AaveV3ArbitrumAssets.GHO_UNDERLYING).getFacilitator( + proposal.FACILITATOR() + ); + + assertEq(newLimit, proposal.NEW_LIMIT()); + } +} diff --git a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.sol b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.sol index 33d9ff1ed..2b753e955 100644 --- a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.sol +++ b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.sol @@ -1,6 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; +import {MiscEthereum} from 'aave-address-book/MiscEthereum.sol'; import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; interface UpgradeableLockReleaseTokenPool { @@ -14,9 +15,9 @@ interface UpgradeableLockReleaseTokenPool { * - Discussion: https://governance.aave.com/t/arfc-gho-arb-increase-ccip-facilitator-capacity/18169 */ contract AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707 is IProposalGenericExecutor { - address public constant GHO_TOKEN_POOL = 0x5756880B6a1EAba0175227bf02a7E87c1e02B28C; uint256 public constant NEW_LIMIT = 2_500_000 ether; + function execute() external { - UpgradeableLockReleaseTokenPool(GHO_TOKEN_POOL).setBridgeLimit(NEW_LIMIT); + UpgradeableLockReleaseTokenPool(MiscEthereum.GHO_CCIP_TOKEN_POOL).setBridgeLimit(NEW_LIMIT); } } From 00c4986a42c1b4f094f25e097f15524c44301473 Mon Sep 17 00:00:00 2001 From: efecarranza Date: Thu, 11 Jul 2024 12:22:39 -0400 Subject: [PATCH 03/10] chore: use igho from libraries --- ...rum_IncreaseCCIPFacilitatorCapacity_20240707.sol | 7 ++----- ...m_IncreaseCCIPFacilitatorCapacity_20240707.t.sol | 13 +++++-------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.sol b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.sol index d561ad432..6698b87cd 100644 --- a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.sol +++ b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.sol @@ -2,12 +2,9 @@ pragma solidity ^0.8.0; import {AaveV3ArbitrumAssets} from 'aave-address-book/AaveV3Arbitrum.sol'; +import {IGhoToken} from 'gho-core/gho/interfaces/IGhoToken.sol'; import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; -interface IGHOToken { - function setFacilitatorBucketCapacity(address facilitator, uint128 limit) external; -} - /** * @title Increase CCIP Facilitator Capacity * @author @karpatkey_TokenLogic @@ -19,7 +16,7 @@ contract AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707 is IProposalGen uint128 public constant NEW_LIMIT = 2_500_000 ether; function execute() external { - IGHOToken(AaveV3ArbitrumAssets.GHO_UNDERLYING).setFacilitatorBucketCapacity( + IGhoToken(AaveV3ArbitrumAssets.GHO_UNDERLYING).setFacilitatorBucketCapacity( FACILITATOR, NEW_LIMIT ); diff --git a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol index 637199c05..281aae5f3 100644 --- a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol +++ b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol @@ -2,17 +2,14 @@ pragma solidity ^0.8.0; import {AaveV3ArbitrumAssets} from 'aave-address-book/AaveV3Arbitrum.sol'; - +import {IGhoToken} from 'gho-core/gho/interfaces/IGhoToken.sol'; import {ProtocolV3TestBase} from 'aave-helpers/ProtocolV3TestBase.sol'; -import {AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707} from './AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.sol'; -interface IGHOToken { - function getFacilitator(address facilitator) external returns (uint128, uint128, string memory); -} +import {AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707} from './AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.sol'; /** * @dev Test for AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707 - * command: FOUNDRY_PROFILE=mainnet forge test --match-path=src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol -vv + * command: FOUNDRY_PROFILE=arbitrum forge test --match-path=src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol -vv */ contract AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707_Test is ProtocolV3TestBase { AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707 internal proposal; @@ -26,14 +23,14 @@ contract AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707_Test is Protoco * @dev executes the generic test suite including e2e and config snapshots */ function test_newLimitIsSet() public { - (uint128 currentLimit, , ) = IGHOToken(AaveV3ArbitrumAssets.GHO_UNDERLYING).getFacilitator( + (uint128 currentLimit, , ) = IGhoToken(AaveV3ArbitrumAssets.GHO_UNDERLYING).getFacilitator( proposal.FACILITATOR() ); assertEq(currentLimit, 1_000_000 ether); executePayload(vm, address(proposal)); - (uint128 newLimit, , ) = IGHOToken(AaveV3ArbitrumAssets.GHO_UNDERLYING).getFacilitator( + (uint128 newLimit, , ) = IGhoToken(AaveV3ArbitrumAssets.GHO_UNDERLYING).getFacilitator( proposal.FACILITATOR() ); From c82038442e14328835f35bd989e701f73688e04b Mon Sep 17 00:00:00 2001 From: efecarranza Date: Thu, 11 Jul 2024 12:25:00 -0400 Subject: [PATCH 04/10] chore: update aave helpers --- lib/aave-helpers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/aave-helpers b/lib/aave-helpers index efcdc0c64..2e1710dec 160000 --- a/lib/aave-helpers +++ b/lib/aave-helpers @@ -1 +1 @@ -Subproject commit efcdc0c64c2bfef1dfa61a034692dc71d737d26b +Subproject commit 2e1710decbfcc074804c1f2bd760e228e6442953 From 36473dffec229a2494cc5db792bd4e744b242bb7 Mon Sep 17 00:00:00 2001 From: efecarranza Date: Tue, 16 Jul 2024 14:14:17 -0400 Subject: [PATCH 05/10] chore:a dd test --- ...Test_IncreaseCCIPFacilitatorCapacity.t.sol | 449 ++++++++++++++++++ .../IncreaseCCIPFacilitatorCapacity.md | 3 +- ...easeCCIPFacilitatorCapacity_20240707.s.sol | 34 +- 3 files changed, 483 insertions(+), 3 deletions(-) create mode 100644 src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3E2ETest_IncreaseCCIPFacilitatorCapacity.t.sol diff --git a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3E2ETest_IncreaseCCIPFacilitatorCapacity.t.sol b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3E2ETest_IncreaseCCIPFacilitatorCapacity.t.sol new file mode 100644 index 000000000..4d909dde7 --- /dev/null +++ b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3E2ETest_IncreaseCCIPFacilitatorCapacity.t.sol @@ -0,0 +1,449 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {GovV3Helpers} from 'aave-helpers/GovV3Helpers.sol'; +import {ProtocolV3TestBase, ReserveConfig} from 'aave-helpers/ProtocolV3TestBase.sol'; +import {AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol'; +import {AaveV3Arbitrum} from 'aave-address-book/AaveV3Arbitrum.sol'; +import {MiscEthereum} from 'aave-address-book/MiscEthereum.sol'; +import {MiscArbitrum} from 'aave-address-book/MiscArbitrum.sol'; +import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; +import {GovernanceV3Arbitrum} from 'aave-address-book/GovernanceV3Arbitrum.sol'; +import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol'; +import {RateLimiter} from 'ccip/v0.8/ccip/libraries/RateLimiter.sol'; +import {Internal} from 'ccip/v0.8/ccip/libraries/Internal.sol'; +import {Client} from 'ccip/v0.8/ccip/libraries/Client.sol'; +import {Router} from 'ccip/v0.8/ccip/Router.sol'; +import {PriceRegistry} from 'ccip/v0.8/ccip/PriceRegistry.sol'; +import {EVM2EVMOnRamp} from 'ccip/v0.8/ccip/onRamp/EVM2EVMOnRamp.sol'; +import {EVM2EVMOffRamp} from 'ccip/v0.8/ccip/offRamp/EVM2EVMOffRamp.sol'; +import {IPool} from 'ccip/v0.8/ccip/interfaces/pools/IPool.sol'; + +import {UpgradeableLockReleaseTokenPool} from 'ccip/v0.8/ccip/pools/GHO/UpgradeableLockReleaseTokenPool.sol'; +import {UpgradeableBurnMintTokenPool} from 'ccip/v0.8/ccip/pools/GHO/UpgradeableBurnMintTokenPool.sol'; + +import {IGhoToken} from 'gho-core/gho/interfaces/IGhoToken.sol'; + +import {AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707} from './AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.sol'; +import {AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707} from './AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.sol'; + +/** + * @dev Test for AaveV3E2E_GHOCrossChainLaunch_20240528 + * command: FOUNDRY_PROFILE=mainnet forge test --match-path=src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3E2ETest_IncreaseCCIPFacilitatorCapacity.t.sol -vv + */ +contract AaveV3E2ETest_IncreaseCCIPFacilitatorCapacity is ProtocolV3TestBase { + using Internal for Internal.EVM2EVMMessage; + + AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707 internal arbProposal; + AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707 internal ethProposal; + + UpgradeableLockReleaseTokenPool internal ETH_TOKEN_POOL = MiscEthereum.GHO_CCIP_TOKEN_POOL; + UpgradeableBurnMintTokenPool internal ARB_TOKEN_POOL = MiscArbitrum.GHO_CCIP_TOKEN_POOL; + IGhoToken internal ETH_GHO; + IGhoToken internal ARB_GHO; + + Router internal ETH_ROUTER; + Router internal ARB_ROUTER; + + uint256 public constant CURRENT_CCIP_BUCKET_CAPACITY = 1_000_000e18; // 1M + uint64 public constant ETH_ARB_CHAIN_SELECTOR = 5009297550715157269; + uint64 public constant ARB_ETH_CHAIN_SELECTOR = 4949039107694359620; + + address internal constant CCIP_ETH_ON_RAMP = 0x925228D7B82d883Dde340A55Fe8e6dA56244A22C; + address internal constant CCIP_ETH_OFF_RAMP = 0xeFC4a18af59398FF23bfe7325F2401aD44286F4d; + address internal constant CCIP_ARB_ON_RAMP = 0xCe11020D56e5FDbfE46D9FC3021641FfbBB5AdEE; + address internal constant CCIP_ARB_OFF_RAMP = 0x542ba1902044069330e8c5b36A84EC503863722f; + + event Released(address indexed sender, address indexed recipient, uint256 amount); + event Locked(address indexed sender, uint256 amount); + event Minted(address indexed sender, address indexed recipient, uint256 amount); + event Burned(address indexed sender, uint256 amount); + event CCIPSendRequested(Internal.EVM2EVMMessage message); + event Transfer(address indexed from, address indexed to, uint256 value); + event Initialized(uint8 version); + + uint256 internal ethereumFork; + uint256 internal arbitrumFork; + + function setUp() public { + ethereumFork = vm.createFork(vm.rpcUrl('mainnet'), 20257789); + arbitrumFork = vm.createFork(vm.rpcUrl('arbitrum'), 230441155); + + // Proposal creation + vm.selectFork(ethereumFork); + ethProposal = new AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707(); + ETH_GHO = IGhoToken(MiscEthereum.GHO_TOKEN); + ETH_ROUTER = Router(ethProposal.CCIP_ROUTER()); + + vm.selectFork(arbitrumFork); + arbProposal = new AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707(); + ARB_ROUTER = Router(MiscArbitrum.CCIP_ROUTER); + + // AIP execution + vm.selectFork(ethereumFork); + vm.recordLogs(); + + GovV3Helpers.executePayload(vm, address(ethProposal)); + + vm.selectFork(arbitrumFork); + vm.recordLogs(); + + GovV3Helpers.executePayload(vm, address(arbProposal)); + + // Chainlink execution + vm.selectFork(ethereumFork); + { + // OnRamp and OffRamp + Router.OnRamp[] memory onRampUpdates = new Router.OnRamp[](1); + Router.OffRamp[] memory offRampUpdates = new Router.OffRamp[](1); + // ARB -> ETH + onRampUpdates[0] = Router.OnRamp({ + destChainSelector: ETH_ARB_CHAIN_SELECTOR, + onRamp: CCIP_ETH_ON_RAMP + }); + // ETH -> ARB + offRampUpdates[0] = Router.OffRamp({ + sourceChainSelector: ETH_ARB_CHAIN_SELECTOR, + offRamp: CCIP_ETH_OFF_RAMP + }); + address routerOwner = ETH_ROUTER.owner(); + vm.startPrank(routerOwner); + ETH_ROUTER.applyRampUpdates(onRampUpdates, new Router.OffRamp[](0), offRampUpdates); + } + + { + // Add TokenPool to OnRamp + address[] memory tokens = new address[](1); + IPool[] memory pools = new IPool[](1); + tokens[0] = address(ETH_GHO); + pools[0] = IPool(address(ETH_TOKEN_POOL)); + address onRampOwner = EVM2EVMOnRamp(CCIP_ETH_ON_RAMP).owner(); + vm.startPrank(onRampOwner); + EVM2EVMOnRamp(CCIP_ETH_ON_RAMP).applyPoolUpdates( + new Internal.PoolUpdate[](0), + _getTokensAndPools(tokens, pools) + ); + + // Match Arbitrum GHO token with Ethereum TokenPool + tokens[0] = address(ARB_GHO); + EVM2EVMOffRamp(CCIP_ETH_OFF_RAMP).applyPoolUpdates( + new Internal.PoolUpdate[](0), + _getTokensAndPools(tokens, pools) + ); + } + + { + // OnRamp Price Registry + EVM2EVMOnRamp.DynamicConfig memory onRampDynamicConfig = EVM2EVMOnRamp(CCIP_ETH_ON_RAMP) + .getDynamicConfig(); + Internal.PriceUpdates memory priceUpdate = _getSingleTokenPriceUpdateStruct( + address(ETH_GHO), + 1e18 + ); + + PriceRegistry(onRampDynamicConfig.priceRegistry).updatePrices(priceUpdate); + // OffRamp Price Registry + EVM2EVMOffRamp.DynamicConfig memory offRampDynamicConfig = EVM2EVMOffRamp(CCIP_ETH_OFF_RAMP) + .getDynamicConfig(); + PriceRegistry(offRampDynamicConfig.priceRegistry).updatePrices(priceUpdate); + } + + vm.selectFork(arbitrumFork); + { + Router.OnRamp[] memory onRampUpdates = new Router.OnRamp[](1); + Router.OffRamp[] memory offRampUpdates = new Router.OffRamp[](1); + // ETH -> ARB + onRampUpdates[0] = Router.OnRamp({ + destChainSelector: ARB_ETH_CHAIN_SELECTOR, + onRamp: CCIP_ARB_ON_RAMP + }); + // ARB -> ETH + offRampUpdates[0] = Router.OffRamp({ + sourceChainSelector: ARB_ETH_CHAIN_SELECTOR, + offRamp: CCIP_ARB_OFF_RAMP + }); + address routerOwner = ARB_ROUTER.owner(); + vm.startPrank(routerOwner); + ARB_ROUTER.applyRampUpdates(onRampUpdates, new Router.OffRamp[](0), offRampUpdates); + } + + { + // Add TokenPool to OnRamp + address[] memory tokens = new address[](1); + IPool[] memory pools = new IPool[](1); + tokens[0] = address(ARB_GHO); + pools[0] = IPool(address(ARB_TOKEN_POOL)); + address onRampOwner = EVM2EVMOnRamp(CCIP_ARB_ON_RAMP).owner(); + vm.startPrank(onRampOwner); + EVM2EVMOnRamp(CCIP_ARB_ON_RAMP).applyPoolUpdates( + new Internal.PoolUpdate[](0), + _getTokensAndPools(tokens, pools) + ); + + // Match Ethereum GHO token with Arbitrum TokenPool + tokens[0] = address(ETH_GHO); + EVM2EVMOffRamp(CCIP_ARB_OFF_RAMP).applyPoolUpdates( + new Internal.PoolUpdate[](0), + _getTokensAndPools(tokens, pools) + ); + } + + { + // OnRamp Price Registry + EVM2EVMOnRamp.DynamicConfig memory onRampDynamicConfig = EVM2EVMOnRamp(CCIP_ARB_ON_RAMP) + .getDynamicConfig(); + Internal.PriceUpdates memory priceUpdate = _getSingleTokenPriceUpdateStruct( + address(ARB_GHO), + 1e18 + ); + + PriceRegistry(onRampDynamicConfig.priceRegistry).updatePrices(priceUpdate); + // OffRamp Price Registry + EVM2EVMOffRamp.DynamicConfig memory offRampDynamicConfig = EVM2EVMOffRamp(CCIP_ARB_OFF_RAMP) + .getDynamicConfig(); + PriceRegistry(offRampDynamicConfig.priceRegistry).updatePrices(priceUpdate); + } + } + + /// @dev Full E2E Test: transfer from Ethereum to Arbitrum and way back + function test_ccipFullE22() public { + // CCIP Transfer from Ethereum to Arbitrum + // Ethereum execution (origin) + vm.selectFork(ethereumFork); + address user = makeAddr('user'); + uint256 amount = 500_000e18; // 500K ETH_GHO + deal(user, 1e18); // 1 ETH + deal(address(ETH_GHO), user, amount); + + assertEq(ETH_GHO.balanceOf(address(ETH_TOKEN_POOL)), 0); + assertEq(ETH_TOKEN_POOL.getBridgeLimit(), ethProposal.CCIP_BRIDGE_LIMIT()); + assertEq(ETH_TOKEN_POOL.getCurrentBridgedAmount(), 0); + + vm.startPrank(user); + // Use address(0) to use native token as fee token + Internal.EVM2EVMMessage memory message = _sendCcip( + SendCcipParams({ + expectedSeqNum: 1, + router: ETH_ROUTER, + onRamp: CCIP_ETH_ON_RAMP, + token: address(ETH_GHO), + amount: amount, + feeToken: address(0), + sourceChainSelector: ARB_ETH_CHAIN_SELECTOR, + destChainSelector: ETH_ARB_CHAIN_SELECTOR, + sender: user, + receiver: user + }) + ); + + assertEq(ETH_GHO.balanceOf(user), 0); + assertEq(ETH_GHO.balanceOf(address(ETH_TOKEN_POOL)), amount); + assertEq(ETH_TOKEN_POOL.getBridgeLimit(), ethProposal.CCIP_BRIDGE_LIMIT()); + assertEq(ETH_TOKEN_POOL.getCurrentBridgedAmount(), amount); + + // Arbitrum execution (destination) + vm.selectFork(arbitrumFork); + + assertEq(ARB_GHO.balanceOf(address(ARB_TOKEN_POOL)), 0); + (uint256 capacity, uint256 level) = ARB_GHO.getFacilitatorBucket(address(ARB_TOKEN_POOL)); + assertEq(capacity, CURRENT_CCIP_BUCKET_CAPACITY); + assertEq(level, 0); + + // Mock off ramp + vm.startPrank(CCIP_ARB_OFF_RAMP); + bytes[] memory emptyData = new bytes[](1); + EVM2EVMOffRamp(CCIP_ARB_OFF_RAMP).executeSingleMessage(message, emptyData); + + assertEq(ARB_GHO.balanceOf(address(ARB_TOKEN_POOL)), 0); + (capacity, level) = ARB_GHO.getFacilitatorBucket(address(ARB_TOKEN_POOL)); + assertEq(capacity, CURRENT_CCIP_BUCKET_CAPACITY); + assertEq(level, amount); + + // CCIP Transfer from Arbitrum to Ethereum + // Arbitrum execution (origin) + vm.selectFork(arbitrumFork); + deal(user, 1e18); // 1 ETH + + assertEq(ARB_GHO.balanceOf(address(ARB_TOKEN_POOL)), 0); + (capacity, level) = ARB_GHO.getFacilitatorBucket(address(ARB_TOKEN_POOL)); + assertEq(capacity, CURRENT_CCIP_BUCKET_CAPACITY); + assertEq(level, amount); + + vm.startPrank(user); + // Use address(0) to use native token as fee token + message = _sendCcip( + SendCcipParams({ + expectedSeqNum: 1, + router: ARB_ROUTER, + onRamp: CCIP_ARB_ON_RAMP, + token: address(ARB_GHO), + amount: amount, + feeToken: address(0), + sourceChainSelector: ETH_ARB_CHAIN_SELECTOR, + destChainSelector: ARB_ETH_CHAIN_SELECTOR, + sender: user, + receiver: user + }) + ); + + assertEq(ARB_GHO.balanceOf(user), 0); + assertEq(ARB_GHO.balanceOf(address(ARB_TOKEN_POOL)), 0); + (capacity, level) = ARB_GHO.getFacilitatorBucket(address(ARB_TOKEN_POOL)); + assertEq(capacity, CURRENT_CCIP_BUCKET_CAPACITY); + assertEq(level, 0); + + // Ethereum execution (destination) + vm.selectFork(ethereumFork); + + assertEq(ETH_GHO.balanceOf(user), 0); + assertEq(ETH_GHO.balanceOf(address(ETH_TOKEN_POOL)), amount); + assertEq(ETH_TOKEN_POOL.getBridgeLimit(), ethProposal.CCIP_BRIDGE_LIMIT()); + assertEq(ETH_TOKEN_POOL.getCurrentBridgedAmount(), amount); + + // Mock off ramp + vm.startPrank(CCIP_ETH_OFF_RAMP); + EVM2EVMOffRamp(CCIP_ETH_OFF_RAMP).executeSingleMessage(message, emptyData); + + assertEq(ETH_GHO.balanceOf(user), amount); + assertEq(ETH_GHO.balanceOf(address(ETH_TOKEN_POOL)), 0); + assertEq(ETH_TOKEN_POOL.getBridgeLimit(), ethProposal.CCIP_BRIDGE_LIMIT()); + assertEq(ETH_TOKEN_POOL.getCurrentBridgedAmount(), 0); + } + + // --- + // Utils + // -- + + struct SendCcipParams { + uint64 expectedSeqNum; + Router router; + address onRamp; + address token; + uint256 amount; + address feeToken; + uint64 sourceChainSelector; + uint64 destChainSelector; + address sender; + address receiver; + } + + function _sendCcip( + SendCcipParams memory params + ) internal returns (Internal.EVM2EVMMessage memory) { + Client.EVM2AnyMessage memory message = _generateSingleTokenMessage( + params.receiver, + params.token, + params.amount, + params.feeToken + ); + uint256 expectedFee = params.router.getFee(params.destChainSelector, message); + + bytes32 metadataHash = keccak256( + abi.encode( + Internal.EVM_2_EVM_MESSAGE_HASH, + params.sourceChainSelector, + params.destChainSelector, + params.onRamp + ) + ); + + Internal.EVM2EVMMessage memory geEvent = _messageToEvent( + message, + params.expectedSeqNum, + params.expectedSeqNum, + expectedFee, + params.sender, + params.sourceChainSelector, + metadataHash + ); + + IERC20(params.token).approve(address(params.router), params.amount); + params.router.ccipSend{value: expectedFee}(params.destChainSelector, message); + + return geEvent; + } + + function _generateSingleTokenMessage( + address receiver, + address token, + uint256 amount, + address feeToken + ) public pure returns (Client.EVM2AnyMessage memory) { + Client.EVMTokenAmount[] memory tokenAmounts = new Client.EVMTokenAmount[](1); + tokenAmounts[0] = Client.EVMTokenAmount({token: token, amount: amount}); + return + Client.EVM2AnyMessage({ + receiver: abi.encode(receiver), + data: '', + tokenAmounts: tokenAmounts, + feeToken: feeToken, + extraArgs: Client._argsToBytes(Client.EVMExtraArgsV1({gasLimit: 200_000})) + }); + } + + function _messageToEvent( + Client.EVM2AnyMessage memory message, + uint64 seqNum, + uint64 nonce, + uint256 feeTokenAmount, + address originalSender, + uint64 sourceChainSelector, + bytes32 metadataHash + ) public pure returns (Internal.EVM2EVMMessage memory) { + // Slicing is only available for calldata. So we have to build a new bytes array. + bytes memory args = new bytes(message.extraArgs.length - 4); + for (uint256 i = 4; i < message.extraArgs.length; ++i) { + args[i - 4] = message.extraArgs[i]; + } + Client.EVMExtraArgsV1 memory extraArgs = abi.decode(args, (Client.EVMExtraArgsV1)); + Internal.EVM2EVMMessage memory messageEvent = Internal.EVM2EVMMessage({ + sequenceNumber: seqNum, + feeTokenAmount: feeTokenAmount, + sender: originalSender, + nonce: nonce, + gasLimit: extraArgs.gasLimit, + strict: false, + sourceChainSelector: sourceChainSelector, + receiver: abi.decode(message.receiver, (address)), + data: message.data, + tokenAmounts: message.tokenAmounts, + sourceTokenData: new bytes[](message.tokenAmounts.length), + feeToken: message.feeToken, + messageId: '' + }); + + messageEvent.messageId = Internal._hash(messageEvent, metadataHash); + return messageEvent; + } + + function _getTokensAndPools( + address[] memory tokens, + IPool[] memory pools + ) internal pure returns (Internal.PoolUpdate[] memory) { + Internal.PoolUpdate[] memory tokensAndPools = new Internal.PoolUpdate[](tokens.length); + for (uint256 i = 0; i < tokens.length; ++i) { + tokensAndPools[i] = Internal.PoolUpdate({token: tokens[i], pool: address(pools[i])}); + } + return tokensAndPools; + } + + function _getSingleTokenPriceUpdateStruct( + address token, + uint224 price + ) internal pure returns (Internal.PriceUpdates memory) { + Internal.TokenPriceUpdate[] memory tokenPriceUpdates = new Internal.TokenPriceUpdate[](1); + tokenPriceUpdates[0] = Internal.TokenPriceUpdate({sourceToken: token, usdPerToken: price}); + + Internal.PriceUpdates memory priceUpdates = Internal.PriceUpdates({ + tokenPriceUpdates: tokenPriceUpdates, + gasPriceUpdates: new Internal.GasPriceUpdate[](0) + }); + + return priceUpdates; + } + + function _getFacilitatorLevel(address f) internal view returns (uint256) { + (, uint256 level) = ARB_GHO.getFacilitatorBucket(f); + return level; + } +} diff --git a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity.md b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity.md index 30e029033..4efe7d68c 100644 --- a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity.md +++ b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity.md @@ -11,11 +11,12 @@ This publication proposes increasing the CCIP Facilitator Capacity on Arbitrum f ## Motivation -GHO was successfully launched on Arbitrum and the CCIP GHO Facilitator Bucket Capacity is 65% utilized. With $3.41M of liquidity and a solid peg during launch, there is sufficient depth to facilitate increasing the CCIP GHO Facilitator Bucket Capacity from 1M to 2.5M in line with the initial risk parameters proposed prior to launch 3. +GHO was successfully launched on Arbitrum and the CCIP GHO Facilitator Bucket Capacity is 65% utilized. With $3.41M of liquidity and a solid peg during launch, there is sufficient depth to facilitate increasing the CCIP GHO Facilitator Bucket Capacity from 1M to 2.5M in line with the initial risk parameters proposed prior to launch. ## Specification This proposal will increase the CCIP GHO Facilitator Bucket Capacity from 1M units to 2.5M units via the Direct-to-AIP process. +The equivalent bridgeLimit is also being increased on Ethereum Mainnet to 2.5M units. ## References diff --git a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity_20240707.s.sol b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity_20240707.s.sol index 7b514ffe0..c0f397fdb 100644 --- a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity_20240707.s.sol +++ b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity_20240707.s.sol @@ -3,8 +3,9 @@ pragma solidity ^0.8.0; import {GovV3Helpers, IPayloadsControllerCore, PayloadsControllerUtils} from 'aave-helpers/GovV3Helpers.sol'; import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; -import {EthereumScript} from 'aave-helpers/ScriptUtils.sol'; +import {ArbitrumScript, EthereumScript} from 'aave-helpers/ScriptUtils.sol'; import {AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707} from './AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.sol'; +import {AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707} from './AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.sol'; /** * @dev Deploy Ethereum @@ -28,6 +29,28 @@ contract DeployEthereum is EthereumScript { } } +/** + * @dev Deploy Arbitrum + * deploy-command: make deploy-ledger contract=src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity_20240707.s.sol:DeployArbitrum chain=arbitrum + * verify-command: FOUNDRY_PROFILE=arbitrum npx catapulta-verify -b broadcast/IncreaseCCIPFacilitatorCapacity_20240707.s.sol/42161/run-latest.json + */ +contract DeployArbitrum is ArbitrumScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707).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/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity_20240707.s.sol:CreateProposal chain=mainnet @@ -35,7 +58,7 @@ contract DeployEthereum is EthereumScript { contract CreateProposal is EthereumScript { function run() external { // create payloads - PayloadsControllerUtils.Payload[] memory payloads = new PayloadsControllerUtils.Payload[](1); + PayloadsControllerUtils.Payload[] memory payloads = new PayloadsControllerUtils.Payload[](2); // compose actions for validation IPayloadsControllerCore.ExecutionAction[] @@ -45,6 +68,13 @@ contract CreateProposal is EthereumScript { ); payloads[0] = GovV3Helpers.buildMainnetPayload(vm, actionsEthereum); + IPayloadsControllerCore.ExecutionAction[] + memory actionsArbitrum = new IPayloadsControllerCore.ExecutionAction[](1); + actionsArbitrum[0] = GovV3Helpers.buildAction( + type(AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707).creationCode + ); + payloads[1] = GovV3Helpers.buildArbitrumPayload(vm, actionsArbitrum); + // create proposal vm.startBroadcast(); GovV3Helpers.createProposal( From 1a05307f07eda8df74fb8fbdc49557ed80cbc2a4 Mon Sep 17 00:00:00 2001 From: efecarranza Date: Tue, 16 Jul 2024 14:17:53 -0400 Subject: [PATCH 06/10] test --- lib/aave-helpers | 1 - 1 file changed, 1 deletion(-) delete mode 160000 lib/aave-helpers diff --git a/lib/aave-helpers b/lib/aave-helpers deleted file mode 160000 index f7833b374..000000000 --- a/lib/aave-helpers +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f7833b374505dfd9190614a733fc69c89af944f1 From bbae7cb4bebc3c63c2a78a50c1c58298437f4d7c Mon Sep 17 00:00:00 2001 From: efecarranza Date: Tue, 16 Jul 2024 14:17:57 -0400 Subject: [PATCH 07/10] forge install: aave-helpers v2.3.0 --- lib/aave-helpers | 1 + 1 file changed, 1 insertion(+) create mode 160000 lib/aave-helpers diff --git a/lib/aave-helpers b/lib/aave-helpers new file mode 160000 index 000000000..7b4decf9c --- /dev/null +++ b/lib/aave-helpers @@ -0,0 +1 @@ +Subproject commit 7b4decf9c3d89452b8b5f478eb0e5f799f695086 From 27043c3c55a17f212fb1c5b1daf48b25d186eb95 Mon Sep 17 00:00:00 2001 From: efecarranza Date: Tue, 16 Jul 2024 14:21:28 -0400 Subject: [PATCH 08/10] add helpers --- lib/aave-helpers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/aave-helpers b/lib/aave-helpers index 7b4decf9c..f7833b374 160000 --- a/lib/aave-helpers +++ b/lib/aave-helpers @@ -1 +1 @@ -Subproject commit 7b4decf9c3d89452b8b5f478eb0e5f799f695086 +Subproject commit f7833b374505dfd9190614a733fc69c89af944f1 From 51abc3b51a693372a1ffff53d197cb73b7f39cea Mon Sep 17 00:00:00 2001 From: efecarranza Date: Wed, 17 Jul 2024 23:42:12 -0400 Subject: [PATCH 09/10] feat: add e2e test --- ...easeCCIPFacilitatorCapacity_20240707.t.sol | 14 +- ...Test_IncreaseCCIPFacilitatorCapacity.t.sol | 286 ++++++------------ ...easeCCIPFacilitatorCapacity_20240707.t.sol | 5 +- 3 files changed, 99 insertions(+), 206 deletions(-) diff --git a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol index 281aae5f3..acdf5c9cd 100644 --- a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol +++ b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol @@ -23,17 +23,15 @@ contract AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707_Test is Protoco * @dev executes the generic test suite including e2e and config snapshots */ function test_newLimitIsSet() public { - (uint128 currentLimit, , ) = IGhoToken(AaveV3ArbitrumAssets.GHO_UNDERLYING).getFacilitator( - proposal.FACILITATOR() - ); - assertEq(currentLimit, 1_000_000 ether); + IGhoToken.Facilitator memory prevFacilitator = IGhoToken(AaveV3ArbitrumAssets.GHO_UNDERLYING) + .getFacilitator(proposal.FACILITATOR()); + assertEq(prevFacilitator.bucketCapacity, 1_000_000 ether); executePayload(vm, address(proposal)); - (uint128 newLimit, , ) = IGhoToken(AaveV3ArbitrumAssets.GHO_UNDERLYING).getFacilitator( - proposal.FACILITATOR() - ); + IGhoToken.Facilitator memory facilitator = IGhoToken(AaveV3ArbitrumAssets.GHO_UNDERLYING) + .getFacilitator(proposal.FACILITATOR()); - assertEq(newLimit, proposal.NEW_LIMIT()); + assertEq(facilitator.bucketCapacity, proposal.NEW_LIMIT()); } } diff --git a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3E2ETest_IncreaseCCIPFacilitatorCapacity.t.sol b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3E2ETest_IncreaseCCIPFacilitatorCapacity.t.sol index 4d909dde7..998f5637c 100644 --- a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3E2ETest_IncreaseCCIPFacilitatorCapacity.t.sol +++ b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3E2ETest_IncreaseCCIPFacilitatorCapacity.t.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.0; import {GovV3Helpers} from 'aave-helpers/GovV3Helpers.sol'; import {ProtocolV3TestBase, ReserveConfig} from 'aave-helpers/ProtocolV3TestBase.sol'; import {AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol'; -import {AaveV3Arbitrum} from 'aave-address-book/AaveV3Arbitrum.sol'; +import {AaveV3Arbitrum, AaveV3ArbitrumAssets} from 'aave-address-book/AaveV3Arbitrum.sol'; import {MiscEthereum} from 'aave-address-book/MiscEthereum.sol'; import {MiscArbitrum} from 'aave-address-book/MiscArbitrum.sol'; import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; @@ -37,17 +37,19 @@ contract AaveV3E2ETest_IncreaseCCIPFacilitatorCapacity is ProtocolV3TestBase { AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707 internal arbProposal; AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707 internal ethProposal; - UpgradeableLockReleaseTokenPool internal ETH_TOKEN_POOL = MiscEthereum.GHO_CCIP_TOKEN_POOL; - UpgradeableBurnMintTokenPool internal ARB_TOKEN_POOL = MiscArbitrum.GHO_CCIP_TOKEN_POOL; + UpgradeableLockReleaseTokenPool internal ETH_TOKEN_POOL = + UpgradeableLockReleaseTokenPool(MiscEthereum.GHO_CCIP_TOKEN_POOL); + UpgradeableBurnMintTokenPool internal ARB_TOKEN_POOL = + UpgradeableBurnMintTokenPool(MiscArbitrum.GHO_CCIP_TOKEN_POOL); IGhoToken internal ETH_GHO; IGhoToken internal ARB_GHO; - Router internal ETH_ROUTER; - Router internal ARB_ROUTER; + Router internal ETH_ROUTER = Router(0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D); + Router internal ARB_ROUTER = Router(0x141fa059441E0ca23ce184B6A78bafD2A517DdE8); uint256 public constant CURRENT_CCIP_BUCKET_CAPACITY = 1_000_000e18; // 1M - uint64 public constant ETH_ARB_CHAIN_SELECTOR = 5009297550715157269; - uint64 public constant ARB_ETH_CHAIN_SELECTOR = 4949039107694359620; + uint64 public constant ETH_ARB_CHAIN_SELECTOR = 4949039107694359620; + uint64 public constant ARB_ETH_CHAIN_SELECTOR = 5009297550715157269; address internal constant CCIP_ETH_ON_RAMP = 0x925228D7B82d883Dde340A55Fe8e6dA56244A22C; address internal constant CCIP_ETH_OFF_RAMP = 0xeFC4a18af59398FF23bfe7325F2401aD44286F4d; @@ -66,147 +68,30 @@ contract AaveV3E2ETest_IncreaseCCIPFacilitatorCapacity is ProtocolV3TestBase { uint256 internal arbitrumFork; function setUp() public { - ethereumFork = vm.createFork(vm.rpcUrl('mainnet'), 20257789); - arbitrumFork = vm.createFork(vm.rpcUrl('arbitrum'), 230441155); + ethereumFork = vm.createFork(vm.rpcUrl('mainnet'), 20330677); + arbitrumFork = vm.createFork(vm.rpcUrl('arbitrum'), 233363817); // Proposal creation vm.selectFork(ethereumFork); ethProposal = new AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707(); ETH_GHO = IGhoToken(MiscEthereum.GHO_TOKEN); - ETH_ROUTER = Router(ethProposal.CCIP_ROUTER()); vm.selectFork(arbitrumFork); arbProposal = new AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707(); - ARB_ROUTER = Router(MiscArbitrum.CCIP_ROUTER); - - // AIP execution - vm.selectFork(ethereumFork); - vm.recordLogs(); - - GovV3Helpers.executePayload(vm, address(ethProposal)); - - vm.selectFork(arbitrumFork); - vm.recordLogs(); - - GovV3Helpers.executePayload(vm, address(arbProposal)); - - // Chainlink execution - vm.selectFork(ethereumFork); - { - // OnRamp and OffRamp - Router.OnRamp[] memory onRampUpdates = new Router.OnRamp[](1); - Router.OffRamp[] memory offRampUpdates = new Router.OffRamp[](1); - // ARB -> ETH - onRampUpdates[0] = Router.OnRamp({ - destChainSelector: ETH_ARB_CHAIN_SELECTOR, - onRamp: CCIP_ETH_ON_RAMP - }); - // ETH -> ARB - offRampUpdates[0] = Router.OffRamp({ - sourceChainSelector: ETH_ARB_CHAIN_SELECTOR, - offRamp: CCIP_ETH_OFF_RAMP - }); - address routerOwner = ETH_ROUTER.owner(); - vm.startPrank(routerOwner); - ETH_ROUTER.applyRampUpdates(onRampUpdates, new Router.OffRamp[](0), offRampUpdates); - } - - { - // Add TokenPool to OnRamp - address[] memory tokens = new address[](1); - IPool[] memory pools = new IPool[](1); - tokens[0] = address(ETH_GHO); - pools[0] = IPool(address(ETH_TOKEN_POOL)); - address onRampOwner = EVM2EVMOnRamp(CCIP_ETH_ON_RAMP).owner(); - vm.startPrank(onRampOwner); - EVM2EVMOnRamp(CCIP_ETH_ON_RAMP).applyPoolUpdates( - new Internal.PoolUpdate[](0), - _getTokensAndPools(tokens, pools) - ); - - // Match Arbitrum GHO token with Ethereum TokenPool - tokens[0] = address(ARB_GHO); - EVM2EVMOffRamp(CCIP_ETH_OFF_RAMP).applyPoolUpdates( - new Internal.PoolUpdate[](0), - _getTokensAndPools(tokens, pools) - ); - } + ARB_GHO = IGhoToken(AaveV3ArbitrumAssets.GHO_UNDERLYING); + } - { - // OnRamp Price Registry - EVM2EVMOnRamp.DynamicConfig memory onRampDynamicConfig = EVM2EVMOnRamp(CCIP_ETH_ON_RAMP) - .getDynamicConfig(); - Internal.PriceUpdates memory priceUpdate = _getSingleTokenPriceUpdateStruct( - address(ETH_GHO), - 1e18 - ); - - PriceRegistry(onRampDynamicConfig.priceRegistry).updatePrices(priceUpdate); - // OffRamp Price Registry - EVM2EVMOffRamp.DynamicConfig memory offRampDynamicConfig = EVM2EVMOffRamp(CCIP_ETH_OFF_RAMP) - .getDynamicConfig(); - PriceRegistry(offRampDynamicConfig.priceRegistry).updatePrices(priceUpdate); - } + /// @dev Full E2E Test: transfer from Ethereum to Arbitrum and way back, with limit + function test_ccipFullE2E() public { + uint256 currentBridgedAmount = 1_000_000e18; vm.selectFork(arbitrumFork); - { - Router.OnRamp[] memory onRampUpdates = new Router.OnRamp[](1); - Router.OffRamp[] memory offRampUpdates = new Router.OffRamp[](1); - // ETH -> ARB - onRampUpdates[0] = Router.OnRamp({ - destChainSelector: ARB_ETH_CHAIN_SELECTOR, - onRamp: CCIP_ARB_ON_RAMP - }); - // ARB -> ETH - offRampUpdates[0] = Router.OffRamp({ - sourceChainSelector: ARB_ETH_CHAIN_SELECTOR, - offRamp: CCIP_ARB_OFF_RAMP - }); - address routerOwner = ARB_ROUTER.owner(); - vm.startPrank(routerOwner); - ARB_ROUTER.applyRampUpdates(onRampUpdates, new Router.OffRamp[](0), offRampUpdates); - } - - { - // Add TokenPool to OnRamp - address[] memory tokens = new address[](1); - IPool[] memory pools = new IPool[](1); - tokens[0] = address(ARB_GHO); - pools[0] = IPool(address(ARB_TOKEN_POOL)); - address onRampOwner = EVM2EVMOnRamp(CCIP_ARB_ON_RAMP).owner(); - vm.startPrank(onRampOwner); - EVM2EVMOnRamp(CCIP_ARB_ON_RAMP).applyPoolUpdates( - new Internal.PoolUpdate[](0), - _getTokensAndPools(tokens, pools) - ); - - // Match Ethereum GHO token with Arbitrum TokenPool - tokens[0] = address(ETH_GHO); - EVM2EVMOffRamp(CCIP_ARB_OFF_RAMP).applyPoolUpdates( - new Internal.PoolUpdate[](0), - _getTokensAndPools(tokens, pools) - ); - } - { - // OnRamp Price Registry - EVM2EVMOnRamp.DynamicConfig memory onRampDynamicConfig = EVM2EVMOnRamp(CCIP_ARB_ON_RAMP) - .getDynamicConfig(); - Internal.PriceUpdates memory priceUpdate = _getSingleTokenPriceUpdateStruct( - address(ARB_GHO), - 1e18 - ); - - PriceRegistry(onRampDynamicConfig.priceRegistry).updatePrices(priceUpdate); - // OffRamp Price Registry - EVM2EVMOffRamp.DynamicConfig memory offRampDynamicConfig = EVM2EVMOffRamp(CCIP_ARB_OFF_RAMP) - .getDynamicConfig(); - PriceRegistry(offRampDynamicConfig.priceRegistry).updatePrices(priceUpdate); - } - } + assertEq(ARB_GHO.balanceOf(address(ARB_TOKEN_POOL)), 0); + (uint256 capacity, uint256 level) = ARB_GHO.getFacilitatorBucket(address(ARB_TOKEN_POOL)); + assertEq(capacity, CURRENT_CCIP_BUCKET_CAPACITY); + assertEq(level, currentBridgedAmount); - /// @dev Full E2E Test: transfer from Ethereum to Arbitrum and way back - function test_ccipFullE22() public { // CCIP Transfer from Ethereum to Arbitrum // Ethereum execution (origin) vm.selectFork(ethereumFork); @@ -215,99 +100,109 @@ contract AaveV3E2ETest_IncreaseCCIPFacilitatorCapacity is ProtocolV3TestBase { deal(user, 1e18); // 1 ETH deal(address(ETH_GHO), user, amount); - assertEq(ETH_GHO.balanceOf(address(ETH_TOKEN_POOL)), 0); - assertEq(ETH_TOKEN_POOL.getBridgeLimit(), ethProposal.CCIP_BRIDGE_LIMIT()); - assertEq(ETH_TOKEN_POOL.getCurrentBridgedAmount(), 0); + assertEq(ETH_GHO.balanceOf(address(ETH_TOKEN_POOL)), currentBridgedAmount); + assertEq(ETH_TOKEN_POOL.getBridgeLimit(), 1_000_000e18); + assertEq(ETH_TOKEN_POOL.getCurrentBridgedAmount(), currentBridgedAmount); vm.startPrank(user); - // Use address(0) to use native token as fee token - Internal.EVM2EVMMessage memory message = _sendCcip( - SendCcipParams({ - expectedSeqNum: 1, - router: ETH_ROUTER, - onRamp: CCIP_ETH_ON_RAMP, - token: address(ETH_GHO), - amount: amount, - feeToken: address(0), - sourceChainSelector: ARB_ETH_CHAIN_SELECTOR, - destChainSelector: ETH_ARB_CHAIN_SELECTOR, - sender: user, - receiver: user - }) + SendCcipParams memory params = SendCcipParams({ + expectedSeqNum: 1, + router: ETH_ROUTER, + onRamp: CCIP_ETH_ON_RAMP, + token: address(ETH_GHO), + amount: amount, + feeToken: address(0), + sourceChainSelector: ARB_ETH_CHAIN_SELECTOR, + destChainSelector: ETH_ARB_CHAIN_SELECTOR, + sender: user, + receiver: user + }); + + ( + Client.EVM2AnyMessage memory message, + Internal.EVM2EVMMessage memory geEvent, + uint256 expectedFee + ) = _prepareCcip(params); + + vm.expectRevert( + abi.encodeWithSelector( + UpgradeableLockReleaseTokenPool.BridgeLimitExceeded.selector, + 1_000_000e18 + ) ); + params.router.ccipSend{value: expectedFee}(params.destChainSelector, message); - assertEq(ETH_GHO.balanceOf(user), 0); - assertEq(ETH_GHO.balanceOf(address(ETH_TOKEN_POOL)), amount); - assertEq(ETH_TOKEN_POOL.getBridgeLimit(), ethProposal.CCIP_BRIDGE_LIMIT()); - assertEq(ETH_TOKEN_POOL.getCurrentBridgedAmount(), amount); + GovV3Helpers.executePayload(vm, address(ethProposal)); - // Arbitrum execution (destination) vm.selectFork(arbitrumFork); + GovV3Helpers.executePayload(vm, address(arbProposal)); - assertEq(ARB_GHO.balanceOf(address(ARB_TOKEN_POOL)), 0); - (uint256 capacity, uint256 level) = ARB_GHO.getFacilitatorBucket(address(ARB_TOKEN_POOL)); - assertEq(capacity, CURRENT_CCIP_BUCKET_CAPACITY); - assertEq(level, 0); + vm.selectFork(ethereumFork); + + assertEq(ETH_TOKEN_POOL.getBridgeLimit(), ethProposal.NEW_LIMIT()); + assertEq(ETH_TOKEN_POOL.getCurrentBridgedAmount(), currentBridgedAmount); + + params.router.ccipSend{value: expectedFee}(params.destChainSelector, message); + + assertEq(ETH_TOKEN_POOL.getCurrentBridgedAmount(), currentBridgedAmount + amount); + + // Arbitrum execution (destination) + vm.selectFork(arbitrumFork); // Mock off ramp vm.startPrank(CCIP_ARB_OFF_RAMP); bytes[] memory emptyData = new bytes[](1); - EVM2EVMOffRamp(CCIP_ARB_OFF_RAMP).executeSingleMessage(message, emptyData); + EVM2EVMOffRamp(CCIP_ARB_OFF_RAMP).executeSingleMessage(geEvent, emptyData); assertEq(ARB_GHO.balanceOf(address(ARB_TOKEN_POOL)), 0); (capacity, level) = ARB_GHO.getFacilitatorBucket(address(ARB_TOKEN_POOL)); - assertEq(capacity, CURRENT_CCIP_BUCKET_CAPACITY); - assertEq(level, amount); + assertEq(capacity, arbProposal.NEW_LIMIT()); + assertEq(level, currentBridgedAmount + amount); // CCIP Transfer from Arbitrum to Ethereum // Arbitrum execution (origin) vm.selectFork(arbitrumFork); deal(user, 1e18); // 1 ETH - assertEq(ARB_GHO.balanceOf(address(ARB_TOKEN_POOL)), 0); - (capacity, level) = ARB_GHO.getFacilitatorBucket(address(ARB_TOKEN_POOL)); - assertEq(capacity, CURRENT_CCIP_BUCKET_CAPACITY); - assertEq(level, amount); - vm.startPrank(user); // Use address(0) to use native token as fee token - message = _sendCcip( - SendCcipParams({ - expectedSeqNum: 1, - router: ARB_ROUTER, - onRamp: CCIP_ARB_ON_RAMP, - token: address(ARB_GHO), - amount: amount, - feeToken: address(0), - sourceChainSelector: ETH_ARB_CHAIN_SELECTOR, - destChainSelector: ARB_ETH_CHAIN_SELECTOR, - sender: user, - receiver: user - }) - ); + params = SendCcipParams({ + expectedSeqNum: 1, + router: ARB_ROUTER, + onRamp: CCIP_ARB_ON_RAMP, + token: address(ARB_GHO), + amount: amount, + feeToken: address(0), + sourceChainSelector: ETH_ARB_CHAIN_SELECTOR, + destChainSelector: ARB_ETH_CHAIN_SELECTOR, + sender: user, + receiver: user + }); + (message, geEvent, expectedFee) = _prepareCcip(params); + params.router.ccipSend{value: expectedFee}(params.destChainSelector, message); assertEq(ARB_GHO.balanceOf(user), 0); assertEq(ARB_GHO.balanceOf(address(ARB_TOKEN_POOL)), 0); (capacity, level) = ARB_GHO.getFacilitatorBucket(address(ARB_TOKEN_POOL)); - assertEq(capacity, CURRENT_CCIP_BUCKET_CAPACITY); - assertEq(level, 0); + assertEq(capacity, arbProposal.NEW_LIMIT()); + assertEq(level, currentBridgedAmount); // Ethereum execution (destination) vm.selectFork(ethereumFork); assertEq(ETH_GHO.balanceOf(user), 0); - assertEq(ETH_GHO.balanceOf(address(ETH_TOKEN_POOL)), amount); - assertEq(ETH_TOKEN_POOL.getBridgeLimit(), ethProposal.CCIP_BRIDGE_LIMIT()); - assertEq(ETH_TOKEN_POOL.getCurrentBridgedAmount(), amount); + assertEq(ETH_GHO.balanceOf(address(ETH_TOKEN_POOL)), currentBridgedAmount + amount); + assertEq(ETH_TOKEN_POOL.getBridgeLimit(), ethProposal.NEW_LIMIT()); + assertEq(ETH_TOKEN_POOL.getCurrentBridgedAmount(), currentBridgedAmount + amount); // Mock off ramp vm.startPrank(CCIP_ETH_OFF_RAMP); - EVM2EVMOffRamp(CCIP_ETH_OFF_RAMP).executeSingleMessage(message, emptyData); + EVM2EVMOffRamp(CCIP_ETH_OFF_RAMP).executeSingleMessage(geEvent, emptyData); assertEq(ETH_GHO.balanceOf(user), amount); - assertEq(ETH_GHO.balanceOf(address(ETH_TOKEN_POOL)), 0); - assertEq(ETH_TOKEN_POOL.getBridgeLimit(), ethProposal.CCIP_BRIDGE_LIMIT()); - assertEq(ETH_TOKEN_POOL.getCurrentBridgedAmount(), 0); + assertEq(ETH_GHO.balanceOf(address(ETH_TOKEN_POOL)), currentBridgedAmount); + assertEq(ETH_TOKEN_POOL.getBridgeLimit(), ethProposal.NEW_LIMIT()); + assertEq(ETH_TOKEN_POOL.getCurrentBridgedAmount(), currentBridgedAmount); } // --- @@ -327,9 +222,9 @@ contract AaveV3E2ETest_IncreaseCCIPFacilitatorCapacity is ProtocolV3TestBase { address receiver; } - function _sendCcip( + function _prepareCcip( SendCcipParams memory params - ) internal returns (Internal.EVM2EVMMessage memory) { + ) internal returns (Client.EVM2AnyMessage memory, Internal.EVM2EVMMessage memory, uint256) { Client.EVM2AnyMessage memory message = _generateSingleTokenMessage( params.receiver, params.token, @@ -358,9 +253,8 @@ contract AaveV3E2ETest_IncreaseCCIPFacilitatorCapacity is ProtocolV3TestBase { ); IERC20(params.token).approve(address(params.router), params.amount); - params.router.ccipSend{value: expectedFee}(params.destChainSelector, message); - return geEvent; + return (message, geEvent, expectedFee); } function _generateSingleTokenMessage( diff --git a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol index a2d47c877..dd90ec6b1 100644 --- a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol +++ b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol @@ -2,6 +2,7 @@ pragma solidity ^0.8.0; import {AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol'; +import {MiscEthereum} from 'aave-address-book/MiscEthereum.sol'; import {ProtocolV3TestBase} from 'aave-helpers/ProtocolV3TestBase.sol'; import {AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707} from './AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.sol'; @@ -30,14 +31,14 @@ contract AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707_Test is Protoco function test_newLimitIsSet() public { // Current limit is 1M assertEq( - UpgradeableLockReleaseTokenPool(proposal.GHO_TOKEN_POOL()).getBridgeLimit(), + UpgradeableLockReleaseTokenPool(MiscEthereum.GHO_CCIP_TOKEN_POOL).getBridgeLimit(), 1_000_000 ether ); executePayload(vm, address(proposal)); assertEq( - UpgradeableLockReleaseTokenPool(proposal.GHO_TOKEN_POOL()).getBridgeLimit(), + UpgradeableLockReleaseTokenPool(MiscEthereum.GHO_CCIP_TOKEN_POOL).getBridgeLimit(), proposal.NEW_LIMIT() ); } From 6e6fb30d097676da9ecd2af57b3eff64a4e0e9f0 Mon Sep 17 00:00:00 2001 From: efecarranza Date: Fri, 19 Jul 2024 12:10:13 -0400 Subject: [PATCH 10/10] chore: pr updates --- ...veV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.sol | 4 ++-- ...V3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol | 5 +++-- .../IncreaseCCIPFacilitatorCapacity.md | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.sol b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.sol index 6698b87cd..af95989aa 100644 --- a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.sol +++ b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.sol @@ -2,6 +2,7 @@ pragma solidity ^0.8.0; import {AaveV3ArbitrumAssets} from 'aave-address-book/AaveV3Arbitrum.sol'; +import {MiscArbitrum} from 'aave-address-book/MiscArbitrum.sol'; import {IGhoToken} from 'gho-core/gho/interfaces/IGhoToken.sol'; import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; @@ -12,12 +13,11 @@ import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGeneric * - Discussion: https://governance.aave.com/t/arfc-gho-arb-increase-ccip-facilitator-capacity/18169 */ contract AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707 is IProposalGenericExecutor { - address public constant FACILITATOR = 0xF168B83598516A532a85995b52504a2Fa058C068; uint128 public constant NEW_LIMIT = 2_500_000 ether; function execute() external { IGhoToken(AaveV3ArbitrumAssets.GHO_UNDERLYING).setFacilitatorBucketCapacity( - FACILITATOR, + MiscArbitrum.GHO_CCIP_TOKEN_POOL, NEW_LIMIT ); } diff --git a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol index acdf5c9cd..2899e78f2 100644 --- a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol +++ b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol @@ -2,6 +2,7 @@ pragma solidity ^0.8.0; import {AaveV3ArbitrumAssets} from 'aave-address-book/AaveV3Arbitrum.sol'; +import {MiscArbitrum} from 'aave-address-book/MiscArbitrum.sol'; import {IGhoToken} from 'gho-core/gho/interfaces/IGhoToken.sol'; import {ProtocolV3TestBase} from 'aave-helpers/ProtocolV3TestBase.sol'; @@ -24,13 +25,13 @@ contract AaveV3Arbitrum_IncreaseCCIPFacilitatorCapacity_20240707_Test is Protoco */ function test_newLimitIsSet() public { IGhoToken.Facilitator memory prevFacilitator = IGhoToken(AaveV3ArbitrumAssets.GHO_UNDERLYING) - .getFacilitator(proposal.FACILITATOR()); + .getFacilitator(MiscArbitrum.GHO_CCIP_TOKEN_POOL); assertEq(prevFacilitator.bucketCapacity, 1_000_000 ether); executePayload(vm, address(proposal)); IGhoToken.Facilitator memory facilitator = IGhoToken(AaveV3ArbitrumAssets.GHO_UNDERLYING) - .getFacilitator(proposal.FACILITATOR()); + .getFacilitator(MiscArbitrum.GHO_CCIP_TOKEN_POOL); assertEq(facilitator.bucketCapacity, proposal.NEW_LIMIT()); } diff --git a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity.md b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity.md index 4efe7d68c..71c7826a3 100644 --- a/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity.md +++ b/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/IncreaseCCIPFacilitatorCapacity.md @@ -11,7 +11,7 @@ This publication proposes increasing the CCIP Facilitator Capacity on Arbitrum f ## Motivation -GHO was successfully launched on Arbitrum and the CCIP GHO Facilitator Bucket Capacity is 65% utilized. With $3.41M of liquidity and a solid peg during launch, there is sufficient depth to facilitate increasing the CCIP GHO Facilitator Bucket Capacity from 1M to 2.5M in line with the initial risk parameters proposed prior to launch. +GHO was successfully launched on Arbitrum and the CCIP GHO Facilitator Bucket Capacity is 100% utilized. With $3.41M of liquidity and a solid peg during launch, there is sufficient depth to facilitate increasing the CCIP GHO Facilitator Bucket Capacity from 1M to 2.5M in line with the initial risk parameters proposed prior to launch. ## Specification @@ -22,7 +22,7 @@ The equivalent bridgeLimit is also being increased on Ethereum Mainnet to 2.5M u - Implementation: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.sol) - Tests: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240707_AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity/AaveV3Ethereum_IncreaseCCIPFacilitatorCapacity_20240707.t.sol) -- [Snapshot](Direct-to-AIP) +- Snapshot: Direct-to-AIP - [Discussion](https://governance.aave.com/t/arfc-gho-arb-increase-ccip-facilitator-capacity/18169) ## Copyright