Instant Layer
Instant Layer
The Instant Layer verifies EIP-712 signed operations from authorized signers and routes them to either PartyB contracts or MultiAccount contracts,
Read more about Instant Layer's role in Instant Actions here.
Key Concepts
SignedOperation: The core unit of execution. Contains call data, the signer address, an optional account source (MultiAccount address for PartyA operations, address(0) for PartyB operations), a nonce, a salt, a deadline, and an EIP-712 signature.
Salt: A bytes32 value included in every operation hash. Provides replay protection without requiring sequential ordering. Every operation hash is tracked and cannot be reused.
Nonce: Optional ordered execution. When set to 0, the operation relies solely on salt-based replay protection. When non-zero, it must equal nonces[signer] + 1 — enforcing strict ordering for that signer.
Template: A stored sequence of Operation structs, each defining insertion points and source indices. These tell the executor where to write return values from prior steps into later call data payloads.
Insertion Points: Byte offsets within call data where a prior operation's return value (decoded as bytes32) is written via assembly. This is how templates chain results between steps.
setCallFromInstantLayer: Before executing any operations, the contract calls symmio.setCallFromInstantLayer(true). After all operations complete (or on failure), it resets the flag to false. This signals to the core protocol that execution is happening through the Instant Layer.
Registration Management
Both PartyB contracts and MultiAccount contracts must be registered before they can participate in Instant Layer execution.
registerPartyB / unregisterPartyB
Sets registeredPartyBs[partyB] to true/false. Registration also grants OPERATOR_ROLE to the PartyB address; unregistration revokes it.
Events: PartyBRegistered(partyB) / PartyBUnregistered(partyB)
registerPartyBBatch
Registers multiple PartyBs in a single transaction. Grants OPERATOR_ROLE to each.
registerMultiAccount / unregisterMultiAccount
Sets registeredMultiAccounts[multiAccount] to true/false. Does not grant or revoke OPERATOR_ROLE — MultiAccount contracts are routing targets, not executors.
Events: MultiAccountRegistered(multiAccount) / MultiAccountUnregistered(multiAccount)
registerMultiAccountBatch
Registers multiple MultiAccount contracts in a single transaction.
Template Management
Templates define reusable operation sequences where earlier results can be injected into later call data.
addTemplate()
Creates a new template with an auto-incremented ID. Active by default.
Parameters:
name: Human-readable label (for off-chain reference).operations: Array ofOperationstructs. Each contains:insertionPoints— byte offsets in call data where prior results should be written.sourceIndices— which prior operation's result to use at each insertion point.
Event: TemplateAdded(templateId, name)
setTemplateActive()
Enables or disables a template. Reverts with InvalidTemplate if the ID doesn't exist.
Event: TemplateUpdated(templateId, active)
Operation Execution
executeTemplate()
Executes a stored template's operation sequence. Operations run in order with return value injection between steps.
Parameters:
templateId: Must exist and be active.signedOps: Must have exactly the same length as the template's operations array.
Execution flow:
Validates template existence, active status, and array length match.
Calls
symmio.setCallFromInstantLayer(true).For each operation:
_verifyOperation()— checks deadline, registration, replay protection, signature, and optional nonce._insertResults()— writes prior return values into call data at the template's specified offsets._executeOperationSafe()— routes to MultiAccount or PartyB.
Calls
symmio.setCallFromInstantLayer(false).
Event: OperationsExecuted(templateId, msg.sender)
executeBatch()
Executes independent signed operations atomically.
Parameters:
signedOps: Must not be empty (reverts withEmptyBatch).
Execution flow:
Calls
symmio.setCallFromInstantLayer(true).For each operation: verify and execute. On failure, reset flag and revert with
OperationFailed.Calls
symmio.setCallFromInstantLayer(false).
Event: BatchExecuted(msg.sender, signedOps.length)
View Functions
isPartyBRegistered / isMultiAccountRegistered
getTemplate / getTemplateOperations / getLastTemplateID
Structs
Operation
Defines where to inject prior results into call data within a template.
Template
A stored sequence of operations with a name and active flag.
SignedOperation
A signed unit of execution. accountSource is the MultiAccount address for PartyA operations, or address(0) for PartyB operations where signer is the PartyB contract address.
Last updated
