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 new file mode 100644 index 000000000..da9f23131 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -0,0 +1,21 @@ +// 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..c64ea61fe --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Arbitrum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -0,0 +1,21 @@ +// 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 new file mode 100644 index 000000000..21c4d67a2 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {ChainIds} from 'aave-helpers/ChainIds.sol'; +import {MiscAvalanche} from 'aave-address-book/MiscAvalanche.sol'; +import {GovernanceV3Avalanche} from 'aave-address-book/GovernanceV3Avalanche.sol'; +import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; + +/** + * @title aDI and bridge adapters update + * @author BGD Labs @bgdlabs + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/21 + */ +contract AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313 is + BaseAdaptersUpdatePayload( + BaseAdaptersUpdatePayload.ConstructorInput({ + ccc: GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER, + proxyAdmin: MiscAvalanche.PROXY_ADMIN, + newCCCImplementation: 0x5Ef80c5eB6CF65Dab8cD1C0ee258a6D2bD38Bd22, + ccipNewAdapter: 0x2b88C83727B0E290B76EB3F6133994fF81B7f355, + ccipAdapterToRemove: 0x3F006299eC88985c18E6e885EeA29A49eC579882 + }) + ) +{ + 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 = 0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29; + destinationAdapters[0].chainId = ChainIds.MAINNET; + + return destinationAdapters; + } +} 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..8c48f0ea8 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -0,0 +1,27 @@ +// 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 { + constructor() + BaseTest( + GovernanceV3Avalanche.CROSS_CHAIN_CONTROLLER, + MiscAvalanche.PROXY_ADMIN, + type(AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode, + 'avalanche', + 42801819 + ) + {} +} 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..267c5cda3 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {ChainIds} from 'aave-helpers/ChainIds.sol'; +import {MiscBNB} from 'aave-address-book/MiscBNB.sol'; +import {GovernanceV3BNB} from 'aave-address-book/GovernanceV3BNB.sol'; +import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; + +/** + * @title aDI and bridge adapters update + * @author BGD Labs @bgdlabs + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/21 + */ +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 new file mode 100644 index 000000000..90491cacc --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -0,0 +1,26 @@ +// 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 { + constructor() + BaseTest( + GovernanceV3BNB.CROSS_CHAIN_CONTROLLER, + MiscBNB.PROXY_ADMIN, + type(AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode, + 'bnb', + 37073128 + ) + {} +} 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..90e975b89 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -0,0 +1,21 @@ +// 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..4bc7cc4af --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Base_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -0,0 +1,21 @@ +// 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 new file mode 100644 index 000000000..72b2128e5 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {ChainIds} from 'aave-helpers/ChainIds.sol'; +import {MiscEthereum} from 'aave-address-book/MiscEthereum.sol'; +import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; +import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; + +/** + * @title aDI and bridge adapters update + * @author BGD Labs @bgdlabs + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/21 + */ +contract AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313 is + BaseAdaptersUpdatePayload( + BaseAdaptersUpdatePayload.ConstructorInput({ + ccc: GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER, + proxyAdmin: MiscEthereum.PROXY_ADMIN, + newCCCImplementation: 0x28559c2F4B038b1E836fA419DCcDe7454d8Fe215, + ccipNewAdapter: 0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29, + ccipAdapterToRemove: 0xDB8953194810b1942544fA528791278D458719D5 + }) + ) +{ + 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[](3); + + destinationAdapters[0].adapter = 0x2b88C83727B0E290B76EB3F6133994fF81B7f355; + destinationAdapters[0].chainId = ChainIds.AVALANCHE; + + destinationAdapters[1].adapter = 0xe79757D55a1600eF28D816a893E78E9FCDE2019E; + destinationAdapters[1].chainId = ChainIds.POLYGON; + + destinationAdapters[2].adapter = 0xAE93BEa44dcbE52B625169588574d31e36fb3A67; + destinationAdapters[2].chainId = ChainIds.BNB; + + return destinationAdapters; + } +} 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..452cfdc2f --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -0,0 +1,29 @@ +// 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 { + constructor() + BaseTest( + GovernanceV3Ethereum.CROSS_CHAIN_CONTROLLER, + MiscEthereum.PROXY_ADMIN, + type(AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode, + 'mainnet', + 19418547 + ) + {} +} 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..d07749aea --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -0,0 +1,21 @@ +// 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..c68702fb7 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Gnosis_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -0,0 +1,21 @@ +// 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..28b627c48 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -0,0 +1,21 @@ +// 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..2b45e7c5b --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Metis_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -0,0 +1,21 @@ +// 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..b78cab479 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -0,0 +1,21 @@ +// 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..d6717230d --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Optimism_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -0,0 +1,21 @@ +// 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 new file mode 100644 index 000000000..c04e92853 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {ChainIds} from 'aave-helpers/ChainIds.sol'; +import {MiscPolygon} from 'aave-address-book/MiscPolygon.sol'; +import {GovernanceV3Polygon} from 'aave-address-book/GovernanceV3Polygon.sol'; +import {BaseAdaptersUpdatePayload} from './BaseAdaptersUpdatePayload.sol'; + +/** + * @title aDI and bridge adapters update + * @author BGD Labs @bgdlabs + * - Discussion: https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/21 + */ +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 getDestinationAdapters() + public + pure + override + returns (DestinationAdaptersInput[] memory) + { + DestinationAdaptersInput[] memory destinationAdapters = new DestinationAdaptersInput[](1); + + destinationAdapters[0].adapter = 0xB7a6618df58626C3a122ABAFD6Ee63Af63f3Ef29; + destinationAdapters[0].chainId = ChainIds.MAINNET; + + return destinationAdapters; + } +} 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..074f83b52 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -0,0 +1,25 @@ +// 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 { + constructor() + BaseTest( + GovernanceV3Polygon.CROSS_CHAIN_CONTROLLER, + MiscPolygon.PROXY_ADMIN, + type(AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313).creationCode, + 'polygon', + 54566890 + ) + {} +} 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..e32cd1d8a --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.sol @@ -0,0 +1,21 @@ +// 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..4b6b34610 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/AaveV3Scroll_UpdateADIImplementationAndCCIPAdapters_20240313.t.sol @@ -0,0 +1,21 @@ +// 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 new file mode 100644 index 000000000..ef059f78b --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/BaseTest.sol @@ -0,0 +1,356 @@ +// 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; + 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 BaseCCCImplementationUpdatePayloadTest { + BaseAdaptersUpdatePayload internal ethereumPayload; + BaseAdaptersUpdatePayload internal polygonPayload; + BaseAdaptersUpdatePayload internal avalanchePayload; + BaseAdaptersUpdatePayload internal binancePayload; + + constructor( + address ccc, + address proxyAdmin, + bytes memory _payloadCode, + string memory _network, + uint256 _blockNumber + ) BaseCCCImplementationUpdatePayloadTest(ccc, proxyAdmin, _payloadCode, _network, _blockNumber) {} + + function setUp() public override { + super.setUp(); + + ethereumPayload = new AaveV3Ethereum_UpdateADIImplementationAndCCIPAdapters_20240313(); + polygonPayload = new AaveV3Polygon_UpdateADIImplementationAndCCIPAdapters_20240313(); + avalanchePayload = new AaveV3Avalanche_UpdateADIImplementationAndCCIPAdapters_20240313(); + binancePayload = new AaveV3BNB_UpdateADIImplementationAndCCIPAdapters_20240313(); + } + + 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 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/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md new file mode 100644 index 000000000..247bae65b --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters.md @@ -0,0 +1,61 @@ +--- +title: "Update a.DI implementation and CCIP adapters" +author: "BGD Labs @bgdlabs" +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 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) + +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) | + +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) +- 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 + +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..79bc186af --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/UpdateADIImplementationAndCCIPAdapters_20240313.s.sol @@ -0,0 +1,328 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {GovV3Helpers, IPayloadsControllerCore, PayloadsControllerUtils} from 'aave-helpers/GovV3Helpers.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 + * 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 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 + */ +contract CreateProposal is EthereumScript { + function run() external { + // create payloads + PayloadsControllerUtils.Payload[] memory payloads = new PayloadsControllerUtils.Payload[](10); + + // 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); + + 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( + 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..95f74c7f3 --- /dev/null +++ b/src/20240313_Multi_UpdateADIImplementationAndCCIPAdapters/config.ts @@ -0,0 +1,35 @@ +import {ConfigFile} from '../../generator/types'; +export const config: ConfigFile = { + rootOptions: { + author: 'BGD Labs @bgdlabs', + pools: [ + 'AaveV3Ethereum', + 'AaveV3Polygon', + 'AaveV3Avalanche', + 'AaveV3BNB', + 'AaveV3Base', + 'AaveV3Gnosis', + 'AaveV3Optimism', + 'AaveV3Arbitrum', + 'AaveV3Metis', + 'AaveV3Scroll', + ], + 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}}, + 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}}, + }, +};