From ecd784a6e191b1225b2a72ba30fce0b520f873e3 Mon Sep 17 00:00:00 2001 From: andrejrakic Date: Mon, 16 Dec 2024 16:30:30 +0100 Subject: [PATCH] chore: Migrate Chainlink Local CCT guides to v1.5.1 --- .../ccip/foundry/cct-burn-and-mint-fork.mdx | 54 ++++++++++------ .../foundry/cct-lock-and-release-fork.mdx | 62 +++++++++++++------ 2 files changed, 78 insertions(+), 38 deletions(-) diff --git a/src/content/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork.mdx b/src/content/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork.mdx index 1bf73d166f3..99f4210b002 100644 --- a/src/content/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork.mdx +++ b/src/content/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork.mdx @@ -167,7 +167,10 @@ contract CCIPv1_5BurnMintPoolFork is Test { CCIPLocalSimulatorFork public ccipLocalSimulatorFork; MockERC20BurnAndMintToken public mockERC20TokenEthSepolia; MockERC20BurnAndMintToken public mockERC20TokenBaseSepolia; + BurnMintTokenPool public burnMintTokenPoolEthSepolia; + BurnMintTokenPool public burnMintTokenPoolBaseSepolia; + Register.NetworkDetails ethSepoliaNetworkDetails; Register.NetworkDetails baseSepoliaNetworkDetails; uint256 ethSepoliaFork; @@ -230,12 +233,14 @@ contract CCIPv1_5BurnMintPoolFork is Test { function test_forkSupportNewCCIPToken() public { // Step 3) Deploy BurnMintTokenPool on Ethereum Sepolia vm.selectFork(ethSepoliaFork); - Register.NetworkDetails memory ethSepoliaNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); + ethSepoliaNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); address[] memory allowlist = new address[](0); + uint8 localTokenDecimals = 18; vm.startPrank(alice); - BurnMintTokenPool burnMintTokenPoolEthSepolia = new BurnMintTokenPool( + burnMintTokenPoolEthSepolia = new BurnMintTokenPool( IBurnMintERC20(address(mockERC20TokenEthSepolia)), + localTokenDecimals, allowlist, ethSepoliaNetworkDetails.rmnProxyAddress, ethSepoliaNetworkDetails.routerAddress @@ -257,8 +262,9 @@ contract CCIPv1_5BurnMintPoolFork is Test { baseSepoliaNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); vm.startPrank(alice); - BurnMintTokenPool burnMintTokenPoolBaseSepolia = new BurnMintTokenPool( + burnMintTokenPoolBaseSepolia = new BurnMintTokenPool( IBurnMintERC20(address(mockERC20TokenBaseSepolia)), + localTokenDecimals, allowlist, baseSepoliaNetworkDetails.rmnProxyAddress, baseSepoliaNetworkDetails.routerAddress @@ -434,15 +440,17 @@ contract CCIPv1_5BurnMintPoolFork is Test { vm.startPrank(alice); TokenPool.ChainUpdate[] memory chains = new TokenPool.ChainUpdate[](1); + bytes[] memory remotePoolAddressesEthSepolia = new bytes[](1); + remotePoolAddressesEthSepolia[0] = abi.encode(address(burnMintTokenPoolEthSepolia)); chains[0] = TokenPool.ChainUpdate({ remoteChainSelector: baseSepoliaNetworkDetails.chainSelector, - allowed: true, - remotePoolAddress: abi.encode(address(burnMintTokenPoolBaseSepolia)), + remotePoolAddresses: remotePoolAddressesEthSepolia, remoteTokenAddress: abi.encode(address(mockERC20TokenBaseSepolia)), outboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: 100_000, rate: 167 }), inboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: 100_000, rate: 167 }) }); - burnMintTokenPoolEthSepolia.applyChainUpdates(chains); + uint64[] memory remoteChainSelectorsToRemove = new uint64[](0); + burnMintTokenPoolEthSepolia.applyChainUpdates(remoteChainSelectorsToRemove, chains); vm.stopPrank(); } } @@ -460,15 +468,16 @@ contract CCIPv1_5BurnMintPoolFork is Test { vm.startPrank(alice); chains = new TokenPool.ChainUpdate[](1); + bytes[] memory remotePoolAddressesBaseSepolia = new bytes[](1); + remotePoolAddressesBaseSepolia[0] = abi.encode(address(burnMintTokenPoolEthSepolia)); chains[0] = TokenPool.ChainUpdate({ remoteChainSelector: ethSepoliaNetworkDetails.chainSelector, - allowed: true, - remotePoolAddress: abi.encode(address(burnMintTokenPoolEthSepolia)), + remotePoolAddresses: remotePoolAddressesBaseSepolia, remoteTokenAddress: abi.encode(address(mockERC20TokenEthSepolia)), outboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: 100_000, rate: 167 }), inboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: 100_000, rate: 167 }) }); - burnMintTokenPoolBaseSepolia.applyChainUpdates(chains); + burnMintTokenPoolBaseSepolia.applyChainUpdates(remoteChainSelectorsToRemove, chains); vm.stopPrank(); } } @@ -590,7 +599,10 @@ contract CCIPv1_5BurnMintPoolFork is Test { CCIPLocalSimulatorFork public ccipLocalSimulatorFork; MockERC20BurnAndMintToken public mockERC20TokenEthSepolia; MockERC20BurnAndMintToken public mockERC20TokenBaseSepolia; + BurnMintTokenPool public burnMintTokenPoolEthSepolia; + BurnMintTokenPool public burnMintTokenPoolBaseSepolia; + Register.NetworkDetails ethSepoliaNetworkDetails; Register.NetworkDetails baseSepoliaNetworkDetails; uint256 ethSepoliaFork; @@ -625,12 +637,14 @@ contract CCIPv1_5BurnMintPoolFork is Test { function test_forkSupportNewCCIPToken() public { // Step 3) Deploy BurnMintTokenPool on Ethereum Sepolia vm.selectFork(ethSepoliaFork); - Register.NetworkDetails memory ethSepoliaNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); + ethSepoliaNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); address[] memory allowlist = new address[](0); + uint8 localTokenDecimals = 18; vm.startPrank(alice); - BurnMintTokenPool burnMintTokenPoolEthSepolia = new BurnMintTokenPool( + burnMintTokenPoolEthSepolia = new BurnMintTokenPool( IBurnMintERC20(address(mockERC20TokenEthSepolia)), + localTokenDecimals, allowlist, ethSepoliaNetworkDetails.rmnProxyAddress, ethSepoliaNetworkDetails.routerAddress @@ -642,8 +656,9 @@ contract CCIPv1_5BurnMintPoolFork is Test { baseSepoliaNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); vm.startPrank(alice); - BurnMintTokenPool burnMintTokenPoolBaseSepolia = new BurnMintTokenPool( + burnMintTokenPoolBaseSepolia = new BurnMintTokenPool( IBurnMintERC20(address(mockERC20TokenBaseSepolia)), + localTokenDecimals, allowlist, baseSepoliaNetworkDetails.rmnProxyAddress, baseSepoliaNetworkDetails.routerAddress @@ -729,15 +744,17 @@ contract CCIPv1_5BurnMintPoolFork is Test { vm.startPrank(alice); TokenPool.ChainUpdate[] memory chains = new TokenPool.ChainUpdate[](1); + bytes[] memory remotePoolAddressesEthSepolia = new bytes[](1); + remotePoolAddressesEthSepolia[0] = abi.encode(address(burnMintTokenPoolEthSepolia)); chains[0] = TokenPool.ChainUpdate({ remoteChainSelector: baseSepoliaNetworkDetails.chainSelector, - allowed: true, - remotePoolAddress: abi.encode(address(burnMintTokenPoolBaseSepolia)), + remotePoolAddresses: remotePoolAddressesEthSepolia, remoteTokenAddress: abi.encode(address(mockERC20TokenBaseSepolia)), outboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: 100_000, rate: 167 }), inboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: 100_000, rate: 167 }) }); - burnMintTokenPoolEthSepolia.applyChainUpdates(chains); + uint64[] memory remoteChainSelectorsToRemove = new uint64[](0); + burnMintTokenPoolEthSepolia.applyChainUpdates(remoteChainSelectorsToRemove, chains); vm.stopPrank(); // Step 14) Configure Token Pool on Base Sepolia @@ -745,15 +762,16 @@ contract CCIPv1_5BurnMintPoolFork is Test { vm.startPrank(alice); chains = new TokenPool.ChainUpdate[](1); + bytes[] memory remotePoolAddressesBaseSepolia = new bytes[](1); + remotePoolAddressesBaseSepolia[0] = abi.encode(address(burnMintTokenPoolEthSepolia)); chains[0] = TokenPool.ChainUpdate({ remoteChainSelector: ethSepoliaNetworkDetails.chainSelector, - allowed: true, - remotePoolAddress: abi.encode(address(burnMintTokenPoolEthSepolia)), + remotePoolAddresses: remotePoolAddressesBaseSepolia, remoteTokenAddress: abi.encode(address(mockERC20TokenEthSepolia)), outboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: 100_000, rate: 167 }), inboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: 100_000, rate: 167 }) }); - burnMintTokenPoolBaseSepolia.applyChainUpdates(chains); + burnMintTokenPoolBaseSepolia.applyChainUpdates(remoteChainSelectorsToRemove, chains); vm.stopPrank(); // Step 15) Mint tokens on Ethereum Sepolia and transfer them to Base Sepolia diff --git a/src/content/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork.mdx b/src/content/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork.mdx index 85b6a215d66..0fa001649b5 100644 --- a/src/content/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork.mdx +++ b/src/content/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork.mdx @@ -134,6 +134,11 @@ contract CCIPv1_5LockReleasePoolFork is Test { CCIPLocalSimulatorFork public ccipLocalSimulatorFork; MockERC20TokenOwner public mockERC20TokenEthSepolia; MockERC20TokenOwner public mockERC20TokenBaseSepolia; + LockReleaseTokenPool public lockReleaseTokenPoolEthSepolia; + LockReleaseTokenPool public lockReleaseTokenPoolBaseSepolia; + + Register.NetworkDetails ethSepoliaNetworkDetails; + Register.NetworkDetails baseSepoliaNetworkDetails; uint256 ethSepoliaFork; uint256 baseSepoliaFork; @@ -195,12 +200,14 @@ contract CCIPv1_5LockReleasePoolFork is Test { function test_forkSupportNewCCIPToken() public { // Step 3) Deploy LockReleaseTokenPool on Ethereum Sepolia vm.selectFork(ethSepoliaFork); - Register.NetworkDetails memory ethSepoliaNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); + ethSepoliaNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); address[] memory allowlist = new address[](0); + uint8 localTokenDecimals = 18; vm.startPrank(alice); - LockReleaseTokenPool lockReleaseTokenPoolEthSepolia = new LockReleaseTokenPool( + lockReleaseTokenPoolEthSepolia = new LockReleaseTokenPool( IERC20(address(mockERC20TokenEthSepolia)), + localTokenDecimals, allowlist, ethSepoliaNetworkDetails.rmnProxyAddress, true, // acceptLiquidity @@ -220,11 +227,12 @@ contract CCIPv1_5LockReleasePoolFork is Test { // Step 4) Deploy LockReleaseTokenPool on Base Sepolia vm.selectFork(baseSepoliaFork); - Register.NetworkDetails memory baseSepoliaNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); + baseSepoliaNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); vm.startPrank(alice); - LockReleaseTokenPool lockReleaseTokenPoolBaseSepolia = new LockReleaseTokenPool( + lockReleaseTokenPoolBaseSepolia = new LockReleaseTokenPool( IERC20(address(mockERC20TokenBaseSepolia)), + localTokenDecimals, allowlist, baseSepoliaNetworkDetails.rmnProxyAddress, true, // acceptLiquidity @@ -407,15 +415,17 @@ contract CCIPv1_5LockReleasePoolFork is Test { vm.startPrank(alice); TokenPool.ChainUpdate[] memory chains = new TokenPool.ChainUpdate[](1); + bytes[] memory remotePoolAddressesEthSepolia = new bytes[](1); + remotePoolAddressesEthSepolia[0] = abi.encode(address(lockReleaseTokenPoolBaseSepolia)); chains[0] = TokenPool.ChainUpdate({ remoteChainSelector: baseSepoliaNetworkDetails.chainSelector, - allowed: true, - remotePoolAddress: abi.encode(address(lockReleaseTokenPoolBaseSepolia)), + remotePoolAddresses: remotePoolAddressesEthSepolia, remoteTokenAddress: abi.encode(address(mockERC20TokenBaseSepolia)), outboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: liquidityAmount, rate: 167 }), inboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: liquidityAmount, rate: 167 }) }); - lockReleaseTokenPoolEthSepolia.applyChainUpdates(chains); + uint64[] memory remoteChainSelectorsToRemove = new uint64[](0); + lockReleaseTokenPoolEthSepolia.applyChainUpdates(remoteChainSelectorsToRemove, chains); vm.stopPrank(); } } @@ -433,15 +443,16 @@ contract CCIPv1_5LockReleasePoolFork is Test { vm.startPrank(alice); chains = new TokenPool.ChainUpdate[](1); + bytes[] memory remotePoolAddressesBaseSepolia = new bytes[](1); + remotePoolAddressesBaseSepolia[0] = abi.encode(address(lockReleaseTokenPoolEthSepolia)); chains[0] = TokenPool.ChainUpdate({ remoteChainSelector: ethSepoliaNetworkDetails.chainSelector, - allowed: true, - remotePoolAddress: abi.encode(address(lockReleaseTokenPoolEthSepolia)), + remotePoolAddresses: remotePoolAddressesBaseSepolia, remoteTokenAddress: abi.encode(address(mockERC20TokenEthSepolia)), outboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: liquidityAmount, rate: 167 }), inboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: liquidityAmount, rate: 167 }) }); - lockReleaseTokenPoolBaseSepolia.applyChainUpdates(chains); + lockReleaseTokenPoolBaseSepolia.applyChainUpdates(remoteChainSelectorsToRemove, chains); vm.stopPrank(); } } @@ -534,6 +545,11 @@ contract CCIPv1_5LockReleasePoolFork is Test { CCIPLocalSimulatorFork public ccipLocalSimulatorFork; MockERC20TokenOwner public mockERC20TokenEthSepolia; MockERC20TokenOwner public mockERC20TokenBaseSepolia; + LockReleaseTokenPool public lockReleaseTokenPoolEthSepolia; + LockReleaseTokenPool public lockReleaseTokenPoolBaseSepolia; + + Register.NetworkDetails ethSepoliaNetworkDetails; + Register.NetworkDetails baseSepoliaNetworkDetails; uint256 ethSepoliaFork; uint256 baseSepoliaFork; @@ -567,12 +583,14 @@ contract CCIPv1_5LockReleasePoolFork is Test { function test_forkSupportNewCCIPToken() public { // Step 3) Deploy LockReleaseTokenPool on Ethereum Sepolia vm.selectFork(ethSepoliaFork); - Register.NetworkDetails memory ethSepoliaNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); + ethSepoliaNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); address[] memory allowlist = new address[](0); + uint8 localTokenDecimals = 18; vm.startPrank(alice); - LockReleaseTokenPool lockReleaseTokenPoolEthSepolia = new LockReleaseTokenPool( + lockReleaseTokenPoolEthSepolia = new LockReleaseTokenPool( IERC20(address(mockERC20TokenEthSepolia)), + localTokenDecimals, allowlist, ethSepoliaNetworkDetails.rmnProxyAddress, true, // acceptLiquidity @@ -582,11 +600,12 @@ contract CCIPv1_5LockReleasePoolFork is Test { // Step 4) Deploy LockReleaseTokenPool on Base Sepolia vm.selectFork(baseSepoliaFork); - Register.NetworkDetails memory baseSepoliaNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); + baseSepoliaNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); vm.startPrank(alice); - LockReleaseTokenPool lockReleaseTokenPoolBaseSepolia = new LockReleaseTokenPool( + lockReleaseTokenPoolBaseSepolia = new LockReleaseTokenPool( IERC20(address(mockERC20TokenBaseSepolia)), + localTokenDecimals, allowlist, baseSepoliaNetworkDetails.rmnProxyAddress, true, // acceptLiquidity @@ -679,15 +698,17 @@ contract CCIPv1_5LockReleasePoolFork is Test { vm.startPrank(alice); TokenPool.ChainUpdate[] memory chains = new TokenPool.ChainUpdate[](1); + bytes[] memory remotePoolAddressesEthSepolia = new bytes[](1); + remotePoolAddressesEthSepolia[0] = abi.encode(address(lockReleaseTokenPoolBaseSepolia)); chains[0] = TokenPool.ChainUpdate({ remoteChainSelector: baseSepoliaNetworkDetails.chainSelector, - allowed: true, - remotePoolAddress: abi.encode(address(lockReleaseTokenPoolBaseSepolia)), + remotePoolAddresses: remotePoolAddressesEthSepolia, remoteTokenAddress: abi.encode(address(mockERC20TokenBaseSepolia)), outboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: liquidityAmount, rate: 167 }), inboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: liquidityAmount, rate: 167 }) }); - lockReleaseTokenPoolEthSepolia.applyChainUpdates(chains); + uint64[] memory remoteChainSelectorsToRemove = new uint64[](0); + lockReleaseTokenPoolEthSepolia.applyChainUpdates(remoteChainSelectorsToRemove, chains); vm.stopPrank(); // Step 14) Configure Token Pool on Base Sepolia @@ -695,15 +716,16 @@ contract CCIPv1_5LockReleasePoolFork is Test { vm.startPrank(alice); chains = new TokenPool.ChainUpdate[](1); + bytes[] memory remotePoolAddressesBaseSepolia = new bytes[](1); + remotePoolAddressesBaseSepolia[0] = abi.encode(address(lockReleaseTokenPoolEthSepolia)); chains[0] = TokenPool.ChainUpdate({ remoteChainSelector: ethSepoliaNetworkDetails.chainSelector, - allowed: true, - remotePoolAddress: abi.encode(address(lockReleaseTokenPoolEthSepolia)), + remotePoolAddresses: remotePoolAddressesBaseSepolia, remoteTokenAddress: abi.encode(address(mockERC20TokenEthSepolia)), outboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: liquidityAmount, rate: 167 }), inboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: liquidityAmount, rate: 167 }) }); - lockReleaseTokenPoolBaseSepolia.applyChainUpdates(chains); + lockReleaseTokenPoolBaseSepolia.applyChainUpdates(remoteChainSelectorsToRemove, chains); vm.stopPrank(); // Step 15) Transfer tokens from Ethereum Sepolia to Base Sepolia