MetaIntentReceiver
Inherits: Receiver, ReentrancyGuard, OwnableRoles, Pausable, VaultFallback
Title: MetaIntentReceiver
Tracks order fulfillment on destination chain and handles token transfers to recipients
Called by underlying protocols (Across, UniswapX, etc.) to mark completion and transfer tokens
Constants
ADMIN_ROLE
Administrator role identifier
uint256 public constant ADMIN_ROLE = _ROLE_0
OPERATOR_ROLE
Operator role identifier
uint256 public constant OPERATOR_ROLE = _ROLE_1
State Variables
_fulfillments
Track which outputs have been fulfilled with their payload hashes
mapping(bytes32 orderId => mapping(bytes32 outputHash => bytes32 payloadHash)) _fulfillments
Functions
constructor
constructor(address owner, address operator, address vault) ;
fulfill
Fulfill an order output by transferring tokens to the recipient
function fulfill(RelayedOrderOutput calldata output)
external
// onlyAuthorized
whenNotPaused
nonReentrant
returns (bytes32 payloadHash);
Parameters
| Name | Type | Description |
|---|---|---|
output | RelayedOrderOutput | The output to fulfill |
Returns
| Name | Type | Description |
|---|---|---|
payloadHash | bytes32 | Hash of the fulfillment payload for verification |
setVault
function setVault(address newVault) external onlyRoles(ADMIN_ROLE);
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);
outputFulfilled
Check if a specific output hash exists for an order
function outputFulfilled(bytes32 orderId, bytes32 outputHash) external view returns (bool exists);
Parameters
| Name | Type | Description |
|---|---|---|
orderId | bytes32 | The order ID |
outputHash | bytes32 | The output hash to check |
Returns
| Name | Type | Description |
|---|---|---|
exists | bool | True if the output exists |
outputPayloadHash
Get the payload hash for a fulfilled output
function outputPayloadHash(bytes32 orderId, bytes32 outputHash) external view returns (bytes32 result);
Parameters
| Name | Type | Description |
|---|---|---|
orderId | bytes32 | The order ID |
outputHash | bytes32 | The output hash |
Returns
| Name | Type | Description |
|---|---|---|
result | bytes32 | The payload hash if output exists, bytes32(0) otherwise |
_payloadHash
Calculate payload hash for an output
function _payloadHash(bytes32 protocolId, uint32 timestamp) internal pure returns (bytes32 hash);
Parameters
| Name | Type | Description |
|---|---|---|
protocolId | bytes32 | The protocol ID |
timestamp | uint32 | The timestamp |
Returns
| Name | Type | Description |
|---|---|---|
hash | bytes32 | The payload hash |
_processCall
Process call and handle fallback on failure
function _processCall(RelayedOrderOutput calldata output) private;
Parameters
| Name | Type | Description |
|---|---|---|
output | RelayedOrderOutput | The output to process |
_relayToRecipient
Send funds and relay optional calldata to recipient
Calldata can only be relayed iff recipient is a contract
function _relayToRecipient(RelayedOrderOutput calldata output) internal;
Parameters
| Name | Type | Description |
|---|---|---|
output | RelayedOrderOutput | The output containing fallbackReceiver info |
receive
receive() external payable;
Events
OutputFulfilled
Emitted when a single output is fulfilled
event OutputFulfilled(
bytes32 indexed orderId,
bytes32 indexed outputHash,
bytes32 indexed payloadHash,
bytes32 recipient,
bytes32 token,
uint256 amount,
address filler
);