Skip to main content

Disperse Payment Signature Structure

To authorize disperse payment operations the user must generate a cryptographic signature compliant with the EIP-191 standard.

The signature is created by signing a precisely formatted string message derived from the payment details. The structure of this message varies slightly depending on whether the recipient is specified by a direct address (to_address) or an identity string (to_identity).

Signed Message Format

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

string.concat(
"ef83c1d6",
",",
AdvancedStrings.bytes32ToString(hashList),
",",
AdvancedStrings.addressToString(_token),
",",
Strings.toString(_amount),
",",
Strings.toString(_priorityFee),
",",
Strings.toString(_nonce),
",",
_priority_boolean ? "true" : "false",
",",
AdvancedStrings.addressToString(_executor)
)
  1. Function Selector: ef83c1d6 (identifies the dispersePay function)
  2. Hashed toData: bytes32ToString(sha256(abi.encode(toData))) (a hash of the recipient data array)
  3. Token Address: addressToString(_token) (lowercase string representation)
  4. Total Amount: Strings.toString(_amount) (string representation)
  5. Priority Fee: Strings.toString(_priorityFee) (string representation)
  6. Nonce: Strings.toString(_nonce) (string representation)
  7. Priority Flag: "true" or "false" (string representation based on _priority boolean)
  8. Executor Address: addressToString(_executor) (lowercase string representation)

(Helper functions like bytes32ToString, addressToString, and Strings.toString are assumed utilities for converting data types to their string representations for signing).

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)

Hash List Structure

The hashList component within the signature message is derived by ABI-encoding the entire toData array and then computing its sha256 hash:

bytes32 hashList = sha256(abi.encode(toData));

This ensures that the signature covers the specific recipient list and amounts.

DispersePayMetadata Struct

Defines the payment details for a single recipient within the toData array.

struct DispersePayMetadata {
uint256 amount;
address to_address;
string to_identity;
}