Receivers
Receivers are contracts that implement the IXReceiver
interface:
These are the main contracts that integrators implement. Connext provides a few abstract receivers that should be inherited in order to gain the built-in security and error handling.
ForwarderXReceiver
The ForwarderXReceiver
is used for unauthenticated calls. The receiver has two virtual functions that the integrator should implement to 1) prepare and 2) forward the call.
_prepare
Preparation steps should be performed in _prepare
, which can include operations like swapping funds.
_forwardFunctionCall
The _forwardFunctionCall
should contain the logic that calls the destination target contract.
AuthForwarderXReceiver
The AuthForwarderXReceiver
is used for authenticated calls. It follows the same two-step pattern as the ForwarderXReceiver
(_prepare
+ _forwardFunctionCall
).
onlyOrigin
In addition, the xReceive
method is guarded by an onlyOrigin
modifier which ensures that:
The originating call comes from a registered origin domain.
The originating call comes from the expected origin contract of the origin domain.
The call to this contract comes from Connext.
These checks guarantee that any successful call to an AuthForwarderXReceiver
contains validated data. For more information on authentication, see the Authentication section.
originRegistry
This contract also holds an originRegistry
which maps origin domain IDs to origin sender contracts. This registry is checked to uphold requirement #2 for the modifier above.
The contract is Ownable
and only the owner can addOrigin
and removeOrigin
. All expected origins and senders should be registered in this mapping.