Function: claimFastWithdraw(address l1Token, address to, uint256 amount, byte[32] messageHash, bytes signature)
A user submits a withdrawal request on Cloak, sets the contract FastWithdrawVault as the target address, and provides the actual recipient address in the payload. The Cloak sequencer checks if the transaction is valid. If the checks are passed, the user can fast-withdraw tokens through this function with the signature provided by the sequencer.
Inputs
l1TokenControl: Fully controlled by the caller.
Constraints: Must equal the
l1Tokenencoded in the signed message.Impact: The address of the token to be withdrawn.
toControl: Fully controlled by the caller.
Constraints: Must equal the
toencoded in the signed message.Impact: The address of the recipient.
amountControl: Fully controlled by the caller.
Constraints: Must equal the
amountencoded in the signed message.Impact: The amount of tokens to withdraw.
messageHashControl: Fully controlled by the caller.
Constraints: Must equal the
messageHashencoded in the signed message.Impact: The corresponding withdraw-message hash on Cloak.
signatureControl: Fully controlled by the caller.
Constraints: Must be a valid EIP-712 signature over
(l1Token, l2Token, to, amount, messageHash).Impact: The signature of the message from the sequencer.
Branches and code coverage
Intended branches
This function emits the event
Withdraw.The user receives the token as expected.
The amount of the corresponding token held by the contract decreases.
Negative behavior
Reverts if the signer does not have
SEQUENCER_ROLE.Reverts if the signature is invalid.
Reverts if the fast withdraw is already processed.