CCIPGatewayAdapter
Inherits: IERC7786GatewaySource, IAny2EVMMessageReceiverV2, ICCIPGatewayAdapter
Title: CCIPGatewayAdapter
Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from Chainlink CCIP (https://github.com/smartcontractkit/chainlink-ccip)
ERC-7786 cross-chain gateway facet over Chainlink CCIP. sendMessage quotes + submits a CCIP
message via the router; ccipReceive is the router's delivery callback. EVM chains only.
Stateless delegator — logic/storage live in CCIPGatewayAdapterLib. CCIP routes by uint64 chain
selector (the lib holds a chainId ⇄ selector map); the router-gated ccipReceive is the inbound
analogue of Wormhole's receiveWormholeMessages / Axelar's execute. Implements the V2 CCIP
receiver (IAny2EVMMessageReceiverV2): V1 ccipReceive delivery plus getCCVsAndFinalityConfig so
CCV-enabled lanes can read the admin-configured Cross-Chain Verifier / finality requirements.
Notes:
- lattice-version: 0.1.0
- lattice-source: Chainlink
Functions
sendMessage
- MUST emit a MessageSent event.
If any of the attributes is not supported, this function SHOULD revert with an
UnsupportedAttribute error. Other errors SHOULD revert with errors not specified in ERC-7786.
Endpoint for creating a new message. If the message requires further (gateway specific)
processing before it can be sent to the destination chain, then a non-zero sendId must be
returned. Otherwise, the message MUST be sent and this function must return 0.
function sendMessage(bytes calldata recipient, bytes calldata payload, bytes[] calldata attributes)
external
payable
virtual
returns (bytes32);Parameters
| Name | Type | Description |
|---|---|---|
| recipient | bytes | |
| payload | bytes | |
| attributes | bytes[] |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bytes32 |
supportsAttribute
Getter to check whether an attribute is supported or not.
function supportsAttribute(bytes4 selector) external pure virtual returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
| selector | bytes4 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |
ccipReceive
Called by the CCIP router to deliver a cross-chain message.
function ccipReceive(Client.Any2EVMMessage calldata message) external virtual;Parameters
| Name | Type | Description |
|---|---|---|
| message | Client.Any2EVMMessage |
getCCVsAndFinalityConfig
Returns the receiver's required + optional Cross-Chain Verifiers, the optional-CCV threshold,
and the allowed finality config for messages arriving from sourceChainSelector.
function getCCVsAndFinalityConfig(uint64 sourceChainSelector, bytes calldata)
external
view
virtual
returns (
address[] memory requiredCCVs,
address[] memory optionalCCVs,
uint8 optionalThreshold,
bytes4 allowedFinalityConfig
);Parameters
| Name | Type | Description |
|---|---|---|
| sourceChainSelector | uint64 | |
| _ | bytes |
Returns
| Name | Type | Description |
|---|---|---|
| requiredCCVs | address[] | |
| optionalCCVs | address[] | |
| optionalThreshold | uint8 | |
| allowedFinalityConfig | bytes4 |
router
function router() external view virtual returns (address);Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |
feeToken
function feeToken() external view virtual returns (address);Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |
getChainSelector
function getChainSelector(uint256 chainId) external view virtual returns (uint64);Parameters
| Name | Type | Description |
|---|---|---|
| chainId | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint64 |
getChainId
function getChainId(uint64 selector) external view virtual returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| selector | uint64 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
getRemoteGateway
function getRemoteGateway(uint256 chainId) external view virtual returns (address);Parameters
| Name | Type | Description |
|---|---|---|
| chainId | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |
getDestinationGasLimit
function getDestinationGasLimit(uint256 chainId) external view virtual returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| chainId | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
getAllowOutOfOrderExecution
function getAllowOutOfOrderExecution(uint256 chainId) external view virtual returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
| chainId | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |
quoteFee
Quotes the CCIP fee (in the configured fee token) to send payload to recipient (ERC-7930).
function quoteFee(bytes calldata recipient, bytes calldata payload) external view virtual returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| recipient | bytes | |
| payload | bytes |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
registerChainSelector
Registers an EVM chainId ↔ CCIP chain-selector equivalence (both directions). Admin only.
function registerChainSelector(uint256 chainId, uint64 selector) external virtual;Parameters
| Name | Type | Description |
|---|---|---|
| chainId | uint256 | |
| selector | uint64 |
registerRemoteGateway
Registers a trusted remote gateway adapter for a chain. Admin only.
function registerRemoteGateway(uint256 chainId, address remote) external virtual;Parameters
| Name | Type | Description |
|---|---|---|
| chainId | uint256 | |
| remote | address |
configureDestination
Configures a destination's delivery gas limit and out-of-order execution flag. Admin only.
function configureDestination(uint256 chainId, uint256 gasLimit, bool allowOutOfOrderExecution) external virtual;Parameters
| Name | Type | Description |
|---|---|---|
| chainId | uint256 | |
| gasLimit | uint256 | |
| allowOutOfOrderExecution | bool |
setFeeToken
Sets the fee token (address(0) ⇒ native). Admin only.
function setFeeToken(address feeToken_) external virtual;Parameters
| Name | Type | Description |
|---|---|---|
| feeToken_ | address |
configureCCV
Configures the CCV requirements + allowed finality returned to the CCIP router for inbound
messages from chainId. optionalThreshold must be ≤ optionalCCVs.length. Admin only.
function configureCCV(
uint256 chainId,
address[] calldata requiredCCVs,
address[] calldata optionalCCVs,
uint8 optionalThreshold,
bytes4 allowedFinalityConfig
) external virtual;Parameters
| Name | Type | Description |
|---|---|---|
| chainId | uint256 | |
| requiredCCVs | address[] | |
| optionalCCVs | address[] | |
| optionalThreshold | uint8 | |
| allowedFinalityConfig | bytes4 | CCIP finality flag; bytes4(0) requires full finality (the safe default). |
getCCVConfig
Returns the configured CCV requirements / finality for inbound messages from chainId
(all-empty / bytes4(0) ⇒ unconfigured: CCIP defaults, require full finality).
function getCCVConfig(uint256 chainId)
external
view
virtual
returns (
address[] memory requiredCCVs,
address[] memory optionalCCVs,
uint8 optionalThreshold,
bytes4 allowedFinalityConfig
);Parameters
| Name | Type | Description |
|---|---|---|
| chainId | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| requiredCCVs | address[] | |
| optionalCCVs | address[] | |
| optionalThreshold | uint8 | |
| allowedFinalityConfig | bytes4 |
exportSelectors
ERC-8153 selector export: this facet's cuttable selectors, tightly packed (4 bytes each).
Excludes exportSelectors() itself (0x0ef22643) - it is never cut into a diamond. Order matches
forge inspect CCIPGatewayAdapter methodIdentifiers (alphabetical by signature); kept in exact parity by
ExportSelectorsParityTest. Chunks:
ccipReceive((bytes32,uint64,bytes,bytes,(address,uint256)[])) 0x85572ffb
configureCCV(uint256,address[],address[],uint8,bytes4) 0xbc633c78
configureDestination(uint256,uint256,bool) 0xf8291572
feeToken() 0x647846a5
getAllowOutOfOrderExecution(uint256) 0x578599f7
getCCVConfig(uint256) 0x0a2525d2
getCCVsAndFinalityConfig(uint64,bytes) 0x1bfc84d0
getChainId(uint64) 0x8b6cecf8
getChainSelector(uint256) 0x92e2106f
getDestinationGasLimit(uint256) 0xb168cf09
getRemoteGateway(uint256) 0x752bcf06
quoteFee(bytes,bytes) 0x58d14c04
registerChainSelector(uint256,uint64) 0xef251049
registerRemoteGateway(uint256,address) 0x997ce1f0
router() 0xf887ea40
sendMessage(bytes,bytes,bytes[]) 0xcdfe7f5c
setFeeToken(address) 0x15cce224
supportsAttribute(bytes4) 0xdc680a0f
function exportSelectors() external pure virtual returns (bytes memory selectors);Returns
| Name | Type | Description |
|---|---|---|
| selectors | bytes |