MetaIntentTransmitter
Inherits: Transmitter, ReentrancyGuard, OwnableRoles, Pausable, EIP712
Title: MetaIntentTransmitter
One-way order issuer that:
- Pulls inputs from user
- Executes protocol calls in order
- Emits event and exits
Constants
OPERATOR_ROLE
Operator role identifier
uint256 public constant OPERATOR_ROLE = _ROLE_0
AUTHORITY_ROLE
Authority role identifier
uint256 public constant AUTHORITY_ROLE = _ROLE_1
TOKEN_STACK_SLOT
Note: storage-location: erc7201:metaintenttransmitter.tokens
bytes32 constant TOKEN_STACK_SLOT = 0x1b08c89f51b1decc132fa8988a44ec87df810cdce8fa337e2d1606c8b95fe100
State Variables
_nonces
Prevent nonce reuse per user
mapping(address user => mapping(uint256 nonce => bytes32 orderId)) _nonces
_executedOrders
Track order execution for analytics
mapping(bytes32 orderId => uint256 nonce) _executedOrders
routeAuthority
Address for authorizing routes
address public routeAuthority
Functions
constructor
constructor(address owner, address operator, address authorizer, address initialRouteAuthority) EIP712();
execute
Execute a meta-intent order by pulling inputs and executing protocol calls
function execute(Order calldata order) external payable whenNotPaused nonReentrant returns (bytes32 orderId);
Parameters
| Name | Type | Description |
|---|---|---|
order | Order | The order to execute |
Returns
| Name | Type | Description |
|---|---|---|
orderId | bytes32 | Unique identifier for the executed order |
pause
Pause the contract, preventing state change calls
Can only be called by an administrator
function pause() external onlyRoles(OPERATOR_ROLE);
unpause
Unpause the contract, allowing state change calls
Can only be called by an administrator
function unpause() external onlyRoles(OPERATOR_ROLE);
setRouteAuthority
Update the route authority address
Can only be called by an administrator
function setRouteAuthority(address newRouteAuthority) external onlyRoles(AUTHORITY_ROLE);
Parameters
| Name | Type | Description |
|---|---|---|
newRouteAuthority | address | The new Mure signer address |
previewOrderId
Compute orderId without executing (for front-end)
function previewOrderId(Order calldata order) external view returns (bytes32);
orderConsumed
Check if an order has been consumed
function orderConsumed(bytes32 orderId) public view returns (bool);
nonceConsumed
Check if nonce has been used
function nonceConsumed(address user, uint256 nonce) public view returns (bool);
_consumeNonce
Consume a nonce for user and associate it with orderId
function _consumeNonce(address user, uint256 nonce, bytes32 orderId) internal;
_refundExcess
If return any current balance to msg.sender
function _refundExcess(address to) internal;
_verifyCallSignature
Verifies that the call signature is valid for the given order
Uses EIP712 domain hashing and SignatureCheckerLib for verification
function _verifyCallSignature(Order calldata order) internal view;
Parameters
| Name | Type | Description |
|---|---|---|
order | Order | The order to verify signature for |
_domainNameAndVersion
function _domainNameAndVersion() internal pure override returns (string memory name, string memory version);
_tokens
function _tokens() internal pure returns (LibTransient.TStack storage ptr);
_pushAddr
function _pushAddr(LibTransient.TStack storage tokens, address addr) internal;
_popAddr
function _popAddr(LibTransient.TStack storage tokens) internal returns (address addr);
_setRouteAuthority
function _setRouteAuthority(address newRouteAuthority) internal;
Events
OrderInitiated
Emitted when order is successfully initialized
Off-chain systems index this to track order lifecycle
event OrderInitiated(bytes32 indexed orderId, address indexed user, uint256 timestamp);
RouteAuthorityUpdated
Emitted when the route authority address is rotated
Off-chain systems index this to track signer changes
event RouteAuthorityUpdated(address indexed oldAuthority, address indexed newAuthority);