Function: executeWithdrawAction(EventTypes.WithdrawData withdraw, uint64 eventId)
This allows to withdraw previously deposited funds. The vault in the destination chain should contain enough liquidity to withdraw from.
Inputs
withdrawControl: Full control by operator.
Constraints: Balance of
accountIdis enough, thebrokerIdandtokenis allowed, and the balance oftokenin the destinationchainIdis enough. ThewithdrawNonceshould not be less than the last nonce.Impact: The funds of the tokens from
accountIdwill be transferred to thereceiverinchainId.
eventIdControl: Full control by operator.
Constraints: There are not any checks.
Impact: The unique ID of withdraw action.
Branches and code coverage
Intended branches
Check if the branch has test coverage.
Include function calls.
End sentences with periods.
Negative behavior
Sender is not related to the
accountId.Untrusted
brokerId.Untrusted
tokenSymbol.The
withdrawNonceis less than the last.tokenAmountis more thanaccountIdbalance.tokenAmountis more than Vault balance inchainId.receiveris the zero address.The
frozenBalanceofaccountIdis not zero.The
frozenBalanceofaccountIdis not zero.
Function call analysis
vaultManager.getAllowedBroker(brokerHash)External/Internal? External.
Argument control?
brokerHashis controlled by operator.Impact: Return true if the
brokerHashis allowed.
vaultManager.getAllowedChainToken(tokenHash, withdraw.chainId)External/Internal? External.
Argument control?
tokenHashis calculated;withdraw.chainIdis controlled by operator.Impact: Return true if the
tokenHashinchainIdis allowed.
vaultManager.getMaxWithdrawFee(tokenHash)External/Internal? External.
Argument control?
tokenHashis calculated.Impact: Return the max fee value for
tokenHash.
vaultManager.getBalance(tokenHash, withdraw.chainId)External/Internal? External.
Argument control?
tokenHashis calculated;withdraw.chainIdis controlled by operator.Impact: Return the balance of all deposited funds for
tokenHashinchainId.
Signature.verifyWithdraw(withdraw.sender, withdraw)External/Internal? Internal.
Argument control? All arguments are controlled by operator.
Impact: Verify that sender has signed the withdraw data.
account.frozenBalance(withdraw.withdrawNonce, tokenHash, withdraw.tokenAmount)External/Internal? Internal.
Argument control? All arguments are controlled by operator.
Impact: Decrease the balance of
accountIdand increase the frozen balance.
vaultManager.frozenBalance(tokenHash, withdraw.chainId, withdraw.tokenAmount - withdraw.fee)External/Internal? External.
Argument control? All arguments are controlled by operator.
Impact: Increase the frozen balance of
tokenHashinchainId.
ILedgerCrossChainManager(crossChainManagerAddress).withdraw(withdraw)External/Internal? External.
Argument control?
withdrawis controlled by operator.Impact: Send cross-chain LayerZero message to perform withdraw action in Vault in destination chain.