Function: accountWithDrawFinish(AccountTypes.AccountWithdraw withdraw)
This function is called in the process of cross-chain withdrawal of funds. At first, the executeWithdrawAction
function is triggered in this chain — after that, withdrawal in Vault contract in destination chain. And then, the Vault contract triggers a cross-chain message that triggers this function to finish the withdraw process, after successfully transferring funds to receiver.
This is the structure of input withdraw
object:
Branches and code coverage
Intended branches
Withdraw process finished properly.
The frozen balance is zero after call.
Negative behavior
accountId
is not registered.sender
is not related to theaccountId
.receiver
is the zero address.brokerHash
is not allowed.tokenHash
is not allowed.chainId
is untrusted.withdrawNonce
already used.
Function call analysis
account.finishFrozenBalance(withdraw.withdrawNonce, withdraw.tokenHash, withdraw.tokenAmount);
External/Internal? Internal.
Argument control? All arguments are controlled by operator.
Impact: Function deletes the frozen account funds to finish withdraw process.
vaultManager.finishFrozenBalance(withdraw.tokenHash, withdraw.chainId, withdraw.tokenAmount - withdraw.fee);
External/Internal? External.
Argument control? All arguments are controlled by operator.
Impact: Function deletes the frozen
vaultManager
funds to finish withdraw process.
feeManager.getFeeCollector(IFeeManager.FeeCollectorType.WithdrawFeeCollector);
External/Internal? External.
Argument control? Is not controlled by operator.
Impact: Returns id of the account that receives the fee.
feeCollectorAccount.addBalance(withdraw.tokenHash, withdraw.fee);
External/Internal? Internal.
Argument control? All arguments are controlled by operator.
Impact: Add fee to the fee receiver balance.