MultiChainSignaturesModule
Inherits: ISafeTx
Author: Ultrasound Labs
Safe module that allows the same batched signature to be replayed across multiple chains; only
the transactions whose chainIds[i] match block.chainid are executed.
Note: security-contact: security@ultrasoundlabs.org
State Variables
VERSION
Human-readable contract version (kept for backwards compatibility with Safe tooling).
string public constant VERSION = "1.4.1-MCSM";
DOMAIN_SEPARATOR_TYPEHASH
bytes32 private constant DOMAIN_SEPARATOR_TYPEHASH =
keccak256("EIP712Domain(uint256 chainId,address verifyingContract)");
SAFE_TX_BATCH_TYPEHASH
bytes32 private constant SAFE_TX_BATCH_TYPEHASH = keccak256(
"SafeTxBatch(address subaccount,SafeTx[] safeTxs,uint256[] chainIds)SafeTx(address to,uint256 value,bytes data,uint8 operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address refundReceiver,uint256 nonce)"
);
SAFE_TX_TYPEHASH
bytes32 private constant SAFE_TX_TYPEHASH = keccak256(
"SafeTx(address to,uint256 value,bytes data,uint8 operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address refundReceiver,uint256 nonce)"
);
SIGLESS_TRANSACTION_EXECUTOR
The address of the SiglessTransactionExecutor library used for delegate-calls.
address public immutable SIGLESS_TRANSACTION_EXECUTOR;
Functions
constructor
Constructs the module.
constructor(address _siglessTransactionExecutor);
Parameters
| Name | Type | Description |
|---|---|---|
_siglessTransactionExecutor | address | Address of the library that will execute SafeTx via delegatecall. |
execTransactionBatch
Executes the subset of safeTxBatch targeted to the current chain.
function execTransactionBatch(address account, SafeTxBatch calldata safeTxBatch, bytes calldata signatures)
public
returns (bool success);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The Safe account the batch applies to. |
safeTxBatch | SafeTxBatch | Batch struct containing transactions and their intended chainIds. |
signatures | bytes | Concatenated owner signatures over the EIP-712 batch preimage. |
Returns
| Name | Type | Description |
|---|---|---|
success | bool | True if all on-chain-eligible transactions executed without failures. |
encodeTransactionBatchData
Encodes the SafeTxBatch into the pre-image for signature verification following the same structure hashing rules as Safe.
function encodeTransactionBatchData(SafeTxBatch calldata safeTxBatch) public view returns (bytes memory);
Parameters
| Name | Type | Description |
|---|---|---|
safeTxBatch | SafeTxBatch | Batch struct containing the transactions and their target chainIds. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bytes | encodedData The ABI-encoded EIP-712 pre-image that is signed by Safe owners. |
domainSeparator
Returns the domain separator used for batch hashing (chainId hard-coded to 1).
function domainSeparator() public view returns (bytes32 separator);
Returns
| Name | Type | Description |
|---|---|---|
separator | bytes32 | The EIP-712 domain separator. |
Events
SafeTxFailed
Emitted when a transaction in the batch reverts on the current chain.
event SafeTxFailed(address indexed safe, uint256 indexed index);
Parameters
| Name | Type | Description |
|---|---|---|
safe | address | The Safe account that attempted the execution. |
index | uint256 | The index of the failing transaction within the batch. |
Errors
MismatchedSubaccount
Custom errors
error MismatchedSubaccount();
Structs
SafeTxBatch
struct SafeTxBatch {
address subaccount;
SafeTx[] safeTxs;
uint256[] chainIds;
}