From e527565b421d6fec29519cc17bffc83ec59327c2 Mon Sep 17 00:00:00 2001 From: Oleg Date: Thu, 12 Dec 2024 15:22:38 +0000 Subject: [PATCH] hotfix for setPools --- .env.deployments.mainnet | 10 +++--- contracts/ChildPool.sol | 69 -------------------------------------- contracts/ParentPool.sol | 72 ++-------------------------------------- 3 files changed, 8 insertions(+), 143 deletions(-) diff --git a/.env.deployments.mainnet b/.env.deployments.mainnet index 97e3c650..df4ff541 100644 --- a/.env.deployments.mainnet +++ b/.env.deployments.mainnet @@ -39,9 +39,9 @@ CHILD_POOL_PROXY_ADMIN_AVALANCHE=0x3888A36fF10D894DA4000c94340C40761138C69F CHILD_POOL_PROXY_ADMIN_POLYGON=0x3888A36fF10D894DA4000c94340C40761138C69F ### CHILD POOLS IMPLEMENTATIONS MAINNET ### -CHILD_POOL_ARBITRUM=0x0786fF7667393A926A19812F45c510BF148E9e07 -CHILD_POOL_POLYGON=0x021CA4CFDFaDFc0Ec78731a6467d7e4110E2aFe8 -CHILD_POOL_AVALANCHE=0xE6F7331FBf3aC0d2431Fa6e8E30025C27227Dc8B +CHILD_POOL_ARBITRUM=0x005fbD9F071089E4809D96125593C91DA06cfb8a +CHILD_POOL_POLYGON=0x0E7e4F4051dc1Ed9a4e6925c8ae81Bc7A7dadA03 +CHILD_POOL_AVALANCHE=0xE00c9F35c22af8Ea0fE0e1aBB7055B036CD9670c ### PARENT POOL PROXY PRODUCTION CONTRACTS ADDRESSES ### PARENT_POOL_PROXY_BASE=0x0AE1B2730066AD46481ab0a5fd2B5893f8aBa323 @@ -50,7 +50,7 @@ PARENT_POOL_PROXY_BASE=0x0AE1B2730066AD46481ab0a5fd2B5893f8aBa323 PARENT_POOL_PROXY_ADMIN_BASE=0xF069f384a177083c4d62539e187860d2e163b0F4 ### PARENT POOL IMPLEMENTATION PRODUCTION CONTRACTS ADDRESSES ### -PARENT_POOL_BASE=0x00ae866A88ED98582F796A4a9c5e8a472a3fDd29 +PARENT_POOL_BASE=0xd1e678F184Bc10814c834910B49207A3f84bbf8f PARENT_POOL_AUTOMATION_FORWARDER_BASE=0x15B457D85653A2cdebCd8E742bBCcADB1691bc2A @@ -72,4 +72,4 @@ CONCERO_PAUSE_POLYGON=0x00c4d25487297C4fc1341aa840a4F56e474f6A0d CONCERO_PAUSE_BASE=0x00c4d25487297C4fc1341aa840a4F56e474f6A0d CONCERO_PAUSE_AVALANCHE=0x00c4d25487297C4fc1341aa840a4F56e474f6A0d -PARENT_POOL_CLF_CLA_BASE=0x9015c8E94D168b4DF96aC189Cd7b54F94B77C94F \ No newline at end of file +PARENT_POOL_CLF_CLA_BASE=0x16920260fbd66960A1Ef71dca1560c231C53B36f \ No newline at end of file diff --git a/contracts/ChildPool.sol b/contracts/ChildPool.sol index f49bb605..8b72b3db 100644 --- a/contracts/ChildPool.sol +++ b/contracts/ChildPool.sol @@ -296,11 +296,6 @@ contract ChildPool is CCIPReceiver, ChildPoolStorage { abi.decode(any2EvmMessage.sender, (address)) ) { - if (_isOldCcipFailedMessage(any2EvmMessage)) { - _processOldCcipFailedMessage(any2EvmMessage); - return; - } - ICCIP.CcipTxData memory ccipTxData = abi.decode(any2EvmMessage.data, (ICCIP.CcipTxData)); uint256 ccipReceivedAmount = any2EvmMessage.destTokenAmounts[0].amount; address ccipReceivedToken = any2EvmMessage.destTokenAmounts[0].token; @@ -339,70 +334,6 @@ contract ChildPool is CCIPReceiver, ChildPoolStorage { ); } - function _processOldCcipFailedMessage(Client.Any2EVMMessage memory message) internal { - if (message.destTokenAmounts[0].token != address(i_USDC)) { - revert NotUsdcToken(); - } - - (address lpAddress, address user, uint256 receivedFee) = abi.decode( - message.data, - (address, address, uint256) - ); - - bool isUserTx = receivedFee > 0 && user != address(0); - bool isWithdrawalTx = lpAddress != address(0); - - if (isUserTx) { - bool isTxConfirmed = IInfraOrchestrator(i_infraProxy).isTxConfirmed(message.messageId); - - if (!isTxConfirmed) { - IInfraOrchestrator(i_infraProxy).confirmTx(message.messageId); - i_USDC.safeTransfer(user, message.destTokenAmounts[0].amount); - } else { - uint256 amountAfterFees = (message.destTokenAmounts[0].amount - receivedFee); - s_loansInUse -= amountAfterFees; - } - } else if (isWithdrawalTx) { - revert("Old CCIP failed message"); - } - - emit CCIPReceived( - message.messageId, - message.sourceChainSelector, - abi.decode(message.sender, (address)), - message.destTokenAmounts[0].token, - message.destTokenAmounts[0].amount - ); - } - - function _isOldCcipFailedMessage( - Client.Any2EVMMessage memory message - ) internal pure returns (bool) { - bytes32[13] memory failedMessages = [ - bytes32(0xf5fa6715661250a9a69c0b7a3deee972f05e4a6ecc551e3731254c2d99bb0039), - bytes32(0x4214466b4db150fa026c619a1c37a5fa26864fde962e326bf78b4116ab25481f), - bytes32(0xbf395fee83447a4ec365efdf6b698daebaa7e1d93220b8bf7952a26493317205), - bytes32(0xb05685f874de4e1377e9b280a99d862fd52add8d7dea879f10b6fe0dcfdd7211), - bytes32(0x087e924eb468df95e97d0aea0cc85bf7367c476bb1751c570033dd6487206c90), - bytes32(0xfbf870987a20d29b24823f413342ccd5a1e85694bc49270b03bcd0091596024e), - bytes32(0xd6c0a2fb3bd52a0edef1c782d2ccd122c1945dd34179148e9488f75bc5e41e68), - bytes32(0x406f4caaaef00a91b16589fff2f4fcd334a9c05978296da810663b2e827b2224), - bytes32(0x32f49eac7b11d44f33215257f9b152e87b3cf572a872c26e7905752b56e7f368), - bytes32(0x828d6857ef072b9bc0f36bc8b363c624c92a67fd76ea62f39b5fa23b637a05c8), - bytes32(0xe70206c11d0773b922e331ec598cedc379e5e7ad2eed813171faf2f72e3d7e1c), - bytes32(0x184e805eec1e349090750e44abf68df005ff06d95a8929cf7eea86bf397a1730), - bytes32(0x185eb6b85943ffaa724a59f151d2b5e717ff1bb9dbaf802ceaec5f63910e0551) - ]; - - for (uint256 i; i < failedMessages.length; i++) { - if (message.messageId == failedMessages[i]) { - return true; - } - } - - return false; - } - /** * @notice Function to Distribute Liquidity across Concero Pools and process withdrawals * @param _chainSelector the chainSelector of the pool to send the USDC diff --git a/contracts/ParentPool.sol b/contracts/ParentPool.sol index 77157ffc..fd952a00 100644 --- a/contracts/ParentPool.sol +++ b/contracts/ParentPool.sol @@ -250,6 +250,7 @@ contract ParentPool is IParentPool, CCIPReceiver, ParentPoolCommon, ParentPoolSt * @param _usdcAmount amount to be deposited */ function startDeposit(uint256 _usdcAmount) external onlyProxyContext { + revert("paused"); if (_usdcAmount < MIN_DEPOSIT) { revert DepositAmountBelowMinimum(MIN_DEPOSIT); } @@ -297,6 +298,7 @@ contract ParentPool is IParentPool, CCIPReceiver, ParentPoolCommon, ParentPoolSt * @param _depositRequestId the ID of the deposit request */ function completeDeposit(bytes32 _depositRequestId) external onlyProxyContext { + revert("paused"); DepositRequest storage request = s_depositRequests[_depositRequestId]; address lpAddress = request.lpAddress; uint256 usdcAmount = request.usdcAmountToDeposit; @@ -337,6 +339,7 @@ contract ParentPool is IParentPool, CCIPReceiver, ParentPoolCommon, ParentPoolSt * @param _lpAmount the amount of LP tokens to be burnt */ function startWithdrawal(uint256 _lpAmount) external onlyProxyContext { + revert("paused"); if (_lpAmount < 1 ether) revert WithdrawAmountBelowMinimum(1 ether); if (s_withdrawalIdByLPAddress[msg.sender] != bytes32(0)) { revert WithdrawalRequestAlreadyExists(); @@ -621,11 +624,6 @@ contract ParentPool is IParentPool, CCIPReceiver, ParentPoolCommon, ParentPoolSt abi.decode(any2EvmMessage.sender, (address)) ) { - if (_isOldCcipFailedMessage(any2EvmMessage)) { - _processOldCcipFailedMessage(any2EvmMessage); - return; - } - ICCIP.CcipTxData memory ccipTxData = abi.decode(any2EvmMessage.data, (ICCIP.CcipTxData)); uint256 ccipReceivedAmount = any2EvmMessage.destTokenAmounts[0].amount; address ccipReceivedToken = any2EvmMessage.destTokenAmounts[0].token; @@ -688,70 +686,6 @@ contract ParentPool is IParentPool, CCIPReceiver, ParentPoolCommon, ParentPoolSt ); } - function _processOldCcipFailedMessage(Client.Any2EVMMessage memory message) internal { - if (message.destTokenAmounts[0].token != address(i_USDC)) { - revert NotUsdcToken(); - } - - (address lpAddress, address user, uint256 receivedFee) = abi.decode( - message.data, - (address, address, uint256) - ); - - bool isUserTx = receivedFee > 0 && user != address(0); - bool isWithdrawalTx = lpAddress != address(0); - - if (isUserTx) { - bool isTxConfirmed = IInfraOrchestrator(i_infraProxy).isTxConfirmed(message.messageId); - - if (!isTxConfirmed) { - IInfraOrchestrator(i_infraProxy).confirmTx(message.messageId); - i_USDC.safeTransfer(user, message.destTokenAmounts[0].amount); - } else { - uint256 amountAfterFees = (message.destTokenAmounts[0].amount - receivedFee); - s_loansInUse -= amountAfterFees; - } - } else if (isWithdrawalTx) { - revert("Old CCIP failed message"); - } - - emit CCIPReceived( - message.messageId, - message.sourceChainSelector, - abi.decode(message.sender, (address)), - message.destTokenAmounts[0].token, - message.destTokenAmounts[0].amount - ); - } - - function _isOldCcipFailedMessage( - Client.Any2EVMMessage memory message - ) internal pure returns (bool) { - bytes32[13] memory failedMessages = [ - bytes32(0xf5fa6715661250a9a69c0b7a3deee972f05e4a6ecc551e3731254c2d99bb0039), - bytes32(0x4214466b4db150fa026c619a1c37a5fa26864fde962e326bf78b4116ab25481f), - bytes32(0xbf395fee83447a4ec365efdf6b698daebaa7e1d93220b8bf7952a26493317205), - bytes32(0xb05685f874de4e1377e9b280a99d862fd52add8d7dea879f10b6fe0dcfdd7211), - bytes32(0x087e924eb468df95e97d0aea0cc85bf7367c476bb1751c570033dd6487206c90), - bytes32(0xfbf870987a20d29b24823f413342ccd5a1e85694bc49270b03bcd0091596024e), - bytes32(0xd6c0a2fb3bd52a0edef1c782d2ccd122c1945dd34179148e9488f75bc5e41e68), - bytes32(0x406f4caaaef00a91b16589fff2f4fcd334a9c05978296da810663b2e827b2224), - bytes32(0x32f49eac7b11d44f33215257f9b152e87b3cf572a872c26e7905752b56e7f368), - bytes32(0x828d6857ef072b9bc0f36bc8b363c624c92a67fd76ea62f39b5fa23b637a05c8), - bytes32(0xe70206c11d0773b922e331ec598cedc379e5e7ad2eed813171faf2f72e3d7e1c), - bytes32(0x184e805eec1e349090750e44abf68df005ff06d95a8929cf7eea86bf397a1730), - bytes32(0x185eb6b85943ffaa724a59f151d2b5e717ff1bb9dbaf802ceaec5f63910e0551) - ]; - - for (uint256 i; i < failedMessages.length; i++) { - if (message.messageId == failedMessages[i]) { - return true; - } - } - - return false; - } - /** * @notice Function to process the withdraw request * @param withdrawalId the id of the withdraw request