diff --git a/contracts/.changeset/chilly-news-wink.md b/contracts/.changeset/chilly-news-wink.md new file mode 100644 index 00000000000..80bd5ad37ac --- /dev/null +++ b/contracts/.changeset/chilly-news-wink.md @@ -0,0 +1,5 @@ +--- +'@chainlink/contracts': minor +--- + +#feature Add two new pool types: Siloed-LockRelease and BurnToAddress and fix bug in HybridUSDCTokenPool for transferLiqudity #bugfix diff --git a/contracts/gas-snapshots/ccip.gas-snapshot b/contracts/gas-snapshots/ccip.gas-snapshot index 3dcef0ec6c7..17d69f5a499 100644 --- a/contracts/gas-snapshots/ccip.gas-snapshot +++ b/contracts/gas-snapshots/ccip.gas-snapshot @@ -133,6 +133,7 @@ FeeQuoter_updateTokenPriceFeeds:test_ZeroFeeds() (gas: 12471) FeeQuoter_validateDestFamilyAddress:test_ValidEVMAddress() (gas: 6789) FeeQuoter_validateDestFamilyAddress:test_ValidNonEVMAddress() (gas: 6514) HybridLockReleaseUSDCTokenPool_TransferLiquidity:test_transferLiquidity() (gas: 167715) +HybridLockReleaseUSDCTokenPool_TransferLiquidity:test_transferLiquidity_MultipleChainsSequentially() (gas: 233095) HybridLockReleaseUSDCTokenPool_lockOrBurn:test_PrimaryMechanism() (gas: 130356) HybridLockReleaseUSDCTokenPool_lockOrBurn:test_onLockReleaseMechanism() (gas: 140104) HybridLockReleaseUSDCTokenPool_lockOrBurn:test_onLockReleaseMechanism_thenSwitchToPrimary() (gas: 202967) diff --git a/contracts/src/v0.8/ccip/test/pools/USDC/HybridLockReleaseUSDCTokenPool/HybridLockReleaseUSDCTokenPool.transferLiquidity.t.sol b/contracts/src/v0.8/ccip/test/pools/USDC/HybridLockReleaseUSDCTokenPool/HybridLockReleaseUSDCTokenPool.transferLiquidity.t.sol index d0600d26b88..4b55b31f2fb 100644 --- a/contracts/src/v0.8/ccip/test/pools/USDC/HybridLockReleaseUSDCTokenPool/HybridLockReleaseUSDCTokenPool.transferLiquidity.t.sol +++ b/contracts/src/v0.8/ccip/test/pools/USDC/HybridLockReleaseUSDCTokenPool/HybridLockReleaseUSDCTokenPool.transferLiquidity.t.sol @@ -63,6 +63,34 @@ contract HybridLockReleaseUSDCTokenPool_TransferLiquidity is HybridLockReleaseUS ); } + function test_transferLiquidity_MultipleChainsSequentially() public { + // Set as the OWNER so we can provide liquidity + vm.startPrank(OWNER); + + uint64 RANDOM_CHAIN_SELECTOR = DEST_CHAIN_SELECTOR + 1; + + s_usdcTokenPool.setLiquidityProvider(DEST_CHAIN_SELECTOR, OWNER); + s_usdcTokenPool.setLiquidityProvider(RANDOM_CHAIN_SELECTOR, OWNER); + + s_token.approve(address(s_usdcTokenPool), type(uint256).max); + + uint256 liquidityAmount = 1e9; + + // Provide some liquidity to the pool + s_usdcTokenPool.provideLiquidity(DEST_CHAIN_SELECTOR, liquidityAmount); + s_usdcTokenPool.provideLiquidity(RANDOM_CHAIN_SELECTOR, liquidityAmount); + + // Set the new token pool as the rebalancer + s_usdcTokenPool.transferOwnership(address(s_usdcTokenPoolTransferLiquidity)); + + // Test the ability to transfer liquidity from multiple chains in multiple sequential calls + s_usdcTokenPoolTransferLiquidity.transferLiquidity(address(s_usdcTokenPool), DEST_CHAIN_SELECTOR); + s_usdcTokenPoolTransferLiquidity.transferLiquidity(address(s_usdcTokenPool), RANDOM_CHAIN_SELECTOR); + + assertEq(s_token.balanceOf(address(s_usdcTokenPoolTransferLiquidity)), liquidityAmount * 2); + assertEq(s_usdcTokenPoolTransferLiquidity.getLockedTokensForChain(RANDOM_CHAIN_SELECTOR), liquidityAmount); + } + function test_RevertWhen_cannotTransferLiquidityDuringPendingMigration() public { // Set as the OWNER so we can provide liquidity vm.startPrank(OWNER);