Relayer Calls
Relayer calls allow an end-user to sign a Ambient command using an off-chain EIP-712 signature. This signed command can then be executed inside an Ethereum transaction sent by a third-party relayer. The user can optionally "tip" the relayer to compensate for the gas cost.
callpathIdx
and cmd
are the same parameters that would be passed to the standard userCmd
and will behave identically.
Conds
conds
is a bytestring encoded in a fixed format that governs the conditions of the relayer call. If any of the set conditions are not met at execution call, the transaction will fail. The bytestring is encoded as follows
block.timestamp
must occur before deadline
and after alive
nonce
defines a user-specific relayer nonce that increments by one on every relayer call. The user's current on-chain nonce must match the condition or the transaction will falt. This is to prevent replay attacks. Every unique value of salt
defines a unique nonce track (that starts at 0), this allows for multidimensional nonces.
relayer
restricts the address of the relayer that can execute the command. Either msg.sender
or tx.origin
must match this address or the contract call will revert. If this value is set to address(0)
the condition is unenforced.
tip
The bytestring of tip
can either be empty (in which case no tip is paid to the relayer) or can be set using the following fixed encoding scheme:
token
is the token the tip is being paid in. amount
is the total amount of the token being paid as a tip to relayer.
recv
is the recipient of the relayer tip. It can either be set to a specific address (either EOA or smart contract), or can be generically paid based on the following magic values:
address(256)
- Tip is paid to themsg.sender
of the contract calleraddress(512)
- Tip is paid to thetx.origin
of the Ethereum transaction.
Tips are always paid from the surplus collateral balance of the end-user. If the end-user has insufficient surplus collateral the contract call will revert.
signature
This is the EIP-712 signature of the command and conditions. It is constructed from the standard v, r, and s recovery signature as follows:
The signature is constructed using the EIP-712 standard. The EIP-712 domain hash is constructed as:
The typed content hash is constructed as
Last updated