SiglessTransactionExecutor
Inherits: ISafeTx, SecuredTokenTransfer, Executor, GuardManager
Author: Ultrasound Labs - @ultrasoundlabs This contract merges the "sigless" execution (no signature check) with the full Safe transaction execution logic. It allows you to execute a SafeTx struct directly, skipping signature checks, but still performing all the other steps (gas accounting, payment, etc) as in the original Safe contract. We don't import the Safe contract to save on gas costs.
Safe account has to delegatecall this contract to execute SafeTx with a normal flow except for the signature verification
State Variables
DOMAIN_SEPARATOR_TYPEHASH
bytes32 private constant DOMAIN_SEPARATOR_TYPEHASH = 0x47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218;
SAFE_TX_TYPEHASH
bytes32 private constant SAFE_TX_TYPEHASH = 0xbb8310d486368db6bd6f849402fdd73ad53d316b5a4b2644ad6efe0f941286d8;
__gap
uint256[5] private __gap;
nonce
Tracks the next expected Safe transaction nonce.
uint256 public nonce;
Functions
revertWithError
Function which uses assembly to revert with the passed error message.
Currently it is expected that the error string is at max 5 bytes of length. Ex: "GSXXX"
function revertWithError(bytes5 error) internal pure;
Parameters
| Name | Type | Description |
|---|---|---|
error | bytes5 | The error string to revert with. |
execTransaction
Execute a SafeTx without requiring a signature.
This function unpacks the SafeTx struct and executes the transaction using the same logic as the original Safe contract, but skips signature verification. This is useful for trusted modules or scenarios where signature checks are not needed.
function execTransaction(SafeTx calldata safeTx) public returns (bool success);
Parameters
| Name | Type | Description |
|---|---|---|
safeTx | SafeTx | The SafeTx struct containing all transaction parameters. |
Returns
| Name | Type | Description |
|---|---|---|
success | bool | True if the transaction was executed successfully, false otherwise. |
_handlePayment
Handles the payment/refund for a Safe transaction.
*Forked from Gnosis Safe handlePayment. Slither’s arbitrary-send-eth
detector reports the receiver.send(payment) call below. In the
canonical Safe design this is intentional and safe:
- The refund occurs after successful execution of the user’s transaction.
- Only the entity footing the gas bill (
refundReceiverortx.origin) receives the refund. - The 2 300-gas stipend of
.sendmitigates re-entrancy; reverting on failure matches upstream semantics and prevents silent griefing.*
function _handlePayment(
uint256 gasUsed,
uint256 baseGas,
uint256 gasPrice,
address gasToken,
address payable refundReceiver
) private returns (uint256 payment);
Parameters
| Name | Type | Description |
|---|---|---|
gasUsed | uint256 | Gas used by the Safe transaction. |
baseGas | uint256 | Gas costs that are independent of the transaction execution (e.g. base transaction fee, signature check, payment of the refund). |
gasPrice | uint256 | Gas price that should be used for the payment calculation. |
gasToken | address | Token address (or 0 if ETH) that is used for the payment. |
refundReceiver | address payable | Address that will receive the refund (defaults to tx.origin). |
Returns
| Name | Type | Description |
|---|---|---|
payment | uint256 | The amount of payment made in the specified token. |
encodeTransactionData
Returns the pre-image of the transaction hash (see getTransactionHash).
Forked from Safe.sol
function encodeTransactionData(
address to,
uint256 value,
bytes memory data,
Enum.Operation operation,
uint256 safeTxGas,
uint256 baseGas,
uint256 gasPrice,
address gasToken,
address refundReceiver,
uint256 _nonce
) internal view returns (bytes memory);
Parameters
| Name | Type | Description |
|---|---|---|
to | address | Destination address. |
value | uint256 | Ether value. |
data | bytes | Data payload. |
operation | Enum.Operation | Operation type. |
safeTxGas | uint256 | Gas that should be used for the safe transaction. |
baseGas | uint256 | Gas costs for that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund) |
gasPrice | uint256 | Maximum gas price that should be used for this transaction. |
gasToken | address | Token address (or 0 if ETH) that is used for the payment. |
refundReceiver | address | Address of receiver of gas payment (or 0 if tx.origin). |
_nonce | uint256 | Transaction nonce. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bytes | Transaction hash bytes. |
domainSeparator
Returns the EIP-712 domain separator (chainId hard-coded to 1).
Returns the domain separator for this contract, as defined in the EIP-712 standard.
Forked from Safe.sol
function domainSeparator() public view returns (bytes32 separator);
Returns
| Name | Type | Description |
|---|---|---|
separator | bytes32 | The domain separator. |
getChainId
Returns the ID of the chain the contract is currently deployed on.
Forked from Safe.sol
function getChainId() public view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The ID of the current chain as a uint256. |
Events
ExecutionFailure
Emitted when a delegated Safe transaction reverts.
event ExecutionFailure(bytes32 indexed txHash, uint256 indexed payment);
Parameters
| Name | Type | Description |
|---|---|---|
txHash | bytes32 | The EIP-712 hash of the SafeTx. |
payment | uint256 | The gas payment that was attempted. |
ExecutionSuccess
Emitted when a delegated Safe transaction executes successfully.
event ExecutionSuccess(bytes32 indexed txHash, uint256 indexed payment);
Parameters
| Name | Type | Description |
|---|---|---|
txHash | bytes32 | The EIP-712 hash of the SafeTx. |
payment | uint256 | The gas payment that was made. |