CCIP v1.5.1 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) CCIPReceiver(router) {
 }

Errors

InvalidRouter

error InvalidRouter(address router)

Functions

constructor

constructor(address router) internal

Parameters

NameTypeDescription
routeraddressThe router address.

supportsInterface

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

IERC165 supports an interfaceId. This allows CCIP to check if ccipReceive is available before calling it.

  • If this returns false or reverts, only tokens are transferred to the receiver.
  • If this returns true, tokens are transferred and ccipReceive is called atomically.
  • If the receiver address does not have code associated with it at execution time (EXTCODESIZE returns 0), only tokens will be transferred.

Parameters

NameTypeDescription
interfaceIdbytes4The interfaceId to check

Return Values

NameTypeDescription
[0]booltrue if the interfaceId is supported

ccipReceive

function ccipReceive(Client.Any2EVMMessage calldata message) external

Parameters

NameTypeDescription
messagestruct Client.Any2EVMMessageAny2EVMMessage

_ccipReceive

function _ccipReceive(Client.Any2EVMMessage memory 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

onlyRouter

modifier onlyRouter()

Only calls from the set router are accepted.

Get the latest Chainlink content straight to your inbox.