NEW

The Constellation Hackathon is on: Compete for $500K+ in prizes.

Back

CCIPReceiver API Reference

CCIP receiver contracts inherit from CCIPReceiver.

import {CCIPReceiver} from "@chainlink/contracts-ccip/src/v0.8/ccip/applications/CCIPReceiver.sol";
...

constructor(address _router) is CCIPReceiver(router) {
 }

Functions

constructor

constructor(address router) internal

supportsInterface

function supportsInterface(bytes4 interfaceId) public pure returns (bool)

IERC165 supports an interfaceId

Parameters

NameTypeDescription
interfaceIdbytes4The interfaceId to check

Return Values

NameTypeDescription
[0]booltrue if the interfaceId is supported

ccipReceive

function ccipReceive(struct Client.Any2EVMMessage message) external  override onlyRouter

Only the Router can call this function to deliver a message. If this reverts, any token transfers also revert. The message will move to a FAILED state and become available for manual execution.

Parameters

NameTypeDescription
messagestruct Client.Any2EVMMessageCCIP Message

_ccipReceive

function _ccipReceive(struct Client.Any2EVMMessage message) internal virtual

Override this function in your implementation.

Parameters

NameTypeDescription
messagestruct Client.Any2EVMMessageAny2EVMMessage

getRouter

function getRouter() public view returns (address)

This function returns the current Router address.

Return Values

NameTypeDescription
[0]addressi_router address

InvalidRouter

error InvalidRouter(address router)

onlyRouter

modifier onlyRouter()

Only calls from the set router are accepted.

Stay updated on the latest Chainlink news