Skip to main content

Withdrawal Signature Structure

To authorize withdrawal operations from the EVVM protocol, the user whose funds are being withdrawn (from) must generate a cryptographic signature compliant with the EIP-191 standard.

This signature proves the user's intent and authorization to withdraw a specific amount of a token to a designated external addressToReceive (if any), according to the parameters included in the signed message.

Signed Message Format

The message is constructed by concatenating the following components as strings, separated by commas (,):

string.concat(
_priority_boolean ? "920f3d76" : "52896a1f",
",",
AdvancedStrings.addressToString(addressToReceive),
",",
AdvancedStrings.addressToString(_token),
",",
Strings.toString(_amount),
",",
Strings.toString(_priorityFee),
",",
Strings.toString(_nonce),
",",
_priority_boolean ? "true" : "false"
)

1. Withdrawal Identifier (Hex String):

  • Value: Depends on the _priority_boolean flag indicating the intended nonce type:
    • 920f3d76: Used for asynchronous withdrawals (_priority_boolean is true).
    • 52896a1f: Used for synchronous withdrawals (_priority_boolean is false).

2. Recipient Address (String):

  • Value: The result of AdvancedStrings.addressToString(addressToReceive).
  • Purpose: The string representation of the destination address on the external network where the withdrawn tokens should be sent via the bridge.

3. Token Address (String):

  • Value: The result of AdvancedStrings.addressToString(_token).
  • Purpose: The string representation of the ERC20 token contract address being withdrawn.

4. Amount (String):

  • Value: The result of Strings.toString(_amount).
  • Purpose: The string representation of the quantity (uint256) of the token the user authorizes to be withdrawn.

5. Priority Fee (String):

  • Value: The result of Strings.toString(_priorityFee).
  • Purpose: The string representation of the fee (uint256) included in the transaction authorization. (Note: Whether this fee is paid to an executor depends on the specific withdrawal function called, e.g., NoMateStaking versions typically do not pay this to the executor).

6. Nonce (String):

  • Value: The result of Strings.toString(_nonce).
  • Purpose: The string representation of the user's (from address's) nonce required for replay protection. This must match the user's expected synchronous nonce if _priority_boolean is false, or be an unused asynchronous nonce if _priority_boolean is true.

7. Priority Flag (String):

  • Value: The literal string "true" if _priority_boolean is true (asynchronous), or "false" if _priority_boolean is false (synchronous).
  • Purpose: Explicitly includes the intended nonce context (sync/async) in the signed message, aligning with the chosen Withdrawal Identifier.
tip
  • addressToString converts an address to a lowercase string
  • Strings.toString converts a number to a string
  • _priority_boolean indicates whether the payment will be executed asynchronously (true) or synchronously (false)
  • The function selector (4faa1fa2 for synchronous or f4e1895b for asynchronous) is determined by the _priority_boolean value