From b0103caceef620c7dbf29d4c2fe88d062d1deef9 Mon Sep 17 00:00:00 2001 From: cby3149 Date: Tue, 2 Jul 2024 13:55:19 -0700 Subject: [PATCH 1/3] Add withdrawal amount --- packages/boba/contracts/contracts/LP/L2LiquidityPool.sol | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/boba/contracts/contracts/LP/L2LiquidityPool.sol b/packages/boba/contracts/contracts/LP/L2LiquidityPool.sol index 429ea65e71..99b188c066 100644 --- a/packages/boba/contracts/contracts/LP/L2LiquidityPool.sol +++ b/packages/boba/contracts/contracts/LP/L2LiquidityPool.sol @@ -839,7 +839,8 @@ contract L2LiquidityPool is CrossDomainEnabled, ReentrancyGuardUpgradeable, Paus L1LiquidityPoolAddress, _amount, DEFAULT_FINALIZE_WITHDRAWAL_L1_GAS, - "" + "", + { value: _amount } ); } else { require(_amount <= IERC20(_tokenAddress).balanceOf(address(this)), "Requested ERC20 exceeds pool balance"); From 6bd84f4a561e28e540bdcb0cfeefdac28c79e8fe Mon Sep 17 00:00:00 2001 From: cby3149 Date: Tue, 2 Jul 2024 14:02:58 -0700 Subject: [PATCH 2/3] Fix smart contract --- packages/boba/contracts/contracts/LP/L2LiquidityPool.sol | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/boba/contracts/contracts/LP/L2LiquidityPool.sol b/packages/boba/contracts/contracts/LP/L2LiquidityPool.sol index 99b188c066..4bd9e7ec0e 100644 --- a/packages/boba/contracts/contracts/LP/L2LiquidityPool.sol +++ b/packages/boba/contracts/contracts/LP/L2LiquidityPool.sol @@ -834,13 +834,12 @@ contract L2LiquidityPool is CrossDomainEnabled, ReentrancyGuardUpgradeable, Paus if (_tokenAddress == Lib_PredeployAddresses.OVM_ETH) { require(_amount <= address(this).balance, "Requested ETH exceeds pool balance"); - L2StandardBridge(Lib_PredeployAddresses.L2_STANDARD_BRIDGE).withdrawTo( + L2StandardBridge(Lib_PredeployAddresses.L2_STANDARD_BRIDGE).withdrawTo{ value: _amount }( _tokenAddress, L1LiquidityPoolAddress, _amount, DEFAULT_FINALIZE_WITHDRAWAL_L1_GAS, - "", - { value: _amount } + "" ); } else { require(_amount <= IERC20(_tokenAddress).balanceOf(address(this)), "Requested ERC20 exceeds pool balance"); From 59b10be776e52dd32450fbc817c55f742d010593 Mon Sep 17 00:00:00 2001 From: cby3149 Date: Tue, 2 Jul 2024 14:14:06 -0700 Subject: [PATCH 3/3] Add a helper function --- .../contracts/contracts/LP/L2LiquidityPool.sol | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/boba/contracts/contracts/LP/L2LiquidityPool.sol b/packages/boba/contracts/contracts/LP/L2LiquidityPool.sol index 4bd9e7ec0e..44f1396cfe 100644 --- a/packages/boba/contracts/contracts/LP/L2LiquidityPool.sol +++ b/packages/boba/contracts/contracts/LP/L2LiquidityPool.sol @@ -834,7 +834,7 @@ contract L2LiquidityPool is CrossDomainEnabled, ReentrancyGuardUpgradeable, Paus if (_tokenAddress == Lib_PredeployAddresses.OVM_ETH) { require(_amount <= address(this).balance, "Requested ETH exceeds pool balance"); - L2StandardBridge(Lib_PredeployAddresses.L2_STANDARD_BRIDGE).withdrawTo{ value: _amount }( + L2LiquidityPoolHelper(payable(Lib_PredeployAddresses.L2_STANDARD_BRIDGE)).withdrawTo{ value: _amount }( _tokenAddress, L1LiquidityPoolAddress, _amount, @@ -1032,3 +1032,15 @@ contract L2LiquidityPool is CrossDomainEnabled, ReentrancyGuardUpgradeable, Paus } } + +interface L2LiquidityPoolHelper { + function withdrawTo( + address _l2Token, + address _to, + uint256 _amount, + uint32 _l1Gas, + bytes calldata _data + ) + external + payable; +}