MockEvm2EvmOffRamp API reference

MockEvm2EvmOffRamp

This contract handles off-ramp processes for CCIP messages

DynamicConfig

struct DynamicConfig {
  uint32 permissionLessExecutionThresholdSeconds;
  address router;
  address priceRegistry;
  uint16 maxNumberOfTokensPerMsg;
  uint32 maxDataBytes;
  uint32 maxPoolReleaseOrMintGas;
}

i_sourceChainSelector

uint64 i_sourceChainSelector

chain selector for the source chain

s_ccipLocalSimulator

address s_ccipLocalSimulator

Address of the CCIP Local Simulator

s_dynamicConfig

struct MockEvm2EvmOffRamp.DynamicConfig s_dynamicConfig

Dynamic configuration of the offramp

CanOnlySimulatorCall

error CanOnlySimulatorCall()

Error thrown when a function can only be called by the simulator

ReceiverError

error ReceiverError(bytes error)

Error thrown when there is an error in the receiver

Parameters

NameTypeDescription
errorbytesThe error data

TokenHandlingError

error TokenHandlingError(bytes error)

Error thrown when there is an error in token handling

Parameters

NameTypeDescription
errorbytesThe error data

UnsupportedToken

error UnsupportedToken(contract IERC20 token)

Error thrown when an unsupported token is encountered

Parameters

NameTypeDescription
tokencontract IERC20The unsupported token

constructor

constructor(address ccipLocalSimulator, struct MockEvm2EvmOffRamp.DynamicConfig dynamicConfig, struct RateLimiter.Config config, uint64 sourceChainSelector, address[] sourceTokens, address[] pools) public

Constructor to initialize the contract.

Parameters

NameTypeDescription
ccipLocalSimulatoraddressAddress of the CCIP local simulator.
dynamicConfigstruct MockEvm2EvmOffRamp.DynamicConfigInitial dynamic configuration parameters.
configstruct RateLimiter.ConfigRate limiter configuration.
sourceChainSelectoruint64Source chain selector.
sourceTokensaddress[]List of supported tokens on the source chain.
poolsaddress[]List of pools corresponding to the supported tokens on the source chain.

executeSingleMessage

function executeSingleMessage(struct Internal.EVM2EVMMessage message, bytes[] offchainTokenData) external

Executes a single CCIP message.

Parameters

NameTypeDescription
messagestruct Internal.EVM2EVMMessageThe CCIP message to be executed.
offchainTokenDatabytes[]Additional off-chain token data.

_releaseOrMintTokens

function _releaseOrMintTokens(struct Client.EVMTokenAmount[] sourceTokenAmounts, bytes originalSender, address receiver, bytes[] sourceTokenData, bytes[] offchainTokenData) internal returns (struct Client.EVMTokenAmount[])

Uses pools to release or mint a number of different tokens to a receiver address.

This function wraps the token pool call in a try-catch block to gracefully handle any non-rate limiting errors that may occur. If we encounter a rate limiting related error we bubble it up. If we encounter a non-rate limiting error we wrap it in a TokenHandlingError.

Parameters

NameTypeDescription
sourceTokenAmountsstruct Client.EVMTokenAmount[]List of tokens and amount values to be released/minted.
originalSenderbytesThe message sender.
receiveraddressThe address that will receive the tokens.
sourceTokenDatabytes[]Array of token data returned by token pools on the source chain.
offchainTokenDatabytes[]Array of token data fetched offchain by the DON.

Return Values

NameTypeDescription
[0]struct Client.EVMTokenAmount[]destTokenAmounts - The amounts of tokens released or minted.

getPoolBySourceToken

function getPoolBySourceToken(contract IERC20 sourceToken) public view returns (contract IPool)

Get a token pool by its source token.

Parameters

NameTypeDescription
sourceTokencontract IERC20The source token.

Return Values

NameTypeDescription
[0]contract IPoolpool - The corresponding token pool.

Get the latest Chainlink content straight to your inbox.