From 3ed6487b6968fce0218a530df5f87d61e8c24cc0 Mon Sep 17 00:00:00 2001 From: sendra Date: Wed, 13 Mar 2024 10:14:22 +0100 Subject: [PATCH 01/17] feat: Update CrossChainController implementation and CCIP adapters --- ...ImplementationAndCCIPAdapters_20240313.sol | 133 ++++++++++ ...plementationAndCCIPAdapters_20240313.t.sol | 113 ++++++++ ...ImplementationAndCCIPAdapters_20240313.sol | 80 ++++++ ...plementationAndCCIPAdapters_20240313.t.sol | 85 ++++++ ...ImplementationAndCCIPAdapters_20240313.sol | 161 +++++++++++ ...plementationAndCCIPAdapters_20240313.t.sol | 168 ++++++++++++ ...ImplementationAndCCIPAdapters_20240313.sol | 130 +++++++++ ...plementationAndCCIPAdapters_20240313.t.sol | 112 ++++++++ .../BaseTest.sol | 249 ++++++++++++++++++ .../UpdateADIImplementationAndCCIPAdapters.md | 22 ++ ...plementationAndCCIPAdapters_20240313.s.sol | 148 +++++++++++ .../config.ts | 18 ++ 12 files changed, 1419 insertions(+) create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.sol create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.sol create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.sol create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.sol create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseTest.sol create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/config.ts diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.sol new file mode 100644 index 000000000..79c9aab43 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -0,0 +1,133 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; +import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol'; +import {ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/ProxyAdmin.sol'; +import {ChainIds} from 'aave-helpers/ChainIds.sol'; +import {MiscAvalanche} from 'aave-address-book/MiscAvalanche.sol'; +import {GovernanceV3Avalanche} from 'aave-address-book/GovernanceV3Avalanche.sol'; +import {ICrossChainReceiver, ICrossChainForwarder} from 'aave-address-book/common/ICrossChainController.sol'; + +import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; + +/** + * @title Update a.DI implementation and CCIP adapters + * @author BGD Labs @bgdlabs + * - Snapshot: TODO + * - Discussion: TODO + */ +contract AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313 is + IProposalGenericExecutor +{ + address public constant CCIP_ADAPTER_TO_REMOVE = 0x3F006299eC88985c18E6e885EeA29A49eC579882; + address public constant CCIP_NEW_ADAPTER = 0x2b88C83727B0E290B76EB3F6133994fF81B7f355; + address public constant DESTINATION_CCIP_NEW_ADAPTER = 0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29; + address public constant NEW_CROSS_CHAIN_CONTROLLER_IMPLEMENTATION = + 0x5Ef80c5eB6CF65Dab8cD1C0ee258a6D2bD38Bd22; + + function execute() external { + // Update CrossChainController implementation + ProxyAdmin(MiscAvalanche.PROXY_ADMIN).upgradeAndCall( + TransparentUpgradeableProxy(payable(GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER)), + NEW_CROSS_CHAIN_CONTROLLER_IMPLEMENTATION, + abi.encodeWithSignature('initializeRevision()') + ); + + // remove old Receiver bridge adapter + ICrossChainReceiver(GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER) + .disallowReceiverBridgeAdapters(_getReceiverBridgeAdaptersToRemove()); + + // remove forwarding adapters + ICrossChainForwarder(GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER).disableBridgeAdapters( + _getForwarderBridgeAdaptersToRemove() + ); + + // add receiver adapters + ICrossChainReceiver(GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER).allowReceiverBridgeAdapters( + _getReceiverBridgeAdaptersToAllow() + ); + + // add forwarding adapters + ICrossChainForwarder(GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER).enableBridgeAdapters( + _getForwarderBridgeAdaptersToEnable() + ); + } + + function _getReceiverBridgeAdaptersToRemove() + internal + pure + returns (ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] memory) + { + uint256[] memory chainIds = new uint256[](1); + chainIds[0] = ChainIds.MAINNET; + + // remove old Receiver bridge adapter + ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] + memory bridgeAdaptersToRemove = new ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[](1); + + bridgeAdaptersToRemove[0] = ICrossChainReceiver.ReceiverBridgeAdapterConfigInput({ + bridgeAdapter: CCIP_ADAPTER_TO_REMOVE, + chainIds: chainIds + }); + + return bridgeAdaptersToRemove; + } + + function _getForwarderBridgeAdaptersToRemove() + internal + pure + returns (ICrossChainForwarder.BridgeAdapterToDisable[] memory) + { + uint256[] memory chainIds = new uint256[](1); + chainIds[0] = ChainIds.MAINNET; + + ICrossChainForwarder.BridgeAdapterToDisable[] + memory forwarderAdaptersToRemove = new ICrossChainForwarder.BridgeAdapterToDisable[](1); + + forwarderAdaptersToRemove[0] = ICrossChainForwarder.BridgeAdapterToDisable({ + bridgeAdapter: CCIP_ADAPTER_TO_REMOVE, + chainIds: chainIds + }); + + return forwarderAdaptersToRemove; + } + + function _getReceiverBridgeAdaptersToAllow() + internal + pure + returns (ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] memory) + { + uint256[] memory chainIds = new uint256[](1); + chainIds[0] = ChainIds.MAINNET; + + ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] + memory bridgeAdapterConfig = new ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[](1); + + bridgeAdapterConfig[0] = ICrossChainReceiver.ReceiverBridgeAdapterConfigInput({ + bridgeAdapter: CCIP_NEW_ADAPTER, + chainIds: chainIds + }); + + return bridgeAdapterConfig; + } + + function _getForwarderBridgeAdaptersToEnable() + internal + pure + returns (ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] memory) + { + ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] + memory bridgeAdaptersToEnable = new ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[]( + 1 + ); + + bridgeAdaptersToEnable[0] = ICrossChainForwarder.ForwarderBridgeAdapterConfigInput({ + currentChainBridgeAdapter: CCIP_NEW_ADAPTER, + destinationBridgeAdapter: DESTINATION_CCIP_NEW_ADAPTER, + destinationChainId: ChainIds.MAINNET + }); + + return bridgeAdaptersToEnable; + } +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol new file mode 100644 index 000000000..56eb15392 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -0,0 +1,113 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {AaveV3Avalanche} from 'aave-address-book/AaveV3Avalanche.sol'; +import {MiscAvalanche} from 'aave-address-book/MiscAvalanche.sol'; +import {GovernanceV3Avalanche} from 'aave-address-book/GovernanceV3Avalanche.sol'; +import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; +import './BaseTest.sol'; + +import {AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; + +/** + * @dev Test for AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313 + * command: make test-contract filter=AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313 + */ +contract AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313_Test is BaseTest { + AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313 internal payload; + + constructor() + BaseTest( + GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER, + MiscAvalanche.PROXY_ADMIN, + 'avalanche', + 42801819 + ) + {} + + function setUp() public override { + super.setUp(); + payload = new AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313(); + payloadAddress = address(payload); + } + + function _getAdapterNames() internal view override returns (AdapterName[] memory) { + AdapterName[] memory adapterNames = new AdapterName[](1); + adapterNames[0] = AdapterName({adapter: payload.CCIP_NEW_ADAPTER(), name: 'CCIP adapter'}); + + return adapterNames; + } + + function _checkCorrectPathConfiguration() internal override { + assertEq(ethereumPayload.CCIP_NEW_ADAPTER(), payload.DESTINATION_CCIP_NEW_ADAPTER()); + } + + function _getTrustedRemotes() internal view override returns (TrustedRemote[] memory) { + TrustedRemote[] memory trustedRemotes = new TrustedRemote[](1); + trustedRemotes[0] = TrustedRemote({ + adapter: payload.CCIP_NEW_ADAPTER(), + expectedRemote: GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER, + remoteChainId: ChainIds.MAINNET + }); + + return trustedRemotes; + } + + function _getForwarderAdaptersByChain( + bool afterExecution + ) internal view override returns (ForwarderAdapters[] memory) { + ForwarderAdapters[] memory forwarderAdapters = new ForwarderAdapters[](1); + + ICrossChainForwarder.ChainIdBridgeConfig[] + memory adapters = new ICrossChainForwarder.ChainIdBridgeConfig[](1); + adapters[0].currentChainBridgeAdapter = payload.CCIP_ADAPTER_TO_REMOVE(); + + if (afterExecution) { + adapters[0].currentChainBridgeAdapter = payload.CCIP_NEW_ADAPTER(); + adapters[0].destinationBridgeAdapter = payload.DESTINATION_CCIP_NEW_ADAPTER(); + } + forwarderAdapters[0].adapters = adapters; + forwarderAdapters[0].chainId = ChainIds.MAINNET; + + return forwarderAdapters; + } + + function _getReceiverAdaptersByChain( + bool afterExecution + ) internal view override returns (AdaptersByChain[] memory) { + address[] memory adapters = new address[](1); + AdaptersByChain[] memory receiverAdaptersByChain = new AdaptersByChain[](1); + + adapters[0] = payload.CCIP_ADAPTER_TO_REMOVE(); + + if (afterExecution) { + adapters[0] = payload.CCIP_NEW_ADAPTER(); + } + receiverAdaptersByChain[0].adapters = adapters; + receiverAdaptersByChain[0].chainId = ChainIds.MAINNET; + + return receiverAdaptersByChain; + } + + function _getAdapterByChain( + bool afterExecution + ) internal view override returns (AdapterAllowed[] memory) { + AdapterAllowed[] memory adaptersAllowed = new AdapterAllowed[](2); + adaptersAllowed[0] = AdapterAllowed({ + adapter: payload.CCIP_ADAPTER_TO_REMOVE(), + chainId: ChainIds.MAINNET, + allowed: true + }); + adaptersAllowed[1] = AdapterAllowed({ + adapter: payload.CCIP_NEW_ADAPTER(), + chainId: ChainIds.MAINNET, + allowed: false + }); + if (afterExecution) { + adaptersAllowed[0].allowed = false; + adaptersAllowed[1].allowed = true; + } + + return adaptersAllowed; + } +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.sol new file mode 100644 index 000000000..9f81ee3ea --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -0,0 +1,80 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; +import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol'; +import {ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/ProxyAdmin.sol'; +import {ChainIds} from 'aave-helpers/ChainIds.sol'; +import {MiscBNB} from 'aave-address-book/MiscBNB.sol'; +import {GovernanceV3BNB} from 'aave-address-book/GovernanceV3BNB.sol'; +import {ICrossChainReceiver} from 'aave-address-book/common/ICrossChainController.sol'; + +/** + * @title Update a.DI implementation and CCIP adapters + * @author BGD Labs @bgdlabs + * - Snapshot: TODO + * - Discussion: TODO + */ +contract AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313 is IProposalGenericExecutor { + address public constant CCIP_ADAPTER_TO_REMOVE = 0x746c675dAB49Bcd5BB9Dc85161f2d7Eb435009bf; + address public constant CCIP_NEW_ADAPTER = 0xAE93BEa44dcbE52B625169588574d31e36fb3A67; + address public constant NEW_CROSS_CHAIN_CONTROLLER_IMPLEMENTATION = + 0xf41193E25408F652AF878c47E4401A01B5E4B682; + + function execute() external { + // Update CrossChainController implementation + ProxyAdmin(MiscBNB.PROXY_ADMIN).upgradeAndCall( + TransparentUpgradeableProxy(payable(GovernanceV3BNB.CROSS_CHAIN_CONTROLLER)), + NEW_CROSS_CHAIN_CONTROLLER_IMPLEMENTATION, + abi.encodeWithSignature('initializeRevision()') + ); + + // remove old Receiver bridge adapter + ICrossChainReceiver(GovernanceV3BNB.CROSS_CHAIN_CONTROLLER).disallowReceiverBridgeAdapters( + _getReceiverBridgeAdaptersToRemove() + ); + + // add receiver adapters + ICrossChainReceiver(GovernanceV3BNB.CROSS_CHAIN_CONTROLLER).allowReceiverBridgeAdapters( + _getReceiverBridgeAdaptersToAllow() + ); + } + + function _getReceiverBridgeAdaptersToRemove() + internal + pure + returns (ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] memory) + { + uint256[] memory chainIds = new uint256[](1); + chainIds[0] = ChainIds.MAINNET; + + ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] + memory bridgeAdaptersToRemove = new ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[](1); + + bridgeAdaptersToRemove[0] = ICrossChainReceiver.ReceiverBridgeAdapterConfigInput({ + bridgeAdapter: CCIP_ADAPTER_TO_REMOVE, + chainIds: chainIds + }); + + return bridgeAdaptersToRemove; + } + + function _getReceiverBridgeAdaptersToAllow() + internal + pure + returns (ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] memory) + { + uint256[] memory chainIds = new uint256[](1); + chainIds[0] = ChainIds.MAINNET; + + ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] + memory bridgeAdapterConfig = new ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[](1); + + bridgeAdapterConfig[0] = ICrossChainReceiver.ReceiverBridgeAdapterConfigInput({ + bridgeAdapter: CCIP_NEW_ADAPTER, + chainIds: chainIds + }); + + return bridgeAdapterConfig; + } +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol new file mode 100644 index 000000000..7e6c0fe1c --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -0,0 +1,85 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {AaveV3BNB} from 'aave-address-book/AaveV3BNB.sol'; +import {MiscBNB} from 'aave-address-book/MiscBNB.sol'; +import {GovernanceV3BNB} from 'aave-address-book/GovernanceV3BNB.sol'; +import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; +import './BaseTest.sol'; + +import {AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; + +/** + * @dev Test for AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313 + * command: make test-contract filter=AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313 + */ +contract AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313_Test is BaseTest { + AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313 internal payload; + + constructor() + BaseTest(GovernanceV3BNB.CROSS_CHAIN_CONTROLLER, MiscBNB.PROXY_ADMIN, 'bnb', 36903911) + {} + + function setUp() public override { + super.setUp(); + payload = new AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313(); + payloadAddress = address(payload); + } + + function _getAdapterNames() internal view override returns (AdapterName[] memory) { + AdapterName[] memory adapterNames = new AdapterName[](1); + adapterNames[0] = AdapterName({adapter: payload.CCIP_NEW_ADAPTER(), name: 'CCIP adapter'}); + + return adapterNames; + } + + function _getTrustedRemotes() internal view override returns (TrustedRemote[] memory) { + TrustedRemote[] memory trustedRemotes = new TrustedRemote[](1); + trustedRemotes[0] = TrustedRemote({ + adapter: payload.CCIP_NEW_ADAPTER(), + expectedRemote: GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER, + remoteChainId: ChainIds.MAINNET + }); + + return trustedRemotes; + } + + function _getReceiverAdaptersByChain( + bool afterExecution + ) internal view override returns (AdaptersByChain[] memory) { + address[] memory adapters = new address[](1); + AdaptersByChain[] memory receiverAdaptersByChain = new AdaptersByChain[](1); + + adapters[0] = payload.CCIP_ADAPTER_TO_REMOVE(); + + if (afterExecution) { + adapters[0] = payload.CCIP_NEW_ADAPTER(); + } + receiverAdaptersByChain[0].adapters = adapters; + receiverAdaptersByChain[0].chainId = ChainIds.MAINNET; + + return receiverAdaptersByChain; + } + + function _getAdapterByChain( + bool afterExecution + ) internal view override returns (AdapterAllowed[] memory) { + AdapterAllowed[] memory adaptersAllowed = new AdapterAllowed[](2); + adaptersAllowed[0] = AdapterAllowed({ + adapter: payload.CCIP_ADAPTER_TO_REMOVE(), + chainId: ChainIds.MAINNET, + allowed: true + }); + adaptersAllowed[1] = AdapterAllowed({ + adapter: payload.CCIP_NEW_ADAPTER(), + chainId: ChainIds.MAINNET, + allowed: false + }); + if (afterExecution) { + adaptersAllowed[0].allowed = false; + adaptersAllowed[5].allowed = true; + } + + return adaptersAllowed; + } +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.sol new file mode 100644 index 000000000..c6eb56b3d --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -0,0 +1,161 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; +import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol'; +import {ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/ProxyAdmin.sol'; +import {ChainIds} from 'aave-helpers/ChainIds.sol'; +import {MiscEthereum} from 'aave-address-book/MiscEthereum.sol'; +import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; +import {ICrossChainReceiver, ICrossChainForwarder} from 'aave-address-book/common/ICrossChainController.sol'; + +/** + * @title Update a.DI implementation and CCIP adapters + * @author BGD Labs @bgdlabs + * - Snapshot: TODO + * - Discussion: TODO + */ +contract AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313 is + IProposalGenericExecutor +{ + //receiver adapters to remove + address public constant CCIP_ADAPTER_TO_REMOVE = 0xDB8953194810b1942544fA528791278D458719D5; + // forwarder-receiver adapter pairs to add + address public constant CCIP_NEW_ADAPTER = 0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29; + + address public constant DESTINATION_CCIP_NEW_ADAPTER_AVALANCHE = + 0x2b88C83727B0E290B76EB3F6133994fF81B7f355; + address public constant DESTINATION_CCIP_NEW_ADAPTER_POLYGON = + 0xe79757D55a1600eF28D816a893E78E9FCDE2019E; + address public constant DESTINATION_CCIP_NEW_ADAPTER_BNB = + 0xAE93BEa44dcbE52B625169588574d31e36fb3A67; + + address public constant NEW_CROSS_CHAIN_CONTROLLER_IMPLEMENTATION = + 0x28559c2F4B038b1E836fA419DCcDe7454d8Fe215; + + function execute() external { + // Update CrossChainController implementation + ProxyAdmin(MiscEthereum.PROXY_ADMIN).upgradeAndCall( + TransparentUpgradeableProxy(payable(GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER)), + NEW_CROSS_CHAIN_CONTROLLER_IMPLEMENTATION, + abi.encodeWithSignature('initializeRevision()') + ); + // add receiver adapters + ICrossChainReceiver(GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER).allowReceiverBridgeAdapters( + _getReceiverBridgeAdaptersToAllow() + ); + + // add forwarding adapters + ICrossChainForwarder(GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER).enableBridgeAdapters( + _getForwarderBridgeAdaptersToEnable() + ); + + // remove old Receiver bridge adapter + ICrossChainReceiver(GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER).disallowReceiverBridgeAdapters( + _getReceiverBridgeAdaptersToRemove() + ); + + // remove forwarding adapters + ICrossChainForwarder(GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER).disableBridgeAdapters( + _getForwarderBridgeAdaptersToRemove() + ); + } + + function _getReceiverBridgeAdaptersToRemove() + internal + pure + returns (ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] memory) + { + ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] + memory receiverAdaptersToRemove = new ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[]( + 1 + ); + + uint256[] memory receiverChainIds = new uint256[](1); + receiverChainIds[0] = ChainIds.POLYGON; + receiverChainIds[1] = ChainIds.AVALANCHE; + + receiverAdaptersToRemove[0] = ICrossChainReceiver.ReceiverBridgeAdapterConfigInput({ + bridgeAdapter: CCIP_ADAPTER_TO_REMOVE, + chainIds: receiverChainIds + }); + + return receiverAdaptersToRemove; + } + + function _getForwarderBridgeAdaptersToRemove() + internal + pure + returns (ICrossChainForwarder.BridgeAdapterToDisable[] memory) + { + ICrossChainForwarder.BridgeAdapterToDisable[] + memory forwarderAdaptersToRemove = new ICrossChainForwarder.BridgeAdapterToDisable[](1); + + uint256[] memory forwarderCCIPChainIds = new uint256[](3); + forwarderCCIPChainIds[0] = ChainIds.AVALANCHE; + forwarderCCIPChainIds[1] = ChainIds.POLYGON; + forwarderCCIPChainIds[2] = ChainIds.BNB; + + forwarderAdaptersToRemove[0] = ICrossChainForwarder.BridgeAdapterToDisable({ + bridgeAdapter: CCIP_ADAPTER_TO_REMOVE, + chainIds: forwarderCCIPChainIds + }); + + return forwarderAdaptersToRemove; + } + + function _getReceiverBridgeAdaptersToAllow() + internal + pure + returns (ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] memory) + { + uint256[] memory receiverChainIds = new uint256[](2); + receiverChainIds[0] = ChainIds.AVALANCHE; + receiverChainIds[1] = ChainIds.POLYGON; + + ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] + memory receiverAdaptersToAllow = new ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[]( + 1 + ); + + receiverAdaptersToAllow[0] = ICrossChainReceiver.ReceiverBridgeAdapterConfigInput({ + bridgeAdapter: CCIP_NEW_ADAPTER, + chainIds: receiverChainIds + }); + + return receiverAdaptersToAllow; + } + + function _getForwarderBridgeAdaptersToEnable() + internal + pure + returns (ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] memory) + { + ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] + memory forwarderAdaptersToEnable = new ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[]( + 3 + ); + // avalanche path + forwarderAdaptersToEnable[0] = ICrossChainForwarder.ForwarderBridgeAdapterConfigInput({ + currentChainBridgeAdapter: CCIP_NEW_ADAPTER, + destinationBridgeAdapter: DESTINATION_CCIP_NEW_ADAPTER_AVALANCHE, + destinationChainId: ChainIds.AVALANCHE + }); + + // polygon path + forwarderAdaptersToEnable[1] = ICrossChainForwarder.ForwarderBridgeAdapterConfigInput({ + currentChainBridgeAdapter: CCIP_NEW_ADAPTER, + destinationBridgeAdapter: DESTINATION_CCIP_NEW_ADAPTER_POLYGON, + destinationChainId: ChainIds.POLYGON + }); + + // binance path + forwarderAdaptersToEnable[2] = ICrossChainForwarder.ForwarderBridgeAdapterConfigInput({ + currentChainBridgeAdapter: CCIP_NEW_ADAPTER, + destinationBridgeAdapter: DESTINATION_CCIP_NEW_ADAPTER_BNB, + destinationChainId: ChainIds.BNB + }); + + return forwarderAdaptersToEnable; + } +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol new file mode 100644 index 000000000..292f4368a --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -0,0 +1,168 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol'; +import {MiscEthereum} from 'aave-address-book/MiscEthereum.sol'; +import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; +import {GovernanceV3Polygon} from 'aave-address-book/GovernanceV3Polygon.sol'; +import {GovernanceV3Avalanche} from 'aave-address-book/GovernanceV3Avalanche.sol'; +import './BaseTest.sol'; +import {AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; +import {AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; +import {AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; +import {AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; + +/** + * @dev Test for AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313 + * command: make test-contract filter=AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313 + */ +contract AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313_Test is BaseTest { + AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313 internal payload; + AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313 internal avalanchePayload; + AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313 internal bnbPayload; + AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313 internal polygonPayload; + + constructor() + BaseTest( + GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER, + MiscEthereum.PROXY_ADMIN, + 'mainnet', + 19418547 + ) + {} + + function setUp() public override { + super.setUp(); + payload = new AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313(); + avalanchePayload = new AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313(); + bnbPayload = new AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313(); + polygonPayload = new AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313(); + payloadAddress = address(payload); + } + + function _getAdapterNames() internal view override returns (AdapterName[] memory) { + AdapterName[] memory adapterNames = new AdapterName[](1); + adapterNames[0] = AdapterName({adapter: payload.CCIP_NEW_ADAPTER(), name: 'CCIP adapter'}); + + return adapterNames; + } + + function _checkCorrectPathConfiguration() internal override { + assertEq(payload.DESTINATION_CCIP_NEW_ADAPTER_AVALANCHE(), avalanchePayload.CCIP_NEW_ADAPTER()); + assertEq(payload.DESTINATION_CCIP_NEW_ADAPTER_BNB(), bnbPayload.CCIP_NEW_ADAPTER()); + assertEq(payload.DESTINATION_CCIP_NEW_ADAPTER_POLYGON(), polygonPayload.CCIP_NEW_ADAPTER()); + } + + function _getTrustedRemotes() internal view override returns (TrustedRemote[] memory) { + TrustedRemote[] memory trustedRemotes = new TrustedRemote[](2); + trustedRemotes[0] = TrustedRemote({ + adapter: payload.CCIP_NEW_ADAPTER(), + expectedRemote: GovernanceV3Polygon.CROSS_CHAIN_CONTROLLER, + remoteChainId: ChainIds.POLYGON + }); + trustedRemotes[1] = TrustedRemote({ + adapter: payload.CCIP_NEW_ADAPTER(), + expectedRemote: GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER, + remoteChainId: ChainIds.AVALANCHE + }); + + return trustedRemotes; + } + + function _getReceiverAdaptersByChain( + bool afterExecution + ) internal view override returns (AdaptersByChain[] memory) { + address[] memory polygonAdapters = new address[](1); + address[] memory avalancheAdapters = new address[](1); + AdaptersByChain[] memory receiverAdaptersByChain = new AdaptersByChain[](2); + + polygonAdapters[0] = payload.CCIP_ADAPTER_TO_REMOVE(); + avalancheAdapters[0] = payload.CCIP_ADAPTER_TO_REMOVE(); + + if (afterExecution) { + polygonAdapters[0] = payload.CCIP_NEW_ADAPTER(); + avalancheAdapters[0] = payload.CCIP_NEW_ADAPTER(); + } + receiverAdaptersByChain[0].adapters = polygonAdapters; + receiverAdaptersByChain[0].chainId = ChainIds.POLYGON; + receiverAdaptersByChain[0].adapters = avalancheAdapters; + receiverAdaptersByChain[0].chainId = ChainIds.AVALANCHE; + + return receiverAdaptersByChain; + } + + function _getForwarderAdaptersByChain( + bool afterExecution + ) internal view override returns (ForwarderAdapters[] memory) { + ForwarderAdapters[] memory forwarderAdapters = new ForwarderAdapters[](3); + + ICrossChainForwarder.ChainIdBridgeConfig[] + memory polygonAdapters = new ICrossChainForwarder.ChainIdBridgeConfig[](1); + ICrossChainForwarder.ChainIdBridgeConfig[] + memory avalancheAdapters = new ICrossChainForwarder.ChainIdBridgeConfig[](1); + ICrossChainForwarder.ChainIdBridgeConfig[] + memory binanceAdapters = new ICrossChainForwarder.ChainIdBridgeConfig[](1); + + // polygon + polygonAdapters[0].currentChainBridgeAdapter = payload.CCIP_ADAPTER_TO_REMOVE(); + // avalanche + avalancheAdapters[0].currentChainBridgeAdapter = payload.CCIP_ADAPTER_TO_REMOVE(); + // binance + binanceAdapters[0].currentChainBridgeAdapter = payload.CCIP_ADAPTER_TO_REMOVE(); + + if (afterExecution) { + // polygon + polygonAdapters[0].currentChainBridgeAdapter = payload.CCIP_NEW_ADAPTER(); + polygonAdapters[0].destinationBridgeAdapter = payload.DESTINATION_CCIP_NEW_ADAPTER_POLYGON(); + // avalanche + avalancheAdapters[0].currentChainBridgeAdapter = payload.CCIP_NEW_ADAPTER(); + avalancheAdapters[0].destinationBridgeAdapter = payload + .DESTINATION_CCIP_NEW_ADAPTER_AVALANCHE(); + // binance + binanceAdapters[0].currentChainBridgeAdapter = payload.CCIP_NEW_ADAPTER(); + binanceAdapters[0].destinationBridgeAdapter = payload.DESTINATION_CCIP_NEW_ADAPTER_BNB(); + } + forwarderAdapters[0].adapters = polygonAdapters; + forwarderAdapters[0].chainId = ChainIds.POLYGON; + forwarderAdapters[1].adapters = avalancheAdapters; + forwarderAdapters[1].chainId = ChainIds.AVALANCHE; + forwarderAdapters[2].adapters = binanceAdapters; + forwarderAdapters[2].chainId = ChainIds.BNB; + + return forwarderAdapters; + } + + function _getAdapterByChain( + bool afterExecution + ) internal view override returns (AdapterAllowed[] memory) { + AdapterAllowed[] memory adaptersAllowed = new AdapterAllowed[](4); + adaptersAllowed[0] = AdapterAllowed({ + adapter: payload.CCIP_ADAPTER_TO_REMOVE(), + chainId: ChainIds.POLYGON, + allowed: true + }); + adaptersAllowed[1] = AdapterAllowed({ + adapter: payload.CCIP_ADAPTER_TO_REMOVE(), + chainId: ChainIds.AVALANCHE, + allowed: true + }); + adaptersAllowed[2] = AdapterAllowed({ + adapter: payload.CCIP_NEW_ADAPTER(), + chainId: ChainIds.POLYGON, + allowed: false + }); + adaptersAllowed[3] = AdapterAllowed({ + adapter: payload.CCIP_NEW_ADAPTER(), + chainId: ChainIds.AVALANCHE, + allowed: false + }); + if (afterExecution) { + adaptersAllowed[0].allowed = false; + adaptersAllowed[1].allowed = false; + adaptersAllowed[2].allowed = true; + adaptersAllowed[3].allowed = true; + } + + return adaptersAllowed; + } +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.sol new file mode 100644 index 000000000..9847ecbb5 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -0,0 +1,130 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; +import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol'; +import {ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/ProxyAdmin.sol'; +import {ChainIds} from 'aave-helpers/ChainIds.sol'; +import {MiscPolygon} from 'aave-address-book/MiscPolygon.sol'; +import {ICrossChainReceiver, ICrossChainForwarder} from 'aave-address-book/common/ICrossChainController.sol'; +import {GovernanceV3Polygon} from 'aave-address-book/GovernanceV3Polygon.sol'; + +/** + * @title Update a.DI implementation and CCIP adapters + * @author BGD Labs @bgdlabs + * - Snapshot: TODO + * - Discussion: TODO + */ +contract AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313 is IProposalGenericExecutor { + address public constant CCIP_ADAPTER_TO_REMOVE = 0x95Fa2c817169E26956AB8795c84a225b55d7db5B; + address public constant CCIP_NEW_ADAPTER = 0xe79757D55a1600eF28D816a893E78E9FCDE2019E; + address public constant DESTINATION_CCIP_NEW_ADAPTER = 0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29; + address public constant NEW_CROSS_CHAIN_CONTROLLER_IMPLEMENTATION = + 0x87a95917DE670088d81B9a8B30E3B36704Ba3043; + + function execute() external { + // Update CrossChainController implementation + ProxyAdmin(MiscPolygon.PROXY_ADMIN).upgradeAndCall( + TransparentUpgradeableProxy(payable(GovernanceV3Polygon.CROSS_CHAIN_CONTROLLER)), + NEW_CROSS_CHAIN_CONTROLLER_IMPLEMENTATION, + abi.encodeWithSignature('initializeRevision()') + ); + + // remove old Receiver bridge adapter + ICrossChainReceiver(GovernanceV3Polygon.CROSS_CHAIN_CONTROLLER).disallowReceiverBridgeAdapters( + _getReceiverBridgeAdaptersToRemove() + ); + + // remove forwarding adapters + ICrossChainForwarder(GovernanceV3Polygon.CROSS_CHAIN_CONTROLLER).disableBridgeAdapters( + _getForwarderBridgeAdaptersToRemove() + ); + + // add receiver adapters + ICrossChainReceiver(GovernanceV3Polygon.CROSS_CHAIN_CONTROLLER).allowReceiverBridgeAdapters( + _getReceiverBridgeAdaptersToAllow() + ); + + // add forwarding adapters + ICrossChainForwarder(GovernanceV3Polygon.CROSS_CHAIN_CONTROLLER).enableBridgeAdapters( + _getForwarderBridgeAdaptersToEnable() + ); + } + + function _getReceiverBridgeAdaptersToRemove() + internal + pure + returns (ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] memory) + { + uint256[] memory chainIds = new uint256[](1); + chainIds[0] = ChainIds.MAINNET; + + // remove old Receiver bridge adapter + ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] + memory bridgeAdaptersToRemove = new ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[](1); + + bridgeAdaptersToRemove[0] = ICrossChainReceiver.ReceiverBridgeAdapterConfigInput({ + bridgeAdapter: CCIP_ADAPTER_TO_REMOVE, + chainIds: chainIds + }); + + return bridgeAdaptersToRemove; + } + + function _getForwarderBridgeAdaptersToRemove() + internal + pure + returns (ICrossChainForwarder.BridgeAdapterToDisable[] memory) + { + uint256[] memory chainIds = new uint256[](1); + chainIds[0] = ChainIds.MAINNET; + + ICrossChainForwarder.BridgeAdapterToDisable[] + memory forwarderAdaptersToRemove = new ICrossChainForwarder.BridgeAdapterToDisable[](1); + + forwarderAdaptersToRemove[0] = ICrossChainForwarder.BridgeAdapterToDisable({ + bridgeAdapter: CCIP_ADAPTER_TO_REMOVE, + chainIds: chainIds + }); + + return forwarderAdaptersToRemove; + } + + function _getReceiverBridgeAdaptersToAllow() + internal + pure + returns (ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] memory) + { + uint256[] memory chainIds = new uint256[](1); + chainIds[0] = ChainIds.MAINNET; + + ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] + memory bridgeAdapterConfig = new ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[](1); + + bridgeAdapterConfig[0] = ICrossChainReceiver.ReceiverBridgeAdapterConfigInput({ + bridgeAdapter: CCIP_NEW_ADAPTER, + chainIds: chainIds + }); + + return bridgeAdapterConfig; + } + + function _getForwarderBridgeAdaptersToEnable() + internal + pure + returns (ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] memory) + { + ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] + memory bridgeAdaptersToEnable = new ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[]( + 1 + ); + + bridgeAdaptersToEnable[0] = ICrossChainForwarder.ForwarderBridgeAdapterConfigInput({ + currentChainBridgeAdapter: CCIP_NEW_ADAPTER, + destinationBridgeAdapter: DESTINATION_CCIP_NEW_ADAPTER, + destinationChainId: ChainIds.MAINNET + }); + + return bridgeAdaptersToEnable; + } +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol new file mode 100644 index 000000000..db5fe6fb2 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -0,0 +1,112 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {AaveV3Polygon} from 'aave-address-book/AaveV3Polygon.sol'; +import {MiscPolygon} from 'aave-address-book/MiscPolygon.sol'; +import {GovernanceV3Polygon} from 'aave-address-book/GovernanceV3Polygon.sol'; +import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; +import './BaseTest.sol'; +import {AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; + +/** + * @dev Test for AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313 + * command: make test-contract filter=AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313 + */ +contract AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313_Test is BaseTest { + AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313 internal payload; + + constructor() + BaseTest( + GovernanceV3Polygon.CROSS_CHAIN_CONTROLLER, + MiscPolygon.PROXY_ADMIN, + 'polygon', + 54566890 + ) + {} + + function setUp() public override { + super.setUp(); + payload = new AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313(); + payloadAddress = address(payload); + } + + function _getAdapterNames() internal view override returns (AdapterName[] memory) { + AdapterName[] memory adapterNames = new AdapterName[](1); + adapterNames[0] = AdapterName({adapter: payload.CCIP_NEW_ADAPTER(), name: 'CCIP adapter'}); + + return adapterNames; + } + + function _checkCorrectPathConfiguration() internal override { + assertEq(ethereumPayload.CCIP_NEW_ADAPTER(), payload.DESTINATION_CCIP_NEW_ADAPTER()); + } + + function _getTrustedRemotes() internal view override returns (TrustedRemote[] memory) { + TrustedRemote[] memory trustedRemotes = new TrustedRemote[](1); + trustedRemotes[0] = TrustedRemote({ + adapter: payload.CCIP_NEW_ADAPTER(), + expectedRemote: GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER, + remoteChainId: ChainIds.MAINNET + }); + + return trustedRemotes; + } + + function _getForwarderAdaptersByChain( + bool afterExecution + ) internal view override returns (ForwarderAdapters[] memory) { + ForwarderAdapters[] memory forwarderAdapters = new ForwarderAdapters[](1); + + ICrossChainForwarder.ChainIdBridgeConfig[] + memory adapters = new ICrossChainForwarder.ChainIdBridgeConfig[](1); + adapters[0].currentChainBridgeAdapter = payload.CCIP_ADAPTER_TO_REMOVE(); + + if (afterExecution) { + adapters[0].currentChainBridgeAdapter = payload.CCIP_NEW_ADAPTER(); + adapters[0].destinationBridgeAdapter = payload.DESTINATION_CCIP_NEW_ADAPTER(); + } + forwarderAdapters[0].adapters = adapters; + forwarderAdapters[0].chainId = ChainIds.MAINNET; + + return forwarderAdapters; + } + + function _getReceiverAdaptersByChain( + bool afterExecution + ) internal view override returns (AdaptersByChain[] memory) { + address[] memory adapters = new address[](1); + AdaptersByChain[] memory receiverAdaptersByChain = new AdaptersByChain[](1); + + adapters[0] = payload.CCIP_ADAPTER_TO_REMOVE(); + + if (afterExecution) { + adapters[0] = payload.CCIP_NEW_ADAPTER(); + } + receiverAdaptersByChain[0].adapters = adapters; + receiverAdaptersByChain[0].chainId = ChainIds.MAINNET; + + return receiverAdaptersByChain; + } + + function _getAdapterByChain( + bool afterExecution + ) internal view override returns (AdapterAllowed[] memory) { + AdapterAllowed[] memory adaptersAllowed = new AdapterAllowed[](2); + adaptersAllowed[0] = AdapterAllowed({ + adapter: payload.CCIP_ADAPTER_TO_REMOVE(), + chainId: ChainIds.MAINNET, + allowed: true + }); + adaptersAllowed[1] = AdapterAllowed({ + adapter: payload.CCIP_NEW_ADAPTER(), + chainId: ChainIds.MAINNET, + allowed: false + }); + if (afterExecution) { + adaptersAllowed[0].allowed = false; + adaptersAllowed[1].allowed = true; + } + + return adaptersAllowed; + } +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseTest.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseTest.sol new file mode 100644 index 000000000..7f840cab5 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseTest.sol @@ -0,0 +1,249 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {ProtocolV3TestBase} from 'aave-helpers/ProtocolV3TestBase.sol'; +import {ICrossChainReceiver, ICrossChainForwarder} from 'aave-address-book/common/ICrossChainController.sol'; +import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol'; +import {ChainIds} from 'aave-helpers/ChainIds.sol'; +import {ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/ProxyAdmin.sol'; +import {IBaseAdapter} from 'aave-address-book/common/IBaseAdapter.sol'; +import {AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; + +struct AdapterName { + address adapter; + string name; +} + +struct TrustedRemote { + address adapter; + address expectedRemote; + uint256 remoteChainId; +} + +struct AdapterAllowed { + address adapter; + uint256 chainId; + bool allowed; +} + +struct AdaptersByChain { + address[] adapters; + uint256 chainId; +} + +struct ForwarderAdapters { + ICrossChainForwarder.ChainIdBridgeConfig[] adapters; + uint256 chainId; +} + +interface Payload { + function NEW_CROSS_CHAIN_CONTROLLER_IMPLEMENTATION() external returns (address); +} + +abstract contract BaseTest is ProtocolV3TestBase { + address public immutable CROSS_CHAIN_CONTROLLER; + address public immutable PROXY_ADMIN; + + address public payloadAddress; + string public network; + uint256 public blockNumber; + + AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313 internal ethereumPayload; + + constructor(address ccc, address proxyAdmin, string memory _network, uint256 _blockNumber) { + CROSS_CHAIN_CONTROLLER = ccc; + PROXY_ADMIN = proxyAdmin; + network = _network; + blockNumber = _blockNumber; + } + + function setUp() public virtual { + vm.createSelectFork(vm.rpcUrl(network), blockNumber); + ethereumPayload = new AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313(); + } + + /** + * @dev executes the generic test suite including e2e and config snapshots + */ + function test_defaultProposalExecution() public { + _checkTrustedRemotes(); + _checkCorrectPathConfiguration(); + _checkCorrectAdapterNames(); + + _checkCurrentReceiversState(false); + _checkAllReceiversAreRepresented(false); + _checkAllForwarderAdaptersAreRepresented(false); + _checkImplementationAddress( + Payload(payloadAddress).NEW_CROSS_CHAIN_CONTROLLER_IMPLEMENTATION(), + false + ); + + executePayload(vm, payloadAddress); + + _checkCurrentReceiversState(true); + _checkAllReceiversAreRepresented(true); + _checkAllForwarderAdaptersAreRepresented(true); + _checkImplementationAddress( + Payload(payloadAddress).NEW_CROSS_CHAIN_CONTROLLER_IMPLEMENTATION(), + true + ); + } + + // -------------- virtual methods -------------------------- + function _checkCorrectPathConfiguration() internal virtual {} + + function _getAdapterNames() internal view virtual returns (AdapterName[] memory); + + function _getTrustedRemotes() internal view virtual returns (TrustedRemote[] memory); + + function _getAdapterByChain( + bool beforeExecution + ) internal view virtual returns (AdapterAllowed[] memory); + + function _getForwarderAdaptersByChain( + bool beforeExecution + ) internal view virtual returns (ForwarderAdapters[] memory) { + ForwarderAdapters[] memory forwarderAdapters = new ForwarderAdapters[](0); + return forwarderAdapters; + } + + function _getReceiverAdaptersByChain( + bool beforeExecution + ) internal view virtual returns (AdaptersByChain[] memory); + + // ------------------------ checks ------------- + function _checkAllForwarderAdaptersAreRepresented(bool afterExecution) internal { + ForwarderAdapters[] memory forwarderAdapters = _getForwarderAdaptersByChain(afterExecution); + + for (uint256 i = 0; i < forwarderAdapters.length; i++) { + _testForwarderAdapterCorrectness( + forwarderAdapters[i].chainId, + forwarderAdapters[i].adapters, + afterExecution + ); + } + } + + function _checkAllReceiversAreRepresented(bool afterExecution) internal virtual { + AdaptersByChain[] memory receiverAdaptersByChain = _getReceiverAdaptersByChain(afterExecution); + + for (uint256 i = 0; i < receiverAdaptersByChain.length; i++) { + _testReceiverAdaptersByChain( + receiverAdaptersByChain[i].chainId, + receiverAdaptersByChain[i].adapters + ); + } + } + + function _checkCurrentReceiversState(bool afterExecution) internal { + AdapterAllowed[] memory adaptersByChain = _getAdapterByChain(afterExecution); + + for (uint256 i = 0; i < adaptersByChain.length; i++) { + assertEq( + ICrossChainReceiver(CROSS_CHAIN_CONTROLLER).isReceiverBridgeAdapterAllowed( + adaptersByChain[i].adapter, + adaptersByChain[i].chainId + ), + adaptersByChain[i].allowed + ); + } + } + + function _checkCorrectAdapterNames() internal { + AdapterName[] memory adapterNames = _getAdapterNames(); + + for (uint256 i = 0; i < adapterNames.length; i++) { + string memory adapterName = IBaseAdapter(adapterNames[i].adapter).adapterName(); + assertEq(keccak256(abi.encode(adapterName)), keccak256(abi.encode(adapterNames[i].name))); + } + } + + function _checkTrustedRemotes() internal { + TrustedRemote[] memory trustedRemotes = _getTrustedRemotes(); + + for (uint256 i = 0; i < trustedRemotes.length; i++) { + assertEq( + trustedRemotes[i].expectedRemote, + IBaseAdapter(trustedRemotes[i].adapter).getTrustedRemoteByChainId( + trustedRemotes[i].remoteChainId + ) + ); + } + } + + function _checkImplementationAddress(address implementation, bool equal) internal { + address cccImplementation = ProxyAdmin(PROXY_ADMIN).getProxyImplementation( + TransparentUpgradeableProxy(payable(CROSS_CHAIN_CONTROLLER)) + ); + assertEq(cccImplementation == implementation, equal); + } + + //----------------------------------------------------------------- + + function _testForwarderAdapterCorrectness( + uint256 chainId, + ICrossChainForwarder.ChainIdBridgeConfig[] memory adapters, + bool checkDestination + ) internal { + ICrossChainForwarder.ChainIdBridgeConfig[] + memory forwarderBridgeAdapters = ICrossChainForwarder(CROSS_CHAIN_CONTROLLER) + .getForwarderBridgeAdaptersByChain(chainId); + + uint256 adaptersCount; + for (uint256 i = 0; i < forwarderBridgeAdapters.length; i++) { + for (uint256 j = 0; j < adapters.length; j++) { + if ( + forwarderBridgeAdapters[i].currentChainBridgeAdapter == + adapters[j].currentChainBridgeAdapter + ) { + if (checkDestination) { + if ( + forwarderBridgeAdapters[i].destinationBridgeAdapter == + adapters[j].destinationBridgeAdapter + ) { + adaptersCount++; + } + } else { + adaptersCount++; + } + } + } + } + assertEq(adaptersCount, adapters.length); + } + + function _testReceiverAdaptersByChain(uint256 chainId, address[] memory adapters) internal { + address[] memory receiverAdapters = ICrossChainReceiver(CROSS_CHAIN_CONTROLLER) + .getReceiverBridgeAdaptersByChain(chainId); + + uint256 adaptersCount; + for (uint256 i = 0; i < receiverAdapters.length; i++) { + for (uint256 j = 0; j < adapters.length; j++) { + if (receiverAdapters[i] == adapters[j]) { + adaptersCount++; + } + } + } + assertEq(adaptersCount, adapters.length); + } + + function _testOnlyUpdatedReceiverAdapterChanges( + address[] memory previousReceivers, + address newAdapter, + address removedAdapter + ) internal { + address[] memory currentReceiverAdapters = ICrossChainReceiver(CROSS_CHAIN_CONTROLLER) + .getReceiverBridgeAdaptersByChain(chainId); + + uint256 adaptersCount; + bool removedAdapterFound; + bool newAdapterFound; + for (uint256 i = 0; i < currentReceiverAdapters.length; i++) { + for (uint256 j = 0; j < previousReceivers.length; j++) { + if (currentReceiverAdapters[i] == adapters[j]) { + adaptersCount++; + } + } + } + } +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md new file mode 100644 index 000000000..68a6a6589 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md @@ -0,0 +1,22 @@ +--- +title: "Update a.DI implementation and CCIP adapters" +author: "BGD Labs @bgdlabs" +discussions: "" +--- + +## Simple Summary + +## Motivation + +## Specification + +## References + +- Implementation: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Polygon](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Avalanche](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3BNB](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.sol) +- Tests: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol), [AaveV3Polygon](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol), [AaveV3Avalanche](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol), [AaveV3BNB](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol) +- [Snapshot](TODO) +- [Discussion](TODO) + +## Copyright + +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol new file mode 100644 index 000000000..5f8270226 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol @@ -0,0 +1,148 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {GovV3Helpers, IPayloadsControllerCore, PayloadsControllerUtils} from 'aave-helpers/GovV3Helpers.sol'; +import {EthereumScript, PolygonScript, AvalancheScript, BNBScript} from 'aave-helpers/ScriptUtils.sol'; +import {AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; +import {AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; +import {AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; +import {AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; + +/** + * @dev Deploy Ethereum + * deploy-command: make deploy-ledger contract=src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol:DeployEthereum chain=mainnet + * verify-command: npx catapulta-verify -b broadcast/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol/1/run-latest.json + */ +contract DeployEthereum is EthereumScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode + ); + + // compose action + IPayloadsControllerCore.ExecutionAction[] + memory actions = new IPayloadsControllerCore.ExecutionAction[](1); + actions[0] = GovV3Helpers.buildAction(payload0); + + // register action at payloadsController + GovV3Helpers.createPayload(actions); + } +} + +/** + * @dev Deploy Polygon + * deploy-command: make deploy-ledger contract=src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol:DeployPolygon chain=polygon + * verify-command: npx catapulta-verify -b broadcast/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol/137/run-latest.json + */ +contract DeployPolygon is PolygonScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode + ); + + // compose action + IPayloadsControllerCore.ExecutionAction[] + memory actions = new IPayloadsControllerCore.ExecutionAction[](1); + actions[0] = GovV3Helpers.buildAction(payload0); + + // register action at payloadsController + GovV3Helpers.createPayload(actions); + } +} + +/** + * @dev Deploy Avalanche + * deploy-command: make deploy-ledger contract=src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol:DeployAvalanche chain=avalanche + * verify-command: npx catapulta-verify -b broadcast/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol/43114/run-latest.json + */ +contract DeployAvalanche is AvalancheScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode + ); + + // compose action + IPayloadsControllerCore.ExecutionAction[] + memory actions = new IPayloadsControllerCore.ExecutionAction[](1); + actions[0] = GovV3Helpers.buildAction(payload0); + + // register action at payloadsController + GovV3Helpers.createPayload(actions); + } +} + +/** + * @dev Deploy BNB + * deploy-command: make deploy-ledger contract=src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol:DeployBNB chain=bnb + * verify-command: npx catapulta-verify -b broadcast/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol/56/run-latest.json + */ +contract DeployBNB is BNBScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313).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/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol:CreateProposal chain=mainnet + */ +contract CreateProposal is EthereumScript { + function run() external { + // create payloads + PayloadsControllerUtils.Payload[] memory payloads = new PayloadsControllerUtils.Payload[](4); + + // compose actions for validation + IPayloadsControllerCore.ExecutionAction[] + memory actionsEthereum = new IPayloadsControllerCore.ExecutionAction[](1); + actionsEthereum[0] = GovV3Helpers.buildAction( + type(AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode + ); + payloads[0] = GovV3Helpers.buildMainnetPayload(vm, actionsEthereum); + + IPayloadsControllerCore.ExecutionAction[] + memory actionsPolygon = new IPayloadsControllerCore.ExecutionAction[](1); + actionsPolygon[0] = GovV3Helpers.buildAction( + type(AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode + ); + payloads[1] = GovV3Helpers.buildPolygonPayload(vm, actionsPolygon); + + IPayloadsControllerCore.ExecutionAction[] + memory actionsAvalanche = new IPayloadsControllerCore.ExecutionAction[](1); + actionsAvalanche[0] = GovV3Helpers.buildAction( + type(AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode + ); + payloads[2] = GovV3Helpers.buildAvalanchePayload(vm, actionsAvalanche); + + IPayloadsControllerCore.ExecutionAction[] + memory actionsBNB = new IPayloadsControllerCore.ExecutionAction[](1); + actionsBNB[0] = GovV3Helpers.buildAction( + type(AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode + ); + payloads[3] = GovV3Helpers.buildBNBPayload(vm, actionsBNB); + + // create proposal + vm.startBroadcast(); + GovV3Helpers.createProposal( + vm, + payloads, + GovV3Helpers.ipfsHashFile( + vm, + 'src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md' + ) + ); + } +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/config.ts b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/config.ts new file mode 100644 index 000000000..307a94eba --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/config.ts @@ -0,0 +1,18 @@ +import {ConfigFile} from '../../generator/types'; +export const config: ConfigFile = { + rootOptions: { + author: 'BGD Labs @bgdlabs', + pools: ['AaveV3Ethereum', 'AaveV3Polygon', 'AaveV3Avalanche', 'AaveV3BNB'], + title: 'Update a.DI implementation and CCIP adapters', + shortName: 'UpdateADIImplementationAndCCIPAdapters', + date: '20240313', + discussion: '', + snapshot: '', + }, + poolOptions: { + AaveV3Ethereum: {configs: {OTHERS: {}}, cache: {blockNumber: 19424932}}, + AaveV3Polygon: {configs: {OTHERS: {}}, cache: {blockNumber: 54601669}}, + AaveV3Avalanche: {configs: {OTHERS: {}}, cache: {blockNumber: 42840161}}, + AaveV3BNB: {configs: {OTHERS: {}}, cache: {blockNumber: 36928161}}, + }, +}; From d20ab9dd02845d81a21aaf08888b7a8e7d0226f5 Mon Sep 17 00:00:00 2001 From: sendra Date: Wed, 13 Mar 2024 10:43:16 +0100 Subject: [PATCH 02/17] fix: added some internal test methods --- .../BaseTest.sol | 39 +++++++++++++++---- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseTest.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseTest.sol index 7f840cab5..649c2f227 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseTest.sol +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseTest.sol @@ -78,8 +78,12 @@ abstract contract BaseTest is ProtocolV3TestBase { false ); + AdaptersByChain[] memory receiversBeforeExecution = _getCurrentReceiverAdaptersByChain(); + executePayload(vm, payloadAddress); + AdaptersByChain[] memory afterBeforeExecution = _getCurrentReceiverAdaptersByChain(); + _checkCurrentReceiversState(true); _checkAllReceiversAreRepresented(true); _checkAllForwarderAdaptersAreRepresented(true); @@ -97,18 +101,18 @@ abstract contract BaseTest is ProtocolV3TestBase { function _getTrustedRemotes() internal view virtual returns (TrustedRemote[] memory); function _getAdapterByChain( - bool beforeExecution + bool afterExecution ) internal view virtual returns (AdapterAllowed[] memory); function _getForwarderAdaptersByChain( - bool beforeExecution + bool afterExecution ) internal view virtual returns (ForwarderAdapters[] memory) { ForwarderAdapters[] memory forwarderAdapters = new ForwarderAdapters[](0); return forwarderAdapters; } function _getReceiverAdaptersByChain( - bool beforeExecution + bool afterExecution ) internal view virtual returns (AdaptersByChain[] memory); // ------------------------ checks ------------- @@ -230,20 +234,41 @@ abstract contract BaseTest is ProtocolV3TestBase { function _testOnlyUpdatedReceiverAdapterChanges( address[] memory previousReceivers, address newAdapter, - address removedAdapter + uint256 chainId ) internal { address[] memory currentReceiverAdapters = ICrossChainReceiver(CROSS_CHAIN_CONTROLLER) .getReceiverBridgeAdaptersByChain(chainId); uint256 adaptersCount; - bool removedAdapterFound; - bool newAdapterFound; + uint256 newAdapterCount; for (uint256 i = 0; i < currentReceiverAdapters.length; i++) { for (uint256 j = 0; j < previousReceivers.length; j++) { - if (currentReceiverAdapters[i] == adapters[j]) { + if (currentReceiverAdapters[i] == previousReceivers[j]) { adaptersCount++; } + if (currentReceiverAdapters[i] == newAdapter) { + newAdapterCount++; + } } } + + assertEq(previousReceivers.length, currentReceiverAdapters.length); + assertEq(currentReceiverAdapters.length, adaptersCount + newAdapterCount); + } + + function _getCurrentReceiverAdaptersByChain() internal returns (AdaptersByChain[] memory) { + uint256[] memory supportedChains = ICrossChainReceiver(CROSS_CHAIN_CONTROLLER) + .getSupportedChains(); + + AdaptersByChain[] memory receiverAdapters = new AdaptersByChain[](supportedChains.length); + + for (uint256 i = 0; i < supportedChains.length; i++) { + address[] memory receivers = ICrossChainReceiver(CROSS_CHAIN_CONTROLLER) + .getReceiverBridgeAdaptersByChain(supportedChains[i]); + + receiverAdapters[i] = AdaptersByChain({adapters: receivers, chainId: supportedChains[i]}); + } + + return receiverAdapters; } } From ee8f5ab3a551fe65018039099da8ef227cd36bca Mon Sep 17 00:00:00 2001 From: sendra Date: Mon, 18 Mar 2024 11:45:38 +0100 Subject: [PATCH 03/17] Feat/ccip update templating (#255) * CCIP update templating * fix: added missing chain id * fix compilation issues * fix: fixed compilation error * remove redundant DestinationAdaptersInput path * update readme with implementation and tests * fix: test cleanup * fix: more test cleanup * add BaseCCCImplementationUpdatePayloadTest * change BaseTest * fix: added tests to check that only changed necessary receivers * add getTrustedRemoteByChainId * formatting * fix: added test to check that forwarders are set * fix: update scripts (#248) * fix: added test to check only changes on specified forwarders * fix: update readme * fix: add missing ccc impl address for ethereum * fix: updated base contract to add receivers only if receiving chains exist. Added discussion links --------- Co-authored-by: Andrei Kozlov Co-authored-by: Lukas --- ...ImplementationAndCCIPAdapters_20240313.sol | 23 + ...plementationAndCCIPAdapters_20240313.t.sol | 23 + ...ImplementationAndCCIPAdapters_20240313.sol | 137 +----- ...plementationAndCCIPAdapters_20240313.t.sol | 90 +--- ...ImplementationAndCCIPAdapters_20240313.sol | 86 +--- ...plementationAndCCIPAdapters_20240313.t.sol | 73 +-- ...ImplementationAndCCIPAdapters_20240313.sol | 23 + ...plementationAndCCIPAdapters_20240313.t.sol | 23 + ...ImplementationAndCCIPAdapters_20240313.sol | 168 ++----- ...plementationAndCCIPAdapters_20240313.t.sol | 141 +----- ...ImplementationAndCCIPAdapters_20240313.sol | 23 + ...plementationAndCCIPAdapters_20240313.t.sol | 23 + ...ImplementationAndCCIPAdapters_20240313.sol | 23 + ...plementationAndCCIPAdapters_20240313.t.sol | 23 + ...ImplementationAndCCIPAdapters_20240313.sol | 23 + ...plementationAndCCIPAdapters_20240313.t.sol | 23 + ...ImplementationAndCCIPAdapters_20240313.sol | 138 ++---- ...plementationAndCCIPAdapters_20240313.t.sol | 89 +--- ...ImplementationAndCCIPAdapters_20240313.sol | 23 + ...plementationAndCCIPAdapters_20240313.t.sol | 23 + .../BaseAdaptersUpdatePayload.sol | 165 +++++++ .../BaseCCCImplementationUpdatePayload.sol | 32 ++ ...BaseCCCImplementationUpdatePayloadTest.sol | 55 +++ .../BaseTest.sol | 416 +++++++++++------- .../UpdateADIImplementationAndCCIPAdapters.md | 46 +- ...plementationAndCCIPAdapters_20240313.s.sol | 184 +++++++- .../config.ts | 19 +- 27 files changed, 1126 insertions(+), 989 deletions(-) create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.sol create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.sol create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.sol create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.sol create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.sol create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.sol create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseAdaptersUpdatePayload.sol create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseCCCImplementationUpdatePayload.sol create mode 100644 src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseCCCImplementationUpdatePayloadTest.sol diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.sol new file mode 100644 index 000000000..a3030e5bd --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {MiscArbitrum} from 'aave-address-book/MiscArbitrum.sol'; +import {GovernanceV3Arbitrum} from 'aave-address-book/GovernanceV3Arbitrum.sol'; +import {BaseCCCImplementationUpdatePayload} from './BaseCCCImplementationUpdatePayload.sol'; + +/** + * @title aDI and bridge adapters update + * @author BGD Labs @bgdlabs + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/21 + */ +contract AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313 is + BaseCCCImplementationUpdatePayload( + BaseCCCImplementationUpdatePayload.CCCImplementationUpdateInput({ + ccc: GovernanceV3Arbitrum.CROSS_CHAIN_CONTROLLER, + proxyAdmin: MiscArbitrum.PROXY_ADMIN, + newCCCImplementation: 0x6e633269af45F37c44659D98f382dd0DD524E5Df + }) + ) +{ + +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol new file mode 100644 index 000000000..7ad9133b2 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; +import {MiscArbitrum} from 'aave-address-book/MiscArbitrum.sol'; +import {GovernanceV3Arbitrum} from 'aave-address-book/GovernanceV3Arbitrum.sol'; + +import {AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; +import {BaseCCCImplementationUpdatePayloadTest} from './BaseCCCImplementationUpdatePayloadTest.sol'; + +/** + * @dev Test for AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313 + * command: make test-contract filter=AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313 + */ +contract AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313_Test is + BaseCCCImplementationUpdatePayloadTest( + GovernanceV3Arbitrum.CROSS_CHAIN_CONTROLLER, + MiscArbitrum.PROXY_ADMIN, + type(AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode, + 'arbitrum', + 189596312 + ) +{ + +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.sol index 79c9aab43..21c4d67a2 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.sol +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -1,133 +1,44 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; -import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol'; -import {ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/ProxyAdmin.sol'; import {ChainIds} from 'aave-helpers/ChainIds.sol'; import {MiscAvalanche} from 'aave-address-book/MiscAvalanche.sol'; import {GovernanceV3Avalanche} from 'aave-address-book/GovernanceV3Avalanche.sol'; -import {ICrossChainReceiver, ICrossChainForwarder} from 'aave-address-book/common/ICrossChainController.sol'; - -import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; +import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; /** - * @title Update a.DI implementation and CCIP adapters + * @title aDI and bridge adapters update * @author BGD Labs @bgdlabs - * - Snapshot: TODO - * - Discussion: TODO + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/21 */ contract AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313 is - IProposalGenericExecutor + BaseAdaptersUpdatePayload( + BaseAdaptersUpdatePayload.ConstructorInput({ + ccc: GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER, + proxyAdmin: MiscAvalanche.PROXY_ADMIN, + newCCCImplementation: 0x5Ef80c5eB6CF65Dab8cD1C0ee258a6D2bD38Bd22, + ccipNewAdapter: 0x2b88C83727B0E290B76EB3F6133994fF81B7f355, + ccipAdapterToRemove: 0x3F006299eC88985c18E6e885EeA29A49eC579882 + }) + ) { - address public constant CCIP_ADAPTER_TO_REMOVE = 0x3F006299eC88985c18E6e885EeA29A49eC579882; - address public constant CCIP_NEW_ADAPTER = 0x2b88C83727B0E290B76EB3F6133994fF81B7f355; - address public constant DESTINATION_CCIP_NEW_ADAPTER = 0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29; - address public constant NEW_CROSS_CHAIN_CONTROLLER_IMPLEMENTATION = - 0x5Ef80c5eB6CF65Dab8cD1C0ee258a6D2bD38Bd22; - - function execute() external { - // Update CrossChainController implementation - ProxyAdmin(MiscAvalanche.PROXY_ADMIN).upgradeAndCall( - TransparentUpgradeableProxy(payable(GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER)), - NEW_CROSS_CHAIN_CONTROLLER_IMPLEMENTATION, - abi.encodeWithSignature('initializeRevision()') - ); - - // remove old Receiver bridge adapter - ICrossChainReceiver(GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER) - .disallowReceiverBridgeAdapters(_getReceiverBridgeAdaptersToRemove()); - - // remove forwarding adapters - ICrossChainForwarder(GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER).disableBridgeAdapters( - _getForwarderBridgeAdaptersToRemove() - ); - - // add receiver adapters - ICrossChainReceiver(GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER).allowReceiverBridgeAdapters( - _getReceiverBridgeAdaptersToAllow() - ); - - // add forwarding adapters - ICrossChainForwarder(GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER).enableBridgeAdapters( - _getForwarderBridgeAdaptersToEnable() - ); - } - - function _getReceiverBridgeAdaptersToRemove() - internal - pure - returns (ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] memory) - { - uint256[] memory chainIds = new uint256[](1); - chainIds[0] = ChainIds.MAINNET; - - // remove old Receiver bridge adapter - ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] - memory bridgeAdaptersToRemove = new ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[](1); - - bridgeAdaptersToRemove[0] = ICrossChainReceiver.ReceiverBridgeAdapterConfigInput({ - bridgeAdapter: CCIP_ADAPTER_TO_REMOVE, - chainIds: chainIds - }); - - return bridgeAdaptersToRemove; - } - - function _getForwarderBridgeAdaptersToRemove() - internal - pure - returns (ICrossChainForwarder.BridgeAdapterToDisable[] memory) - { - uint256[] memory chainIds = new uint256[](1); - chainIds[0] = ChainIds.MAINNET; - - ICrossChainForwarder.BridgeAdapterToDisable[] - memory forwarderAdaptersToRemove = new ICrossChainForwarder.BridgeAdapterToDisable[](1); - - forwarderAdaptersToRemove[0] = ICrossChainForwarder.BridgeAdapterToDisable({ - bridgeAdapter: CCIP_ADAPTER_TO_REMOVE, - chainIds: chainIds - }); - - return forwarderAdaptersToRemove; - } - - function _getReceiverBridgeAdaptersToAllow() - internal - pure - returns (ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] memory) - { - uint256[] memory chainIds = new uint256[](1); - chainIds[0] = ChainIds.MAINNET; - - ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] - memory bridgeAdapterConfig = new ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[](1); - - bridgeAdapterConfig[0] = ICrossChainReceiver.ReceiverBridgeAdapterConfigInput({ - bridgeAdapter: CCIP_NEW_ADAPTER, - chainIds: chainIds - }); - - return bridgeAdapterConfig; + function getChainsToReceive() public pure override returns (uint256[] memory) { + uint256[] memory chains = new uint256[](1); + chains[0] = ChainIds.MAINNET; + return chains; } - function _getForwarderBridgeAdaptersToEnable() - internal + function getDestinationAdapters() + public pure - returns (ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] memory) + override + returns (DestinationAdaptersInput[] memory) { - ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] - memory bridgeAdaptersToEnable = new ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[]( - 1 - ); + DestinationAdaptersInput[] memory destinationAdapters = new DestinationAdaptersInput[](1); - bridgeAdaptersToEnable[0] = ICrossChainForwarder.ForwarderBridgeAdapterConfigInput({ - currentChainBridgeAdapter: CCIP_NEW_ADAPTER, - destinationBridgeAdapter: DESTINATION_CCIP_NEW_ADAPTER, - destinationChainId: ChainIds.MAINNET - }); + destinationAdapters[0].adapter = 0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29; + destinationAdapters[0].chainId = ChainIds.MAINNET; - return bridgeAdaptersToEnable; + return destinationAdapters; } } diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol index 56eb15392..8c48f0ea8 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -5,6 +5,7 @@ import {AaveV3Avalanche} from 'aave-address-book/AaveV3Avalanche.sol'; import {MiscAvalanche} from 'aave-address-book/MiscAvalanche.sol'; import {GovernanceV3Avalanche} from 'aave-address-book/GovernanceV3Avalanche.sol'; import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; + import './BaseTest.sol'; import {AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; @@ -14,100 +15,13 @@ import {AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313} from '. * command: make test-contract filter=AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313 */ contract AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313_Test is BaseTest { - AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313 internal payload; - constructor() BaseTest( GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER, MiscAvalanche.PROXY_ADMIN, + type(AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode, 'avalanche', 42801819 ) {} - - function setUp() public override { - super.setUp(); - payload = new AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313(); - payloadAddress = address(payload); - } - - function _getAdapterNames() internal view override returns (AdapterName[] memory) { - AdapterName[] memory adapterNames = new AdapterName[](1); - adapterNames[0] = AdapterName({adapter: payload.CCIP_NEW_ADAPTER(), name: 'CCIP adapter'}); - - return adapterNames; - } - - function _checkCorrectPathConfiguration() internal override { - assertEq(ethereumPayload.CCIP_NEW_ADAPTER(), payload.DESTINATION_CCIP_NEW_ADAPTER()); - } - - function _getTrustedRemotes() internal view override returns (TrustedRemote[] memory) { - TrustedRemote[] memory trustedRemotes = new TrustedRemote[](1); - trustedRemotes[0] = TrustedRemote({ - adapter: payload.CCIP_NEW_ADAPTER(), - expectedRemote: GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER, - remoteChainId: ChainIds.MAINNET - }); - - return trustedRemotes; - } - - function _getForwarderAdaptersByChain( - bool afterExecution - ) internal view override returns (ForwarderAdapters[] memory) { - ForwarderAdapters[] memory forwarderAdapters = new ForwarderAdapters[](1); - - ICrossChainForwarder.ChainIdBridgeConfig[] - memory adapters = new ICrossChainForwarder.ChainIdBridgeConfig[](1); - adapters[0].currentChainBridgeAdapter = payload.CCIP_ADAPTER_TO_REMOVE(); - - if (afterExecution) { - adapters[0].currentChainBridgeAdapter = payload.CCIP_NEW_ADAPTER(); - adapters[0].destinationBridgeAdapter = payload.DESTINATION_CCIP_NEW_ADAPTER(); - } - forwarderAdapters[0].adapters = adapters; - forwarderAdapters[0].chainId = ChainIds.MAINNET; - - return forwarderAdapters; - } - - function _getReceiverAdaptersByChain( - bool afterExecution - ) internal view override returns (AdaptersByChain[] memory) { - address[] memory adapters = new address[](1); - AdaptersByChain[] memory receiverAdaptersByChain = new AdaptersByChain[](1); - - adapters[0] = payload.CCIP_ADAPTER_TO_REMOVE(); - - if (afterExecution) { - adapters[0] = payload.CCIP_NEW_ADAPTER(); - } - receiverAdaptersByChain[0].adapters = adapters; - receiverAdaptersByChain[0].chainId = ChainIds.MAINNET; - - return receiverAdaptersByChain; - } - - function _getAdapterByChain( - bool afterExecution - ) internal view override returns (AdapterAllowed[] memory) { - AdapterAllowed[] memory adaptersAllowed = new AdapterAllowed[](2); - adaptersAllowed[0] = AdapterAllowed({ - adapter: payload.CCIP_ADAPTER_TO_REMOVE(), - chainId: ChainIds.MAINNET, - allowed: true - }); - adaptersAllowed[1] = AdapterAllowed({ - adapter: payload.CCIP_NEW_ADAPTER(), - chainId: ChainIds.MAINNET, - allowed: false - }); - if (afterExecution) { - adaptersAllowed[0].allowed = false; - adaptersAllowed[1].allowed = true; - } - - return adaptersAllowed; - } } diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.sol index 9f81ee3ea..267c5cda3 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.sol +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -1,80 +1,30 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; -import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol'; -import {ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/ProxyAdmin.sol'; import {ChainIds} from 'aave-helpers/ChainIds.sol'; import {MiscBNB} from 'aave-address-book/MiscBNB.sol'; import {GovernanceV3BNB} from 'aave-address-book/GovernanceV3BNB.sol'; -import {ICrossChainReceiver} from 'aave-address-book/common/ICrossChainController.sol'; +import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; /** - * @title Update a.DI implementation and CCIP adapters + * @title aDI and bridge adapters update * @author BGD Labs @bgdlabs - * - Snapshot: TODO - * - Discussion: TODO + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/21 */ -contract AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313 is IProposalGenericExecutor { - address public constant CCIP_ADAPTER_TO_REMOVE = 0x746c675dAB49Bcd5BB9Dc85161f2d7Eb435009bf; - address public constant CCIP_NEW_ADAPTER = 0xAE93BEa44dcbE52B625169588574d31e36fb3A67; - address public constant NEW_CROSS_CHAIN_CONTROLLER_IMPLEMENTATION = - 0xf41193E25408F652AF878c47E4401A01B5E4B682; - - function execute() external { - // Update CrossChainController implementation - ProxyAdmin(MiscBNB.PROXY_ADMIN).upgradeAndCall( - TransparentUpgradeableProxy(payable(GovernanceV3BNB.CROSS_CHAIN_CONTROLLER)), - NEW_CROSS_CHAIN_CONTROLLER_IMPLEMENTATION, - abi.encodeWithSignature('initializeRevision()') - ); - - // remove old Receiver bridge adapter - ICrossChainReceiver(GovernanceV3BNB.CROSS_CHAIN_CONTROLLER).disallowReceiverBridgeAdapters( - _getReceiverBridgeAdaptersToRemove() - ); - - // add receiver adapters - ICrossChainReceiver(GovernanceV3BNB.CROSS_CHAIN_CONTROLLER).allowReceiverBridgeAdapters( - _getReceiverBridgeAdaptersToAllow() - ); - } - - function _getReceiverBridgeAdaptersToRemove() - internal - pure - returns (ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] memory) - { - uint256[] memory chainIds = new uint256[](1); - chainIds[0] = ChainIds.MAINNET; - - ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] - memory bridgeAdaptersToRemove = new ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[](1); - - bridgeAdaptersToRemove[0] = ICrossChainReceiver.ReceiverBridgeAdapterConfigInput({ - bridgeAdapter: CCIP_ADAPTER_TO_REMOVE, - chainIds: chainIds - }); - - return bridgeAdaptersToRemove; - } - - function _getReceiverBridgeAdaptersToAllow() - internal - pure - returns (ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] memory) - { - uint256[] memory chainIds = new uint256[](1); - chainIds[0] = ChainIds.MAINNET; - - ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] - memory bridgeAdapterConfig = new ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[](1); - - bridgeAdapterConfig[0] = ICrossChainReceiver.ReceiverBridgeAdapterConfigInput({ - bridgeAdapter: CCIP_NEW_ADAPTER, - chainIds: chainIds - }); - - return bridgeAdapterConfig; +contract AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313 is + BaseAdaptersUpdatePayload( + BaseAdaptersUpdatePayload.ConstructorInput({ + ccc: GovernanceV3BNB.CROSS_CHAIN_CONTROLLER, + proxyAdmin: MiscBNB.PROXY_ADMIN, + newCCCImplementation: 0xf41193E25408F652AF878c47E4401A01B5E4B682, + ccipNewAdapter: 0xAE93BEa44dcbE52B625169588574d31e36fb3A67, + ccipAdapterToRemove: 0x746c675dAB49Bcd5BB9Dc85161f2d7Eb435009bf + }) + ) +{ + function getChainsToReceive() public pure override returns (uint256[] memory) { + uint256[] memory chains = new uint256[](1); + chains[0] = ChainIds.MAINNET; + return chains; } } diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol index 7e6c0fe1c..90491cacc 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -14,72 +14,13 @@ import {AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV * command: make test-contract filter=AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313 */ contract AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313_Test is BaseTest { - AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313 internal payload; - constructor() - BaseTest(GovernanceV3BNB.CROSS_CHAIN_CONTROLLER, MiscBNB.PROXY_ADMIN, 'bnb', 36903911) + BaseTest( + GovernanceV3BNB.CROSS_CHAIN_CONTROLLER, + MiscBNB.PROXY_ADMIN, + type(AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode, + 'bnb', + 37073128 + ) {} - - function setUp() public override { - super.setUp(); - payload = new AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313(); - payloadAddress = address(payload); - } - - function _getAdapterNames() internal view override returns (AdapterName[] memory) { - AdapterName[] memory adapterNames = new AdapterName[](1); - adapterNames[0] = AdapterName({adapter: payload.CCIP_NEW_ADAPTER(), name: 'CCIP adapter'}); - - return adapterNames; - } - - function _getTrustedRemotes() internal view override returns (TrustedRemote[] memory) { - TrustedRemote[] memory trustedRemotes = new TrustedRemote[](1); - trustedRemotes[0] = TrustedRemote({ - adapter: payload.CCIP_NEW_ADAPTER(), - expectedRemote: GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER, - remoteChainId: ChainIds.MAINNET - }); - - return trustedRemotes; - } - - function _getReceiverAdaptersByChain( - bool afterExecution - ) internal view override returns (AdaptersByChain[] memory) { - address[] memory adapters = new address[](1); - AdaptersByChain[] memory receiverAdaptersByChain = new AdaptersByChain[](1); - - adapters[0] = payload.CCIP_ADAPTER_TO_REMOVE(); - - if (afterExecution) { - adapters[0] = payload.CCIP_NEW_ADAPTER(); - } - receiverAdaptersByChain[0].adapters = adapters; - receiverAdaptersByChain[0].chainId = ChainIds.MAINNET; - - return receiverAdaptersByChain; - } - - function _getAdapterByChain( - bool afterExecution - ) internal view override returns (AdapterAllowed[] memory) { - AdapterAllowed[] memory adaptersAllowed = new AdapterAllowed[](2); - adaptersAllowed[0] = AdapterAllowed({ - adapter: payload.CCIP_ADAPTER_TO_REMOVE(), - chainId: ChainIds.MAINNET, - allowed: true - }); - adaptersAllowed[1] = AdapterAllowed({ - adapter: payload.CCIP_NEW_ADAPTER(), - chainId: ChainIds.MAINNET, - allowed: false - }); - if (afterExecution) { - adaptersAllowed[0].allowed = false; - adaptersAllowed[5].allowed = true; - } - - return adaptersAllowed; - } } diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.sol new file mode 100644 index 000000000..d6ed97266 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {MiscBase} from 'aave-address-book/MiscBase.sol'; +import {GovernanceV3Base} from 'aave-address-book/GovernanceV3Base.sol'; +import {BaseCCCImplementationUpdatePayload} from './BaseCCCImplementationUpdatePayload.sol'; + +/** + * @title aDI and bridge adapters update + * @author BGD Labs @bgdlabs + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/21 + */ +contract AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313 is + BaseCCCImplementationUpdatePayload( + BaseCCCImplementationUpdatePayload.CCCImplementationUpdateInput({ + ccc: GovernanceV3Base.CROSS_CHAIN_CONTROLLER, + proxyAdmin: MiscBase.PROXY_ADMIN, + newCCCImplementation: 0x9b6f5ef589A3DD08670Dd146C11C4Fb33E04494F + }) + ) +{ + +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol new file mode 100644 index 000000000..88b0f61f6 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; +import {MiscBase} from 'aave-address-book/MiscBase.sol'; +import {GovernanceV3Base} from 'aave-address-book/GovernanceV3Base.sol'; + +import {AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; +import {BaseCCCImplementationUpdatePayloadTest} from './BaseCCCImplementationUpdatePayloadTest.sol'; + +/** + * @dev Test for AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313 + * command: make test-contract filter=AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313 + */ +contract AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313_Test is + BaseCCCImplementationUpdatePayloadTest( + GovernanceV3Base.CROSS_CHAIN_CONTROLLER, + MiscBase.PROXY_ADMIN, + type(AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode, + 'base', + 11725901 + ) +{ + +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.sol index c6eb56b3d..72b2128e5 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.sol +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -1,161 +1,51 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; -import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol'; -import {ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/ProxyAdmin.sol'; import {ChainIds} from 'aave-helpers/ChainIds.sol'; import {MiscEthereum} from 'aave-address-book/MiscEthereum.sol'; import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; -import {ICrossChainReceiver, ICrossChainForwarder} from 'aave-address-book/common/ICrossChainController.sol'; +import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; /** - * @title Update a.DI implementation and CCIP adapters + * @title aDI and bridge adapters update * @author BGD Labs @bgdlabs - * - Snapshot: TODO - * - Discussion: TODO + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/21 */ contract AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313 is - IProposalGenericExecutor + BaseAdaptersUpdatePayload( + BaseAdaptersUpdatePayload.ConstructorInput({ + ccc: GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER, + proxyAdmin: MiscEthereum.PROXY_ADMIN, + newCCCImplementation: 0x28559c2F4B038b1E836fA419DCcDe7454d8Fe215, + ccipNewAdapter: 0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29, + ccipAdapterToRemove: 0xDB8953194810b1942544fA528791278D458719D5 + }) + ) { - //receiver adapters to remove - address public constant CCIP_ADAPTER_TO_REMOVE = 0xDB8953194810b1942544fA528791278D458719D5; - // forwarder-receiver adapter pairs to add - address public constant CCIP_NEW_ADAPTER = 0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29; - - address public constant DESTINATION_CCIP_NEW_ADAPTER_AVALANCHE = - 0x2b88C83727B0E290B76EB3F6133994fF81B7f355; - address public constant DESTINATION_CCIP_NEW_ADAPTER_POLYGON = - 0xe79757D55a1600eF28D816a893E78E9FCDE2019E; - address public constant DESTINATION_CCIP_NEW_ADAPTER_BNB = - 0xAE93BEa44dcbE52B625169588574d31e36fb3A67; - - address public constant NEW_CROSS_CHAIN_CONTROLLER_IMPLEMENTATION = - 0x28559c2F4B038b1E836fA419DCcDe7454d8Fe215; - - function execute() external { - // Update CrossChainController implementation - ProxyAdmin(MiscEthereum.PROXY_ADMIN).upgradeAndCall( - TransparentUpgradeableProxy(payable(GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER)), - NEW_CROSS_CHAIN_CONTROLLER_IMPLEMENTATION, - abi.encodeWithSignature('initializeRevision()') - ); - // add receiver adapters - ICrossChainReceiver(GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER).allowReceiverBridgeAdapters( - _getReceiverBridgeAdaptersToAllow() - ); - - // add forwarding adapters - ICrossChainForwarder(GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER).enableBridgeAdapters( - _getForwarderBridgeAdaptersToEnable() - ); - - // remove old Receiver bridge adapter - ICrossChainReceiver(GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER).disallowReceiverBridgeAdapters( - _getReceiverBridgeAdaptersToRemove() - ); - - // remove forwarding adapters - ICrossChainForwarder(GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER).disableBridgeAdapters( - _getForwarderBridgeAdaptersToRemove() - ); - } - - function _getReceiverBridgeAdaptersToRemove() - internal - pure - returns (ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] memory) - { - ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] - memory receiverAdaptersToRemove = new ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[]( - 1 - ); - - uint256[] memory receiverChainIds = new uint256[](1); - receiverChainIds[0] = ChainIds.POLYGON; - receiverChainIds[1] = ChainIds.AVALANCHE; - - receiverAdaptersToRemove[0] = ICrossChainReceiver.ReceiverBridgeAdapterConfigInput({ - bridgeAdapter: CCIP_ADAPTER_TO_REMOVE, - chainIds: receiverChainIds - }); - - return receiverAdaptersToRemove; + function getChainsToReceive() public pure override returns (uint256[] memory) { + uint256[] memory chains = new uint256[](2); + chains[0] = ChainIds.AVALANCHE; + chains[1] = ChainIds.POLYGON; + return chains; } - function _getForwarderBridgeAdaptersToRemove() - internal + function getDestinationAdapters() + public pure - returns (ICrossChainForwarder.BridgeAdapterToDisable[] memory) + override + returns (DestinationAdaptersInput[] memory) { - ICrossChainForwarder.BridgeAdapterToDisable[] - memory forwarderAdaptersToRemove = new ICrossChainForwarder.BridgeAdapterToDisable[](1); + DestinationAdaptersInput[] memory destinationAdapters = new DestinationAdaptersInput[](3); - uint256[] memory forwarderCCIPChainIds = new uint256[](3); - forwarderCCIPChainIds[0] = ChainIds.AVALANCHE; - forwarderCCIPChainIds[1] = ChainIds.POLYGON; - forwarderCCIPChainIds[2] = ChainIds.BNB; - - forwarderAdaptersToRemove[0] = ICrossChainForwarder.BridgeAdapterToDisable({ - bridgeAdapter: CCIP_ADAPTER_TO_REMOVE, - chainIds: forwarderCCIPChainIds - }); - - return forwarderAdaptersToRemove; - } - - function _getReceiverBridgeAdaptersToAllow() - internal - pure - returns (ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] memory) - { - uint256[] memory receiverChainIds = new uint256[](2); - receiverChainIds[0] = ChainIds.AVALANCHE; - receiverChainIds[1] = ChainIds.POLYGON; - - ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] - memory receiverAdaptersToAllow = new ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[]( - 1 - ); - - receiverAdaptersToAllow[0] = ICrossChainReceiver.ReceiverBridgeAdapterConfigInput({ - bridgeAdapter: CCIP_NEW_ADAPTER, - chainIds: receiverChainIds - }); - - return receiverAdaptersToAllow; - } - - function _getForwarderBridgeAdaptersToEnable() - internal - pure - returns (ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] memory) - { - ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] - memory forwarderAdaptersToEnable = new ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[]( - 3 - ); - // avalanche path - forwarderAdaptersToEnable[0] = ICrossChainForwarder.ForwarderBridgeAdapterConfigInput({ - currentChainBridgeAdapter: CCIP_NEW_ADAPTER, - destinationBridgeAdapter: DESTINATION_CCIP_NEW_ADAPTER_AVALANCHE, - destinationChainId: ChainIds.AVALANCHE - }); + destinationAdapters[0].adapter = 0x2b88C83727B0E290B76EB3F6133994fF81B7f355; + destinationAdapters[0].chainId = ChainIds.AVALANCHE; - // polygon path - forwarderAdaptersToEnable[1] = ICrossChainForwarder.ForwarderBridgeAdapterConfigInput({ - currentChainBridgeAdapter: CCIP_NEW_ADAPTER, - destinationBridgeAdapter: DESTINATION_CCIP_NEW_ADAPTER_POLYGON, - destinationChainId: ChainIds.POLYGON - }); + destinationAdapters[1].adapter = 0xe79757D55a1600eF28D816a893E78E9FCDE2019E; + destinationAdapters[1].chainId = ChainIds.POLYGON; - // binance path - forwarderAdaptersToEnable[2] = ICrossChainForwarder.ForwarderBridgeAdapterConfigInput({ - currentChainBridgeAdapter: CCIP_NEW_ADAPTER, - destinationBridgeAdapter: DESTINATION_CCIP_NEW_ADAPTER_BNB, - destinationChainId: ChainIds.BNB - }); + destinationAdapters[2].adapter = 0xAE93BEa44dcbE52B625169588574d31e36fb3A67; + destinationAdapters[2].chainId = ChainIds.BNB; - return forwarderAdaptersToEnable; + return destinationAdapters; } } diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol index 292f4368a..452cfdc2f 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -17,152 +17,13 @@ import {AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313} from './ * command: make test-contract filter=AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313 */ contract AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313_Test is BaseTest { - AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313 internal payload; - AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313 internal avalanchePayload; - AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313 internal bnbPayload; - AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313 internal polygonPayload; - constructor() BaseTest( GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER, MiscEthereum.PROXY_ADMIN, + type(AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode, 'mainnet', 19418547 ) {} - - function setUp() public override { - super.setUp(); - payload = new AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313(); - avalanchePayload = new AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313(); - bnbPayload = new AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313(); - polygonPayload = new AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313(); - payloadAddress = address(payload); - } - - function _getAdapterNames() internal view override returns (AdapterName[] memory) { - AdapterName[] memory adapterNames = new AdapterName[](1); - adapterNames[0] = AdapterName({adapter: payload.CCIP_NEW_ADAPTER(), name: 'CCIP adapter'}); - - return adapterNames; - } - - function _checkCorrectPathConfiguration() internal override { - assertEq(payload.DESTINATION_CCIP_NEW_ADAPTER_AVALANCHE(), avalanchePayload.CCIP_NEW_ADAPTER()); - assertEq(payload.DESTINATION_CCIP_NEW_ADAPTER_BNB(), bnbPayload.CCIP_NEW_ADAPTER()); - assertEq(payload.DESTINATION_CCIP_NEW_ADAPTER_POLYGON(), polygonPayload.CCIP_NEW_ADAPTER()); - } - - function _getTrustedRemotes() internal view override returns (TrustedRemote[] memory) { - TrustedRemote[] memory trustedRemotes = new TrustedRemote[](2); - trustedRemotes[0] = TrustedRemote({ - adapter: payload.CCIP_NEW_ADAPTER(), - expectedRemote: GovernanceV3Polygon.CROSS_CHAIN_CONTROLLER, - remoteChainId: ChainIds.POLYGON - }); - trustedRemotes[1] = TrustedRemote({ - adapter: payload.CCIP_NEW_ADAPTER(), - expectedRemote: GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER, - remoteChainId: ChainIds.AVALANCHE - }); - - return trustedRemotes; - } - - function _getReceiverAdaptersByChain( - bool afterExecution - ) internal view override returns (AdaptersByChain[] memory) { - address[] memory polygonAdapters = new address[](1); - address[] memory avalancheAdapters = new address[](1); - AdaptersByChain[] memory receiverAdaptersByChain = new AdaptersByChain[](2); - - polygonAdapters[0] = payload.CCIP_ADAPTER_TO_REMOVE(); - avalancheAdapters[0] = payload.CCIP_ADAPTER_TO_REMOVE(); - - if (afterExecution) { - polygonAdapters[0] = payload.CCIP_NEW_ADAPTER(); - avalancheAdapters[0] = payload.CCIP_NEW_ADAPTER(); - } - receiverAdaptersByChain[0].adapters = polygonAdapters; - receiverAdaptersByChain[0].chainId = ChainIds.POLYGON; - receiverAdaptersByChain[0].adapters = avalancheAdapters; - receiverAdaptersByChain[0].chainId = ChainIds.AVALANCHE; - - return receiverAdaptersByChain; - } - - function _getForwarderAdaptersByChain( - bool afterExecution - ) internal view override returns (ForwarderAdapters[] memory) { - ForwarderAdapters[] memory forwarderAdapters = new ForwarderAdapters[](3); - - ICrossChainForwarder.ChainIdBridgeConfig[] - memory polygonAdapters = new ICrossChainForwarder.ChainIdBridgeConfig[](1); - ICrossChainForwarder.ChainIdBridgeConfig[] - memory avalancheAdapters = new ICrossChainForwarder.ChainIdBridgeConfig[](1); - ICrossChainForwarder.ChainIdBridgeConfig[] - memory binanceAdapters = new ICrossChainForwarder.ChainIdBridgeConfig[](1); - - // polygon - polygonAdapters[0].currentChainBridgeAdapter = payload.CCIP_ADAPTER_TO_REMOVE(); - // avalanche - avalancheAdapters[0].currentChainBridgeAdapter = payload.CCIP_ADAPTER_TO_REMOVE(); - // binance - binanceAdapters[0].currentChainBridgeAdapter = payload.CCIP_ADAPTER_TO_REMOVE(); - - if (afterExecution) { - // polygon - polygonAdapters[0].currentChainBridgeAdapter = payload.CCIP_NEW_ADAPTER(); - polygonAdapters[0].destinationBridgeAdapter = payload.DESTINATION_CCIP_NEW_ADAPTER_POLYGON(); - // avalanche - avalancheAdapters[0].currentChainBridgeAdapter = payload.CCIP_NEW_ADAPTER(); - avalancheAdapters[0].destinationBridgeAdapter = payload - .DESTINATION_CCIP_NEW_ADAPTER_AVALANCHE(); - // binance - binanceAdapters[0].currentChainBridgeAdapter = payload.CCIP_NEW_ADAPTER(); - binanceAdapters[0].destinationBridgeAdapter = payload.DESTINATION_CCIP_NEW_ADAPTER_BNB(); - } - forwarderAdapters[0].adapters = polygonAdapters; - forwarderAdapters[0].chainId = ChainIds.POLYGON; - forwarderAdapters[1].adapters = avalancheAdapters; - forwarderAdapters[1].chainId = ChainIds.AVALANCHE; - forwarderAdapters[2].adapters = binanceAdapters; - forwarderAdapters[2].chainId = ChainIds.BNB; - - return forwarderAdapters; - } - - function _getAdapterByChain( - bool afterExecution - ) internal view override returns (AdapterAllowed[] memory) { - AdapterAllowed[] memory adaptersAllowed = new AdapterAllowed[](4); - adaptersAllowed[0] = AdapterAllowed({ - adapter: payload.CCIP_ADAPTER_TO_REMOVE(), - chainId: ChainIds.POLYGON, - allowed: true - }); - adaptersAllowed[1] = AdapterAllowed({ - adapter: payload.CCIP_ADAPTER_TO_REMOVE(), - chainId: ChainIds.AVALANCHE, - allowed: true - }); - adaptersAllowed[2] = AdapterAllowed({ - adapter: payload.CCIP_NEW_ADAPTER(), - chainId: ChainIds.POLYGON, - allowed: false - }); - adaptersAllowed[3] = AdapterAllowed({ - adapter: payload.CCIP_NEW_ADAPTER(), - chainId: ChainIds.AVALANCHE, - allowed: false - }); - if (afterExecution) { - adaptersAllowed[0].allowed = false; - adaptersAllowed[1].allowed = false; - adaptersAllowed[2].allowed = true; - adaptersAllowed[3].allowed = true; - } - - return adaptersAllowed; - } } diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.sol new file mode 100644 index 000000000..bc9fa4b51 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {MiscGnosis} from 'aave-address-book/MiscGnosis.sol'; +import {GovernanceV3Gnosis} from 'aave-address-book/GovernanceV3Gnosis.sol'; +import {BaseCCCImplementationUpdatePayload} from './BaseCCCImplementationUpdatePayload.sol'; + +/** + * @title aDI and bridge adapters update + * @author BGD Labs @bgdlabs + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/21 + */ +contract AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313 is + BaseCCCImplementationUpdatePayload( + BaseCCCImplementationUpdatePayload.CCCImplementationUpdateInput({ + ccc: GovernanceV3Gnosis.CROSS_CHAIN_CONTROLLER, + proxyAdmin: MiscGnosis.PROXY_ADMIN, + newCCCImplementation: 0x5e06b10B3b9c3E1c0996D2544A35B9839Be02922 + }) + ) +{ + +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol new file mode 100644 index 000000000..71b99ecf0 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; +import {MiscGnosis} from 'aave-address-book/MiscGnosis.sol'; +import {GovernanceV3Gnosis} from 'aave-address-book/GovernanceV3Gnosis.sol'; + +import {AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; +import {BaseCCCImplementationUpdatePayloadTest} from './BaseCCCImplementationUpdatePayloadTest.sol'; + +/** + * @dev Test for AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313 + * command: make test-contract filter=AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313 + */ +contract AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313_Test is + BaseCCCImplementationUpdatePayloadTest( + GovernanceV3Gnosis.CROSS_CHAIN_CONTROLLER, + MiscGnosis.PROXY_ADMIN, + type(AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode, + 'gnosis', + 32990165 + ) +{ + +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.sol new file mode 100644 index 000000000..6913b3d4b --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {MiscMetis} from 'aave-address-book/MiscMetis.sol'; +import {GovernanceV3Metis} from 'aave-address-book/GovernanceV3Metis.sol'; +import {BaseCCCImplementationUpdatePayload} from './BaseCCCImplementationUpdatePayload.sol'; + +/** + * @title aDI and bridge adapters update + * @author BGD Labs @bgdlabs + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/21 + */ +contract AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313 is + BaseCCCImplementationUpdatePayload( + BaseCCCImplementationUpdatePayload.CCCImplementationUpdateInput({ + ccc: GovernanceV3Metis.CROSS_CHAIN_CONTROLLER, + proxyAdmin: MiscMetis.PROXY_ADMIN, + newCCCImplementation: 0xa198Fac58E02A5C5F8F7e877895d50cFa9ad1E04 + }) + ) +{ + +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol new file mode 100644 index 000000000..fb7beb526 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; +import {MiscMetis} from 'aave-address-book/MiscMetis.sol'; +import {GovernanceV3Metis} from 'aave-address-book/GovernanceV3Metis.sol'; + +import {AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; +import {BaseCCCImplementationUpdatePayloadTest} from './BaseCCCImplementationUpdatePayloadTest.sol'; + +/** + * @dev Test for AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313 + * command: make test-contract filter=AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313 + */ +contract AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313_Test is + BaseCCCImplementationUpdatePayloadTest( + GovernanceV3Metis.CROSS_CHAIN_CONTROLLER, + MiscMetis.PROXY_ADMIN, + type(AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode, + 'metis', + 15127085 + ) +{ + +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.sol new file mode 100644 index 000000000..f1288e44b --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {MiscOptimism} from 'aave-address-book/MiscOptimism.sol'; +import {GovernanceV3Optimism} from 'aave-address-book/GovernanceV3Optimism.sol'; +import {BaseCCCImplementationUpdatePayload} from './BaseCCCImplementationUpdatePayload.sol'; + +/** + * @title aDI and bridge adapters update + * @author BGD Labs @bgdlabs + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/21 + */ +contract AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313 is + BaseCCCImplementationUpdatePayload( + BaseCCCImplementationUpdatePayload.CCCImplementationUpdateInput({ + ccc: GovernanceV3Optimism.CROSS_CHAIN_CONTROLLER, + proxyAdmin: MiscOptimism.PROXY_ADMIN, + newCCCImplementation: 0xa5cc218513305221201f196760E9e64e9D49d98A + }) + ) +{ + +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol new file mode 100644 index 000000000..c9e6534ac --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; +import {MiscOptimism} from 'aave-address-book/MiscOptimism.sol'; +import {GovernanceV3Optimism} from 'aave-address-book/GovernanceV3Optimism.sol'; + +import {AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; +import {BaseCCCImplementationUpdatePayloadTest} from './BaseCCCImplementationUpdatePayloadTest.sol'; + +/** + * @dev Test for AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313 + * command: make test-contract filter=AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313 + */ +contract AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313_Test is + BaseCCCImplementationUpdatePayloadTest( + GovernanceV3Optimism.CROSS_CHAIN_CONTROLLER, + MiscOptimism.PROXY_ADMIN, + type(AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode, + 'optimism', + 117321235 + ) +{ + +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.sol index 9847ecbb5..c04e92853 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.sol +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -1,130 +1,44 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; -import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol'; -import {ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/ProxyAdmin.sol'; import {ChainIds} from 'aave-helpers/ChainIds.sol'; import {MiscPolygon} from 'aave-address-book/MiscPolygon.sol'; -import {ICrossChainReceiver, ICrossChainForwarder} from 'aave-address-book/common/ICrossChainController.sol'; import {GovernanceV3Polygon} from 'aave-address-book/GovernanceV3Polygon.sol'; +import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; /** - * @title Update a.DI implementation and CCIP adapters + * @title aDI and bridge adapters update * @author BGD Labs @bgdlabs - * - Snapshot: TODO - * - Discussion: TODO + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/21 */ -contract AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313 is IProposalGenericExecutor { - address public constant CCIP_ADAPTER_TO_REMOVE = 0x95Fa2c817169E26956AB8795c84a225b55d7db5B; - address public constant CCIP_NEW_ADAPTER = 0xe79757D55a1600eF28D816a893E78E9FCDE2019E; - address public constant DESTINATION_CCIP_NEW_ADAPTER = 0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29; - address public constant NEW_CROSS_CHAIN_CONTROLLER_IMPLEMENTATION = - 0x87a95917DE670088d81B9a8B30E3B36704Ba3043; - - function execute() external { - // Update CrossChainController implementation - ProxyAdmin(MiscPolygon.PROXY_ADMIN).upgradeAndCall( - TransparentUpgradeableProxy(payable(GovernanceV3Polygon.CROSS_CHAIN_CONTROLLER)), - NEW_CROSS_CHAIN_CONTROLLER_IMPLEMENTATION, - abi.encodeWithSignature('initializeRevision()') - ); - - // remove old Receiver bridge adapter - ICrossChainReceiver(GovernanceV3Polygon.CROSS_CHAIN_CONTROLLER).disallowReceiverBridgeAdapters( - _getReceiverBridgeAdaptersToRemove() - ); - - // remove forwarding adapters - ICrossChainForwarder(GovernanceV3Polygon.CROSS_CHAIN_CONTROLLER).disableBridgeAdapters( - _getForwarderBridgeAdaptersToRemove() - ); - - // add receiver adapters - ICrossChainReceiver(GovernanceV3Polygon.CROSS_CHAIN_CONTROLLER).allowReceiverBridgeAdapters( - _getReceiverBridgeAdaptersToAllow() - ); - - // add forwarding adapters - ICrossChainForwarder(GovernanceV3Polygon.CROSS_CHAIN_CONTROLLER).enableBridgeAdapters( - _getForwarderBridgeAdaptersToEnable() - ); - } - - function _getReceiverBridgeAdaptersToRemove() - internal - pure - returns (ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] memory) - { - uint256[] memory chainIds = new uint256[](1); - chainIds[0] = ChainIds.MAINNET; - - // remove old Receiver bridge adapter - ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] - memory bridgeAdaptersToRemove = new ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[](1); - - bridgeAdaptersToRemove[0] = ICrossChainReceiver.ReceiverBridgeAdapterConfigInput({ - bridgeAdapter: CCIP_ADAPTER_TO_REMOVE, - chainIds: chainIds - }); - - return bridgeAdaptersToRemove; - } - - function _getForwarderBridgeAdaptersToRemove() - internal - pure - returns (ICrossChainForwarder.BridgeAdapterToDisable[] memory) - { - uint256[] memory chainIds = new uint256[](1); - chainIds[0] = ChainIds.MAINNET; - - ICrossChainForwarder.BridgeAdapterToDisable[] - memory forwarderAdaptersToRemove = new ICrossChainForwarder.BridgeAdapterToDisable[](1); - - forwarderAdaptersToRemove[0] = ICrossChainForwarder.BridgeAdapterToDisable({ - bridgeAdapter: CCIP_ADAPTER_TO_REMOVE, - chainIds: chainIds - }); - - return forwarderAdaptersToRemove; - } - - function _getReceiverBridgeAdaptersToAllow() - internal - pure - returns (ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] memory) - { - uint256[] memory chainIds = new uint256[](1); - chainIds[0] = ChainIds.MAINNET; - - ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] - memory bridgeAdapterConfig = new ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[](1); - - bridgeAdapterConfig[0] = ICrossChainReceiver.ReceiverBridgeAdapterConfigInput({ - bridgeAdapter: CCIP_NEW_ADAPTER, - chainIds: chainIds - }); - - return bridgeAdapterConfig; +contract AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313 is + BaseAdaptersUpdatePayload( + BaseAdaptersUpdatePayload.ConstructorInput({ + ccc: GovernanceV3Polygon.CROSS_CHAIN_CONTROLLER, + proxyAdmin: MiscPolygon.PROXY_ADMIN, + newCCCImplementation: 0x87a95917DE670088d81B9a8B30E3B36704Ba3043, + ccipNewAdapter: 0xe79757D55a1600eF28D816a893E78E9FCDE2019E, + ccipAdapterToRemove: 0x95Fa2c817169E26956AB8795c84a225b55d7db5B + }) + ) +{ + function getChainsToReceive() public pure override returns (uint256[] memory) { + uint256[] memory chains = new uint256[](1); + chains[0] = ChainIds.MAINNET; + return chains; } - function _getForwarderBridgeAdaptersToEnable() - internal + function getDestinationAdapters() + public pure - returns (ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] memory) + override + returns (DestinationAdaptersInput[] memory) { - ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] - memory bridgeAdaptersToEnable = new ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[]( - 1 - ); + DestinationAdaptersInput[] memory destinationAdapters = new DestinationAdaptersInput[](1); - bridgeAdaptersToEnable[0] = ICrossChainForwarder.ForwarderBridgeAdapterConfigInput({ - currentChainBridgeAdapter: CCIP_NEW_ADAPTER, - destinationBridgeAdapter: DESTINATION_CCIP_NEW_ADAPTER, - destinationChainId: ChainIds.MAINNET - }); + destinationAdapters[0].adapter = 0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29; + destinationAdapters[0].chainId = ChainIds.MAINNET; - return bridgeAdaptersToEnable; + return destinationAdapters; } } diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol index db5fe6fb2..074f83b52 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -13,100 +13,13 @@ import {AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313} from './A * command: make test-contract filter=AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313 */ contract AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313_Test is BaseTest { - AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313 internal payload; - constructor() BaseTest( GovernanceV3Polygon.CROSS_CHAIN_CONTROLLER, MiscPolygon.PROXY_ADMIN, + type(AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode, 'polygon', 54566890 ) {} - - function setUp() public override { - super.setUp(); - payload = new AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313(); - payloadAddress = address(payload); - } - - function _getAdapterNames() internal view override returns (AdapterName[] memory) { - AdapterName[] memory adapterNames = new AdapterName[](1); - adapterNames[0] = AdapterName({adapter: payload.CCIP_NEW_ADAPTER(), name: 'CCIP adapter'}); - - return adapterNames; - } - - function _checkCorrectPathConfiguration() internal override { - assertEq(ethereumPayload.CCIP_NEW_ADAPTER(), payload.DESTINATION_CCIP_NEW_ADAPTER()); - } - - function _getTrustedRemotes() internal view override returns (TrustedRemote[] memory) { - TrustedRemote[] memory trustedRemotes = new TrustedRemote[](1); - trustedRemotes[0] = TrustedRemote({ - adapter: payload.CCIP_NEW_ADAPTER(), - expectedRemote: GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER, - remoteChainId: ChainIds.MAINNET - }); - - return trustedRemotes; - } - - function _getForwarderAdaptersByChain( - bool afterExecution - ) internal view override returns (ForwarderAdapters[] memory) { - ForwarderAdapters[] memory forwarderAdapters = new ForwarderAdapters[](1); - - ICrossChainForwarder.ChainIdBridgeConfig[] - memory adapters = new ICrossChainForwarder.ChainIdBridgeConfig[](1); - adapters[0].currentChainBridgeAdapter = payload.CCIP_ADAPTER_TO_REMOVE(); - - if (afterExecution) { - adapters[0].currentChainBridgeAdapter = payload.CCIP_NEW_ADAPTER(); - adapters[0].destinationBridgeAdapter = payload.DESTINATION_CCIP_NEW_ADAPTER(); - } - forwarderAdapters[0].adapters = adapters; - forwarderAdapters[0].chainId = ChainIds.MAINNET; - - return forwarderAdapters; - } - - function _getReceiverAdaptersByChain( - bool afterExecution - ) internal view override returns (AdaptersByChain[] memory) { - address[] memory adapters = new address[](1); - AdaptersByChain[] memory receiverAdaptersByChain = new AdaptersByChain[](1); - - adapters[0] = payload.CCIP_ADAPTER_TO_REMOVE(); - - if (afterExecution) { - adapters[0] = payload.CCIP_NEW_ADAPTER(); - } - receiverAdaptersByChain[0].adapters = adapters; - receiverAdaptersByChain[0].chainId = ChainIds.MAINNET; - - return receiverAdaptersByChain; - } - - function _getAdapterByChain( - bool afterExecution - ) internal view override returns (AdapterAllowed[] memory) { - AdapterAllowed[] memory adaptersAllowed = new AdapterAllowed[](2); - adaptersAllowed[0] = AdapterAllowed({ - adapter: payload.CCIP_ADAPTER_TO_REMOVE(), - chainId: ChainIds.MAINNET, - allowed: true - }); - adaptersAllowed[1] = AdapterAllowed({ - adapter: payload.CCIP_NEW_ADAPTER(), - chainId: ChainIds.MAINNET, - allowed: false - }); - if (afterExecution) { - adaptersAllowed[0].allowed = false; - adaptersAllowed[1].allowed = true; - } - - return adaptersAllowed; - } } diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.sol new file mode 100644 index 000000000..c48042a90 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {MiscScroll} from 'aave-address-book/MiscScroll.sol'; +import {GovernanceV3Scroll} from 'aave-address-book/GovernanceV3Scroll.sol'; +import {BaseCCCImplementationUpdatePayload} from './BaseCCCImplementationUpdatePayload.sol'; + +/** + * @title aDI and bridge adapters update + * @author BGD Labs @bgdlabs + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/21 + */ +contract AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313 is + BaseCCCImplementationUpdatePayload( + BaseCCCImplementationUpdatePayload.CCCImplementationUpdateInput({ + ccc: GovernanceV3Scroll.CROSS_CHAIN_CONTROLLER, + proxyAdmin: MiscScroll.PROXY_ADMIN, + newCCCImplementation: 0x5e06b10B3b9c3E1c0996D2544A35B9839Be02922 + }) + ) +{ + +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol new file mode 100644 index 000000000..751eee27a --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; +import {MiscScroll} from 'aave-address-book/MiscScroll.sol'; +import {GovernanceV3Scroll} from 'aave-address-book/GovernanceV3Scroll.sol'; + +import {AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; +import {BaseCCCImplementationUpdatePayloadTest} from './BaseCCCImplementationUpdatePayloadTest.sol'; + +/** + * @dev Test for AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313 + * command: make test-contract filter=AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313 + */ +contract AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313_Test is + BaseCCCImplementationUpdatePayloadTest( + GovernanceV3Scroll.CROSS_CHAIN_CONTROLLER, + MiscScroll.PROXY_ADMIN, + type(AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode, + 'scroll', + 4063725 + ) +{ + +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseAdaptersUpdatePayload.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseAdaptersUpdatePayload.sol new file mode 100644 index 000000000..c70ea812e --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseAdaptersUpdatePayload.sol @@ -0,0 +1,165 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; +import {ICrossChainReceiver, ICrossChainForwarder} from 'aave-address-book/common/ICrossChainController.sol'; + +import {BaseCCCImplementationUpdatePayload} from './BaseCCCImplementationUpdatePayload.sol'; + +/** + * @title Base payload aDI and bridge adapters update + * @author BGD Labs @bgdlabs + */ +abstract contract BaseAdaptersUpdatePayload is BaseCCCImplementationUpdatePayload { + struct ConstructorInput { + address proxyAdmin; + address ccc; + address newCCCImplementation; + address ccipAdapterToRemove; + address ccipNewAdapter; + } + struct DestinationAdaptersInput { + address adapter; + uint256 chainId; + } + + address public immutable CCIP_ADAPTER_TO_REMOVE; + address public immutable CCIP_NEW_ADAPTER; + + constructor( + ConstructorInput memory constructorInput + ) + BaseCCCImplementationUpdatePayload( + CCCImplementationUpdateInput({ + proxyAdmin: constructorInput.proxyAdmin, + ccc: constructorInput.ccc, + newCCCImplementation: constructorInput.newCCCImplementation + }) + ) + { + CCIP_ADAPTER_TO_REMOVE = constructorInput.ccipAdapterToRemove; + CCIP_NEW_ADAPTER = constructorInput.ccipNewAdapter; + } + + function execute() public override { + super.execute(); + + // remove old Receiver bridge adapter + ICrossChainReceiver(CROSS_CHAIN_CONTROLLER).disallowReceiverBridgeAdapters( + getReceiverBridgeAdaptersToRemove() + ); + + // remove forwarding adapters + ICrossChainForwarder(CROSS_CHAIN_CONTROLLER).disableBridgeAdapters( + getForwarderBridgeAdaptersToRemove() + ); + + uint256[] memory chainsToSend = getChainsToSend(); + uint256[] memory chainsToReceive = getChainsToReceive(); + + if (chainsToReceive.length != 0) { + // add receiver adapters + ICrossChainReceiver(CROSS_CHAIN_CONTROLLER).allowReceiverBridgeAdapters( + getReceiverBridgeAdaptersToAllow() + ); + } + + if (chainsToSend.length != 0) { + // add forwarding adapters + ICrossChainForwarder(CROSS_CHAIN_CONTROLLER).enableBridgeAdapters( + getForwarderBridgeAdaptersToEnable() + ); + } + } + + function getDestinationAdapters() + public + pure + virtual + returns (DestinationAdaptersInput[] memory) + { + DestinationAdaptersInput[] memory destinationAdapters; + return destinationAdapters; + } + + function getChainsToReceive() public pure virtual returns (uint256[] memory); + + function getChainsToSend() public pure returns (uint256[] memory) { + DestinationAdaptersInput[] memory destinationAdapters = getDestinationAdapters(); + uint256[] memory chainsToSend = new uint256[](destinationAdapters.length); + for (uint256 i = 0; i < destinationAdapters.length; i++) { + chainsToSend[i] = destinationAdapters[i].chainId; + } + return chainsToSend; + } + + function getReceiverBridgeAdaptersToRemove() + public + view + returns (ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] memory) + { + // remove old Receiver bridge adapter + ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] + memory bridgeAdaptersToRemove = new ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[](1); + + bridgeAdaptersToRemove[0] = ICrossChainReceiver.ReceiverBridgeAdapterConfigInput({ + bridgeAdapter: CCIP_ADAPTER_TO_REMOVE, + chainIds: getChainsToReceive() + }); + + return bridgeAdaptersToRemove; + } + + function getForwarderBridgeAdaptersToRemove() + public + view + returns (ICrossChainForwarder.BridgeAdapterToDisable[] memory) + { + ICrossChainForwarder.BridgeAdapterToDisable[] + memory forwarderAdaptersToRemove = new ICrossChainForwarder.BridgeAdapterToDisable[](1); + + forwarderAdaptersToRemove[0] = ICrossChainForwarder.BridgeAdapterToDisable({ + bridgeAdapter: CCIP_ADAPTER_TO_REMOVE, + chainIds: getChainsToSend() + }); + + return forwarderAdaptersToRemove; + } + + function getReceiverBridgeAdaptersToAllow() + public + view + returns (ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] memory) + { + ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] + memory bridgeAdapterConfig = new ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[](1); + + bridgeAdapterConfig[0] = ICrossChainReceiver.ReceiverBridgeAdapterConfigInput({ + bridgeAdapter: CCIP_NEW_ADAPTER, + chainIds: getChainsToReceive() + }); + + return bridgeAdapterConfig; + } + + function getForwarderBridgeAdaptersToEnable() + public + view + returns (ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] memory) + { + DestinationAdaptersInput[] memory destinationAdapters = getDestinationAdapters(); + + ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] + memory bridgeAdaptersToEnable = new ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[]( + destinationAdapters.length + ); + + for (uint256 i = 0; i < destinationAdapters.length; i++) { + bridgeAdaptersToEnable[i] = ICrossChainForwarder.ForwarderBridgeAdapterConfigInput({ + currentChainBridgeAdapter: CCIP_NEW_ADAPTER, + destinationBridgeAdapter: destinationAdapters[i].adapter, + destinationChainId: destinationAdapters[i].chainId + }); + } + + return bridgeAdaptersToEnable; + } +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseCCCImplementationUpdatePayload.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseCCCImplementationUpdatePayload.sol new file mode 100644 index 000000000..41d78c09c --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseCCCImplementationUpdatePayload.sol @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; +import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; +import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol'; +import {ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/ProxyAdmin.sol'; + +contract BaseCCCImplementationUpdatePayload is IProposalGenericExecutor { + struct CCCImplementationUpdateInput { + address proxyAdmin; + address ccc; + address newCCCImplementation; + } + + address public immutable CROSS_CHAIN_CONTROLLER_IMPLEMENTATION; + address public immutable CROSS_CHAIN_CONTROLLER; + address public immutable PROXY_ADMIN; + + constructor(CCCImplementationUpdateInput memory updateInput) { + PROXY_ADMIN = updateInput.proxyAdmin; + CROSS_CHAIN_CONTROLLER = updateInput.ccc; + CROSS_CHAIN_CONTROLLER_IMPLEMENTATION = updateInput.newCCCImplementation; + } + + function execute() public virtual { + // Update CrossChainController implementation + ProxyAdmin(PROXY_ADMIN).upgradeAndCall( + TransparentUpgradeableProxy(payable(CROSS_CHAIN_CONTROLLER)), + CROSS_CHAIN_CONTROLLER_IMPLEMENTATION, + abi.encodeWithSignature('initializeRevision()') + ); + } +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseCCCImplementationUpdatePayloadTest.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseCCCImplementationUpdatePayloadTest.sol new file mode 100644 index 000000000..14c1c2cdd --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseCCCImplementationUpdatePayloadTest.sol @@ -0,0 +1,55 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; +import 'aave-helpers/ProtocolV3TestBase.sol'; + +import {ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/ProxyAdmin.sol'; +import {GovV3Helpers} from 'aave-helpers/GovV3Helpers.sol'; +import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol'; + +import {BaseCCCImplementationUpdatePayload} from './BaseCCCImplementationUpdatePayload.sol'; + +contract BaseCCCImplementationUpdatePayloadTest is ProtocolV3TestBase { + address public immutable CROSS_CHAIN_CONTROLLER; + address public immutable PROXY_ADMIN; + + bytes public payloadCode; + address public payloadAddress; + string public network; + uint256 public blockNumber; + + constructor( + address ccc, + address proxyAdmin, + bytes memory _payloadCode, + string memory _network, + uint256 _blockNumber + ) { + CROSS_CHAIN_CONTROLLER = ccc; + PROXY_ADMIN = proxyAdmin; + network = _network; + blockNumber = _blockNumber; + payloadCode = _payloadCode; + } + + function setUp() public virtual { + vm.createSelectFork(vm.rpcUrl(network), blockNumber); + payloadAddress = GovV3Helpers.deployDeterministic(payloadCode); + } + + function test_implementationOfCCCUpdate() public { + address newImplementation = BaseCCCImplementationUpdatePayload(payloadAddress) + .CROSS_CHAIN_CONTROLLER_IMPLEMENTATION(); + + address cccImplementationBefore = ProxyAdmin(PROXY_ADMIN).getProxyImplementation( + TransparentUpgradeableProxy(payable(CROSS_CHAIN_CONTROLLER)) + ); + assertTrue(cccImplementationBefore != newImplementation); + + executePayload(vm, payloadAddress); + + address cccImplementationAfter = ProxyAdmin(PROXY_ADMIN).getProxyImplementation( + TransparentUpgradeableProxy(payable(CROSS_CHAIN_CONTROLLER)) + ); + assertTrue(cccImplementationAfter == newImplementation); + } +} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseTest.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseTest.sol index 649c2f227..ef059f78b 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseTest.sol +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseTest.sol @@ -1,13 +1,25 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; +import 'forge-std/console.sol'; + import {ProtocolV3TestBase} from 'aave-helpers/ProtocolV3TestBase.sol'; import {ICrossChainReceiver, ICrossChainForwarder} from 'aave-address-book/common/ICrossChainController.sol'; import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol'; import {ChainIds} from 'aave-helpers/ChainIds.sol'; import {ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/ProxyAdmin.sol'; import {IBaseAdapter} from 'aave-address-book/common/IBaseAdapter.sol'; + +import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; +import {GovernanceV3Polygon} from 'aave-address-book/GovernanceV3Polygon.sol'; +import {GovernanceV3Avalanche} from 'aave-address-book/GovernanceV3Avalanche.sol'; + import {AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; +import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; +import {AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; +import {AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; +import {AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; +import {BaseCCCImplementationUpdatePayloadTest} from './BaseCCCImplementationUpdatePayloadTest.sol'; struct AdapterName { address adapter; @@ -37,223 +49,293 @@ struct ForwarderAdapters { } interface Payload { - function NEW_CROSS_CHAIN_CONTROLLER_IMPLEMENTATION() external returns (address); + function CROSS_CHAIN_CONTROLLER_IMPLEMENTATION() external returns (address); } -abstract contract BaseTest is ProtocolV3TestBase { - address public immutable CROSS_CHAIN_CONTROLLER; - address public immutable PROXY_ADMIN; +abstract contract BaseTest is BaseCCCImplementationUpdatePayloadTest { + BaseAdaptersUpdatePayload internal ethereumPayload; + BaseAdaptersUpdatePayload internal polygonPayload; + BaseAdaptersUpdatePayload internal avalanchePayload; + BaseAdaptersUpdatePayload internal binancePayload; - address public payloadAddress; - string public network; - uint256 public blockNumber; + constructor( + address ccc, + address proxyAdmin, + bytes memory _payloadCode, + string memory _network, + uint256 _blockNumber + ) BaseCCCImplementationUpdatePayloadTest(ccc, proxyAdmin, _payloadCode, _network, _blockNumber) {} - AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313 internal ethereumPayload; - - constructor(address ccc, address proxyAdmin, string memory _network, uint256 _blockNumber) { - CROSS_CHAIN_CONTROLLER = ccc; - PROXY_ADMIN = proxyAdmin; - network = _network; - blockNumber = _blockNumber; - } + function setUp() public override { + super.setUp(); - function setUp() public virtual { - vm.createSelectFork(vm.rpcUrl(network), blockNumber); ethereumPayload = new AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313(); + polygonPayload = new AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313(); + avalanchePayload = new AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313(); + binancePayload = new AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313(); } - /** - * @dev executes the generic test suite including e2e and config snapshots - */ - function test_defaultProposalExecution() public { - _checkTrustedRemotes(); - _checkCorrectPathConfiguration(); - _checkCorrectAdapterNames(); - - _checkCurrentReceiversState(false); - _checkAllReceiversAreRepresented(false); - _checkAllForwarderAdaptersAreRepresented(false); - _checkImplementationAddress( - Payload(payloadAddress).NEW_CROSS_CHAIN_CONTROLLER_IMPLEMENTATION(), - false - ); - - AdaptersByChain[] memory receiversBeforeExecution = _getCurrentReceiverAdaptersByChain(); - - executePayload(vm, payloadAddress); - - AdaptersByChain[] memory afterBeforeExecution = _getCurrentReceiverAdaptersByChain(); - - _checkCurrentReceiversState(true); - _checkAllReceiversAreRepresented(true); - _checkAllForwarderAdaptersAreRepresented(true); - _checkImplementationAddress( - Payload(payloadAddress).NEW_CROSS_CHAIN_CONTROLLER_IMPLEMENTATION(), - true - ); - } - - // -------------- virtual methods -------------------------- - function _checkCorrectPathConfiguration() internal virtual {} - - function _getAdapterNames() internal view virtual returns (AdapterName[] memory); - - function _getTrustedRemotes() internal view virtual returns (TrustedRemote[] memory); - - function _getAdapterByChain( - bool afterExecution - ) internal view virtual returns (AdapterAllowed[] memory); - - function _getForwarderAdaptersByChain( - bool afterExecution - ) internal view virtual returns (ForwarderAdapters[] memory) { - ForwarderAdapters[] memory forwarderAdapters = new ForwarderAdapters[](0); - return forwarderAdapters; + function getPayloadByChainId(uint256 chainId) public view returns (BaseAdaptersUpdatePayload) { + if (chainId == ChainIds.MAINNET) { + return ethereumPayload; + } else if (chainId == ChainIds.POLYGON) { + return polygonPayload; + } else if (chainId == ChainIds.BNB) { + return binancePayload; + } else if (chainId == ChainIds.AVALANCHE) { + return avalanchePayload; + } + revert(); } - function _getReceiverAdaptersByChain( - bool afterExecution - ) internal view virtual returns (AdaptersByChain[] memory); - - // ------------------------ checks ------------- - function _checkAllForwarderAdaptersAreRepresented(bool afterExecution) internal { - ForwarderAdapters[] memory forwarderAdapters = _getForwarderAdaptersByChain(afterExecution); - - for (uint256 i = 0; i < forwarderAdapters.length; i++) { - _testForwarderAdapterCorrectness( - forwarderAdapters[i].chainId, - forwarderAdapters[i].adapters, - afterExecution - ); + function getTrustedRemoteByChainId(uint256 chainId) public view returns (address) { + if (chainId == ChainIds.MAINNET) { + return GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER; + } else if (chainId == ChainIds.POLYGON) { + return GovernanceV3Polygon.CROSS_CHAIN_CONTROLLER; + } else if (chainId == ChainIds.AVALANCHE) { + return GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER; } + revert(); } - function _checkAllReceiversAreRepresented(bool afterExecution) internal virtual { - AdaptersByChain[] memory receiverAdaptersByChain = _getReceiverAdaptersByChain(afterExecution); - - for (uint256 i = 0; i < receiverAdaptersByChain.length; i++) { - _testReceiverAdaptersByChain( - receiverAdaptersByChain[i].chainId, - receiverAdaptersByChain[i].adapters - ); + function test_trustedRemotes() public { + ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] + memory receivers = BaseAdaptersUpdatePayload(payloadAddress) + .getReceiverBridgeAdaptersToAllow(); + + for (uint256 i = 0; i < receivers.length; i++) { + for (uint256 j = 0; j < receivers[i].chainIds.length; j++) { + assertEq( + getTrustedRemoteByChainId(receivers[i].chainIds[j]), + IBaseAdapter(receivers[i].bridgeAdapter).getTrustedRemoteByChainId( + receivers[i].chainIds[j] + ) + ); + } } } - function _checkCurrentReceiversState(bool afterExecution) internal { - AdapterAllowed[] memory adaptersByChain = _getAdapterByChain(afterExecution); + function test_correctPathConfiguration() public { + BaseAdaptersUpdatePayload.DestinationAdaptersInput[] + memory destinationConfigs = BaseAdaptersUpdatePayload(payloadAddress) + .getDestinationAdapters(); - for (uint256 i = 0; i < adaptersByChain.length; i++) { + for (uint256 i = 0; i < destinationConfigs.length; i++) { assertEq( - ICrossChainReceiver(CROSS_CHAIN_CONTROLLER).isReceiverBridgeAdapterAllowed( - adaptersByChain[i].adapter, - adaptersByChain[i].chainId - ), - adaptersByChain[i].allowed + getPayloadByChainId(destinationConfigs[i].chainId).CCIP_NEW_ADAPTER(), + destinationConfigs[i].adapter ); } } - function _checkCorrectAdapterNames() internal { - AdapterName[] memory adapterNames = _getAdapterNames(); + function test_correctAdapterNames() public { + ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] + memory receivers = BaseAdaptersUpdatePayload(payloadAddress) + .getReceiverBridgeAdaptersToAllow(); - for (uint256 i = 0; i < adapterNames.length; i++) { - string memory adapterName = IBaseAdapter(adapterNames[i].adapter).adapterName(); - assertEq(keccak256(abi.encode(adapterName)), keccak256(abi.encode(adapterNames[i].name))); + for (uint256 i = 0; i < receivers.length; i++) { + string memory adapterName = IBaseAdapter(receivers[i].bridgeAdapter).adapterName(); + assertEq(keccak256(abi.encode(adapterName)), keccak256(abi.encode('CCIP adapter'))); } } - function _checkTrustedRemotes() internal { - TrustedRemote[] memory trustedRemotes = _getTrustedRemotes(); + function test_receiversAreCorrectlySetAfterExecution() public { + ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] + memory beforeReceivers = BaseAdaptersUpdatePayload(payloadAddress) + .getReceiverBridgeAdaptersToAllow(); + + for (uint256 i = 0; i < beforeReceivers.length; i++) { + for (uint256 j = 0; j < beforeReceivers[i].chainIds.length; j++) { + assertEq( + ICrossChainReceiver(CROSS_CHAIN_CONTROLLER).isReceiverBridgeAdapterAllowed( + beforeReceivers[i].bridgeAdapter, + beforeReceivers[i].chainIds[j] + ), + false + ); + } + } - for (uint256 i = 0; i < trustedRemotes.length; i++) { - assertEq( - trustedRemotes[i].expectedRemote, - IBaseAdapter(trustedRemotes[i].adapter).getTrustedRemoteByChainId( - trustedRemotes[i].remoteChainId - ) - ); + executePayload(vm, payloadAddress); + + ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] + memory receivers = BaseAdaptersUpdatePayload(payloadAddress) + .getReceiverBridgeAdaptersToAllow(); + + for (uint256 i = 0; i < receivers.length; i++) { + for (uint256 j = 0; j < receivers[i].chainIds.length; j++) { + assertEq( + ICrossChainReceiver(CROSS_CHAIN_CONTROLLER).isReceiverBridgeAdapterAllowed( + receivers[i].bridgeAdapter, + receivers[i].chainIds[j] + ), + true + ); + } } } - function _checkImplementationAddress(address implementation, bool equal) internal { - address cccImplementation = ProxyAdmin(PROXY_ADMIN).getProxyImplementation( - TransparentUpgradeableProxy(payable(CROSS_CHAIN_CONTROLLER)) - ); - assertEq(cccImplementation == implementation, equal); - } + function test_onlyUpdatedNeededAdapter() public { + uint256[] memory supportedChainsBefore = ICrossChainReceiver(CROSS_CHAIN_CONTROLLER) + .getSupportedChains(); + AdaptersByChain[] memory adaptersBefore = _getCurrentReceiverAdaptersByChain(); - //----------------------------------------------------------------- + executePayload(vm, payloadAddress); - function _testForwarderAdapterCorrectness( - uint256 chainId, - ICrossChainForwarder.ChainIdBridgeConfig[] memory adapters, - bool checkDestination - ) internal { - ICrossChainForwarder.ChainIdBridgeConfig[] - memory forwarderBridgeAdapters = ICrossChainForwarder(CROSS_CHAIN_CONTROLLER) - .getForwarderBridgeAdaptersByChain(chainId); + uint256[] memory supportedChainsAfter = ICrossChainReceiver(CROSS_CHAIN_CONTROLLER) + .getSupportedChains(); - uint256 adaptersCount; - for (uint256 i = 0; i < forwarderBridgeAdapters.length; i++) { - for (uint256 j = 0; j < adapters.length; j++) { - if ( - forwarderBridgeAdapters[i].currentChainBridgeAdapter == - adapters[j].currentChainBridgeAdapter - ) { - if (checkDestination) { - if ( - forwarderBridgeAdapters[i].destinationBridgeAdapter == - adapters[j].destinationBridgeAdapter - ) { - adaptersCount++; + assertEq(supportedChainsBefore, supportedChainsAfter); + for (uint256 i = 0; i < supportedChainsBefore.length; i++) { + assertEq(supportedChainsAfter[i], supportedChainsBefore[i]); + } + + ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] + memory adaptersToRemove = BaseAdaptersUpdatePayload(payloadAddress) + .getReceiverBridgeAdaptersToRemove(); + + for (uint256 i = 0; i < adaptersBefore.length; i++) { + for (uint256 j = 0; j < adaptersToRemove.length; j++) { + for (uint256 x = 0; x < adaptersToRemove[j].chainIds.length; x++) { + if (adaptersToRemove[j].chainIds[x] == adaptersBefore[i].chainId) { + for (uint256 k = 0; k < adaptersBefore[i].adapters.length; k++) { + if (adaptersBefore[i].adapters[k] == adaptersToRemove[j].bridgeAdapter) { + assertEq( + ICrossChainReceiver(CROSS_CHAIN_CONTROLLER).isReceiverBridgeAdapterAllowed( + adaptersToRemove[j].bridgeAdapter, + adaptersBefore[i].chainId + ), + false + ); + } else { + assertEq( + ICrossChainReceiver(CROSS_CHAIN_CONTROLLER).isReceiverBridgeAdapterAllowed( + adaptersBefore[i].adapters[k], + adaptersBefore[i].chainId + ), + true + ); + } } - } else { - adaptersCount++; } } } } - assertEq(adaptersCount, adapters.length); } - function _testReceiverAdaptersByChain(uint256 chainId, address[] memory adapters) internal { - address[] memory receiverAdapters = ICrossChainReceiver(CROSS_CHAIN_CONTROLLER) - .getReceiverBridgeAdaptersByChain(chainId); + function test_forwarderAdaptersAreSet() public { + executePayload(vm, payloadAddress); + + ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] + memory forwarders = BaseAdaptersUpdatePayload(payloadAddress) + .getForwarderBridgeAdaptersToEnable(); - uint256 adaptersCount; - for (uint256 i = 0; i < receiverAdapters.length; i++) { - for (uint256 j = 0; j < adapters.length; j++) { - if (receiverAdapters[i] == adapters[j]) { - adaptersCount++; + for (uint256 i = 0; i < forwarders.length; i++) { + ICrossChainForwarder.ChainIdBridgeConfig[] + memory forwardersBridgeAdaptersByChain = ICrossChainForwarder(CROSS_CHAIN_CONTROLLER) + .getForwarderBridgeAdaptersByChain(forwarders[i].destinationChainId); + bool newAdapterFound; + for (uint256 j = 0; j < forwardersBridgeAdaptersByChain.length; j++) { + if ( + forwardersBridgeAdaptersByChain[j].destinationBridgeAdapter == + forwarders[i].destinationBridgeAdapter && + forwardersBridgeAdaptersByChain[j].currentChainBridgeAdapter == + forwarders[i].currentChainBridgeAdapter + ) { + newAdapterFound = true; } } + assertEq(newAdapterFound, true); } - assertEq(adaptersCount, adapters.length); } - function _testOnlyUpdatedReceiverAdapterChanges( - address[] memory previousReceivers, - address newAdapter, - uint256 chainId - ) internal { - address[] memory currentReceiverAdapters = ICrossChainReceiver(CROSS_CHAIN_CONTROLLER) - .getReceiverBridgeAdaptersByChain(chainId); - - uint256 adaptersCount; - uint256 newAdapterCount; - for (uint256 i = 0; i < currentReceiverAdapters.length; i++) { - for (uint256 j = 0; j < previousReceivers.length; j++) { - if (currentReceiverAdapters[i] == previousReceivers[j]) { - adaptersCount++; - } - if (currentReceiverAdapters[i] == newAdapter) { - newAdapterCount++; + function test_onlyChangedNeededForwarders() public { + ForwarderAdapters[] + memory forwardersBridgeAdaptersByChainBefore = _getCurrentForwarderAdaptersByChain(); + + ICrossChainForwarder.BridgeAdapterToDisable[] + memory adaptersToRemove = BaseAdaptersUpdatePayload(payloadAddress) + .getForwarderBridgeAdaptersToRemove(); + + executePayload(vm, payloadAddress); + + ForwarderAdapters[] + memory forwardersBridgeAdaptersByChainAfter = _getCurrentForwarderAdaptersByChain(); + + assertEq( + forwardersBridgeAdaptersByChainAfter.length, + forwardersBridgeAdaptersByChainBefore.length + ); + + for (uint256 l = 0; l < forwardersBridgeAdaptersByChainBefore.length; l++) { + for (uint256 j = 0; j < forwardersBridgeAdaptersByChainAfter.length; j++) { + if ( + forwardersBridgeAdaptersByChainBefore[l].chainId == + forwardersBridgeAdaptersByChainAfter[j].chainId + ) { + for (uint256 i = 0; i < forwardersBridgeAdaptersByChainBefore[l].adapters.length; i++) { + bool forwarderFound; + for (uint256 m = 0; m < forwardersBridgeAdaptersByChainAfter[j].adapters.length; m++) { + if ( + forwardersBridgeAdaptersByChainBefore[l].adapters[i].destinationBridgeAdapter == + forwardersBridgeAdaptersByChainAfter[j].adapters[m].destinationBridgeAdapter && + forwardersBridgeAdaptersByChainBefore[l].adapters[i].currentChainBridgeAdapter == + forwardersBridgeAdaptersByChainAfter[j].adapters[m].currentChainBridgeAdapter + ) { + forwarderFound = true; + break; + } + } + if (!forwarderFound) { + bool isAdapterToBeRemoved; + for (uint256 k = 0; k < adaptersToRemove.length; k++) { + if ( + forwardersBridgeAdaptersByChainBefore[l].adapters[i].currentChainBridgeAdapter == + adaptersToRemove[k].bridgeAdapter + ) { + for (uint256 n = 0; n < adaptersToRemove[k].chainIds.length; n++) { + if ( + forwardersBridgeAdaptersByChainBefore[l].chainId == + adaptersToRemove[k].chainIds[n] + ) { + isAdapterToBeRemoved = true; + break; + } + } + } + } + assertEq(isAdapterToBeRemoved, true); + } + } } } } + } + + function _getCurrentForwarderAdaptersByChain() internal returns (ForwarderAdapters[] memory) { + uint256[] memory supportedChains = new uint256[](10); + supportedChains[0] = ChainIds.POLYGON; + supportedChains[1] = ChainIds.AVALANCHE; + supportedChains[2] = ChainIds.BNB; + supportedChains[3] = ChainIds.GNOSIS; + supportedChains[4] = ChainIds.ARBITRUM; + supportedChains[5] = ChainIds.OPTIMISM; + supportedChains[6] = ChainIds.METIS; + supportedChains[7] = ChainIds.BASE; + supportedChains[8] = ChainIds.SCROLL; + supportedChains[9] = ChainIds.MAINNET; + + ForwarderAdapters[] memory forwarderAdapters = new ForwarderAdapters[](supportedChains.length); - assertEq(previousReceivers.length, currentReceiverAdapters.length); - assertEq(currentReceiverAdapters.length, adaptersCount + newAdapterCount); + for (uint256 i = 0; i < supportedChains.length; i++) { + ICrossChainForwarder.ChainIdBridgeConfig[] memory forwarders = ICrossChainForwarder( + CROSS_CHAIN_CONTROLLER + ).getForwarderBridgeAdaptersByChain(supportedChains[i]); + + forwarderAdapters[i] = ForwarderAdapters({adapters: forwarders, chainId: supportedChains[i]}); + } + return forwarderAdapters; } function _getCurrentReceiverAdaptersByChain() internal returns (AdaptersByChain[] memory) { diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md index 68a6a6589..be2080ef5 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md @@ -1,21 +1,57 @@ --- title: "Update a.DI implementation and CCIP adapters" author: "BGD Labs @bgdlabs" -discussions: "" +discussions: "https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/21" --- ## Simple Summary +This proposal includes the update of the CrossChainController on all supported networks to Revision 2. +It also updates all the CCIP Bridge Adapters to version 1.2.0 on the supported networks. + ## Motivation +The main motivation of this proposal is to bring the CCIP Bridge Adapters up to date with the latest bridge provider specifications, +and updating the logic to ease and standardize off chain tracking of a.DI contracts and events. + ## Specification +- Update CCIP to v1.2.0 +- Added Adaper Name to the contracts to make it easy to track off chain. + +On the CrossChainController implementation we have updated the logic so that all bridged messages will be treated the same +even if required confirmation have already been reached. (Previously these messages where ignored) + +Updates the implementation of CrossChainController on aDI on all supported networks: + +| Network | CrossChainController Impl | +| --------- | ------------------------------------------------------------------------------------------------------------------------------------ | +| Ethereum | [0x28559c2F4B038b1E836fA419DCcDe7454d8Fe215](https://etherscan.io/address/0x28559c2F4B038b1E836fA419DCcDe7454d8Fe215) | +| Polygon | [0x87a95917DE670088d81B9a8B30E3B36704Ba3043](https://polygonscan.com/address/0x87a95917DE670088d81B9a8B30E3B36704Ba3043) | +| Avalanche | [0x5Ef80c5eB6CF65Dab8cD1C0ee258a6D2bD38Bd22](https://snowscan.xyz/address/0x5Ef80c5eB6CF65Dab8cD1C0ee258a6D2bD38Bd22) | +| Binance | [0xf41193E25408F652AF878c47E4401A01B5E4B682](https://bscscan.com/address/0xf41193E25408F652AF878c47E4401A01B5E4B682) | +| Gnosis | [0x5e06b10B3b9c3E1c0996D2544A35B9839Be02922](https://gnosisscan.io/address/0x5e06b10B3b9c3E1c0996D2544A35B9839Be02922) | +| Arbitrum | [0x6e633269af45F37c44659D98f382dd0DD524E5Df](https://arbiscan.io/address/0x6e633269af45F37c44659D98f382dd0DD524E5Df) | +| Optimism | [0xa5cc218513305221201f196760E9e64e9D49d98A](https://optimistic.etherscan.io/address/0xa5cc218513305221201f196760E9e64e9D49d98A) | +| Metis | [0xa198Fac58E02A5C5F8F7e877895d50cFa9ad1E04](https://andromeda-explorer.metis.io/address/0xa198Fac58E02A5C5F8F7e877895d50cFa9ad1E04) | +| Base | [0x9b6f5ef589A3DD08670Dd146C11C4Fb33E04494F](https://basescan.org/address/0x9b6f5ef589A3DD08670Dd146C11C4Fb33E04494F) | +| Scroll | [0x5e06b10B3b9c3E1c0996D2544A35B9839Be02922](https://scrollscan.com/address/0x5e06b10B3b9c3E1c0996D2544A35B9839Be02922) | + +Updates the bridge adapters used to connect between networks + +| Network | CCIP | +| --------- | ------------------------------------------------------------------------------------------------------------------------ | +| Ethereum | [0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29](https://etherscan.io/address/0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29) | +| Polygon | [0xe79757D55a1600eF28D816a893E78E9FCDE2019E](https://polygonscan.com/address/0xe79757D55a1600eF28D816a893E78E9FCDE2019E) | +| Avalanche | [0x2b88C83727B0E290B76EB3F6133994fF81B7f355](https://snowscan.xyz/address/0x2b88C83727B0E290B76EB3F6133994fF81B7f355) | +| Binance | [0xAE93BEa44dcbE52B625169588574d31e36fb3A67](https://bscscan.com/address/0xAE93BEa44dcbE52B625169588574d31e36fb3A67) | + ## References -- Implementation: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Polygon](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Avalanche](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3BNB](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.sol) -- Tests: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol), [AaveV3Polygon](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol), [AaveV3Avalanche](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol), [AaveV3BNB](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol) -- [Snapshot](TODO) -- [Discussion](TODO) +- Implementation: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Polygon](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Avalanche](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Optimism](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Arbitrum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Metis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Base](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Gnosis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Scroll](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3BNB](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.sol) +- Tests: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol), [AaveV3Polygon](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol), [AaveV3Avalanche](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol), [AaveV3Optimism](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol), [AaveV3Arbitrum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol), [AaveV3Metis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol), [AaveV3Base](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol), [AaveV3Gnosis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol), [AaveV3Scroll](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol), [AaveV3BNB](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol) +- +- [Discussion](https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/21) ## Copyright diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol index 5f8270226..79bc186af 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol @@ -2,11 +2,17 @@ pragma solidity ^0.8.0; import {GovV3Helpers, IPayloadsControllerCore, PayloadsControllerUtils} from 'aave-helpers/GovV3Helpers.sol'; -import {EthereumScript, PolygonScript, AvalancheScript, BNBScript} from 'aave-helpers/ScriptUtils.sol'; +import {EthereumScript, PolygonScript, AvalancheScript, BNBScript, BaseScript, GnosisScript, OptimismScript, ArbitrumScript, MetisScript, ScrollScript} from 'aave-helpers/ScriptUtils.sol'; import {AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; import {AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; import {AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; import {AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; +import {AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; +import {AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; +import {AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; +import {AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; +import {AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; +import {AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313} from './AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.sol'; /** * @dev Deploy Ethereum @@ -96,6 +102,138 @@ contract DeployBNB is BNBScript { } } +/** + * @dev Deploy Base + * deploy-command: make deploy-ledger contract=src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol:DeployBase chain=base + * verify-command: npx catapulta-verify -b broadcast/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol/8453/run-latest.json + */ +contract DeployBase is BaseScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode + ); + + // compose action + IPayloadsControllerCore.ExecutionAction[] + memory actions = new IPayloadsControllerCore.ExecutionAction[](1); + actions[0] = GovV3Helpers.buildAction(payload0); + + // register action at payloadsController + GovV3Helpers.createPayload(actions); + } +} + +/** + * @dev Deploy Gnosis + * deploy-command: make deploy-ledger contract=src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol:DeployGnosis chain=gnosis + * verify-command: npx catapulta-verify -b broadcast/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol/100/run-latest.json + */ +contract DeployGnosis is GnosisScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode + ); + + // compose action + IPayloadsControllerCore.ExecutionAction[] + memory actions = new IPayloadsControllerCore.ExecutionAction[](1); + actions[0] = GovV3Helpers.buildAction(payload0); + + // register action at payloadsController + GovV3Helpers.createPayload(actions); + } +} + +/** + * @dev Deploy Optimism + * deploy-command: make deploy-ledger contract=src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol:DeployOptimism chain=optimism + * verify-command: npx catapulta-verify -b broadcast/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol/10/run-latest.json + */ +contract DeployOptimism is OptimismScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode + ); + + // compose action + IPayloadsControllerCore.ExecutionAction[] + memory actions = new IPayloadsControllerCore.ExecutionAction[](1); + actions[0] = GovV3Helpers.buildAction(payload0); + + // register action at payloadsController + GovV3Helpers.createPayload(actions); + } +} + +/** + * @dev Deploy Arbitrum + * deploy-command: make deploy-ledger contract=src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol:DeployArbitrum chain=arbitrum + * verify-command: npx catapulta-verify -b broadcast/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol/42161/run-latest.json + */ +contract DeployArbitrum is ArbitrumScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode + ); + + // compose action + IPayloadsControllerCore.ExecutionAction[] + memory actions = new IPayloadsControllerCore.ExecutionAction[](1); + actions[0] = GovV3Helpers.buildAction(payload0); + + // register action at payloadsController + GovV3Helpers.createPayload(actions); + } +} + +/** + * @dev Deploy Metis + * deploy-command: make deploy-ledger contract=src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol:DeployMetis chain=metis + * verify-command: npx catapulta-verify -b broadcast/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol/1088/run-latest.json + */ +contract DeployMetis is MetisScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode + ); + + // compose action + IPayloadsControllerCore.ExecutionAction[] + memory actions = new IPayloadsControllerCore.ExecutionAction[](1); + actions[0] = GovV3Helpers.buildAction(payload0); + + // register action at payloadsController + GovV3Helpers.createPayload(actions); + } +} + +/** + * @dev Deploy Scroll + * deploy-command: make deploy-ledger contract=src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol:DeployScroll chain=scroll + * verify-command: npx catapulta-verify -b broadcast/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol/534352/run-latest.json + */ +contract DeployScroll is ScrollScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313).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/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol:CreateProposal chain=mainnet @@ -103,7 +241,7 @@ contract DeployBNB is BNBScript { contract CreateProposal is EthereumScript { function run() external { // create payloads - PayloadsControllerUtils.Payload[] memory payloads = new PayloadsControllerUtils.Payload[](4); + PayloadsControllerUtils.Payload[] memory payloads = new PayloadsControllerUtils.Payload[](10); // compose actions for validation IPayloadsControllerCore.ExecutionAction[] @@ -134,6 +272,48 @@ contract CreateProposal is EthereumScript { ); payloads[3] = GovV3Helpers.buildBNBPayload(vm, actionsBNB); + IPayloadsControllerCore.ExecutionAction[] + memory actionsBase = new IPayloadsControllerCore.ExecutionAction[](1); + actionsBase[0] = GovV3Helpers.buildAction( + type(AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode + ); + payloads[4] = GovV3Helpers.buildBasePayload(vm, actionsBase); + + IPayloadsControllerCore.ExecutionAction[] + memory actionsGnosis = new IPayloadsControllerCore.ExecutionAction[](1); + actionsGnosis[0] = GovV3Helpers.buildAction( + type(AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode + ); + payloads[5] = GovV3Helpers.buildGnosisPayload(vm, actionsGnosis); + + IPayloadsControllerCore.ExecutionAction[] + memory actionsOptimism = new IPayloadsControllerCore.ExecutionAction[](1); + actionsOptimism[0] = GovV3Helpers.buildAction( + type(AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode + ); + payloads[6] = GovV3Helpers.buildOptimismPayload(vm, actionsOptimism); + + IPayloadsControllerCore.ExecutionAction[] + memory actionsArbitrum = new IPayloadsControllerCore.ExecutionAction[](1); + actionsArbitrum[0] = GovV3Helpers.buildAction( + type(AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode + ); + payloads[7] = GovV3Helpers.buildArbitrumPayload(vm, actionsArbitrum); + + IPayloadsControllerCore.ExecutionAction[] + memory actionsMetis = new IPayloadsControllerCore.ExecutionAction[](1); + actionsMetis[0] = GovV3Helpers.buildAction( + type(AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode + ); + payloads[8] = GovV3Helpers.buildMetisPayload(vm, actionsMetis); + + IPayloadsControllerCore.ExecutionAction[] + memory actionsScroll = new IPayloadsControllerCore.ExecutionAction[](1); + actionsScroll[0] = GovV3Helpers.buildAction( + type(AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode + ); + payloads[9] = GovV3Helpers.buildScrollPayload(vm, actionsScroll); + // create proposal vm.startBroadcast(); GovV3Helpers.createProposal( diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/config.ts b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/config.ts index 307a94eba..95f74c7f3 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/config.ts +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/config.ts @@ -2,7 +2,18 @@ import {ConfigFile} from '../../generator/types'; export const config: ConfigFile = { rootOptions: { author: 'BGD Labs @bgdlabs', - pools: ['AaveV3Ethereum', 'AaveV3Polygon', 'AaveV3Avalanche', 'AaveV3BNB'], + pools: [ + 'AaveV3Ethereum', + 'AaveV3Polygon', + 'AaveV3Avalanche', + 'AaveV3BNB', + 'AaveV3Base', + 'AaveV3Gnosis', + 'AaveV3Optimism', + 'AaveV3Arbitrum', + 'AaveV3Metis', + 'AaveV3Scroll', + ], title: 'Update a.DI implementation and CCIP adapters', shortName: 'UpdateADIImplementationAndCCIPAdapters', date: '20240313', @@ -14,5 +25,11 @@ export const config: ConfigFile = { AaveV3Polygon: {configs: {OTHERS: {}}, cache: {blockNumber: 54601669}}, AaveV3Avalanche: {configs: {OTHERS: {}}, cache: {blockNumber: 42840161}}, AaveV3BNB: {configs: {OTHERS: {}}, cache: {blockNumber: 36928161}}, + AaveV3Base: {configs: {OTHERS: {}}, cache: {blockNumber: 36928161}}, + AaveV3Gnosis: {configs: {OTHERS: {}}, cache: {blockNumber: 36928161}}, + AaveV3Optimism: {configs: {OTHERS: {}}, cache: {blockNumber: 36928161}}, + AaveV3Arbitrum: {configs: {OTHERS: {}}, cache: {blockNumber: 36928161}}, + AaveV3Metis: {configs: {OTHERS: {}}, cache: {blockNumber: 36928161}}, + AaveV3Scroll: {configs: {OTHERS: {}}, cache: {blockNumber: 36928161}}, }, }; From 3e460477f2a4906c2178473cee63e12b706fb768 Mon Sep 17 00:00:00 2001 From: sendra Date: Wed, 20 Mar 2024 09:40:08 +0100 Subject: [PATCH 04/17] Update src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md Co-authored-by: Harsh Pandey --- .../UpdateADIImplementationAndCCIPAdapters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md index be2080ef5..8fe1e20c8 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md @@ -17,7 +17,7 @@ and updating the logic to ease and standardize off chain tracking of a.DI contra ## Specification - Update CCIP to v1.2.0 -- Added Adaper Name to the contracts to make it easy to track off chain. +- Added Adapter Name to the contracts to make it easy to track off chain. On the CrossChainController implementation we have updated the logic so that all bridged messages will be treated the same even if required confirmation have already been reached. (Previously these messages where ignored) From 5f86a740f790ca2a696db7ffd61fa86112cfce78 Mon Sep 17 00:00:00 2001 From: sendra Date: Wed, 20 Mar 2024 09:41:11 +0100 Subject: [PATCH 05/17] Update src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md Co-authored-by: Harsh Pandey --- .../UpdateADIImplementationAndCCIPAdapters.md | 1 - 1 file changed, 1 deletion(-) diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md index 8fe1e20c8..c3bf57dc1 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md @@ -50,7 +50,6 @@ Updates the bridge adapters used to connect between networks - Implementation: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Polygon](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Avalanche](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Optimism](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Arbitrum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Metis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Base](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Gnosis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Scroll](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3BNB](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.sol) - Tests: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol), [AaveV3Polygon](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol), [AaveV3Avalanche](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol), [AaveV3Optimism](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol), [AaveV3Arbitrum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol), [AaveV3Metis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol), [AaveV3Base](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol), [AaveV3Gnosis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol), [AaveV3Scroll](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol), [AaveV3BNB](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol) -- - [Discussion](https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/21) ## Copyright From 76a69f0f843052d780b8ac0a43fc26c3599bf0ec Mon Sep 17 00:00:00 2001 From: sendra Date: Wed, 20 Mar 2024 17:39:11 +0100 Subject: [PATCH 06/17] feat: Update Hyperlane bridge adapter to V3 --- ...erlaneBridgeAdapterUpdateToV3_20240320.sol | 40 ++ ...laneBridgeAdapterUpdateToV3_20240320.t.sol | 21 + ...erlaneBridgeAdapterUpdateToV3_20240320.sol | 26 ++ ...laneBridgeAdapterUpdateToV3_20240320.t.sol | 21 + ...erlaneBridgeAdapterUpdateToV3_20240320.sol | 50 +++ ...laneBridgeAdapterUpdateToV3_20240320.t.sol | 21 + ...erlaneBridgeAdapterUpdateToV3_20240320.sol | 26 ++ ...laneBridgeAdapterUpdateToV3_20240320.t.sol | 21 + ...erlaneBridgeAdapterUpdateToV3_20240320.sol | 40 ++ ...laneBridgeAdapterUpdateToV3_20240320.t.sol | 21 + .../BaseAdaptersUpdatePayload.sol | 152 +++++++ .../BaseTest.sol | 373 ++++++++++++++++++ .../HyperlaneBridgeAdapterUpdateToV3.md | 37 ++ ...laneBridgeAdapterUpdateToV3_20240320.s.sol | 178 +++++++++ .../config.ts | 19 + 15 files changed, 1046 insertions(+) create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseAdaptersUpdatePayload.sol create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseTest.sol create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/config.ts diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol new file mode 100644 index 000000000..b170eea69 --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; + +/** + * @title Hyperlane bridge adapter update to V3 + * @author BGD Labs @bgdlabs + * - Snapshot: TODO + * - Discussion: TODO + */ +contract AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320 is + BaseAdaptersUpdatePayload( + BaseAdaptersUpdatePayload.ConstructorInput({ + ccc: GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER, + hlNewAdapter: 0x617332a777780F546261247F621051d0b98975Eb, + hlAdapterToRemove: 0xa198Fac58E02A5C5F8F7e877895d50cFa9ad1E04 + }) + ) +{ + function getChainsToReceive() public pure override returns (uint256[] memory) { + uint256[] memory chains = new uint256[](1); + chains[0] = ChainIds.MAINNET; + return chains; + } + + function getDestinationAdapters() + public + pure + override + returns (DestinationAdaptersInput[] memory) + { + DestinationAdaptersInput[] memory destinationAdapters = new DestinationAdaptersInput[](1); + + destinationAdapters[0].adapter = 0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1; + destinationAdapters[0].chainId = ChainIds.MAINNET; + + return destinationAdapters; + } +} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol new file mode 100644 index 000000000..fd1d93f57 --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {GovernanceV3Avalanche} from 'aave-address-book/GovernanceV3Avalanche.sol'; +import {AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; +import './BaseTest.sol'; + +/** + * @dev Test for AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320 + * command: make test-contract filter=AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320 + */ +contract AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320_Test is BaseTest { + constructor() + BaseTest( + GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER, + type(AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode, + 'avalanche', + 43150105 + ) + {} +} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol new file mode 100644 index 000000000..8cdf3f77f --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; + +/** + * @title Hyperlane bridge adapter update to V3 + * @author BGD Labs @bgdlabs + * - Snapshot: TODO + * - Discussion: TODO + */ +contract AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320 is + BaseAdaptersUpdatePayload( + BaseAdaptersUpdatePayload.ConstructorInput({ + ccc: GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER, + hlNewAdapter: 0x3F006299eC88985c18E6e885EeA29A49eC579882, + hlAdapterToRemove: 0x118DFD5418890c0332042ab05173Db4A2C1d283c + }) + ) +{ + function getChainsToReceive() public pure override returns (uint256[] memory) { + uint256[] memory chains = new uint256[](1); + chains[0] = ChainIds.MAINNET; + return chains; + } +} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol new file mode 100644 index 000000000..26db73a46 --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import './BaseTest.sol'; +import {GovernanceV3BNB} from 'aave-address-book/GovernanceV3BNB.sol'; +import {AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; + +/** + * @dev Test for AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320 + * command: make test-contract filter=AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320 + */ +contract AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320_Test is BaseTest { + constructor() + BaseTest( + GovernanceV3BNB.CROSS_CHAIN_CONTROLLER, + type(AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode, + 'bnb', + 37137492 + ) + {} +} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol new file mode 100644 index 000000000..e8087fe71 --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; + +/** + * @title Hyperlane bridge adapter update to V3 + * @author BGD Labs @bgdlabs + * - Snapshot: TODO + * - Discussion: TODO + */ +contract AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320 is + BaseAdaptersUpdatePayload( + BaseAdaptersUpdatePayload.ConstructorInput({ + ccc: GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER, + hlNewAdapter: 0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1, + hlAdapterToRemove: 0x6Abb61beb5848B476d026C4934E8a6415e2E75a8 + }) + ) +{ + function getChainsToReceive() public pure override returns (uint256[] memory) { + uint256[] memory chains = new uint256[](2); + chains[0] = ChainIds.AVALANCHE; + chains[1] = ChainIds.POLYGON; + return chains; + } + + function getDestinationAdapters() + public + pure + override + returns (DestinationAdaptersInput[] memory) + { + DestinationAdaptersInput[] memory destinationAdapters = new DestinationAdaptersInput[](4); + + destinationAdapters[0].adapter = 0x617332a777780F546261247F621051d0b98975Eb; + destinationAdapters[0].chainId = ChainIds.AVALANCHE; + + destinationAdapters[1].adapter = 0x3e72665008dC237bdd91C04C10782Ed1987a4019; + destinationAdapters[1].chainId = ChainIds.POLYGON; + + destinationAdapters[2].adapter = 0x3F006299eC88985c18E6e885EeA29A49eC579882; + destinationAdapters[2].chainId = ChainIds.BNB; + + destinationAdapters[3].adapter = 0xA806DA549FcB2B4912a7dFFE4c1aA7A1ed0Bd5C9; + destinationAdapters[3].chainId = ChainIds.GNOSIS; + + return destinationAdapters; + } +} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol new file mode 100644 index 000000000..8fe9f05ad --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import './BaseTest.sol'; +import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; +import {AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; + +/** + * @dev Test for AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320 + * command: make test-contract filter=AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320 + */ +contract AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320_Test is BaseTest { + constructor() + BaseTest( + GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER, + type(AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode, + 'mainnet', + 19476776 + ) + {} +} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol new file mode 100644 index 000000000..04b9ef9f8 --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; + +/** + * @title Hyperlane bridge adapter update to V3 + * @author BGD Labs @bgdlabs + * - Snapshot: TODO + * - Discussion: TODO + */ +contract AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320 is + BaseAdaptersUpdatePayload( + BaseAdaptersUpdatePayload.ConstructorInput({ + ccc: GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER, + hlNewAdapter: 0xA806DA549FcB2B4912a7dFFE4c1aA7A1ed0Bd5C9, + hlAdapterToRemove: 0x4A4c73d563395ad827511F70097d4Ef82E653805 + }) + ) +{ + function getChainsToReceive() public pure override returns (uint256[] memory) { + uint256[] memory chains = new uint256[](1); + chains[0] = ChainIds.MAINNET; + return chains; + } +} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol new file mode 100644 index 000000000..ad575883e --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import './BaseTest.sol'; +import {GovernanceV3Gnosis} from 'aave-address-book/GovernanceV3Gnosis.sol'; +import {AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; + +/** + * @dev Test for AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320 + * command: make test-contract filter=AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320 + */ +contract AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320_Test is ProtocolV3TestBase { + constructor() + BaseTest( + GovernanceV3Gnosis.CROSS_CHAIN_CONTROLLER, + type(AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode, + 'gnosis', + 33027304 + ) + {} +} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol new file mode 100644 index 000000000..0ddb11e46 --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; + +/** + * @title Hyperlane bridge adapter update to V3 + * @author BGD Labs @bgdlabs + * - Snapshot: TODO + * - Discussion: TODO + */ +contract AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320 is + BaseAdaptersUpdatePayload( + BaseAdaptersUpdatePayload.ConstructorInput({ + ccc: GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER, + hlNewAdapter: 0x3e72665008dC237bdd91C04C10782Ed1987a4019, + hlAdapterToRemove: 0x3c25b96fF62D21E90556869272a277eE2E229747 + }) + ) +{ + function getChainsToReceive() public pure override returns (uint256[] memory) { + uint256[] memory chains = new uint256[](1); + chains[0] = ChainIds.MAINNET; + return chains; + } + + function getDestinationAdapters() + public + pure + override + returns (DestinationAdaptersInput[] memory) + { + DestinationAdaptersInput[] memory destinationAdapters = new DestinationAdaptersInput[](1); + + destinationAdapters[0].adapter = 0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1; + destinationAdapters[0].chainId = ChainIds.MAINNET; + + return destinationAdapters; + } +} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol new file mode 100644 index 000000000..6d10bd4bf --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import './BaseTest.sol'; +import {GovernanceV3Polygon} from 'aave-address-book/GovernanceV3Polygon.sol'; +import {AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; + +/** + * @dev Test for AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320 + * command: make test-contract filter=AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320 + */ +contract AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320_Test is BaseTest { + constructor() + BaseTest( + GovernanceV3Polygon.CROSS_CHAIN_CONTROLLER, + type(AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode, + 'polygon', + 54882095 + ) + {} +} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseAdaptersUpdatePayload.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseAdaptersUpdatePayload.sol new file mode 100644 index 000000000..98bda15f4 --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseAdaptersUpdatePayload.sol @@ -0,0 +1,152 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; +import {ICrossChainReceiver, ICrossChainForwarder} from 'aave-address-book/common/ICrossChainController.sol'; +import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; + +/** + * @title Base payload aDI and bridge adapters update + * @author BGD Labs @bgdlabs + */ +abstract contract BaseAdaptersUpdatePayload is IProposalGenericExecutor { + struct ConstructorInput { + address ccc; + address hlAdapterToRemove; + address hlNewAdapter; + } + struct DestinationAdaptersInput { + address adapter; + uint256 chainId; + } + + address public immutable CROSS_CHAIN_CONTROLLER; + address public immutable HL_ADAPTER_TO_REMOVE; + address public immutable HL_NEW_ADAPTER; + + constructor(ConstructorInput memory constructorInput) { + CROSS_CHAIN_CONTROLLER = constructorInput.ccc; + HL_ADAPTER_TO_REMOVE = constructorInput.hlAdapterToRemove; + HL_NEW_ADAPTER = constructorInput.hlNewAdapter; + } + + function execute() public override { + // remove old Receiver bridge adapter + ICrossChainReceiver(CROSS_CHAIN_CONTROLLER).disallowReceiverBridgeAdapters( + getReceiverBridgeAdaptersToRemove() + ); + + // remove forwarding adapters + ICrossChainForwarder(CROSS_CHAIN_CONTROLLER).disableBridgeAdapters( + getForwarderBridgeAdaptersToRemove() + ); + + uint256[] memory chainsToSend = getChainsToSend(); + uint256[] memory chainsToReceive = getChainsToReceive(); + + if (chainsToReceive.length != 0) { + // add receiver adapters + ICrossChainReceiver(CROSS_CHAIN_CONTROLLER).allowReceiverBridgeAdapters( + getReceiverBridgeAdaptersToAllow() + ); + } + + if (chainsToSend.length != 0) { + // add forwarding adapters + ICrossChainForwarder(CROSS_CHAIN_CONTROLLER).enableBridgeAdapters( + getForwarderBridgeAdaptersToEnable() + ); + } + } + + function getDestinationAdapters() + public + pure + virtual + returns (DestinationAdaptersInput[] memory) + { + DestinationAdaptersInput[] memory destinationAdapters; + return destinationAdapters; + } + + function getChainsToReceive() public pure virtual returns (uint256[] memory); + + function getChainsToSend() public pure returns (uint256[] memory) { + DestinationAdaptersInput[] memory destinationAdapters = getDestinationAdapters(); + uint256[] memory chainsToSend = new uint256[](destinationAdapters.length); + for (uint256 i = 0; i < destinationAdapters.length; i++) { + chainsToSend[i] = destinationAdapters[i].chainId; + } + return chainsToSend; + } + + function getReceiverBridgeAdaptersToRemove() + public + view + returns (ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] memory) + { + // remove old Receiver bridge adapter + ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] + memory bridgeAdaptersToRemove = new ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[](1); + + bridgeAdaptersToRemove[0] = ICrossChainReceiver.ReceiverBridgeAdapterConfigInput({ + bridgeAdapter: HL_ADAPTER_TO_REMOVE, + chainIds: getChainsToReceive() + }); + + return bridgeAdaptersToRemove; + } + + function getForwarderBridgeAdaptersToRemove() + public + view + returns (ICrossChainForwarder.BridgeAdapterToDisable[] memory) + { + ICrossChainForwarder.BridgeAdapterToDisable[] + memory forwarderAdaptersToRemove = new ICrossChainForwarder.BridgeAdapterToDisable[](1); + + forwarderAdaptersToRemove[0] = ICrossChainForwarder.BridgeAdapterToDisable({ + bridgeAdapter: HL_ADAPTER_TO_REMOVE, + chainIds: getChainsToSend() + }); + + return forwarderAdaptersToRemove; + } + + function getReceiverBridgeAdaptersToAllow() + public + view + returns (ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] memory) + { + ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] + memory bridgeAdapterConfig = new ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[](1); + + bridgeAdapterConfig[0] = ICrossChainReceiver.ReceiverBridgeAdapterConfigInput({ + bridgeAdapter: HL_NEW_ADAPTER, + chainIds: getChainsToReceive() + }); + + return bridgeAdapterConfig; + } + + function getForwarderBridgeAdaptersToEnable() + public + view + returns (ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] memory) + { + DestinationAdaptersInput[] memory destinationAdapters = getDestinationAdapters(); + + ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] + memory bridgeAdaptersToEnable = new ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[]( + destinationAdapters.length + ); + + for (uint256 i = 0; i < destinationAdapters.length; i++) { + bridgeAdaptersToEnable[i] = ICrossChainForwarder.ForwarderBridgeAdapterConfigInput({ + currentChainBridgeAdapter: HL_NEW_ADAPTER, + destinationBridgeAdapter: destinationAdapters[i].adapter, + destinationChainId: destinationAdapters[i].chainId + }); + } + + return bridgeAdaptersToEnable; + } +} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseTest.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseTest.sol new file mode 100644 index 000000000..ea326e256 --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseTest.sol @@ -0,0 +1,373 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import 'forge-std/console.sol'; +import 'aave-helpers/ProtocolV3TestBase.sol'; + +import {ProtocolV3TestBase} from 'aave-helpers/ProtocolV3TestBase.sol'; +import {ICrossChainReceiver, ICrossChainForwarder} from 'aave-address-book/common/ICrossChainController.sol'; +import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol'; +import {ChainIds} from 'aave-helpers/ChainIds.sol'; +import {ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/ProxyAdmin.sol'; +import {IBaseAdapter} from 'aave-address-book/common/IBaseAdapter.sol'; + +import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; +import {GovernanceV3Polygon} from 'aave-address-book/GovernanceV3Polygon.sol'; +import {GovernanceV3Avalanche} from 'aave-address-book/GovernanceV3Avalanche.sol'; + +import {AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; +import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; +import {AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; +import {AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; +import {AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; +import {AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; + +struct AdapterName { + address adapter; + string name; +} + +struct TrustedRemote { + address adapter; + address expectedRemote; + uint256 remoteChainId; +} + +struct AdapterAllowed { + address adapter; + uint256 chainId; + bool allowed; +} + +struct AdaptersByChain { + address[] adapters; + uint256 chainId; +} + +struct ForwarderAdapters { + ICrossChainForwarder.ChainIdBridgeConfig[] adapters; + uint256 chainId; +} + +interface Payload { + function CROSS_CHAIN_CONTROLLER_IMPLEMENTATION() external returns (address); +} + +abstract contract BaseTest is ProtocolV3TestBase { + address public immutable CROSS_CHAIN_CONTROLLER; + + bytes public payloadCode; + address public payloadAddress; + string public network; + uint256 public blockNumber; + + BaseAdaptersUpdatePayload internal ethereumPayload; + BaseAdaptersUpdatePayload internal polygonPayload; + BaseAdaptersUpdatePayload internal avalanchePayload; + BaseAdaptersUpdatePayload internal binancePayload; + BaseAdaptersUpdatePayload internal gnosisPayload; + + constructor( + address ccc, + bytes memory _payloadCode, + string memory _network, + uint256 _blockNumber + ) { + CROSS_CHAIN_CONTROLLER = ccc; + network = _network; + blockNumber = _blockNumber; + payloadCode = _payloadCode; + } + + function setUp() public override { + vm.createSelectFork(vm.rpcUrl(network), blockNumber); + payloadAddress = GovV3Helpers.deployDeterministic(payloadCode); + + ethereumPayload = new AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320(); + polygonPayload = new AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320(); + avalanchePayload = new AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320(); + binancePayload = new AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320(); + gnosisPayload = new AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320(); + } + + function getPayloadByChainId(uint256 chainId) public view returns (BaseAdaptersUpdatePayload) { + if (chainId == ChainIds.MAINNET) { + return ethereumPayload; + } else if (chainId == ChainIds.POLYGON) { + return polygonPayload; + } else if (chainId == ChainIds.BNB) { + return binancePayload; + } else if (chainId == ChainIds.AVALANCHE) { + return avalanchePayload; + } else if (chainId == ChainIds.GNOSIS) { + return gnosisPayload; + } + revert(); + } + + function getTrustedRemoteByChainId(uint256 chainId) public view returns (address) { + if (chainId == ChainIds.MAINNET) { + return GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER; + } else if (chainId == ChainIds.POLYGON) { + return GovernanceV3Polygon.CROSS_CHAIN_CONTROLLER; + } else if (chainId == ChainIds.AVALANCHE) { + return GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER; + } + revert(); + } + + function test_trustedRemotes() public { + ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] + memory receivers = BaseAdaptersUpdatePayload(payloadAddress) + .getReceiverBridgeAdaptersToAllow(); + + for (uint256 i = 0; i < receivers.length; i++) { + for (uint256 j = 0; j < receivers[i].chainIds.length; j++) { + assertEq( + getTrustedRemoteByChainId(receivers[i].chainIds[j]), + IBaseAdapter(receivers[i].bridgeAdapter).getTrustedRemoteByChainId( + receivers[i].chainIds[j] + ) + ); + } + } + } + + function test_correctPathConfiguration() public { + BaseAdaptersUpdatePayload.DestinationAdaptersInput[] + memory destinationConfigs = BaseAdaptersUpdatePayload(payloadAddress) + .getDestinationAdapters(); + + for (uint256 i = 0; i < destinationConfigs.length; i++) { + assertEq( + getPayloadByChainId(destinationConfigs[i].chainId).CCIP_NEW_ADAPTER(), + destinationConfigs[i].adapter + ); + } + } + + function test_correctAdapterNames() public { + ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] + memory receivers = BaseAdaptersUpdatePayload(payloadAddress) + .getReceiverBridgeAdaptersToAllow(); + + for (uint256 i = 0; i < receivers.length; i++) { + string memory adapterName = IBaseAdapter(receivers[i].bridgeAdapter).adapterName(); + assertEq(keccak256(abi.encode(adapterName)), keccak256(abi.encode('CCIP adapter'))); + } + } + + function test_receiversAreCorrectlySetAfterExecution() public { + ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] + memory beforeReceivers = BaseAdaptersUpdatePayload(payloadAddress) + .getReceiverBridgeAdaptersToAllow(); + + for (uint256 i = 0; i < beforeReceivers.length; i++) { + for (uint256 j = 0; j < beforeReceivers[i].chainIds.length; j++) { + assertEq( + ICrossChainReceiver(CROSS_CHAIN_CONTROLLER).isReceiverBridgeAdapterAllowed( + beforeReceivers[i].bridgeAdapter, + beforeReceivers[i].chainIds[j] + ), + false + ); + } + } + + executePayload(vm, payloadAddress); + + ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] + memory receivers = BaseAdaptersUpdatePayload(payloadAddress) + .getReceiverBridgeAdaptersToAllow(); + + for (uint256 i = 0; i < receivers.length; i++) { + for (uint256 j = 0; j < receivers[i].chainIds.length; j++) { + assertEq( + ICrossChainReceiver(CROSS_CHAIN_CONTROLLER).isReceiverBridgeAdapterAllowed( + receivers[i].bridgeAdapter, + receivers[i].chainIds[j] + ), + true + ); + } + } + } + + function test_onlyUpdatedNeededAdapter() public { + uint256[] memory supportedChainsBefore = ICrossChainReceiver(CROSS_CHAIN_CONTROLLER) + .getSupportedChains(); + AdaptersByChain[] memory adaptersBefore = _getCurrentReceiverAdaptersByChain(); + + executePayload(vm, payloadAddress); + + uint256[] memory supportedChainsAfter = ICrossChainReceiver(CROSS_CHAIN_CONTROLLER) + .getSupportedChains(); + + assertEq(supportedChainsBefore, supportedChainsAfter); + for (uint256 i = 0; i < supportedChainsBefore.length; i++) { + assertEq(supportedChainsAfter[i], supportedChainsBefore[i]); + } + + ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] + memory adaptersToRemove = BaseAdaptersUpdatePayload(payloadAddress) + .getReceiverBridgeAdaptersToRemove(); + + for (uint256 i = 0; i < adaptersBefore.length; i++) { + for (uint256 j = 0; j < adaptersToRemove.length; j++) { + for (uint256 x = 0; x < adaptersToRemove[j].chainIds.length; x++) { + if (adaptersToRemove[j].chainIds[x] == adaptersBefore[i].chainId) { + for (uint256 k = 0; k < adaptersBefore[i].adapters.length; k++) { + if (adaptersBefore[i].adapters[k] == adaptersToRemove[j].bridgeAdapter) { + assertEq( + ICrossChainReceiver(CROSS_CHAIN_CONTROLLER).isReceiverBridgeAdapterAllowed( + adaptersToRemove[j].bridgeAdapter, + adaptersBefore[i].chainId + ), + false + ); + } else { + assertEq( + ICrossChainReceiver(CROSS_CHAIN_CONTROLLER).isReceiverBridgeAdapterAllowed( + adaptersBefore[i].adapters[k], + adaptersBefore[i].chainId + ), + true + ); + } + } + } + } + } + } + } + + function test_forwarderAdaptersAreSet() public { + executePayload(vm, payloadAddress); + + ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] + memory forwarders = BaseAdaptersUpdatePayload(payloadAddress) + .getForwarderBridgeAdaptersToEnable(); + + for (uint256 i = 0; i < forwarders.length; i++) { + ICrossChainForwarder.ChainIdBridgeConfig[] + memory forwardersBridgeAdaptersByChain = ICrossChainForwarder(CROSS_CHAIN_CONTROLLER) + .getForwarderBridgeAdaptersByChain(forwarders[i].destinationChainId); + bool newAdapterFound; + for (uint256 j = 0; j < forwardersBridgeAdaptersByChain.length; j++) { + if ( + forwardersBridgeAdaptersByChain[j].destinationBridgeAdapter == + forwarders[i].destinationBridgeAdapter && + forwardersBridgeAdaptersByChain[j].currentChainBridgeAdapter == + forwarders[i].currentChainBridgeAdapter + ) { + newAdapterFound = true; + } + } + assertEq(newAdapterFound, true); + } + } + + function test_onlyChangedNeededForwarders() public { + ForwarderAdapters[] + memory forwardersBridgeAdaptersByChainBefore = _getCurrentForwarderAdaptersByChain(); + + ICrossChainForwarder.BridgeAdapterToDisable[] + memory adaptersToRemove = BaseAdaptersUpdatePayload(payloadAddress) + .getForwarderBridgeAdaptersToRemove(); + + executePayload(vm, payloadAddress); + + ForwarderAdapters[] + memory forwardersBridgeAdaptersByChainAfter = _getCurrentForwarderAdaptersByChain(); + + assertEq( + forwardersBridgeAdaptersByChainAfter.length, + forwardersBridgeAdaptersByChainBefore.length + ); + + for (uint256 l = 0; l < forwardersBridgeAdaptersByChainBefore.length; l++) { + for (uint256 j = 0; j < forwardersBridgeAdaptersByChainAfter.length; j++) { + if ( + forwardersBridgeAdaptersByChainBefore[l].chainId == + forwardersBridgeAdaptersByChainAfter[j].chainId + ) { + for (uint256 i = 0; i < forwardersBridgeAdaptersByChainBefore[l].adapters.length; i++) { + bool forwarderFound; + for (uint256 m = 0; m < forwardersBridgeAdaptersByChainAfter[j].adapters.length; m++) { + if ( + forwardersBridgeAdaptersByChainBefore[l].adapters[i].destinationBridgeAdapter == + forwardersBridgeAdaptersByChainAfter[j].adapters[m].destinationBridgeAdapter && + forwardersBridgeAdaptersByChainBefore[l].adapters[i].currentChainBridgeAdapter == + forwardersBridgeAdaptersByChainAfter[j].adapters[m].currentChainBridgeAdapter + ) { + forwarderFound = true; + break; + } + } + if (!forwarderFound) { + bool isAdapterToBeRemoved; + for (uint256 k = 0; k < adaptersToRemove.length; k++) { + if ( + forwardersBridgeAdaptersByChainBefore[l].adapters[i].currentChainBridgeAdapter == + adaptersToRemove[k].bridgeAdapter + ) { + for (uint256 n = 0; n < adaptersToRemove[k].chainIds.length; n++) { + if ( + forwardersBridgeAdaptersByChainBefore[l].chainId == + adaptersToRemove[k].chainIds[n] + ) { + isAdapterToBeRemoved = true; + break; + } + } + } + } + assertEq(isAdapterToBeRemoved, true); + } + } + } + } + } + } + + function _getCurrentForwarderAdaptersByChain() internal returns (ForwarderAdapters[] memory) { + uint256[] memory supportedChains = new uint256[](10); + supportedChains[0] = ChainIds.POLYGON; + supportedChains[1] = ChainIds.AVALANCHE; + supportedChains[2] = ChainIds.BNB; + supportedChains[3] = ChainIds.GNOSIS; + supportedChains[4] = ChainIds.ARBITRUM; + supportedChains[5] = ChainIds.OPTIMISM; + supportedChains[6] = ChainIds.METIS; + supportedChains[7] = ChainIds.BASE; + supportedChains[8] = ChainIds.SCROLL; + supportedChains[9] = ChainIds.MAINNET; + + ForwarderAdapters[] memory forwarderAdapters = new ForwarderAdapters[](supportedChains.length); + + for (uint256 i = 0; i < supportedChains.length; i++) { + ICrossChainForwarder.ChainIdBridgeConfig[] memory forwarders = ICrossChainForwarder( + CROSS_CHAIN_CONTROLLER + ).getForwarderBridgeAdaptersByChain(supportedChains[i]); + + forwarderAdapters[i] = ForwarderAdapters({adapters: forwarders, chainId: supportedChains[i]}); + } + return forwarderAdapters; + } + + function _getCurrentReceiverAdaptersByChain() internal returns (AdaptersByChain[] memory) { + uint256[] memory supportedChains = ICrossChainReceiver(CROSS_CHAIN_CONTROLLER) + .getSupportedChains(); + + AdaptersByChain[] memory receiverAdapters = new AdaptersByChain[](supportedChains.length); + + for (uint256 i = 0; i < supportedChains.length; i++) { + address[] memory receivers = ICrossChainReceiver(CROSS_CHAIN_CONTROLLER) + .getReceiverBridgeAdaptersByChain(supportedChains[i]); + + receiverAdapters[i] = AdaptersByChain({adapters: receivers, chainId: supportedChains[i]}); + } + + return receiverAdapters; + } +} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md new file mode 100644 index 000000000..0b6038be2 --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md @@ -0,0 +1,37 @@ +--- +title: "Hyperlane bridge adapter update to V3" +author: "BGD Labs @bgdlabs" +discussions: "" +--- + +## Simple Summary + +This proposal updates the bridge Hyperlane bridge adapters used on a.DI to connect Ethereum with Polygon, Avalanche, Binance and Gnosis to the new +Hyperlane V3 version. + +## Motivation + +The main motivation of this proposal is to bring the Hyperlane bridge adapters to the up to date version (V3) + +## Specification + +Updates the Hyperlane bridge adapters used to connect between networks to Hyperlane V3 and it also adds Adapter Name to the contracts +to make it easy to track off chain + +| Network | Hyperlane | +| --------- | ------------------------------------------------------------------------------------------------------------------------ | +| Ethereum | [0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1](https://etherscan.io/address/0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1) | +| Polygon | [0x3e72665008dC237bdd91C04C10782Ed1987a4019](https://polygonscan.com/address/0x3e72665008dC237bdd91C04C10782Ed1987a4019) | +| Avalanche | [0x617332a777780F546261247F621051d0b98975Eb](https://snowscan.xyz/address/0x617332a777780F546261247F621051d0b98975Eb) | +| Binance | [0x3F006299eC88985c18E6e885EeA29A49eC579882](https://bscscan.com/address/0x3F006299eC88985c18E6e885EeA29A49eC579882) | +| Gnosis | [0xA806DA549FcB2B4912a7dFFE4c1aA7A1ed0Bd5C9](https://bscscan.com/address/0xA806DA549FcB2B4912a7dFFE4c1aA7A1ed0Bd5C9) | + +## References + +- Implementation: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Polygon](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Avalanche](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Gnosis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3BNB](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol) +- Tests: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3Polygon](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3Avalanche](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3Gnosis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3BNB](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol) +- [Discussion](TODO) + +## Copyright + +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol new file mode 100644 index 000000000..de53ea912 --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol @@ -0,0 +1,178 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {GovV3Helpers, IPayloadsControllerCore, PayloadsControllerUtils} from 'aave-helpers/GovV3Helpers.sol'; +import {EthereumScript, PolygonScript, AvalancheScript, GnosisScript, BNBScript} from 'aave-helpers/ScriptUtils.sol'; +import {AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; +import {AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; +import {AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; +import {AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; +import {AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; + +/** + * @dev Deploy Ethereum + * deploy-command: make deploy-ledger contract=src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol:DeployEthereum chain=mainnet + * verify-command: npx catapulta-verify -b broadcast/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol/1/run-latest.json + */ +contract DeployEthereum is EthereumScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode + ); + + // compose action + IPayloadsControllerCore.ExecutionAction[] + memory actions = new IPayloadsControllerCore.ExecutionAction[](1); + actions[0] = GovV3Helpers.buildAction(payload0); + + // register action at payloadsController + GovV3Helpers.createPayload(actions); + } +} + +/** + * @dev Deploy Polygon + * deploy-command: make deploy-ledger contract=src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol:DeployPolygon chain=polygon + * verify-command: npx catapulta-verify -b broadcast/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol/137/run-latest.json + */ +contract DeployPolygon is PolygonScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode + ); + + // compose action + IPayloadsControllerCore.ExecutionAction[] + memory actions = new IPayloadsControllerCore.ExecutionAction[](1); + actions[0] = GovV3Helpers.buildAction(payload0); + + // register action at payloadsController + GovV3Helpers.createPayload(actions); + } +} + +/** + * @dev Deploy Avalanche + * deploy-command: make deploy-ledger contract=src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol:DeployAvalanche chain=avalanche + * verify-command: npx catapulta-verify -b broadcast/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol/43114/run-latest.json + */ +contract DeployAvalanche is AvalancheScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode + ); + + // compose action + IPayloadsControllerCore.ExecutionAction[] + memory actions = new IPayloadsControllerCore.ExecutionAction[](1); + actions[0] = GovV3Helpers.buildAction(payload0); + + // register action at payloadsController + GovV3Helpers.createPayload(actions); + } +} + +/** + * @dev Deploy Gnosis + * deploy-command: make deploy-ledger contract=src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol:DeployGnosis chain=gnosis + * verify-command: npx catapulta-verify -b broadcast/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol/100/run-latest.json + */ +contract DeployGnosis is GnosisScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode + ); + + // compose action + IPayloadsControllerCore.ExecutionAction[] + memory actions = new IPayloadsControllerCore.ExecutionAction[](1); + actions[0] = GovV3Helpers.buildAction(payload0); + + // register action at payloadsController + GovV3Helpers.createPayload(actions); + } +} + +/** + * @dev Deploy BNB + * deploy-command: make deploy-ledger contract=src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol:DeployBNB chain=bnb + * verify-command: npx catapulta-verify -b broadcast/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol/56/run-latest.json + */ +contract DeployBNB is BNBScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320).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/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol:CreateProposal chain=mainnet + */ +contract CreateProposal is EthereumScript { + function run() external { + // create payloads + PayloadsControllerUtils.Payload[] memory payloads = new PayloadsControllerUtils.Payload[](5); + + // compose actions for validation + IPayloadsControllerCore.ExecutionAction[] + memory actionsEthereum = new IPayloadsControllerCore.ExecutionAction[](1); + actionsEthereum[0] = GovV3Helpers.buildAction( + type(AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode + ); + payloads[0] = GovV3Helpers.buildMainnetPayload(vm, actionsEthereum); + + IPayloadsControllerCore.ExecutionAction[] + memory actionsPolygon = new IPayloadsControllerCore.ExecutionAction[](1); + actionsPolygon[0] = GovV3Helpers.buildAction( + type(AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode + ); + payloads[1] = GovV3Helpers.buildPolygonPayload(vm, actionsPolygon); + + IPayloadsControllerCore.ExecutionAction[] + memory actionsAvalanche = new IPayloadsControllerCore.ExecutionAction[](1); + actionsAvalanche[0] = GovV3Helpers.buildAction( + type(AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode + ); + payloads[2] = GovV3Helpers.buildAvalanchePayload(vm, actionsAvalanche); + + IPayloadsControllerCore.ExecutionAction[] + memory actionsGnosis = new IPayloadsControllerCore.ExecutionAction[](1); + actionsGnosis[0] = GovV3Helpers.buildAction( + type(AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode + ); + payloads[3] = GovV3Helpers.buildGnosisPayload(vm, actionsGnosis); + + IPayloadsControllerCore.ExecutionAction[] + memory actionsBNB = new IPayloadsControllerCore.ExecutionAction[](1); + actionsBNB[0] = GovV3Helpers.buildAction( + type(AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode + ); + payloads[4] = GovV3Helpers.buildBNBPayload(vm, actionsBNB); + + // create proposal + vm.startBroadcast(); + GovV3Helpers.createProposal( + vm, + payloads, + GovV3Helpers.ipfsHashFile( + vm, + 'src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md' + ) + ); + } +} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/config.ts b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/config.ts new file mode 100644 index 000000000..4497b0852 --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/config.ts @@ -0,0 +1,19 @@ +import {ConfigFile} from '../../generator/types'; +export const config: ConfigFile = { + rootOptions: { + author: 'BGD Labs @bgdlabs', + pools: ['AaveV3Ethereum', 'AaveV3Polygon', 'AaveV3Avalanche', 'AaveV3Gnosis', 'AaveV3BNB'], + title: 'Hyperlane bridge adapter update to V3', + shortName: 'HyperlaneBridgeAdapterUpdateToV3', + date: '20240320', + discussion: '', + snapshot: '', + }, + poolOptions: { + AaveV3Ethereum: {configs: {OTHERS: {}}, cache: {blockNumber: 19476776}}, + AaveV3Polygon: {configs: {OTHERS: {}}, cache: {blockNumber: 54882095}}, + AaveV3Avalanche: {configs: {OTHERS: {}}, cache: {blockNumber: 43150105}}, + AaveV3Gnosis: {configs: {OTHERS: {}}, cache: {blockNumber: 33027304}}, + AaveV3BNB: {configs: {OTHERS: {}}, cache: {blockNumber: 37137492}}, + }, +}; From afa345a9cd9121449c4500b2808ed27abb48cc0b Mon Sep 17 00:00:00 2001 From: sendra Date: Wed, 20 Mar 2024 18:12:31 +0100 Subject: [PATCH 07/17] fix: fixed compilation errors --- ...V3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol | 2 ++ .../AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol | 4 +++- ...eV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol | 4 +++- ...aveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol | 4 +++- ...eV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol | 2 +- ...veV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol | 4 +++- .../BaseAdaptersUpdatePayload.sol | 1 + .../BaseTest.sol | 5 +++-- 8 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol index b170eea69..0fb1690aa 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -2,6 +2,8 @@ pragma solidity ^0.8.0; import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; +import {GovernanceV3Avalanche} from 'aave-address-book/GovernanceV3Avalanche.sol'; +import {ChainIds} from 'aave-helpers/ChainIds.sol'; /** * @title Hyperlane bridge adapter update to V3 diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol index 8cdf3f77f..736a5b81c 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -2,6 +2,8 @@ pragma solidity ^0.8.0; import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; +import {GovernanceV3BNB} from 'aave-address-book/GovernanceV3BNB.sol'; +import {ChainIds} from 'aave-helpers/ChainIds.sol'; /** * @title Hyperlane bridge adapter update to V3 @@ -12,7 +14,7 @@ import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; contract AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320 is BaseAdaptersUpdatePayload( BaseAdaptersUpdatePayload.ConstructorInput({ - ccc: GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER, + ccc: GovernanceV3BNB.CROSS_CHAIN_CONTROLLER, hlNewAdapter: 0x3F006299eC88985c18E6e885EeA29A49eC579882, hlAdapterToRemove: 0x118DFD5418890c0332042ab05173Db4A2C1d283c }) diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol index e8087fe71..239ffe5ed 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -2,6 +2,8 @@ pragma solidity ^0.8.0; import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; +import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; +import {ChainIds} from 'aave-helpers/ChainIds.sol'; /** * @title Hyperlane bridge adapter update to V3 @@ -12,7 +14,7 @@ import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; contract AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320 is BaseAdaptersUpdatePayload( BaseAdaptersUpdatePayload.ConstructorInput({ - ccc: GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER, + ccc: GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER, hlNewAdapter: 0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1, hlAdapterToRemove: 0x6Abb61beb5848B476d026C4934E8a6415e2E75a8 }) diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol index 04b9ef9f8..da3b98816 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -2,6 +2,8 @@ pragma solidity ^0.8.0; import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; +import {GovernanceV3Gnosis} from 'aave-address-book/GovernanceV3Gnosis.sol'; +import {ChainIds} from 'aave-helpers/ChainIds.sol'; /** * @title Hyperlane bridge adapter update to V3 @@ -12,7 +14,7 @@ import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; contract AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320 is BaseAdaptersUpdatePayload( BaseAdaptersUpdatePayload.ConstructorInput({ - ccc: GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER, + ccc: GovernanceV3Gnosis.CROSS_CHAIN_CONTROLLER, hlNewAdapter: 0xA806DA549FcB2B4912a7dFFE4c1aA7A1ed0Bd5C9, hlAdapterToRemove: 0x4A4c73d563395ad827511F70097d4Ef82E653805 }) diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol index ad575883e..203faf2c9 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol @@ -9,7 +9,7 @@ import {AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Gn * @dev Test for AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320 * command: make test-contract filter=AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320 */ -contract AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320_Test is ProtocolV3TestBase { +contract AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320_Test is BaseTest { constructor() BaseTest( GovernanceV3Gnosis.CROSS_CHAIN_CONTROLLER, diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol index 0ddb11e46..86e54a1c9 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -2,6 +2,8 @@ pragma solidity ^0.8.0; import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; +import {GovernanceV3Polygon} from 'aave-address-book/GovernanceV3Polygon.sol'; +import {ChainIds} from 'aave-helpers/ChainIds.sol'; /** * @title Hyperlane bridge adapter update to V3 @@ -12,7 +14,7 @@ import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; contract AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320 is BaseAdaptersUpdatePayload( BaseAdaptersUpdatePayload.ConstructorInput({ - ccc: GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER, + ccc: GovernanceV3Polygon.CROSS_CHAIN_CONTROLLER, hlNewAdapter: 0x3e72665008dC237bdd91C04C10782Ed1987a4019, hlAdapterToRemove: 0x3c25b96fF62D21E90556869272a277eE2E229747 }) diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseAdaptersUpdatePayload.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseAdaptersUpdatePayload.sol index 98bda15f4..427907aa4 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseAdaptersUpdatePayload.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseAdaptersUpdatePayload.sol @@ -1,5 +1,6 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; + import {ICrossChainReceiver, ICrossChainForwarder} from 'aave-address-book/common/ICrossChainController.sol'; import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseTest.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseTest.sol index ea326e256..750cf5395 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseTest.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseTest.sol @@ -4,6 +4,7 @@ pragma solidity ^0.8.0; import 'forge-std/console.sol'; import 'aave-helpers/ProtocolV3TestBase.sol'; +import {GovV3Helpers} from 'aave-helpers/GovV3Helpers.sol'; import {ProtocolV3TestBase} from 'aave-helpers/ProtocolV3TestBase.sol'; import {ICrossChainReceiver, ICrossChainForwarder} from 'aave-address-book/common/ICrossChainController.sol'; import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol'; @@ -79,7 +80,7 @@ abstract contract BaseTest is ProtocolV3TestBase { payloadCode = _payloadCode; } - function setUp() public override { + function setUp() public { vm.createSelectFork(vm.rpcUrl(network), blockNumber); payloadAddress = GovV3Helpers.deployDeterministic(payloadCode); @@ -140,7 +141,7 @@ abstract contract BaseTest is ProtocolV3TestBase { for (uint256 i = 0; i < destinationConfigs.length; i++) { assertEq( - getPayloadByChainId(destinationConfigs[i].chainId).CCIP_NEW_ADAPTER(), + getPayloadByChainId(destinationConfigs[i].chainId).HL_NEW_ADAPTER(), destinationConfigs[i].adapter ); } From 59241ee5848ebdfeb03e24de36b7c1399f4012fc Mon Sep 17 00:00:00 2001 From: sendra Date: Thu, 21 Mar 2024 15:45:38 +0100 Subject: [PATCH 08/17] fix: added reference to code diffs --- .../UpdateADIImplementationAndCCIPAdapters.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md index c3bf57dc1..22e01be28 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md @@ -46,6 +46,11 @@ Updates the bridge adapters used to connect between networks | Avalanche | [0x2b88C83727B0E290B76EB3F6133994fF81B7f355](https://snowscan.xyz/address/0x2b88C83727B0E290B76EB3F6133994fF81B7f355) | | Binance | [0xAE93BEa44dcbE52B625169588574d31e36fb3A67](https://bscscan.com/address/0xAE93BEa44dcbE52B625169588574d31e36fb3A67) | +Code diffs for the different networks can be checked on a.DI diff repository for [revision 2](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2). + +- Adapter diffs: [CCIPAdapter](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2/ccip), [BaseAdapter](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2/base_adapter), [IBaseAdapter](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2/i_base_adapter) +- CCC Diffs: [Forwarder](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2/ccc_impl), [Errors](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2/errors) + ## References - Implementation: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Polygon](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Avalanche](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Optimism](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Arbitrum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Metis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Base](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Gnosis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3Scroll](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.sol), [AaveV3BNB](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.sol) From 2e2797428ba51594b9fe43ddb47a04dc2736d31d Mon Sep 17 00:00:00 2001 From: sendra Date: Thu, 21 Mar 2024 15:50:10 +0100 Subject: [PATCH 09/17] fix: linting --- .../UpdateADIImplementationAndCCIPAdapters.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md index 22e01be28..247bae65b 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md @@ -47,9 +47,8 @@ Updates the bridge adapters used to connect between networks | Binance | [0xAE93BEa44dcbE52B625169588574d31e36fb3A67](https://bscscan.com/address/0xAE93BEa44dcbE52B625169588574d31e36fb3A67) | Code diffs for the different networks can be checked on a.DI diff repository for [revision 2](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2). - -- Adapter diffs: [CCIPAdapter](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2/ccip), [BaseAdapter](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2/base_adapter), [IBaseAdapter](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2/i_base_adapter) -- CCC Diffs: [Forwarder](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2/ccc_impl), [Errors](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2/errors) +Adapter diffs: [CCIPAdapter](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2/ccip), [BaseAdapter](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2/base_adapter), [IBaseAdapter](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2/i_base_adapter) +CCC Diffs: [Forwarder](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2/ccc_impl), [Errors](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2/errors) ## References From f6925ac2a8468e85c977810b9c604439c6449cdf Mon Sep 17 00:00:00 2001 From: sendra Date: Thu, 21 Mar 2024 16:04:40 +0100 Subject: [PATCH 10/17] fix: ran lint fix --- lib/aave-helpers | 2 +- ...bitrum_UpdateADIImplementationAndCCIPAdapters_20240313.sol | 4 +--- ...trum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol | 4 +--- ...V3Base_UpdateADIImplementationAndCCIPAdapters_20240313.sol | 4 +--- ...Base_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol | 4 +--- ...Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.sol | 4 +--- ...osis_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol | 4 +--- ...3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.sol | 4 +--- ...etis_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol | 4 +--- ...timism_UpdateADIImplementationAndCCIPAdapters_20240313.sol | 4 +--- ...mism_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol | 4 +--- ...Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.sol | 4 +--- ...roll_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol | 4 +--- 13 files changed, 13 insertions(+), 37 deletions(-) diff --git a/lib/aave-helpers b/lib/aave-helpers index e716f3291..5446518a5 160000 --- a/lib/aave-helpers +++ b/lib/aave-helpers @@ -1 +1 @@ -Subproject commit e716f32915a2fc1e3b7bf6ccdf913efb8b8ace96 +Subproject commit 5446518a5e5a22a0d649305f8dd05d099c1aea55 diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.sol index a3030e5bd..da9f23131 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.sol +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -18,6 +18,4 @@ contract AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313 is newCCCImplementation: 0x6e633269af45F37c44659D98f382dd0DD524E5Df }) ) -{ - -} +{} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol index 7ad9133b2..c64ea61fe 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -18,6 +18,4 @@ contract AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313_Test is 'arbitrum', 189596312 ) -{ - -} +{} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.sol index d6ed97266..90e975b89 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.sol +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -18,6 +18,4 @@ contract AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313 is newCCCImplementation: 0x9b6f5ef589A3DD08670Dd146C11C4Fb33E04494F }) ) -{ - -} +{} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol index 88b0f61f6..4bc7cc4af 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -18,6 +18,4 @@ contract AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313_Test is 'base', 11725901 ) -{ - -} +{} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.sol index bc9fa4b51..d07749aea 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.sol +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -18,6 +18,4 @@ contract AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313 is newCCCImplementation: 0x5e06b10B3b9c3E1c0996D2544A35B9839Be02922 }) ) -{ - -} +{} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol index 71b99ecf0..c68702fb7 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -18,6 +18,4 @@ contract AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313_Test is 'gnosis', 32990165 ) -{ - -} +{} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.sol index 6913b3d4b..28b627c48 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.sol +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -18,6 +18,4 @@ contract AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313 is newCCCImplementation: 0xa198Fac58E02A5C5F8F7e877895d50cFa9ad1E04 }) ) -{ - -} +{} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol index fb7beb526..2b45e7c5b 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -18,6 +18,4 @@ contract AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313_Test is 'metis', 15127085 ) -{ - -} +{} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.sol index f1288e44b..b78cab479 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.sol +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -18,6 +18,4 @@ contract AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313 is newCCCImplementation: 0xa5cc218513305221201f196760E9e64e9D49d98A }) ) -{ - -} +{} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol index c9e6534ac..d6717230d 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -18,6 +18,4 @@ contract AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313_Test is 'optimism', 117321235 ) -{ - -} +{} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.sol index c48042a90..e32cd1d8a 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.sol +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -18,6 +18,4 @@ contract AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313 is newCCCImplementation: 0x5e06b10B3b9c3E1c0996D2544A35B9839Be02922 }) ) -{ - -} +{} diff --git a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol index 751eee27a..4b6b34610 100644 --- a/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -18,6 +18,4 @@ contract AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313_Test is 'scroll', 4063725 ) -{ - -} +{} From e8ac6bb78a4dcfc8e3448ea27c621b63310c5cae Mon Sep 17 00:00:00 2001 From: sendra Date: Thu, 21 Mar 2024 16:56:34 +0100 Subject: [PATCH 11/17] fix: fixed tests --- ...aveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol | 2 +- .../BaseTest.sol | 2 +- .../HyperlaneBridgeAdapterUpdateToV3.md | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol index 203faf2c9..ec83f95d4 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol @@ -15,7 +15,7 @@ contract AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320_Test is BaseTest GovernanceV3Gnosis.CROSS_CHAIN_CONTROLLER, type(AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode, 'gnosis', - 33027304 + 33043984 ) {} } diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseTest.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseTest.sol index 750cf5395..793b24de9 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseTest.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseTest.sol @@ -154,7 +154,7 @@ abstract contract BaseTest is ProtocolV3TestBase { for (uint256 i = 0; i < receivers.length; i++) { string memory adapterName = IBaseAdapter(receivers[i].bridgeAdapter).adapterName(); - assertEq(keccak256(abi.encode(adapterName)), keccak256(abi.encode('CCIP adapter'))); + assertEq(keccak256(abi.encode(adapterName)), keccak256(abi.encode('Hyperlane adapter'))); } } diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md index 0b6038be2..2ccdef3a5 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md @@ -26,6 +26,9 @@ to make it easy to track off chain | Binance | [0x3F006299eC88985c18E6e885EeA29A49eC579882](https://bscscan.com/address/0x3F006299eC88985c18E6e885EeA29A49eC579882) | | Gnosis | [0xA806DA549FcB2B4912a7dFFE4c1aA7A1ed0Bd5C9](https://bscscan.com/address/0xA806DA549FcB2B4912a7dFFE4c1aA7A1ed0Bd5C9) | +Code diffs for the different networks can be checked on a.DI diff repository for [revision 2](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2). +Adapter diffs: [HLAdapter](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2/hyperlane), [BaseAdapter](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2/base_adapter), [IBaseAdapter](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2/i_base_adapter) + ## References - Implementation: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Polygon](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Avalanche](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Gnosis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3BNB](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol) From acb9e6888803d362380bad9bab3362cab3213482 Mon Sep 17 00:00:00 2001 From: sendra Date: Mon, 25 Mar 2024 17:29:22 +0100 Subject: [PATCH 12/17] fix: dont remove forwarders if there is no need --- ...erlaneBridgeAdapterUpdateToV3_20240320.sol | 11 +++++- ...erlaneBridgeAdapterUpdateToV3_20240320.sol | 11 +++++- .../BaseAdaptersUpdatePayload.sol | 37 ++++++++++--------- 3 files changed, 39 insertions(+), 20 deletions(-) diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol index 736a5b81c..091091406 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; +import {BaseAdaptersUpdatePayload, ICrossChainForwarder} from './BaseAdaptersUpdatePayload.sol'; import {GovernanceV3BNB} from 'aave-address-book/GovernanceV3BNB.sol'; import {ChainIds} from 'aave-helpers/ChainIds.sol'; @@ -25,4 +25,13 @@ contract AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320 is chains[0] = ChainIds.MAINNET; return chains; } + + function getForwarderBridgeAdaptersToRemove() + public + pure + override + returns (ICrossChainForwarder.BridgeAdapterToDisable[] memory) + { + return new ICrossChainForwarder.BridgeAdapterToDisable[](0); + } } diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol index da3b98816..53064d7d7 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; +import {BaseAdaptersUpdatePayload, ICrossChainForwarder} from './BaseAdaptersUpdatePayload.sol'; import {GovernanceV3Gnosis} from 'aave-address-book/GovernanceV3Gnosis.sol'; import {ChainIds} from 'aave-helpers/ChainIds.sol'; @@ -25,4 +25,13 @@ contract AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320 is chains[0] = ChainIds.MAINNET; return chains; } + + function getForwarderBridgeAdaptersToRemove() + public + pure + override + returns (ICrossChainForwarder.BridgeAdapterToDisable[] memory) + { + return new ICrossChainForwarder.BridgeAdapterToDisable[](0); + } } diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseAdaptersUpdatePayload.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseAdaptersUpdatePayload.sol index 427907aa4..e7fd1ee7d 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseAdaptersUpdatePayload.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseAdaptersUpdatePayload.sol @@ -31,30 +31,30 @@ abstract contract BaseAdaptersUpdatePayload is IProposalGenericExecutor { function execute() public override { // remove old Receiver bridge adapter - ICrossChainReceiver(CROSS_CHAIN_CONTROLLER).disallowReceiverBridgeAdapters( - getReceiverBridgeAdaptersToRemove() - ); + ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] + memory receiversToRemove = getReceiverBridgeAdaptersToRemove(); + if (receiversToRemove.length != 0) { + ICrossChainReceiver(CROSS_CHAIN_CONTROLLER).disallowReceiverBridgeAdapters(receiversToRemove); + } // remove forwarding adapters - ICrossChainForwarder(CROSS_CHAIN_CONTROLLER).disableBridgeAdapters( - getForwarderBridgeAdaptersToRemove() - ); - - uint256[] memory chainsToSend = getChainsToSend(); - uint256[] memory chainsToReceive = getChainsToReceive(); + ICrossChainForwarder.BridgeAdapterToDisable[] + memory forwardersToRemove = getForwarderBridgeAdaptersToRemove(); + if (forwardersToRemove.length != 0) { + ICrossChainForwarder(CROSS_CHAIN_CONTROLLER).disableBridgeAdapters(forwardersToRemove); + } - if (chainsToReceive.length != 0) { + ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] + memory receiversToAllow = getReceiverBridgeAdaptersToAllow(); + if (receiversToAllow.length != 0) { // add receiver adapters - ICrossChainReceiver(CROSS_CHAIN_CONTROLLER).allowReceiverBridgeAdapters( - getReceiverBridgeAdaptersToAllow() - ); + ICrossChainReceiver(CROSS_CHAIN_CONTROLLER).allowReceiverBridgeAdapters(receiversToAllow); } - - if (chainsToSend.length != 0) { + ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] + memory forwardersToEnable = getForwarderBridgeAdaptersToEnable(); + if (forwardersToEnable.length != 0) { // add forwarding adapters - ICrossChainForwarder(CROSS_CHAIN_CONTROLLER).enableBridgeAdapters( - getForwarderBridgeAdaptersToEnable() - ); + ICrossChainForwarder(CROSS_CHAIN_CONTROLLER).enableBridgeAdapters(forwardersToEnable); } } @@ -99,6 +99,7 @@ abstract contract BaseAdaptersUpdatePayload is IProposalGenericExecutor { function getForwarderBridgeAdaptersToRemove() public view + virtual returns (ICrossChainForwarder.BridgeAdapterToDisable[] memory) { ICrossChainForwarder.BridgeAdapterToDisable[] From 9d7e01a81bfb35aec66748c89b965e3ed20c2c85 Mon Sep 17 00:00:00 2001 From: sendra Date: Tue, 16 Apr 2024 15:21:25 +0200 Subject: [PATCH 13/17] Fix/hyperlane use new helpers and remove old native adapters (#294) * fix: Updated with new helpers usage and diffs * fix: added removal of old native bridges * fix: updated readme * fix: updated aave helpers --- ...eBridgeAdapterUpdateToV3_20240320_after.md | 14 + ...eBridgeAdapterUpdateToV3_20240320_after.md | 30 ++ ...eBridgeAdapterUpdateToV3_20240320_after.md | 18 + ...eBridgeAdapterUpdateToV3_20240320_after.md | 14 + ...eBridgeAdapterUpdateToV3_20240320_after.md | 70 ++++ ...eBridgeAdapterUpdateToV3_20240320_after.md | 18 + ...eBridgeAdapterUpdateToV3_20240320_after.md | 14 + ...eBridgeAdapterUpdateToV3_20240320_after.md | 14 + ...eBridgeAdapterUpdateToV3_20240320_after.md | 30 ++ ...eBridgeAdapterUpdateToV3_20240320_after.md | 14 + lib/aave-helpers | 2 +- ...erlaneBridgeAdapterUpdateToV3_20240320.sol | 28 ++ ...laneBridgeAdapterUpdateToV3_20240320.t.sol | 31 ++ ...erlaneBridgeAdapterUpdateToV3_20240320.sol | 10 +- ...laneBridgeAdapterUpdateToV3_20240320.t.sol | 40 +- ...erlaneBridgeAdapterUpdateToV3_20240320.sol | 19 +- ...laneBridgeAdapterUpdateToV3_20240320.t.sol | 25 +- ...erlaneBridgeAdapterUpdateToV3_20240320.sol | 28 ++ ...laneBridgeAdapterUpdateToV3_20240320.t.sol | 31 ++ ...erlaneBridgeAdapterUpdateToV3_20240320.sol | 10 +- ...laneBridgeAdapterUpdateToV3_20240320.t.sol | 56 ++- ...erlaneBridgeAdapterUpdateToV3_20240320.sol | 19 +- ...laneBridgeAdapterUpdateToV3_20240320.t.sol | 25 +- ...erlaneBridgeAdapterUpdateToV3_20240320.sol | 28 ++ ...laneBridgeAdapterUpdateToV3_20240320.t.sol | 31 ++ ...erlaneBridgeAdapterUpdateToV3_20240320.sol | 28 ++ ...laneBridgeAdapterUpdateToV3_20240320.t.sol | 31 ++ ...erlaneBridgeAdapterUpdateToV3_20240320.sol | 10 +- ...laneBridgeAdapterUpdateToV3_20240320.t.sol | 41 +- ...erlaneBridgeAdapterUpdateToV3_20240320.sol | 28 ++ ...laneBridgeAdapterUpdateToV3_20240320.t.sol | 31 ++ .../BaseAdaptersUpdatePayload.sol | 154 -------- .../BaseTest.sol | 374 ------------------ .../HyperlaneBridgeAdapterUpdateToV3.md | 10 +- ...laneBridgeAdapterUpdateToV3_20240320.s.sol | 154 +++++++- .../config.ts | 19 +- 36 files changed, 876 insertions(+), 623 deletions(-) create mode 100644 diffs/adi_AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md create mode 100644 diffs/adi_AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md create mode 100644 diffs/adi_AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md create mode 100644 diffs/adi_AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md create mode 100644 diffs/adi_AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md create mode 100644 diffs/adi_AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md create mode 100644 diffs/adi_AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md create mode 100644 diffs/adi_AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md create mode 100644 diffs/adi_AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md create mode 100644 diffs/adi_AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320.sol create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320.sol create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320.sol create mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol delete mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseAdaptersUpdatePayload.sol delete mode 100644 src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseTest.sol diff --git a/diffs/adi_AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md b/diffs/adi_AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md new file mode 100644 index 000000000..18d683103 --- /dev/null +++ b/diffs/adi_AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md @@ -0,0 +1,14 @@ +## Raw diff + +```json +{ + "receiverAdaptersByChain": { + "1": { + "0x3829943c53F2d00e20B58475aF19716724bF90Ba": { + "from": true, + "to": null + } + } + } +} +``` \ No newline at end of file diff --git a/diffs/adi_AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md b/diffs/adi_AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md new file mode 100644 index 000000000..25e950947 --- /dev/null +++ b/diffs/adi_AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md @@ -0,0 +1,30 @@ +## Raw diff + +```json +{ + "forwarderAdaptersByChain": { + "1": { + "0xa198Fac58E02A5C5F8F7e877895d50cFa9ad1E04": { + "from": "0x6Abb61beb5848B476d026C4934E8a6415e2E75a8", + "to": null + }, + "0x617332a777780F546261247F621051d0b98975Eb": { + "from": null, + "to": "0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1" + } + } + }, + "receiverAdaptersByChain": { + "1": { + "0xa198Fac58E02A5C5F8F7e877895d50cFa9ad1E04": { + "from": true, + "to": null + }, + "0x617332a777780F546261247F621051d0b98975Eb": { + "from": null, + "to": true + } + } + } +} +``` \ No newline at end of file diff --git a/diffs/adi_AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md b/diffs/adi_AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md new file mode 100644 index 000000000..e9447bbc3 --- /dev/null +++ b/diffs/adi_AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md @@ -0,0 +1,18 @@ +## Raw diff + +```json +{ + "receiverAdaptersByChain": { + "1": { + "0x118DFD5418890c0332042ab05173Db4A2C1d283c": { + "from": true, + "to": null + }, + "0x3F006299eC88985c18E6e885EeA29A49eC579882": { + "from": null, + "to": true + } + } + } +} +``` \ No newline at end of file diff --git a/diffs/adi_AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md b/diffs/adi_AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md new file mode 100644 index 000000000..90c427209 --- /dev/null +++ b/diffs/adi_AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md @@ -0,0 +1,14 @@ +## Raw diff + +```json +{ + "receiverAdaptersByChain": { + "1": { + "0x7b62461a3570c6AC8a9f8330421576e417B71EE7": { + "from": true, + "to": null + } + } + } +} +``` \ No newline at end of file diff --git a/diffs/adi_AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md b/diffs/adi_AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md new file mode 100644 index 000000000..f67469d0d --- /dev/null +++ b/diffs/adi_AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md @@ -0,0 +1,70 @@ +## Raw diff + +```json +{ + "forwarderAdaptersByChain": { + "56": { + "0x6Abb61beb5848B476d026C4934E8a6415e2E75a8": { + "from": "0x118DFD5418890c0332042ab05173Db4A2C1d283c", + "to": null + }, + "0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1": { + "from": null, + "to": "0x3F006299eC88985c18E6e885EeA29A49eC579882" + } + }, + "100": { + "0x6Abb61beb5848B476d026C4934E8a6415e2E75a8": { + "from": "0x4A4c73d563395ad827511F70097d4Ef82E653805", + "to": null + }, + "0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1": { + "from": null, + "to": "0xA806DA549FcB2B4912a7dFFE4c1aA7A1ed0Bd5C9" + } + }, + "137": { + "0x6Abb61beb5848B476d026C4934E8a6415e2E75a8": { + "from": "0x3c25b96fF62D21E90556869272a277eE2E229747", + "to": null + }, + "0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1": { + "from": null, + "to": "0x3e72665008dC237bdd91C04C10782Ed1987a4019" + } + }, + "43114": { + "0x6Abb61beb5848B476d026C4934E8a6415e2E75a8": { + "from": "0xa198Fac58E02A5C5F8F7e877895d50cFa9ad1E04", + "to": null + }, + "0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1": { + "from": null, + "to": "0x617332a777780F546261247F621051d0b98975Eb" + } + } + }, + "receiverAdaptersByChain": { + "137": { + "0x6Abb61beb5848B476d026C4934E8a6415e2E75a8": { + "from": true, + "to": null + }, + "0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1": { + "from": null, + "to": true + } + }, + "43114": { + "0x6Abb61beb5848B476d026C4934E8a6415e2E75a8": { + "from": true, + "to": null + }, + "0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1": { + "from": null, + "to": true + } + } + } +} +``` \ No newline at end of file diff --git a/diffs/adi_AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md b/diffs/adi_AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md new file mode 100644 index 000000000..761269b6a --- /dev/null +++ b/diffs/adi_AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md @@ -0,0 +1,18 @@ +## Raw diff + +```json +{ + "receiverAdaptersByChain": { + "1": { + "0x4A4c73d563395ad827511F70097d4Ef82E653805": { + "from": true, + "to": null + }, + "0xA806DA549FcB2B4912a7dFFE4c1aA7A1ed0Bd5C9": { + "from": null, + "to": true + } + } + } +} +``` \ No newline at end of file diff --git a/diffs/adi_AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md b/diffs/adi_AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md new file mode 100644 index 000000000..286a9dcc5 --- /dev/null +++ b/diffs/adi_AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md @@ -0,0 +1,14 @@ +## Raw diff + +```json +{ + "receiverAdaptersByChain": { + "1": { + "0x746c675dAB49Bcd5BB9Dc85161f2d7Eb435009bf": { + "from": true, + "to": null + } + } + } +} +``` \ No newline at end of file diff --git a/diffs/adi_AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md b/diffs/adi_AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md new file mode 100644 index 000000000..f20b62454 --- /dev/null +++ b/diffs/adi_AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md @@ -0,0 +1,14 @@ +## Raw diff + +```json +{ + "receiverAdaptersByChain": { + "1": { + "0x81d32B36380e6266e1BDd490eAC56cdB300afBe0": { + "from": true, + "to": null + } + } + } +} +``` \ No newline at end of file diff --git a/diffs/adi_AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md b/diffs/adi_AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md new file mode 100644 index 000000000..d2944d375 --- /dev/null +++ b/diffs/adi_AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md @@ -0,0 +1,30 @@ +## Raw diff + +```json +{ + "forwarderAdaptersByChain": { + "1": { + "0x3c25b96fF62D21E90556869272a277eE2E229747": { + "from": "0x6Abb61beb5848B476d026C4934E8a6415e2E75a8", + "to": null + }, + "0x3e72665008dC237bdd91C04C10782Ed1987a4019": { + "from": null, + "to": "0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1" + } + } + }, + "receiverAdaptersByChain": { + "1": { + "0x3c25b96fF62D21E90556869272a277eE2E229747": { + "from": true, + "to": null + }, + "0x3e72665008dC237bdd91C04C10782Ed1987a4019": { + "from": null, + "to": true + } + } + } +} +``` \ No newline at end of file diff --git a/diffs/adi_AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md b/diffs/adi_AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md new file mode 100644 index 000000000..bd1f2e7f9 --- /dev/null +++ b/diffs/adi_AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320_before_adi_AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320_after.md @@ -0,0 +1,14 @@ +## Raw diff + +```json +{ + "receiverAdaptersByChain": { + "1": { + "0x118DFD5418890c0332042ab05173Db4A2C1d283c": { + "from": true, + "to": null + } + } + } +} +``` \ No newline at end of file diff --git a/lib/aave-helpers b/lib/aave-helpers index ffdfec57e..8ff94a640 160000 --- a/lib/aave-helpers +++ b/lib/aave-helpers @@ -1 +1 @@ -Subproject commit ffdfec57ed1b7f90afbcdb108efc1141e91bc479 +Subproject commit 8ff94a640b0dc72649686357709a6396508f0ea6 diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol new file mode 100644 index 000000000..4129c9f1f --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import 'aave-helpers/adi/SimpleReceiverAdapterUpdate.sol'; +import {GovernanceV3Arbitrum} from 'aave-address-book/GovernanceV3Arbitrum.sol'; +import {ChainIds} from 'aave-helpers/ChainIds.sol'; + +/** + * @title Hyperlane bridge adapter update to V3 + * @author BGD Labs @bgdlabs + * - Snapshot: TODO + * - Discussion: TODO + */ +contract AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320 is + SimpleReceiverAdapterUpdate( + SimpleReceiverAdapterUpdate.ConstructorInput({ + ccc: GovernanceV3Arbitrum.CROSS_CHAIN_CONTROLLER, + newAdapter: address(0), // no new adapter + adapterToRemove: 0x3829943c53F2d00e20B58475aF19716724bF90Ba + }) + ) +{ + function getChainsToReceive() public pure override returns (uint256[] memory) { + uint256[] memory chains = new uint256[](1); + chains[0] = ChainIds.MAINNET; + return chains; + } +} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol new file mode 100644 index 000000000..64b871ab3 --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import 'aave-helpers/adi/test/ADITestBase.sol'; +import {GovernanceV3Arbitrum} from 'aave-address-book/GovernanceV3Arbitrum.sol'; +import {AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; + +/** + * @dev Test for AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320 + * command: make test-contract filter=AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320 + */ +contract AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320_Test is ADITestBase { + AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320 internal payload; + + function setUp() public { + vm.createSelectFork(vm.rpcUrl('arbitrum'), 201314733); + payload = new AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320(); + } + + /** + * @dev executes the generic test suite including e2e and config snapshots + */ + function test_defaultProposalExecution() public { + defaultTest( + 'AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320', + GovernanceV3Arbitrum.CROSS_CHAIN_CONTROLLER, + address(payload), + true + ); + } +} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol index 0fb1690aa..fb0faea76 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; import {GovernanceV3Avalanche} from 'aave-address-book/GovernanceV3Avalanche.sol'; import {ChainIds} from 'aave-helpers/ChainIds.sol'; +import 'aave-helpers/adi/SimpleOneToManyAdapterUpdate.sol'; /** * @title Hyperlane bridge adapter update to V3 @@ -12,11 +12,11 @@ import {ChainIds} from 'aave-helpers/ChainIds.sol'; * - Discussion: TODO */ contract AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320 is - BaseAdaptersUpdatePayload( - BaseAdaptersUpdatePayload.ConstructorInput({ + SimpleOneToManyAdapterUpdate( + SimpleOneToManyAdapterUpdate.ConstructorInput({ ccc: GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER, - hlNewAdapter: 0x617332a777780F546261247F621051d0b98975Eb, - hlAdapterToRemove: 0xa198Fac58E02A5C5F8F7e877895d50cFa9ad1E04 + newAdapter: 0x617332a777780F546261247F621051d0b98975Eb, + adapterToRemove: 0xa198Fac58E02A5C5F8F7e877895d50cFa9ad1E04 }) ) { diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol index fd1d93f57..92a68b469 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol @@ -3,19 +3,41 @@ pragma solidity ^0.8.0; import {GovernanceV3Avalanche} from 'aave-address-book/GovernanceV3Avalanche.sol'; import {AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; -import './BaseTest.sol'; +import 'aave-helpers/adi/test/ADITestBase.sol'; +import {AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; /** * @dev Test for AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320 * command: make test-contract filter=AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320 */ -contract AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320_Test is BaseTest { - constructor() - BaseTest( +contract AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320_Test is ADITestBase { + AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320 public payload; + function setUp() public { + vm.createSelectFork(vm.rpcUrl('avalanche'), 43150105); + payload = new AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320(); + } + + function getDestinationPayloadsByChain() + public + view + override + returns (DestinationPayload[] memory) + { + DestinationPayload[] memory destinationPayload = new DestinationPayload[](1); + destinationPayload[0] = DestinationPayload({ + chainId: ChainIds.MAINNET, + payloadCode: type(AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode + }); + + return destinationPayload; + } + + function test_defaultTest() public { + defaultTest( + 'AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320', GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER, - type(AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode, - 'avalanche', - 43150105 - ) - {} + address(payload), + true + ); + } } diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol index 091091406..038ac5752 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {BaseAdaptersUpdatePayload, ICrossChainForwarder} from './BaseAdaptersUpdatePayload.sol'; +import 'aave-helpers/adi/SimpleOneToManyAdapterUpdate.sol'; import {GovernanceV3BNB} from 'aave-address-book/GovernanceV3BNB.sol'; import {ChainIds} from 'aave-helpers/ChainIds.sol'; @@ -12,11 +12,11 @@ import {ChainIds} from 'aave-helpers/ChainIds.sol'; * - Discussion: TODO */ contract AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320 is - BaseAdaptersUpdatePayload( - BaseAdaptersUpdatePayload.ConstructorInput({ + SimpleOneToManyAdapterUpdate( + SimpleOneToManyAdapterUpdate.ConstructorInput({ ccc: GovernanceV3BNB.CROSS_CHAIN_CONTROLLER, - hlNewAdapter: 0x3F006299eC88985c18E6e885EeA29A49eC579882, - hlAdapterToRemove: 0x118DFD5418890c0332042ab05173Db4A2C1d283c + newAdapter: 0x3F006299eC88985c18E6e885EeA29A49eC579882, + adapterToRemove: 0x118DFD5418890c0332042ab05173Db4A2C1d283c }) ) { @@ -25,13 +25,4 @@ contract AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320 is chains[0] = ChainIds.MAINNET; return chains; } - - function getForwarderBridgeAdaptersToRemove() - public - pure - override - returns (ICrossChainForwarder.BridgeAdapterToDisable[] memory) - { - return new ICrossChainForwarder.BridgeAdapterToDisable[](0); - } } diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol index 26db73a46..3bb3d3db3 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol @@ -1,21 +1,28 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import './BaseTest.sol'; import {GovernanceV3BNB} from 'aave-address-book/GovernanceV3BNB.sol'; import {AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; +import 'aave-helpers/adi/test/ADITestBase.sol'; /** * @dev Test for AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320 * command: make test-contract filter=AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320 */ -contract AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320_Test is BaseTest { - constructor() - BaseTest( +contract AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320_Test is ADITestBase { + AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320 public payload; + + function setUp() public { + vm.createSelectFork(vm.rpcUrl('bnb'), 37137492); + payload = new AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320(); + } + + function test_defaultTest() public { + defaultTest( + 'AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320', GovernanceV3BNB.CROSS_CHAIN_CONTROLLER, - type(AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode, - 'bnb', - 37137492 - ) - {} + address(payload), + true + ); + } } diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320.sol new file mode 100644 index 000000000..d8717cb33 --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import 'aave-helpers/adi/SimpleReceiverAdapterUpdate.sol'; +import {GovernanceV3Base} from 'aave-address-book/GovernanceV3Base.sol'; +import {ChainIds} from 'aave-helpers/ChainIds.sol'; + +/** + * @title Hyperlane bridge adapter update to V3 + * @author BGD Labs @bgdlabs + * - Snapshot: TODO + * - Discussion: TODO + */ +contract AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320 is + SimpleReceiverAdapterUpdate( + SimpleReceiverAdapterUpdate.ConstructorInput({ + ccc: GovernanceV3Base.CROSS_CHAIN_CONTROLLER, + newAdapter: address(0), // no new adapter + adapterToRemove: 0x7b62461a3570c6AC8a9f8330421576e417B71EE7 + }) + ) +{ + function getChainsToReceive() public pure override returns (uint256[] memory) { + uint256[] memory chains = new uint256[](1); + chains[0] = ChainIds.MAINNET; + return chains; + } +} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol new file mode 100644 index 000000000..94594ec0f --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import 'aave-helpers/adi/test/ADITestBase.sol'; +import {GovernanceV3Base} from 'aave-address-book/GovernanceV3Base.sol'; +import {AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; + +/** + * @dev Test for AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320 + * command: make test-contract filter=AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320 + */ +contract AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320_Test is ADITestBase { + AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320 internal payload; + + function setUp() public { + vm.createSelectFork(vm.rpcUrl('base'), 13202337); + payload = new AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320(); + } + + /** + * @dev executes the generic test suite including e2e and config snapshots + */ + function test_defaultProposalExecution() public { + defaultTest( + 'AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320', + GovernanceV3Base.CROSS_CHAIN_CONTROLLER, + address(payload), + true + ); + } +} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol index 239ffe5ed..ed4e9e8bd 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; +import 'aave-helpers/adi/SimpleOneToManyAdapterUpdate.sol'; import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; import {ChainIds} from 'aave-helpers/ChainIds.sol'; @@ -12,11 +12,11 @@ import {ChainIds} from 'aave-helpers/ChainIds.sol'; * - Discussion: TODO */ contract AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320 is - BaseAdaptersUpdatePayload( - BaseAdaptersUpdatePayload.ConstructorInput({ + SimpleOneToManyAdapterUpdate( + SimpleOneToManyAdapterUpdate.ConstructorInput({ ccc: GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER, - hlNewAdapter: 0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1, - hlAdapterToRemove: 0x6Abb61beb5848B476d026C4934E8a6415e2E75a8 + newAdapter: 0x01dcb90Cf13b82Cde4A0BAcC655585a83Af3cCC1, + adapterToRemove: 0x6Abb61beb5848B476d026C4934E8a6415e2E75a8 }) ) { diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol index 8fe9f05ad..1b339b835 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol @@ -1,21 +1,59 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import './BaseTest.sol'; import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; import {AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; +import 'aave-helpers/adi/test/ADITestBase.sol'; +import {AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; +import {AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; +import {AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; +import {AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; /** * @dev Test for AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320 * command: make test-contract filter=AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320 */ -contract AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320_Test is BaseTest { - constructor() - BaseTest( +contract AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320_Test is ADITestBase { + AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320 public payload; + + function setUp() public { + vm.createSelectFork(vm.rpcUrl('mainnet'), 19661654); + payload = new AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320(); + } + + function getDestinationPayloadsByChain() + public + view + override + returns (DestinationPayload[] memory) + { + DestinationPayload[] memory destinationPayload = new DestinationPayload[](4); + destinationPayload[0] = DestinationPayload({ + chainId: ChainIds.AVALANCHE, + payloadCode: type(AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode + }); + destinationPayload[1] = DestinationPayload({ + chainId: ChainIds.POLYGON, + payloadCode: type(AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode + }); + destinationPayload[2] = DestinationPayload({ + chainId: ChainIds.BNB, + payloadCode: type(AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode + }); + destinationPayload[3] = DestinationPayload({ + chainId: ChainIds.GNOSIS, + payloadCode: type(AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode + }); + + return destinationPayload; + } + + function test_defaultTest() public { + defaultTest( + 'AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320', GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER, - type(AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode, - 'mainnet', - 19476776 - ) - {} + address(payload), + true + ); + } } diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol index 53064d7d7..59034db87 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {BaseAdaptersUpdatePayload, ICrossChainForwarder} from './BaseAdaptersUpdatePayload.sol'; +import 'aave-helpers/adi/SimpleOneToManyAdapterUpdate.sol'; import {GovernanceV3Gnosis} from 'aave-address-book/GovernanceV3Gnosis.sol'; import {ChainIds} from 'aave-helpers/ChainIds.sol'; @@ -12,11 +12,11 @@ import {ChainIds} from 'aave-helpers/ChainIds.sol'; * - Discussion: TODO */ contract AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320 is - BaseAdaptersUpdatePayload( - BaseAdaptersUpdatePayload.ConstructorInput({ + SimpleOneToManyAdapterUpdate( + SimpleOneToManyAdapterUpdate.ConstructorInput({ ccc: GovernanceV3Gnosis.CROSS_CHAIN_CONTROLLER, - hlNewAdapter: 0xA806DA549FcB2B4912a7dFFE4c1aA7A1ed0Bd5C9, - hlAdapterToRemove: 0x4A4c73d563395ad827511F70097d4Ef82E653805 + newAdapter: 0xA806DA549FcB2B4912a7dFFE4c1aA7A1ed0Bd5C9, + adapterToRemove: 0x4A4c73d563395ad827511F70097d4Ef82E653805 }) ) { @@ -25,13 +25,4 @@ contract AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320 is chains[0] = ChainIds.MAINNET; return chains; } - - function getForwarderBridgeAdaptersToRemove() - public - pure - override - returns (ICrossChainForwarder.BridgeAdapterToDisable[] memory) - { - return new ICrossChainForwarder.BridgeAdapterToDisable[](0); - } } diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol index ec83f95d4..771ca6312 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import './BaseTest.sol'; +import 'aave-helpers/adi/test/ADITestBase.sol'; import {GovernanceV3Gnosis} from 'aave-address-book/GovernanceV3Gnosis.sol'; import {AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; @@ -9,13 +9,20 @@ import {AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Gn * @dev Test for AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320 * command: make test-contract filter=AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320 */ -contract AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320_Test is BaseTest { - constructor() - BaseTest( +contract AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320_Test is ADITestBase { + AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320 public payload; + + function setUp() public { + vm.createSelectFork(vm.rpcUrl('gnosis'), 33457580); + payload = new AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320(); + } + + function test_defaultTest() public { + defaultTest( + 'AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320', GovernanceV3Gnosis.CROSS_CHAIN_CONTROLLER, - type(AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode, - 'gnosis', - 33043984 - ) - {} + address(payload), + true + ); + } } diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol new file mode 100644 index 000000000..578e18e26 --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import 'aave-helpers/adi/SimpleReceiverAdapterUpdate.sol'; +import {GovernanceV3Metis} from 'aave-address-book/GovernanceV3Metis.sol'; +import {ChainIds} from 'aave-helpers/ChainIds.sol'; + +/** + * @title Hyperlane bridge adapter update to V3 + * @author BGD Labs @bgdlabs + * - Snapshot: TODO + * - Discussion: TODO + */ +contract AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320 is + SimpleReceiverAdapterUpdate( + SimpleReceiverAdapterUpdate.ConstructorInput({ + ccc: GovernanceV3Metis.CROSS_CHAIN_CONTROLLER, + newAdapter: address(0), // no new adapter + adapterToRemove: 0x746c675dAB49Bcd5BB9Dc85161f2d7Eb435009bf + }) + ) +{ + function getChainsToReceive() public pure override returns (uint256[] memory) { + uint256[] memory chains = new uint256[](1); + chains[0] = ChainIds.MAINNET; + return chains; + } +} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol new file mode 100644 index 000000000..0fa3ba171 --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import 'aave-helpers/adi/test/ADITestBase.sol'; +import {GovernanceV3Metis} from 'aave-address-book/GovernanceV3Metis.sol'; +import {AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; + +/** + * @dev Test for AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320 + * command: make test-contract filter=AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320 + */ +contract AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320_Test is ADITestBase { + AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320 internal payload; + + function setUp() public { + vm.createSelectFork(vm.rpcUrl('metis'), 16616814); + payload = new AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320(); + } + + /** + * @dev executes the generic test suite including e2e and config snapshots + */ + function test_defaultProposalExecution() public { + defaultTest( + 'AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320', + GovernanceV3Metis.CROSS_CHAIN_CONTROLLER, + address(payload), + true + ); + } +} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320.sol new file mode 100644 index 000000000..03cc37b02 --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import 'aave-helpers/adi/SimpleReceiverAdapterUpdate.sol'; +import {GovernanceV3Optimism} from 'aave-address-book/GovernanceV3Optimism.sol'; +import {ChainIds} from 'aave-helpers/ChainIds.sol'; + +/** + * @title Hyperlane bridge adapter update to V3 + * @author BGD Labs @bgdlabs + * - Snapshot: TODO + * - Discussion: TODO + */ +contract AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320 is + SimpleReceiverAdapterUpdate( + SimpleReceiverAdapterUpdate.ConstructorInput({ + ccc: GovernanceV3Optimism.CROSS_CHAIN_CONTROLLER, + newAdapter: address(0), // no new adapter + adapterToRemove: 0x81d32B36380e6266e1BDd490eAC56cdB300afBe0 + }) + ) +{ + function getChainsToReceive() public pure override returns (uint256[] memory) { + uint256[] memory chains = new uint256[](1); + chains[0] = ChainIds.MAINNET; + return chains; + } +} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol new file mode 100644 index 000000000..72a05b17e --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import 'aave-helpers/adi/test/ADITestBase.sol'; +import {GovernanceV3Optimism} from 'aave-address-book/GovernanceV3Optimism.sol'; +import {AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; + +/** + * @dev Test for AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320 + * command: make test-contract filter=AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320 + */ +contract AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320_Test is ADITestBase { + AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320 internal payload; + + function setUp() public { + vm.createSelectFork(vm.rpcUrl('optimism'), 118797852); + payload = new AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320(); + } + + /** + * @dev executes the generic test suite including e2e and config snapshots + */ + function test_defaultProposalExecution() public { + defaultTest( + 'AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320', + GovernanceV3Optimism.CROSS_CHAIN_CONTROLLER, + address(payload), + true + ); + } +} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol index 86e54a1c9..7a34a9df6 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; +import 'aave-helpers/adi/SimpleOneToManyAdapterUpdate.sol'; import {GovernanceV3Polygon} from 'aave-address-book/GovernanceV3Polygon.sol'; import {ChainIds} from 'aave-helpers/ChainIds.sol'; @@ -12,11 +12,11 @@ import {ChainIds} from 'aave-helpers/ChainIds.sol'; * - Discussion: TODO */ contract AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320 is - BaseAdaptersUpdatePayload( - BaseAdaptersUpdatePayload.ConstructorInput({ + SimpleOneToManyAdapterUpdate( + SimpleOneToManyAdapterUpdate.ConstructorInput({ ccc: GovernanceV3Polygon.CROSS_CHAIN_CONTROLLER, - hlNewAdapter: 0x3e72665008dC237bdd91C04C10782Ed1987a4019, - hlAdapterToRemove: 0x3c25b96fF62D21E90556869272a277eE2E229747 + newAdapter: 0x3e72665008dC237bdd91C04C10782Ed1987a4019, + adapterToRemove: 0x3c25b96fF62D21E90556869272a277eE2E229747 }) ) { diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol index 6d10bd4bf..acd300ad7 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol @@ -1,21 +1,44 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import './BaseTest.sol'; +import 'aave-helpers/adi/test/ADITestBase.sol'; import {GovernanceV3Polygon} from 'aave-address-book/GovernanceV3Polygon.sol'; import {AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; +import {AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; /** * @dev Test for AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320 * command: make test-contract filter=AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320 */ -contract AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320_Test is BaseTest { - constructor() - BaseTest( +contract AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320_Test is ADITestBase { + AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320 public payload; + + function setUp() public { + vm.createSelectFork(vm.rpcUrl('polygon'), 54882095); + payload = new AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320(); + } + + function getDestinationPayloadsByChain() + public + view + override + returns (DestinationPayload[] memory) + { + DestinationPayload[] memory destinationPayload = new DestinationPayload[](1); + destinationPayload[0] = DestinationPayload({ + chainId: ChainIds.MAINNET, + payloadCode: type(AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode + }); + + return destinationPayload; + } + + function test_defaultTest() public { + defaultTest( + 'AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320', GovernanceV3Polygon.CROSS_CHAIN_CONTROLLER, - type(AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode, - 'polygon', - 54882095 - ) - {} + address(payload), + true + ); + } } diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320.sol new file mode 100644 index 000000000..cef19dc20 --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import 'aave-helpers/adi/SimpleReceiverAdapterUpdate.sol'; +import {GovernanceV3Scroll} from 'aave-address-book/GovernanceV3Scroll.sol'; +import {ChainIds} from 'aave-helpers/ChainIds.sol'; + +/** + * @title Hyperlane bridge adapter update to V3 + * @author BGD Labs @bgdlabs + * - Snapshot: TODO + * - Discussion: TODO + */ +contract AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320 is + SimpleReceiverAdapterUpdate( + SimpleReceiverAdapterUpdate.ConstructorInput({ + ccc: GovernanceV3Scroll.CROSS_CHAIN_CONTROLLER, + newAdapter: address(0), // no new adapter + adapterToRemove: 0x118DFD5418890c0332042ab05173Db4A2C1d283c + }) + ) +{ + function getChainsToReceive() public pure override returns (uint256[] memory) { + uint256[] memory chains = new uint256[](1); + chains[0] = ChainIds.MAINNET; + return chains; + } +} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol new file mode 100644 index 000000000..b89bb0c64 --- /dev/null +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import 'aave-helpers/adi/test/ADITestBase.sol'; +import {GovernanceV3Scroll} from 'aave-address-book/GovernanceV3Scroll.sol'; +import {AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; + +/** + * @dev Test for AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320 + * command: make test-contract filter=AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320 + */ +contract AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320_Test is ADITestBase { + AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320 internal payload; + + function setUp() public { + vm.createSelectFork(vm.rpcUrl('scroll'), 4850650); + payload = new AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320(); + } + + /** + * @dev executes the generic test suite including e2e and config snapshots + */ + function test_defaultProposalExecution() public { + defaultTest( + 'AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320', + GovernanceV3Scroll.CROSS_CHAIN_CONTROLLER, + address(payload), + true + ); + } +} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseAdaptersUpdatePayload.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseAdaptersUpdatePayload.sol deleted file mode 100644 index e7fd1ee7d..000000000 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseAdaptersUpdatePayload.sol +++ /dev/null @@ -1,154 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import {ICrossChainReceiver, ICrossChainForwarder} from 'aave-address-book/common/ICrossChainController.sol'; -import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; - -/** - * @title Base payload aDI and bridge adapters update - * @author BGD Labs @bgdlabs - */ -abstract contract BaseAdaptersUpdatePayload is IProposalGenericExecutor { - struct ConstructorInput { - address ccc; - address hlAdapterToRemove; - address hlNewAdapter; - } - struct DestinationAdaptersInput { - address adapter; - uint256 chainId; - } - - address public immutable CROSS_CHAIN_CONTROLLER; - address public immutable HL_ADAPTER_TO_REMOVE; - address public immutable HL_NEW_ADAPTER; - - constructor(ConstructorInput memory constructorInput) { - CROSS_CHAIN_CONTROLLER = constructorInput.ccc; - HL_ADAPTER_TO_REMOVE = constructorInput.hlAdapterToRemove; - HL_NEW_ADAPTER = constructorInput.hlNewAdapter; - } - - function execute() public override { - // remove old Receiver bridge adapter - ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] - memory receiversToRemove = getReceiverBridgeAdaptersToRemove(); - if (receiversToRemove.length != 0) { - ICrossChainReceiver(CROSS_CHAIN_CONTROLLER).disallowReceiverBridgeAdapters(receiversToRemove); - } - - // remove forwarding adapters - ICrossChainForwarder.BridgeAdapterToDisable[] - memory forwardersToRemove = getForwarderBridgeAdaptersToRemove(); - if (forwardersToRemove.length != 0) { - ICrossChainForwarder(CROSS_CHAIN_CONTROLLER).disableBridgeAdapters(forwardersToRemove); - } - - ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] - memory receiversToAllow = getReceiverBridgeAdaptersToAllow(); - if (receiversToAllow.length != 0) { - // add receiver adapters - ICrossChainReceiver(CROSS_CHAIN_CONTROLLER).allowReceiverBridgeAdapters(receiversToAllow); - } - ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] - memory forwardersToEnable = getForwarderBridgeAdaptersToEnable(); - if (forwardersToEnable.length != 0) { - // add forwarding adapters - ICrossChainForwarder(CROSS_CHAIN_CONTROLLER).enableBridgeAdapters(forwardersToEnable); - } - } - - function getDestinationAdapters() - public - pure - virtual - returns (DestinationAdaptersInput[] memory) - { - DestinationAdaptersInput[] memory destinationAdapters; - return destinationAdapters; - } - - function getChainsToReceive() public pure virtual returns (uint256[] memory); - - function getChainsToSend() public pure returns (uint256[] memory) { - DestinationAdaptersInput[] memory destinationAdapters = getDestinationAdapters(); - uint256[] memory chainsToSend = new uint256[](destinationAdapters.length); - for (uint256 i = 0; i < destinationAdapters.length; i++) { - chainsToSend[i] = destinationAdapters[i].chainId; - } - return chainsToSend; - } - - function getReceiverBridgeAdaptersToRemove() - public - view - returns (ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] memory) - { - // remove old Receiver bridge adapter - ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] - memory bridgeAdaptersToRemove = new ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[](1); - - bridgeAdaptersToRemove[0] = ICrossChainReceiver.ReceiverBridgeAdapterConfigInput({ - bridgeAdapter: HL_ADAPTER_TO_REMOVE, - chainIds: getChainsToReceive() - }); - - return bridgeAdaptersToRemove; - } - - function getForwarderBridgeAdaptersToRemove() - public - view - virtual - returns (ICrossChainForwarder.BridgeAdapterToDisable[] memory) - { - ICrossChainForwarder.BridgeAdapterToDisable[] - memory forwarderAdaptersToRemove = new ICrossChainForwarder.BridgeAdapterToDisable[](1); - - forwarderAdaptersToRemove[0] = ICrossChainForwarder.BridgeAdapterToDisable({ - bridgeAdapter: HL_ADAPTER_TO_REMOVE, - chainIds: getChainsToSend() - }); - - return forwarderAdaptersToRemove; - } - - function getReceiverBridgeAdaptersToAllow() - public - view - returns (ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] memory) - { - ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] - memory bridgeAdapterConfig = new ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[](1); - - bridgeAdapterConfig[0] = ICrossChainReceiver.ReceiverBridgeAdapterConfigInput({ - bridgeAdapter: HL_NEW_ADAPTER, - chainIds: getChainsToReceive() - }); - - return bridgeAdapterConfig; - } - - function getForwarderBridgeAdaptersToEnable() - public - view - returns (ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] memory) - { - DestinationAdaptersInput[] memory destinationAdapters = getDestinationAdapters(); - - ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] - memory bridgeAdaptersToEnable = new ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[]( - destinationAdapters.length - ); - - for (uint256 i = 0; i < destinationAdapters.length; i++) { - bridgeAdaptersToEnable[i] = ICrossChainForwarder.ForwarderBridgeAdapterConfigInput({ - currentChainBridgeAdapter: HL_NEW_ADAPTER, - destinationBridgeAdapter: destinationAdapters[i].adapter, - destinationChainId: destinationAdapters[i].chainId - }); - } - - return bridgeAdaptersToEnable; - } -} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseTest.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseTest.sol deleted file mode 100644 index 793b24de9..000000000 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/BaseTest.sol +++ /dev/null @@ -1,374 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import 'forge-std/console.sol'; -import 'aave-helpers/ProtocolV3TestBase.sol'; - -import {GovV3Helpers} from 'aave-helpers/GovV3Helpers.sol'; -import {ProtocolV3TestBase} from 'aave-helpers/ProtocolV3TestBase.sol'; -import {ICrossChainReceiver, ICrossChainForwarder} from 'aave-address-book/common/ICrossChainController.sol'; -import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol'; -import {ChainIds} from 'aave-helpers/ChainIds.sol'; -import {ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/ProxyAdmin.sol'; -import {IBaseAdapter} from 'aave-address-book/common/IBaseAdapter.sol'; - -import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; -import {GovernanceV3Polygon} from 'aave-address-book/GovernanceV3Polygon.sol'; -import {GovernanceV3Avalanche} from 'aave-address-book/GovernanceV3Avalanche.sol'; - -import {AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; -import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; -import {AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; -import {AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; -import {AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; -import {AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; - -struct AdapterName { - address adapter; - string name; -} - -struct TrustedRemote { - address adapter; - address expectedRemote; - uint256 remoteChainId; -} - -struct AdapterAllowed { - address adapter; - uint256 chainId; - bool allowed; -} - -struct AdaptersByChain { - address[] adapters; - uint256 chainId; -} - -struct ForwarderAdapters { - ICrossChainForwarder.ChainIdBridgeConfig[] adapters; - uint256 chainId; -} - -interface Payload { - function CROSS_CHAIN_CONTROLLER_IMPLEMENTATION() external returns (address); -} - -abstract contract BaseTest is ProtocolV3TestBase { - address public immutable CROSS_CHAIN_CONTROLLER; - - bytes public payloadCode; - address public payloadAddress; - string public network; - uint256 public blockNumber; - - BaseAdaptersUpdatePayload internal ethereumPayload; - BaseAdaptersUpdatePayload internal polygonPayload; - BaseAdaptersUpdatePayload internal avalanchePayload; - BaseAdaptersUpdatePayload internal binancePayload; - BaseAdaptersUpdatePayload internal gnosisPayload; - - constructor( - address ccc, - bytes memory _payloadCode, - string memory _network, - uint256 _blockNumber - ) { - CROSS_CHAIN_CONTROLLER = ccc; - network = _network; - blockNumber = _blockNumber; - payloadCode = _payloadCode; - } - - function setUp() public { - vm.createSelectFork(vm.rpcUrl(network), blockNumber); - payloadAddress = GovV3Helpers.deployDeterministic(payloadCode); - - ethereumPayload = new AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320(); - polygonPayload = new AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320(); - avalanchePayload = new AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320(); - binancePayload = new AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320(); - gnosisPayload = new AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320(); - } - - function getPayloadByChainId(uint256 chainId) public view returns (BaseAdaptersUpdatePayload) { - if (chainId == ChainIds.MAINNET) { - return ethereumPayload; - } else if (chainId == ChainIds.POLYGON) { - return polygonPayload; - } else if (chainId == ChainIds.BNB) { - return binancePayload; - } else if (chainId == ChainIds.AVALANCHE) { - return avalanchePayload; - } else if (chainId == ChainIds.GNOSIS) { - return gnosisPayload; - } - revert(); - } - - function getTrustedRemoteByChainId(uint256 chainId) public view returns (address) { - if (chainId == ChainIds.MAINNET) { - return GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER; - } else if (chainId == ChainIds.POLYGON) { - return GovernanceV3Polygon.CROSS_CHAIN_CONTROLLER; - } else if (chainId == ChainIds.AVALANCHE) { - return GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER; - } - revert(); - } - - function test_trustedRemotes() public { - ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] - memory receivers = BaseAdaptersUpdatePayload(payloadAddress) - .getReceiverBridgeAdaptersToAllow(); - - for (uint256 i = 0; i < receivers.length; i++) { - for (uint256 j = 0; j < receivers[i].chainIds.length; j++) { - assertEq( - getTrustedRemoteByChainId(receivers[i].chainIds[j]), - IBaseAdapter(receivers[i].bridgeAdapter).getTrustedRemoteByChainId( - receivers[i].chainIds[j] - ) - ); - } - } - } - - function test_correctPathConfiguration() public { - BaseAdaptersUpdatePayload.DestinationAdaptersInput[] - memory destinationConfigs = BaseAdaptersUpdatePayload(payloadAddress) - .getDestinationAdapters(); - - for (uint256 i = 0; i < destinationConfigs.length; i++) { - assertEq( - getPayloadByChainId(destinationConfigs[i].chainId).HL_NEW_ADAPTER(), - destinationConfigs[i].adapter - ); - } - } - - function test_correctAdapterNames() public { - ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] - memory receivers = BaseAdaptersUpdatePayload(payloadAddress) - .getReceiverBridgeAdaptersToAllow(); - - for (uint256 i = 0; i < receivers.length; i++) { - string memory adapterName = IBaseAdapter(receivers[i].bridgeAdapter).adapterName(); - assertEq(keccak256(abi.encode(adapterName)), keccak256(abi.encode('Hyperlane adapter'))); - } - } - - function test_receiversAreCorrectlySetAfterExecution() public { - ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] - memory beforeReceivers = BaseAdaptersUpdatePayload(payloadAddress) - .getReceiverBridgeAdaptersToAllow(); - - for (uint256 i = 0; i < beforeReceivers.length; i++) { - for (uint256 j = 0; j < beforeReceivers[i].chainIds.length; j++) { - assertEq( - ICrossChainReceiver(CROSS_CHAIN_CONTROLLER).isReceiverBridgeAdapterAllowed( - beforeReceivers[i].bridgeAdapter, - beforeReceivers[i].chainIds[j] - ), - false - ); - } - } - - executePayload(vm, payloadAddress); - - ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] - memory receivers = BaseAdaptersUpdatePayload(payloadAddress) - .getReceiverBridgeAdaptersToAllow(); - - for (uint256 i = 0; i < receivers.length; i++) { - for (uint256 j = 0; j < receivers[i].chainIds.length; j++) { - assertEq( - ICrossChainReceiver(CROSS_CHAIN_CONTROLLER).isReceiverBridgeAdapterAllowed( - receivers[i].bridgeAdapter, - receivers[i].chainIds[j] - ), - true - ); - } - } - } - - function test_onlyUpdatedNeededAdapter() public { - uint256[] memory supportedChainsBefore = ICrossChainReceiver(CROSS_CHAIN_CONTROLLER) - .getSupportedChains(); - AdaptersByChain[] memory adaptersBefore = _getCurrentReceiverAdaptersByChain(); - - executePayload(vm, payloadAddress); - - uint256[] memory supportedChainsAfter = ICrossChainReceiver(CROSS_CHAIN_CONTROLLER) - .getSupportedChains(); - - assertEq(supportedChainsBefore, supportedChainsAfter); - for (uint256 i = 0; i < supportedChainsBefore.length; i++) { - assertEq(supportedChainsAfter[i], supportedChainsBefore[i]); - } - - ICrossChainReceiver.ReceiverBridgeAdapterConfigInput[] - memory adaptersToRemove = BaseAdaptersUpdatePayload(payloadAddress) - .getReceiverBridgeAdaptersToRemove(); - - for (uint256 i = 0; i < adaptersBefore.length; i++) { - for (uint256 j = 0; j < adaptersToRemove.length; j++) { - for (uint256 x = 0; x < adaptersToRemove[j].chainIds.length; x++) { - if (adaptersToRemove[j].chainIds[x] == adaptersBefore[i].chainId) { - for (uint256 k = 0; k < adaptersBefore[i].adapters.length; k++) { - if (adaptersBefore[i].adapters[k] == adaptersToRemove[j].bridgeAdapter) { - assertEq( - ICrossChainReceiver(CROSS_CHAIN_CONTROLLER).isReceiverBridgeAdapterAllowed( - adaptersToRemove[j].bridgeAdapter, - adaptersBefore[i].chainId - ), - false - ); - } else { - assertEq( - ICrossChainReceiver(CROSS_CHAIN_CONTROLLER).isReceiverBridgeAdapterAllowed( - adaptersBefore[i].adapters[k], - adaptersBefore[i].chainId - ), - true - ); - } - } - } - } - } - } - } - - function test_forwarderAdaptersAreSet() public { - executePayload(vm, payloadAddress); - - ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] - memory forwarders = BaseAdaptersUpdatePayload(payloadAddress) - .getForwarderBridgeAdaptersToEnable(); - - for (uint256 i = 0; i < forwarders.length; i++) { - ICrossChainForwarder.ChainIdBridgeConfig[] - memory forwardersBridgeAdaptersByChain = ICrossChainForwarder(CROSS_CHAIN_CONTROLLER) - .getForwarderBridgeAdaptersByChain(forwarders[i].destinationChainId); - bool newAdapterFound; - for (uint256 j = 0; j < forwardersBridgeAdaptersByChain.length; j++) { - if ( - forwardersBridgeAdaptersByChain[j].destinationBridgeAdapter == - forwarders[i].destinationBridgeAdapter && - forwardersBridgeAdaptersByChain[j].currentChainBridgeAdapter == - forwarders[i].currentChainBridgeAdapter - ) { - newAdapterFound = true; - } - } - assertEq(newAdapterFound, true); - } - } - - function test_onlyChangedNeededForwarders() public { - ForwarderAdapters[] - memory forwardersBridgeAdaptersByChainBefore = _getCurrentForwarderAdaptersByChain(); - - ICrossChainForwarder.BridgeAdapterToDisable[] - memory adaptersToRemove = BaseAdaptersUpdatePayload(payloadAddress) - .getForwarderBridgeAdaptersToRemove(); - - executePayload(vm, payloadAddress); - - ForwarderAdapters[] - memory forwardersBridgeAdaptersByChainAfter = _getCurrentForwarderAdaptersByChain(); - - assertEq( - forwardersBridgeAdaptersByChainAfter.length, - forwardersBridgeAdaptersByChainBefore.length - ); - - for (uint256 l = 0; l < forwardersBridgeAdaptersByChainBefore.length; l++) { - for (uint256 j = 0; j < forwardersBridgeAdaptersByChainAfter.length; j++) { - if ( - forwardersBridgeAdaptersByChainBefore[l].chainId == - forwardersBridgeAdaptersByChainAfter[j].chainId - ) { - for (uint256 i = 0; i < forwardersBridgeAdaptersByChainBefore[l].adapters.length; i++) { - bool forwarderFound; - for (uint256 m = 0; m < forwardersBridgeAdaptersByChainAfter[j].adapters.length; m++) { - if ( - forwardersBridgeAdaptersByChainBefore[l].adapters[i].destinationBridgeAdapter == - forwardersBridgeAdaptersByChainAfter[j].adapters[m].destinationBridgeAdapter && - forwardersBridgeAdaptersByChainBefore[l].adapters[i].currentChainBridgeAdapter == - forwardersBridgeAdaptersByChainAfter[j].adapters[m].currentChainBridgeAdapter - ) { - forwarderFound = true; - break; - } - } - if (!forwarderFound) { - bool isAdapterToBeRemoved; - for (uint256 k = 0; k < adaptersToRemove.length; k++) { - if ( - forwardersBridgeAdaptersByChainBefore[l].adapters[i].currentChainBridgeAdapter == - adaptersToRemove[k].bridgeAdapter - ) { - for (uint256 n = 0; n < adaptersToRemove[k].chainIds.length; n++) { - if ( - forwardersBridgeAdaptersByChainBefore[l].chainId == - adaptersToRemove[k].chainIds[n] - ) { - isAdapterToBeRemoved = true; - break; - } - } - } - } - assertEq(isAdapterToBeRemoved, true); - } - } - } - } - } - } - - function _getCurrentForwarderAdaptersByChain() internal returns (ForwarderAdapters[] memory) { - uint256[] memory supportedChains = new uint256[](10); - supportedChains[0] = ChainIds.POLYGON; - supportedChains[1] = ChainIds.AVALANCHE; - supportedChains[2] = ChainIds.BNB; - supportedChains[3] = ChainIds.GNOSIS; - supportedChains[4] = ChainIds.ARBITRUM; - supportedChains[5] = ChainIds.OPTIMISM; - supportedChains[6] = ChainIds.METIS; - supportedChains[7] = ChainIds.BASE; - supportedChains[8] = ChainIds.SCROLL; - supportedChains[9] = ChainIds.MAINNET; - - ForwarderAdapters[] memory forwarderAdapters = new ForwarderAdapters[](supportedChains.length); - - for (uint256 i = 0; i < supportedChains.length; i++) { - ICrossChainForwarder.ChainIdBridgeConfig[] memory forwarders = ICrossChainForwarder( - CROSS_CHAIN_CONTROLLER - ).getForwarderBridgeAdaptersByChain(supportedChains[i]); - - forwarderAdapters[i] = ForwarderAdapters({adapters: forwarders, chainId: supportedChains[i]}); - } - return forwarderAdapters; - } - - function _getCurrentReceiverAdaptersByChain() internal returns (AdaptersByChain[] memory) { - uint256[] memory supportedChains = ICrossChainReceiver(CROSS_CHAIN_CONTROLLER) - .getSupportedChains(); - - AdaptersByChain[] memory receiverAdapters = new AdaptersByChain[](supportedChains.length); - - for (uint256 i = 0; i < supportedChains.length; i++) { - address[] memory receivers = ICrossChainReceiver(CROSS_CHAIN_CONTROLLER) - .getReceiverBridgeAdaptersByChain(supportedChains[i]); - - receiverAdapters[i] = AdaptersByChain({adapters: receivers, chainId: supportedChains[i]}); - } - - return receiverAdapters; - } -} diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md index 2ccdef3a5..f537ba42b 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md @@ -8,10 +8,13 @@ discussions: "" This proposal updates the bridge Hyperlane bridge adapters used on a.DI to connect Ethereum with Polygon, Avalanche, Binance and Gnosis to the new Hyperlane V3 version. +Additionally, removes old native bridges on Optimism, Base, Arbitrum, Scroll and Metis ## Motivation -The main motivation of this proposal is to bring the Hyperlane bridge adapters to the up to date version (V3) +The main motivation of this proposal is to bring the Hyperlane bridge adapters to the up to date version (V3). + +This AIP also removes the old native bridges as new ones have already been set in place and are working. ## Specification @@ -31,8 +34,9 @@ Adapter diffs: [HLAdapter](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs ## References -- Implementation: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Polygon](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Avalanche](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Gnosis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3BNB](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol) -- Tests: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3Polygon](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3Avalanche](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3Gnosis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3BNB](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol) +- Implementation: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Polygon](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Avalanche](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Gnosis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3BNB](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Scroll](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Arbitrum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Optimism](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Metis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Base](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320.sol) +- Tests: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3Polygon](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3Avalanche](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3Gnosis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3BNB](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3Scroll](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3Arbitrum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3Optimism](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3Metis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3Base](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol) +- [Snapshot](TODO) - [Discussion](TODO) ## Copyright diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol index de53ea912..165e9aa74 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol @@ -2,12 +2,17 @@ pragma solidity ^0.8.0; import {GovV3Helpers, IPayloadsControllerCore, PayloadsControllerUtils} from 'aave-helpers/GovV3Helpers.sol'; -import {EthereumScript, PolygonScript, AvalancheScript, GnosisScript, BNBScript} from 'aave-helpers/ScriptUtils.sol'; +import {EthereumScript, PolygonScript, AvalancheScript, GnosisScript, BNBScript, ScrollScript, ArbitrumScript, OptimismScript, MetisScript, BaseScript} from 'aave-helpers/ScriptUtils.sol'; import {AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; import {AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; import {AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; import {AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; import {AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; +import {AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; +import {AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; +import {AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; +import {AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; +import {AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320} from './AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320.sol'; /** * @dev Deploy Ethereum @@ -119,6 +124,116 @@ contract DeployBNB is BNBScript { } } +/** + * @dev Deploy Scroll + * deploy-command: make deploy-ledger contract=src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol:DeployScroll chain=scroll + * verify-command: npx catapulta-verify -b broadcast/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol/534352/run-latest.json + */ +contract DeployScroll is ScrollScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode + ); + + // compose action + IPayloadsControllerCore.ExecutionAction[] + memory actions = new IPayloadsControllerCore.ExecutionAction[](1); + actions[0] = GovV3Helpers.buildAction(payload0); + + // register action at payloadsController + GovV3Helpers.createPayload(actions); + } +} + +/** + * @dev Deploy Arbitrum + * deploy-command: make deploy-ledger contract=src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol:DeployArbitrum chain=arbitrum + * verify-command: npx catapulta-verify -b broadcast/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol/42161/run-latest.json + */ +contract DeployArbitrum is ArbitrumScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode + ); + + // compose action + IPayloadsControllerCore.ExecutionAction[] + memory actions = new IPayloadsControllerCore.ExecutionAction[](1); + actions[0] = GovV3Helpers.buildAction(payload0); + + // register action at payloadsController + GovV3Helpers.createPayload(actions); + } +} + +/** + * @dev Deploy Optimism + * deploy-command: make deploy-ledger contract=src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol:DeployOptimism chain=optimism + * verify-command: npx catapulta-verify -b broadcast/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol/10/run-latest.json + */ +contract DeployOptimism is OptimismScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode + ); + + // compose action + IPayloadsControllerCore.ExecutionAction[] + memory actions = new IPayloadsControllerCore.ExecutionAction[](1); + actions[0] = GovV3Helpers.buildAction(payload0); + + // register action at payloadsController + GovV3Helpers.createPayload(actions); + } +} + +/** + * @dev Deploy Metis + * deploy-command: make deploy-ledger contract=src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol:DeployMetis chain=metis + * verify-command: npx catapulta-verify -b broadcast/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol/1088/run-latest.json + */ +contract DeployMetis is MetisScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode + ); + + // compose action + IPayloadsControllerCore.ExecutionAction[] + memory actions = new IPayloadsControllerCore.ExecutionAction[](1); + actions[0] = GovV3Helpers.buildAction(payload0); + + // register action at payloadsController + GovV3Helpers.createPayload(actions); + } +} + +/** + * @dev Deploy Base + * deploy-command: make deploy-ledger contract=src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol:DeployBase chain=base + * verify-command: npx catapulta-verify -b broadcast/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol/8453/run-latest.json + */ +contract DeployBase is BaseScript { + function run() external broadcast { + // deploy payloads + address payload0 = GovV3Helpers.deployDeterministic( + type(AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320).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/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3_20240320.s.sol:CreateProposal chain=mainnet @@ -126,7 +241,7 @@ contract DeployBNB is BNBScript { contract CreateProposal is EthereumScript { function run() external { // create payloads - PayloadsControllerUtils.Payload[] memory payloads = new PayloadsControllerUtils.Payload[](5); + PayloadsControllerUtils.Payload[] memory payloads = new PayloadsControllerUtils.Payload[](10); // compose actions for validation IPayloadsControllerCore.ExecutionAction[] @@ -164,6 +279,41 @@ contract CreateProposal is EthereumScript { ); payloads[4] = GovV3Helpers.buildBNBPayload(vm, actionsBNB); + IPayloadsControllerCore.ExecutionAction[] + memory actionsScroll = new IPayloadsControllerCore.ExecutionAction[](1); + actionsScroll[0] = GovV3Helpers.buildAction( + type(AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode + ); + payloads[5] = GovV3Helpers.buildScrollPayload(vm, actionsScroll); + + IPayloadsControllerCore.ExecutionAction[] + memory actionsArbitrum = new IPayloadsControllerCore.ExecutionAction[](1); + actionsArbitrum[0] = GovV3Helpers.buildAction( + type(AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode + ); + payloads[6] = GovV3Helpers.buildArbitrumPayload(vm, actionsArbitrum); + + IPayloadsControllerCore.ExecutionAction[] + memory actionsOptimism = new IPayloadsControllerCore.ExecutionAction[](1); + actionsOptimism[0] = GovV3Helpers.buildAction( + type(AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode + ); + payloads[7] = GovV3Helpers.buildOptimismPayload(vm, actionsOptimism); + + IPayloadsControllerCore.ExecutionAction[] + memory actionsMetis = new IPayloadsControllerCore.ExecutionAction[](1); + actionsMetis[0] = GovV3Helpers.buildAction( + type(AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode + ); + payloads[8] = GovV3Helpers.buildMetisPayload(vm, actionsMetis); + + IPayloadsControllerCore.ExecutionAction[] + memory actionsBase = new IPayloadsControllerCore.ExecutionAction[](1); + actionsBase[0] = GovV3Helpers.buildAction( + type(AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320).creationCode + ); + payloads[9] = GovV3Helpers.buildBasePayload(vm, actionsBase); + // create proposal vm.startBroadcast(); GovV3Helpers.createProposal( diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/config.ts b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/config.ts index 4497b0852..6965f3d20 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/config.ts +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/config.ts @@ -1,8 +1,20 @@ import {ConfigFile} from '../../generator/types'; export const config: ConfigFile = { rootOptions: { + configFile: './src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/config.ts', author: 'BGD Labs @bgdlabs', - pools: ['AaveV3Ethereum', 'AaveV3Polygon', 'AaveV3Avalanche', 'AaveV3Gnosis', 'AaveV3BNB'], + pools: [ + 'AaveV3Ethereum', + 'AaveV3Polygon', + 'AaveV3Avalanche', + 'AaveV3Gnosis', + 'AaveV3BNB', + 'AaveV3Scroll', + 'AaveV3Arbitrum', + 'AaveV3Optimism', + 'AaveV3Metis', + 'AaveV3Base', + ], title: 'Hyperlane bridge adapter update to V3', shortName: 'HyperlaneBridgeAdapterUpdateToV3', date: '20240320', @@ -15,5 +27,10 @@ export const config: ConfigFile = { AaveV3Avalanche: {configs: {OTHERS: {}}, cache: {blockNumber: 43150105}}, AaveV3Gnosis: {configs: {OTHERS: {}}, cache: {blockNumber: 33027304}}, AaveV3BNB: {configs: {OTHERS: {}}, cache: {blockNumber: 37137492}}, + AaveV3Scroll: {configs: {OTHERS: {}}, cache: {blockNumber: 4850650}}, + AaveV3Arbitrum: {configs: {OTHERS: {}}, cache: {blockNumber: 201314733}}, + AaveV3Optimism: {configs: {OTHERS: {}}, cache: {blockNumber: 118797852}}, + AaveV3Metis: {configs: {OTHERS: {}}, cache: {blockNumber: 16616814}}, + AaveV3Base: {configs: {OTHERS: {}}, cache: {blockNumber: 13202337}}, }, }; From badd39f455f3cc95916fcbddbcc08c2d43418344 Mon Sep 17 00:00:00 2001 From: sendra Date: Tue, 16 Apr 2024 15:22:51 +0200 Subject: [PATCH 14/17] fix: update helpers --- lib/aave-helpers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/aave-helpers b/lib/aave-helpers index 8ff94a640..31ee36457 160000 --- a/lib/aave-helpers +++ b/lib/aave-helpers @@ -1 +1 @@ -Subproject commit 8ff94a640b0dc72649686357709a6396508f0ea6 +Subproject commit 31ee36457e84e41cc1d328cd923d226557c3fa10 From cc19b5df58742e66937fe61c4b1a543441b513bd Mon Sep 17 00:00:00 2001 From: sendra Date: Tue, 16 Apr 2024 15:33:53 +0200 Subject: [PATCH 15/17] fix: updated title with removal --- .../HyperlaneBridgeAdapterUpdateToV3.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md index f537ba42b..7d92bb614 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md @@ -1,5 +1,5 @@ --- -title: "Hyperlane bridge adapter update to V3" +title: "Hyperlane bridge adapter update to V3 and removal of old native bridge adapters" author: "BGD Labs @bgdlabs" discussions: "" --- From 220483c1a4964cc58c635568f30d6eef3504b5ed Mon Sep 17 00:00:00 2001 From: sendra Date: Thu, 18 Apr 2024 11:20:34 +0200 Subject: [PATCH 16/17] fix: updated readme with more information --- .../HyperlaneBridgeAdapterUpdateToV3.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md index 7d92bb614..c24ddfa24 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md @@ -8,7 +8,7 @@ discussions: "" This proposal updates the bridge Hyperlane bridge adapters used on a.DI to connect Ethereum with Polygon, Avalanche, Binance and Gnosis to the new Hyperlane V3 version. -Additionally, removes old native bridges on Optimism, Base, Arbitrum, Scroll and Metis +Additionally, removes old native bridges on Optimism, Base, Arbitrum, Scroll and Metis, after verifying that the new active versions work properly. ## Motivation @@ -29,6 +29,22 @@ to make it easy to track off chain | Binance | [0x3F006299eC88985c18E6e885EeA29A49eC579882](https://bscscan.com/address/0x3F006299eC88985c18E6e885EeA29A49eC579882) | | Gnosis | [0xA806DA549FcB2B4912a7dFFE4c1aA7A1ed0Bd5C9](https://bscscan.com/address/0xA806DA549FcB2B4912a7dFFE4c1aA7A1ed0Bd5C9) | +To add the new forwarder adapters the method `function enableBridgeAdapters(ForwarderBridgeAdapterConfigInput[] memory bridgeAdapters) external` will be used, +and to remove the old forwarder adapters, the method `function disableBridgeAdapters(BridgeAdapterToDisable[] memory bridgeAdapters) external` will be called on each CrossChainController. + +To add the new receiver adapters the method `function allowReceiverBridgeAdapters(ReceiverBridgeAdapterConfigInput[] memory bridgeAdaptersInput) external` will be used, +and to remove the old receiver adapters, the method `function disallowReceiverBridgeAdapters(ReceiverBridgeAdapterConfigInput[] memory bridgeAdaptersInput) external` will be called on each CrossChainController. + +The old native receiver bridge adapters to remove are: + +| Network | Native adapters | +| -------- | --------------------------------------------------------------------------------------------------------------------------------- | +| Arbitrum | [0x3829943c53F2d00e20B58475aF19716724bF90Ba](https://arbiscan.io/address/0x3829943c53F2d00e20B58475aF19716724bF90Ba) | +| Base | [0x7b62461a3570c6AC8a9f8330421576e417B71EE7](https://basescan.org/address/0x7b62461a3570c6AC8a9f8330421576e417B71EE7) | +| Metis | [0x746c675dAB49Bcd5BB9Dc85161f2d7Eb435009bf](https://explorer.metis.io/address/0x746c675dAB49Bcd5BB9Dc85161f2d7Eb435009bf) | +| Optimism | [0x81d32B36380e6266e1BDd490eAC56cdB300afBe0](https://optimistic.etherscan.io//address/0x81d32B36380e6266e1BDd490eAC56cdB300afBe0) | +| Scroll | [0x118DFD5418890c0332042ab05173Db4A2C1d283c](https://scrollscan.com/address/0x118DFD5418890c0332042ab05173Db4A2C1d283c) | + Code diffs for the different networks can be checked on a.DI diff repository for [revision 2](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2). Adapter diffs: [HLAdapter](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2/hyperlane), [BaseAdapter](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2/base_adapter), [IBaseAdapter](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs/rev2/i_base_adapter) From 165546ba1cf3ab6db050af160f698fcd14ce8dc0 Mon Sep 17 00:00:00 2001 From: sendra Date: Thu, 18 Apr 2024 11:31:24 +0200 Subject: [PATCH 17/17] fix: added discussion link --- ...3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol | 3 +-- ...Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol | 3 +-- ...AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol | 3 +-- ...aveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320.sol | 3 +-- ...3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol | 3 +-- ...eV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol | 3 +-- ...veV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol | 3 +-- ...3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320.sol | 3 +-- ...V3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol | 3 +-- ...eV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320.sol | 3 +-- .../HyperlaneBridgeAdapterUpdateToV3.md | 7 ++----- 11 files changed, 12 insertions(+), 25 deletions(-) diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol index 4129c9f1f..2a3c6e88a 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -8,8 +8,7 @@ import {ChainIds} from 'aave-helpers/ChainIds.sol'; /** * @title Hyperlane bridge adapter update to V3 * @author BGD Labs @bgdlabs - * - Snapshot: TODO - * - Discussion: TODO + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/31 */ contract AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320 is SimpleReceiverAdapterUpdate( diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol index fb0faea76..970ac8eef 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -8,8 +8,7 @@ import 'aave-helpers/adi/SimpleOneToManyAdapterUpdate.sol'; /** * @title Hyperlane bridge adapter update to V3 * @author BGD Labs @bgdlabs - * - Snapshot: TODO - * - Discussion: TODO + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/31 */ contract AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320 is SimpleOneToManyAdapterUpdate( diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol index 038ac5752..5471a247f 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -8,8 +8,7 @@ import {ChainIds} from 'aave-helpers/ChainIds.sol'; /** * @title Hyperlane bridge adapter update to V3 * @author BGD Labs @bgdlabs - * - Snapshot: TODO - * - Discussion: TODO + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/31 */ contract AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320 is SimpleOneToManyAdapterUpdate( diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320.sol index d8717cb33..4a76e8f3f 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -8,8 +8,7 @@ import {ChainIds} from 'aave-helpers/ChainIds.sol'; /** * @title Hyperlane bridge adapter update to V3 * @author BGD Labs @bgdlabs - * - Snapshot: TODO - * - Discussion: TODO + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/31 */ contract AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320 is SimpleReceiverAdapterUpdate( diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol index ed4e9e8bd..7b1d99277 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -8,8 +8,7 @@ import {ChainIds} from 'aave-helpers/ChainIds.sol'; /** * @title Hyperlane bridge adapter update to V3 * @author BGD Labs @bgdlabs - * - Snapshot: TODO - * - Discussion: TODO + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/31 */ contract AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320 is SimpleOneToManyAdapterUpdate( diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol index 59034db87..468dd76c3 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -8,8 +8,7 @@ import {ChainIds} from 'aave-helpers/ChainIds.sol'; /** * @title Hyperlane bridge adapter update to V3 * @author BGD Labs @bgdlabs - * - Snapshot: TODO - * - Discussion: TODO + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/31 */ contract AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320 is SimpleOneToManyAdapterUpdate( diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol index 578e18e26..2ed37d188 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -8,8 +8,7 @@ import {ChainIds} from 'aave-helpers/ChainIds.sol'; /** * @title Hyperlane bridge adapter update to V3 * @author BGD Labs @bgdlabs - * - Snapshot: TODO - * - Discussion: TODO + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/31 */ contract AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320 is SimpleReceiverAdapterUpdate( diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320.sol index 03cc37b02..77337a722 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -8,8 +8,7 @@ import {ChainIds} from 'aave-helpers/ChainIds.sol'; /** * @title Hyperlane bridge adapter update to V3 * @author BGD Labs @bgdlabs - * - Snapshot: TODO - * - Discussion: TODO + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/31 */ contract AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320 is SimpleReceiverAdapterUpdate( diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol index 7a34a9df6..19a91a390 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -8,8 +8,7 @@ import {ChainIds} from 'aave-helpers/ChainIds.sol'; /** * @title Hyperlane bridge adapter update to V3 * @author BGD Labs @bgdlabs - * - Snapshot: TODO - * - Discussion: TODO + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/31 */ contract AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320 is SimpleOneToManyAdapterUpdate( diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320.sol b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320.sol index cef19dc20..ca40f7383 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320.sol +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320.sol @@ -8,8 +8,7 @@ import {ChainIds} from 'aave-helpers/ChainIds.sol'; /** * @title Hyperlane bridge adapter update to V3 * @author BGD Labs @bgdlabs - * - Snapshot: TODO - * - Discussion: TODO + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/31 */ contract AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320 is SimpleReceiverAdapterUpdate( diff --git a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md index c24ddfa24..2acdf1000 100644 --- a/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md +++ b/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/HyperlaneBridgeAdapterUpdateToV3.md @@ -1,7 +1,7 @@ --- title: "Hyperlane bridge adapter update to V3 and removal of old native bridge adapters" author: "BGD Labs @bgdlabs" -discussions: "" +discussions: "https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/31" --- ## Simple Summary @@ -14,8 +14,6 @@ Additionally, removes old native bridges on Optimism, Base, Arbitrum, Scroll and The main motivation of this proposal is to bring the Hyperlane bridge adapters to the up to date version (V3). -This AIP also removes the old native bridges as new ones have already been set in place and are working. - ## Specification Updates the Hyperlane bridge adapters used to connect between networks to Hyperlane V3 and it also adds Adapter Name to the contracts @@ -52,8 +50,7 @@ Adapter diffs: [HLAdapter](https://github.com/bgd-labs/aDI-diffs/tree/main/diffs - Implementation: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Polygon](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Avalanche](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Gnosis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3BNB](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Scroll](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Arbitrum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Optimism](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Metis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320.sol), [AaveV3Base](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320.sol) - Tests: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Ethereum_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3Polygon](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Polygon_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3Avalanche](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Avalanche_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3Gnosis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Gnosis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3BNB](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3BNB_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3Scroll](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Scroll_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3Arbitrum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Arbitrum_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3Optimism](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Optimism_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3Metis](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Metis_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol), [AaveV3Base](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240320_Multi_HyperlaneBridgeAdapterUpdateToV3/AaveV3Base_HyperlaneBridgeAdapterUpdateToV3_20240320.t.sol) -- [Snapshot](TODO) -- [Discussion](TODO) +- [Discussion](https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/31) ## Copyright