Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

MetaIntentReceiver

Git Source

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

NameTypeDescription
outputRelayedOrderOutputThe output to fulfill

Returns

NameTypeDescription
payloadHashbytes32Hash 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

NameTypeDescription
orderIdbytes32The order ID
outputHashbytes32The output hash to check

Returns

NameTypeDescription
existsboolTrue 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

NameTypeDescription
orderIdbytes32The order ID
outputHashbytes32The output hash

Returns

NameTypeDescription
resultbytes32The 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

NameTypeDescription
protocolIdbytes32The protocol ID
timestampuint32The timestamp

Returns

NameTypeDescription
hashbytes32The payload hash

_processCall

Process call and handle fallback on failure

function _processCall(RelayedOrderOutput calldata output) private;

Parameters

NameTypeDescription
outputRelayedOrderOutputThe 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

NameTypeDescription
outputRelayedOrderOutputThe 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
);