Skip to content

Commit

Permalink
fix parent pool complete withdraw function
Browse files Browse the repository at this point in the history
  • Loading branch information
lufaque committed Oct 9, 2024
1 parent 7e241c6 commit 17b4c3e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/hardhat/contracts/ParentPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,7 @@ contract ParentPool is IParentPool, CCIPReceiver, ParentPoolCommon, ParentPoolSt
function _completeWithdraw(bytes32 withdrawalId) internal {
WithdrawRequest storage request = s_withdrawRequests[withdrawalId];
uint256 amountToWithdraw = request.amountToWithdraw;
address lpAddress = request.lpAddress;

i_lpToken.burn(request.lpAmountToBurn);
i_USDC.safeTransfer(request.lpAddress, amountToWithdraw);
Expand All @@ -740,10 +741,10 @@ contract ParentPool is IParentPool, CCIPReceiver, ParentPoolCommon, ParentPoolSt
? s_withdrawAmountLocked - amountToWithdraw
: 0;

delete s_withdrawalIdByLPAddress[msg.sender];
delete s_withdrawalIdByLPAddress[lpAddress];
delete s_withdrawRequests[withdrawalId];

emit WithdrawalCompleted(withdrawalId, msg.sender, address(i_USDC), amountToWithdraw);
emit WithdrawalCompleted(withdrawalId, lpAddress, address(i_USDC), amountToWithdraw);
}

/**
Expand Down

0 comments on commit 17b4c3e

Please sign in to comment.