# Chainlink Local API Reference Source: https://docs.chain.link/chainlink-local/api-reference ## Available Versions ### Latest Release - **[Chainlink Local v0.3.1](/chainlink-local/api-reference/v0.3.1)** (Current Version) - Targets CCIP 2.0: pins `@chainlink/contracts-ccip` 2.0.0 and `@chainlink/contracts` 1.5.0 - New `CCIPLocalRouter` applies the CCIP 2.0 OnRamp and OffRamp message rules in local mode - `CCIPLocalSimulatorFork` and the Hardhat 3 JavaScript helper route CCIP 2.0 (CCV-based) lanes alongside the pre-1.6 and 1.6 eras - New fork-simulator surface: `getMessageStatus`, `setStrictRouting`, CCIP 2.0 router lookups (`getCCIPV2RouterAddress` / `setCCIPV2RouterAddress`), lane CCV configuration - Data Streams contracts: `DataStreamsLocalSimulator`, `DataStreamsLocalSimulatorFork`, mock verifier/proxy/fee manager/reward manager, `MockReportGenerator`, `ReportVersions` > **NOTE: Hardhat 2 users** > > Chainlink Local `0.3.x` does not compile under Hardhat 2 (the contracts use `@openzeppelin/contracts@4.8.3`-style > imports that Hardhat 2 cannot resolve, `HH411`). Hardhat 2 users stay on the `0.2.x` line (`npm install > @chainlink/local@0.2.9`), whose latest documented API reference is [v0.2.3](/chainlink-local/api-reference/v0.2.3). ### Previous Versions - **[Chainlink Local v0.2.2](/chainlink-local/api-reference/v0.2.2)** (Legacy Version) - Added support for CCIP v1.5 - Enhanced token support functions - Updated network configurations - Improved testing utilities - **[Chainlink Local v0.2.1](/chainlink-local/api-reference/v0.2.1)** (Legacy Version) - Added support for Chainlink Data Feeds - Introduced mock aggregator contracts - Basic testing framework setup ## Documentation Structure Each version includes detailed documentation for: - CCIP Components (Router, Simulator) - Data Streams Components (Simulator, Verifier, Report Generator) - Data Feed Contracts - Token Implementations - JavaScript Utilities - Testing Helpers --- # AggregatorInterface v0.2.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@ba1f4636e657f161df634379a5057a5a394e2fbb > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorInterface [`AggregatorInterface`](https://github.com/smartcontractkit/chainlink-local/blob/ba1f4636e657f161df634379a5057a5a394e2fbb/src/data-feeds/interfaces/AggregatorInterface.sol) defines the standard interface for Chainlink Data Feed aggregators. This interface provides methods to access price feed data and timestamps, as well as historical values. ## Events ### AnswerUpdated ```solidity event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt) ``` Emitted when a new answer is available for a price feed. | Parameter | Type | Description | | --------- | --------- | -------------------------------------- | | current | `int256` | The new price value (indexed) | | roundId | `uint256` | The round ID for this update (indexed) | | updatedAt | `uint256` | Timestamp when this answer was updated | ### NewRound ```solidity event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt) ``` Emitted when a new round of price updates begins. | Parameter | Type | Description | | --------- | --------- | ------------------------------------------ | | roundId | `uint256` | The round ID that started (indexed) | | startedBy | `address` | Address that initiated the round (indexed) | | startedAt | `uint256` | Timestamp when the round started | ## Functions ### getAnswer ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` Retrieves the answer for a specific round. **Parameters:** | Parameter | Type | Description | | --------- | --------- | --------------------- | | roundId | `uint256` | The round ID to query | **Returns:** | Type | Description | | -------- | ---------------------------------------- | | `int256` | The price answer for the specified round | ### getTimestamp ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` Retrieves the timestamp for a specific round. **Parameters:** | Parameter | Type | Description | | --------- | --------- | --------------------- | | roundId | `uint256` | The round ID to query | **Returns:** | Type | Description | | --------- | ---------------------------------------- | | `uint256` | The timestamp when the round was updated | ### latestAnswer ```solidity function latestAnswer() external view returns (int256) ``` Retrieves the most recent answer. **Returns:** | Type | Description | | -------- | ---------------------------- | | `int256` | The latest price feed answer | ### latestRound ```solidity function latestRound() external view returns (uint256) ``` Retrieves the most recent round ID. **Returns:** | Type | Description | | --------- | ------------------- | | `uint256` | The latest round ID | ### latestTimestamp ```solidity function latestTimestamp() external view returns (uint256) ``` Retrieves the timestamp of the latest answer. **Returns:** | Type | Description | | --------- | ------------------------------------------------ | | `uint256` | The timestamp when the latest answer was updated | --- # AggregatorV2V3Interface v0.2.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-v2-v3-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@ba1f4636e657f161df634379a5057a5a394e2fbb > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorV2V3Interface [`AggregatorV2V3Interface`](https://github.com/smartcontractkit/chainlink-local/blob/ba1f4636e657f161df634379a5057a5a394e2fbb/src/data-feeds/interfaces/AggregatorV2V3Interface.sol) combines the functionality of both AggregatorInterface and AggregatorV3Interface, providing backward compatibility while supporting newer Data Feed features. > **NOTE** > > This interface inherits from both: > > - AggregatorInterface: Basic price feed functionality > - AggregatorV3Interface: Extended Data Feed capabilities ## Interface Inheritance ```solidity interface AggregatorV2V3Interface is AggregatorInterface, AggregatorV3Interface {} ``` This interface provides access to all functions and events from both parent interfaces. --- # AggregatorV3Interface v0.2.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-v3-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@ba1f4636e657f161df634379a5057a5a394e2fbb > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorV3Interface [`AggregatorV3Interface`](https://github.com/smartcontractkit/chainlink-local/blob/ba1f4636e657f161df634379a5057a5a394e2fbb/src/data-feeds/interfaces/AggregatorV3Interface.sol) defines the extended interface for Chainlink Data Feed aggregators, providing comprehensive round data and metadata about the feed. ## Functions ### decimals ```solidity function decimals() external view returns (uint8) ``` Retrieves the number of decimals used to format the answer. **Returns:** | Type | Description | | ------- | -------------------------------------- | | `uint8` | The number of decimals in the response | ### description ```solidity function description() external view returns (string memory) ``` Retrieves the description of the price feed. **Returns:** | Type | Description | | -------- | --------------------------------- | | `string` | The description of the price feed | ### getRoundData ```solidity function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` Retrieves the complete round data for a specific round ID. > **CAUTION** > > This function should raise "No data present" if data is unavailable, instead of returning unset values which could be > misinterpreted as actual reported values. **Parameters:** | Parameter | Type | Description | | --------- | -------- | --------------------- | | _roundId | `uint80` | The round ID to query | **Returns:** | Parameter | Type | Description | | --------------- | --------- | ----------------------------------------------- | | roundId | `uint80` | The round ID from the aggregator for this round | | answer | `int256` | The price answer for this round | | startedAt | `uint256` | Timestamp when the round started | | updatedAt | `uint256` | Timestamp when the round was updated | | answeredInRound | `uint80` | The round ID in which the answer was computed | ### latestRoundData ```solidity function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` Retrieves the latest round data from the aggregator. > **CAUTION** > > This function should raise "No data present" if data is unavailable, instead of returning unset values which could be > misinterpreted as actual reported values. **Returns:** | Parameter | Type | Description | | --------------- | --------- | ----------------------------------------------- | | roundId | `uint80` | The round ID from the aggregator for this round | | answer | `int256` | The latest price answer | | startedAt | `uint256` | Timestamp when the round started | | updatedAt | `uint256` | Timestamp when the round was updated | | answeredInRound | `uint80` | The round ID in which the answer was computed | ### version ```solidity function version() external view returns (uint256) ``` Retrieves the version number of the aggregator implementation. **Returns:** | Type | Description | | --------- | ------------------------------------ | | `uint256` | The version number of the aggregator | --- # BurnMintERC677Helper v0.2.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.1/burn-mint-erc677-helper > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@ba1f4636e657f161df634379a5057a5a394e2fbb > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## BurnMintERC677Helper [`BurnMintERC677Helper`](https://github.com/smartcontractkit/chainlink-local/blob/ba1f4636e657f161df634379a5057a5a394e2fbb/src/ccip/BurnMintERC677Helper.sol) is a helper contract that extends the BurnMintERC677 token implementation. It provides simplified functionality for minting tokens, primarily intended for testing and development environments. > **NOTE** > > This contract inherits from BurnMintERC677, which implements the ERC677 token standard with burn and mint > capabilities. ## Functions ### constructor Initializes a new BurnMintERC677Helper token with specified name and symbol. | Parameter | Type | Description | | --------- | -------- | ------------------------------ | | name | `string` | The name of the token | | symbol | `string` | The symbol/ticker of the token | > **NOTE** > > The constructor initializes the token with 18 decimals and an initial supply of 0 tokens. ### drip Mints exactly one full token (1e18 base units) to the specified address. | Parameter | Type | Description | | --------- | --------- | ------------------------------------------------- | | to | `address` | The recipient address to receive the minted token | > **TIP** > > This function is particularly useful for testing scenarios where you need to quickly provide tokens to an address > without specifying custom amounts. --- # CCIPLocalSimulatorFork v0.2.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork-js > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@ba1f4636e657f161df634379a5057a5a394e2fbb > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulatorFork [`CCIPLocalSimulatorFork`](https://github.com/smartcontractkit/chainlink-local/blob/main/scripts/CCIPLocalSimulatorFork.js) provides utilities for simulating Cross-Chain Interoperability Protocol (CCIP) operations in a forked environment. It enables testing of cross-chain messaging and token transfers within a Hardhat project. ## Types ### EVM2EVMMessage An object representing a cross-chain message with the following structure: | Property | Type | Description | | ------------------- | ---------------------------------------- | -------------------------------------- | | sourceChainSelector | `bigint` | The chain selector of the source chain | | sender | `string` | The address of the message sender | | receiver | `string` | The address of the message receiver | | sequenceNumber | `bigint` | Message sequence number | | gasLimit | `bigint` | Gas limit for message execution | | strict | `boolean` | Whether strict mode is enabled | | nonce | `bigint` | Message nonce | | feeToken | `string` | Address of the token used for fees | | feeTokenAmount | `bigint` | Amount of fee token | | data | `string` | Message payload data | | tokenAmounts | `Array<{token: string, amount: bigint}>` | Array of token transfers | | sourceTokenData | `Array` | Source token metadata | | messageId | `string` | Unique message identifier | ## Functions ### requestLinkFromTheFaucet Requests LINK tokens from a faucet contract for testing purposes. | Parameter | Type | Description | | ----------- | -------- | ------------------------------------------------------- | | linkAddress | `string` | The address of the LINK contract on the current network | | to | `string` | The address to receive the LINK tokens | | amount | `bigint` | The amount of LINK tokens to request | **Returns**: `Promise` - The transaction hash of the fund transfer > **NOTE** > > The function uses a hardcoded faucet address and requires the ability to impersonate accounts in the forked > environment. ### getEvm2EvmMessage Parses a transaction receipt to extract CCIP message details from the `CCIPSendRequested` event. | Parameter | Type | Description | | --------- | -------- | ------------------------------------------------ | | receipt | `object` | The transaction receipt from the `ccipSend` call | **Returns**: `object | null` - The parsed EVM2EVMMessage object or null if no valid message is found > **TIP** > > This function is particularly useful for testing cross-chain message transmission and verification. ### routeMessage Routes a sent message from the source network to the destination network in the forked environment. | Parameter | Type | Description | | -------------- | -------- | ------------------------------------------ | | routerAddress | `string` | Address of the destination Router contract | | evm2EvmMessage | `object` | The cross-chain message to be routed | **Returns**: `Promise` - Resolves when the message is successfully routed > **CAUTION** > > This function will throw an error if: > > - No off-ramp matches the message's source chain selector > - The call to `router.getOffRamps()` fails --- # CCIPLocalSimulatorFork v0.2.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@ba1f4636e657f161df634379a5057a5a394e2fbb > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulatorFork [`CCIPLocalSimulatorFork`](https://github.com/smartcontractkit/chainlink-local/blob/ba1f4636e657f161df634379a5057a5a394e2fbb/src/ccip/CCIPLocalSimulatorFork.sol) enables testing of CCIP cross-chain messaging in forked network environments. This contract provides essential utilities for configuring networks and simulating message routing between chains in a Foundry test environment. > **NOTE** > > Works with Foundry only ## Events ### CCIPSendRequested ```solidity event CCIPSendRequested(Internal.EVM2EVMMessage message) ``` Emitted when a cross-chain message is requested to be sent through CCIP. ## Variables ### i_register ```solidity Register immutable i_register ``` Stores and manages network configuration details required for CCIP operations. ### LINK_FAUCET ```solidity address constant LINK_FAUCET = 0x4281eCF07378Ee595C564a59048801330f3084eE ``` Provides test LINK tokens to addresses during testing. ### s_processedMessages ```solidity mapping(bytes32 messageId => bool isProcessed) internal s_processedMessages ``` Prevents duplicate processing by tracking which messages have already been handled. ## Functions ### constructor ```solidity constructor() public ``` Initializes the simulator environment by deploying and configuring a persistent Register contract. > **NOTE** > > Records logs and makes the Register contract persistent in the test environment. ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (Register.NetworkDetails memory) ``` Retrieves network-specific CCIP configuration details. Use this function to access default settings or custom configurations for a given network. > **NOTE** > > Returns the default values for currently CCIP supported networks. If network is not present or some of the values are > changed, user can manually add new network details using the `setNetworkDetails` function. **Parameters:** | Parameter | Type | Description | | --------- | --------- | ---------------------------------------------------------------------------------------------------- | | chainId | `uint256` | The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | **Returns:** | Parameter | Type | Description | | -------------- | ------------------------- | -------------------- | | networkDetails | `Register.NetworkDetails` | A struct containing: | • chainSelector - The unique CCIP Chain Selector • routerAddress - The address of the CCIP Router contract • linkAddress - The address of the LINK token • wrappedNativeAddress - The address of the wrapped native token for CCIP fees • ccipBnMAddress - The address of the CCIP BnM token • ccipLnMAddress - The address of the CCIP LnM token | ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Transfers LINK tokens from the faucet to a specified address for testing purposes. > **NOTE** > > Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. **Parameters:** | Parameter | Type | Description | | --------- | --------- | ----------------------------------------------- | | to | `address` | The address to which LINK tokens are to be sent | | amount | `uint256` | The amount of LINK tokens to send | **Returns:** | Parameter | Type | Description | | --------- | ------ | -------------------------------------------------------------------------- | | success | `bool` | Returns `true` if the transfer of tokens was successful, otherwise `false` | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, Register.NetworkDetails memory networkDetails) external ``` Updates or adds CCIP configuration details for a specific blockchain network. > **NOTE** > > If network details are not present or some of the values are changed, user can manually add new network details using > the `setNetworkDetails` function. **Parameters:** | Parameter | Type | Description | | -------------- | ------------------------- | ---------------------------------------------------------------------------------------------------- | | chainId | `uint256` | The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | | networkDetails | `Register.NetworkDetails` | A struct containing: | • chainSelector - The unique CCIP Chain Selector • routerAddress - The address of the CCIP Router contract • linkAddress - The address of the LINK token • wrappedNativeAddress - The address of the wrapped native token for CCIP fees • ccipBnMAddress - The address of the CCIP BnM token • ccipLnMAddress - The address of the CCIP LnM token | ### switchChainAndRouteMessage ```solidity function switchChainAndRouteMessage(uint256 forkId) external ``` Processes a cross-chain message by switching to the destination fork and executing the message. > **NOTE** > > To be called after the sending of the cross-chain message (`ccipSend`). Goes through the list of past logs and looks > for the `CCIPSendRequested` event. Switches to a destination network fork. Routes the sent cross-chain message on the > destination network. **Parameters:** | Parameter | Type | Description | | --------- | --------- | ------------------------------------------------------------------------------------------------------------ | | forkId | `uint256` | The ID of the destination network fork. This is the returned value of `createFork()` or `createSelectFork()` | --- # CCIPLocalSimulator v0.2.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@ba1f4636e657f161df634379a5057a5a394e2fbb > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulator [`CCIPLocalSimulator`](https://github.com/smartcontractkit/chainlink-local/blob/ba1f4636e657f161df634379a5057a5a394e2fbb/src/ccip/CCIPLocalSimulator.sol) is a contract that provides local simulation capabilities for Cross-Chain Interoperability Protocol (CCIP) operations. It manages token deployments and routing configurations for testing CCIP functionality. ## Variables ### CHAIN_SELECTOR ```solidity uint64 constant CHAIN_SELECTOR = 16015286601757825753 ``` The unique identifier for the simulated chain in CCIP operations. ### i_ccipBnM ```solidity BurnMintERC677Helper internal immutable i_ccipBnM ``` The CCIP BnM token contract instance used for cross-chain token transfers. ### i_ccipLnM ```solidity BurnMintERC677Helper internal immutable i_ccipLnM ``` The CCIP LnM token contract instance used for cross-chain token transfers. ### i_linkToken ```solidity LinkToken internal immutable i_linkToken ``` The LINK token contract instance used for paying CCIP fees. ### i_mockRouter ```solidity MockCCIPRouter internal immutable i_mockRouter ``` The mock CCIP router contract instance that simulates cross-chain message routing. ### i_wrappedNative ```solidity WETH9 internal immutable i_wrappedNative ``` The wrapped native token contract instance used for fee payments. ## Functions ### constructor Initializes the simulator by deploying necessary token contracts and configuring supported tokens. > **NOTE** > > Deploys WETH9, LinkToken, and two BurnMintERC677Helper tokens (CCIP-BnM and CCIP-LnM) and sets up a mock router. ### configuration Returns the configuration details for pre-deployed contracts and services needed for local CCIP simulations. **Returns:** | Parameter | Type | Description | | ------------------- | ---------------------- | ------------------------------------- | | chainSelector_ | `uint64` | The unique CCIP Chain Selector | | sourceRouter_ | `IRouterClient` | The source chain Router contract | | destinationRouter_ | `IRouterClient` | The destination chain Router contract | | wrappedNative_ | `WETH9` | The wrapped native token contract | | linkToken_ | `LinkToken` | The LINK token contract | | ccipBnM_ | `BurnMintERC677Helper` | The CCIP-BnM token contract | | ccipLnM_ | `BurnMintERC677Helper` | The CCIP-LnM token contract | ### getSupportedTokens Gets a list of token addresses that are supported for cross-chain transfers by the simulator. **Parameters:** | Parameter | Type | Description | | ------------- | -------- | ------------------------------ | | chainSelector | `uint64` | The unique CCIP Chain Selector | **Returns:** | Parameter | Type | Description | | --------- | ------------------ | --------------------------------- | | tokens | `address[] memory` | List of supported token addresses | > **NOTE** > > Returns an empty array if the chain selector is not supported. ### isChainSupported Checks whether the provided chain selector is supported by the simulator. **Parameters:** | Parameter | Type | Description | | ------------- | -------- | ------------------------------ | | chainSelector | `uint64` | The unique CCIP Chain Selector | **Returns:** | Parameter | Type | Description | | --------- | ------ | --------------------------------------- | | supported | `bool` | True if the chain selector is supported | ### requestLinkFromFaucet Requests LINK tokens from the faucet for a specified address. **Parameters:** | Parameter | Type | Description | | --------- | --------- | ---------------------------------- | | to | `address` | The address to receive LINK tokens | | amount | `uint256` | The amount of LINK tokens to send | **Returns:** | Parameter | Type | Description | | --------- | ------ | ----------------------------------- | | success | `bool` | True if the transfer was successful | ### supportNewToken Allows users to add support for new tokens besides CCIP-BnM and CCIP-LnM for cross-chain transfers. **Parameters:** | Parameter | Type | Description | | ------------ | --------- | --------------------------------------------------- | | tokenAddress | `address` | The address of the token to add to supported tokens | > **TIP** > > Use this function to extend the simulator's capabilities with additional token types for testing purposes. --- # Chainlink Local v0.2.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.1 > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@ba1f4636e657f161df634379a5057a5a394e2fbb > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIP These contracts provide Cross-Chain Interoperability Protocol (CCIP) functionality in a local testing environment: - [CCIPLocalSimulator](/chainlink-local/api-reference/v0.2.1/ccip-local-simulator) - Local CCIP message routing simulator - [CCIPLocalSimulatorFork](/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork) - CCIP simulator for forked networks - [CCIPLocalSimulatorForkJS](/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork-js) - JavaScript utilities for CCIP simulation - [MockEvm2EvmOffRamp](/chainlink-local/api-reference/v0.2.1/mock-evm2evm-offramp) - Mock CCIP off-ramp contract - [Register](/chainlink-local/api-reference/v0.2.1/register) - CCIP network configuration registry ## Data Feeds Contracts for simulating Chainlink Data Feeds: - [AggregatorInterface](/chainlink-local/api-reference/v0.2.1/aggregator-interface) - Basic price feed interface - [AggregatorV2V3Interface](/chainlink-local/api-reference/v0.2.1/aggregator-v2-v3-interface) - Combined V2/V3 price feed interface - [AggregatorV3Interface](/chainlink-local/api-reference/v0.2.1/aggregator-v3-interface) - Extended price feed interface - [MockOffchainAggregator](/chainlink-local/api-reference/v0.2.1/mock-offchain-aggregator) - Mock implementation of off-chain aggregator - [MockV3Aggregator](/chainlink-local/api-reference/v0.2.1/mock-v3-aggregator) - Mock implementation of V3 aggregator ## Token Contracts Standard token implementations for testing: - [BurnMintERC677Helper](/chainlink-local/api-reference/v0.2.1/burn-mint-erc677-helper) - Helper contract for ERC677 token operations - [LinkToken](/chainlink-local/api-reference/v0.2.1/link-token) - LINK token implementation - [WETH9](/chainlink-local/api-reference/v0.2.1/weth9) - Wrapped Ether implementation --- # LinkToken v0.2.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.1/link-token > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@ba1f4636e657f161df634379a5057a5a394e2fbb > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## LinkToken [`LinkToken`](https://github.com/smartcontractkit/chainlink-local/blob/ba1f4636e657f161df634379a5057a5a394e2fbb/src/shared/LinkToken.sol) implements the ERC677 token standard for LINK tokens. This contract provides the basic functionality of the Chainlink token with a fixed total supply. ## Variables ### NAME ```solidity string private constant NAME = "ChainLink Token" ``` The name of the token. ### SYMBOL ```solidity string private constant SYMBOL = "LINK" ``` The symbol of the token. ### TOTAL_SUPPLY ```solidity uint private constant TOTAL_SUPPLY = 10 ** 27 ``` The total supply of LINK tokens (1 billion LINK with 18 decimals). ## Functions ### constructor ```solidity constructor() ERC677(NAME, SYMBOL) ``` Initializes the contract with the token name and symbol, then calls `_onCreate()`. ### _onCreate ```solidity function _onCreate() internal virtual ``` Hook that is called when this contract is created. > **NOTE** > > Default implementation mints 10\*\*27 tokens to msg.sender. This function can be overridden in child contracts (e.g., > LINK bridge tokens). --- # MockEvm2EvmOffRamp v0.2.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-evm2evm-offramp > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@ba1f4636e657f161df634379a5057a5a394e2fbb > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockEvm2EvmOffRamp [`MockEvm2EvmOffRamp`](https://github.com/smartcontractkit/chainlink-local/blob/ba1f4636e657f161df634379a5057a5a394e2fbb/src/ccip/MockEvm2EvmOffRamp.sol) simulates the destination chain component of CCIP's cross-chain message delivery system. This contract handles token releases and message execution in a test environment. ## Errors ### CanOnlySimulatorCall ```solidity error CanOnlySimulatorCall() ``` Thrown when a non-simulator address attempts to call restricted functions. ### ReceiverError ```solidity error ReceiverError(bytes error) ``` Thrown when the CCIP receiver execution fails. ### TokenHandlingError ```solidity error TokenHandlingError(bytes error) ``` Thrown when token release or minting operations encounter non-rate-limiting errors. ### UnsupportedToken ```solidity error UnsupportedToken(IERC20 token) ``` Thrown when attempting to interact with a token that doesn't have an associated pool. ## Structs ### DynamicConfig ```solidity struct DynamicConfig { uint32 permissionLessExecutionThresholdSeconds; address router; address priceRegistry; uint16 maxNumberOfTokensPerMsg; uint32 maxDataBytes; uint32 maxPoolReleaseOrMintGas; } ``` Configuration parameters that can be updated during contract operation: • permissionLessExecutionThresholdSeconds - Waiting time before manual execution is enabled • router - Router address • priceRegistry - Price registry address • maxNumberOfTokensPerMsg - Maximum number of ERC20 token transfers per message • maxDataBytes - Maximum payload data size in bytes • maxPoolReleaseOrMintGas - Maximum gas for token pool releaseOrMint calls ## Variables ### i_sourceChainSelector ```solidity uint64 internal immutable i_sourceChainSelector ``` The chain selector identifying the source chain for this off-ramp. ### s_ccipLocalSimulator ```solidity address internal s_ccipLocalSimulator ``` The address of the local CCIP simulator controlling this off-ramp. ### s_dynamicConfig ```solidity DynamicConfig internal s_dynamicConfig ``` Current dynamic configuration settings for the off-ramp. ### s_poolsBySourceToken ```solidity EnumerableMapAddresses.AddressToAddressMap private s_poolsBySourceToken ``` Maps source token addresses to their corresponding token pool addresses. ## Functions ### constructor ```solidity constructor( address ccipLocalSimulator, DynamicConfig memory dynamicConfig, RateLimiter.Config memory config, uint64 sourceChainSelector, address[] memory sourceTokens, address[] memory pools ) AggregateRateLimiter(config) ``` Initializes the off-ramp with simulator settings, configuration parameters, and token pool mappings. **Parameters:** | Parameter | Type | Description | | ------------------- | -------------------- | ------------------------------------------- | | ccipLocalSimulator | `address` | Address of the CCIP simulator | | dynamicConfig | `DynamicConfig` | Initial dynamic configuration settings | | config | `RateLimiter.Config` | Rate limiter configuration | | sourceChainSelector | `uint64` | Chain selector for the source chain | | sourceTokens | `address[]` | Array of source token addresses | | pools | `address[]` | Array of corresponding token pool addresses | ### executeSingleMessage ```solidity function executeSingleMessage( Internal.EVM2EVMMessage memory message, bytes[] memory offchainTokenData ) external ``` Processes a single cross-chain message by releasing tokens and executing the receiver's callback. > **NOTE** > > Only the CCIP simulator can call this function. It handles token transfers and executes the receiver's message > handling logic. **Parameters:** | Parameter | Type | Description | | ----------------- | ------------------------- | ------------------------------------ | | message | `Internal.EVM2EVMMessage` | The cross-chain message to process | | offchainTokenData | `bytes[]` | Token data provided by off-chain DON | ### getPoolBySourceToken ```solidity function getPoolBySourceToken(IERC20 sourceToken) public view returns (IPool) ``` Retrieves the token pool associated with a source token. **Parameters:** | Parameter | Type | Description | | ----------- | -------- | ----------------------------------- | | sourceToken | `IERC20` | The source token address to look up | **Returns:** | Type | Description | | ------- | -------------------------------------------- | | `IPool` | The token pool contract for the source token | ### _releaseOrMintTokens ```solidity function _releaseOrMintTokens( Client.EVMTokenAmount[] memory sourceTokenAmounts, bytes memory originalSender, address receiver, bytes[] memory sourceTokenData, bytes[] memory offchainTokenData ) internal returns (Client.EVMTokenAmount[] memory) ``` Handles the release or minting of tokens through token pools. This function includes safety measures against malicious tokens and rate limiting. > **NOTE** > > Uses pools to release or mint a number of different tokens to a receiver address. > **TIP** > > 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:** | Parameter | Type | Description | | ------------------ | ------------------------- | --------------------------------------------------------------- | | sourceTokenAmounts | `Client.EVMTokenAmount[]` | List of tokens and amount values to be released/minted | | originalSender | `bytes` | The message sender | | receiver | `address` | The address that will receive the tokens | | sourceTokenData | `bytes[]` | Array of token data returned by token pools on the source chain | | offchainTokenData | `bytes[]` | Array of token data fetched offchain by the DON | **Returns:** | Type | Description | | ------------------------- | ---------------------------------------------- | | `Client.EVMTokenAmount[]` | Array of processed token amounts and addresses | --- # MockOffchainAggregator v0.2.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-offchain-aggregator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@ba1f4636e657f161df634379a5057a5a394e2fbb > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockOffchainAggregator [`MockOffchainAggregator`](https://github.com/smartcontractkit/chainlink-local/blob/ba1f4636e657f161df634379a5057a5a394e2fbb/src/data-feeds/MockOffchainAggregator.sol) simulates a Chainlink Data Feed aggregator for testing purposes. This contract maintains price feed data and allows manual updates of answers and round data. ## Variables ### decimals ```solidity uint8 public decimals ``` The number of decimal places in the answer values. ### getAnswer ```solidity mapping(uint256 => int256) public getAnswer ``` Maps round IDs to their corresponding price answers. ### getTimestamp ```solidity mapping(uint256 => uint256) public getTimestamp ``` Maps round IDs to their update timestamps. ### latestAnswer ```solidity int256 public latestAnswer ``` The most recent price answer. ### latestRound ```solidity uint256 public latestRound ``` The most recent round ID. ### latestTimestamp ```solidity uint256 public latestTimestamp ``` The timestamp of the most recent update. ### maxAnswer ```solidity int192 public maxAnswer ``` The highest answer the system can report. Not exposed from the Proxy contract. ### minAnswer ```solidity int192 public minAnswer ``` The lowest answer the system can report. Not exposed from the Proxy contract. ## Functions ### constructor ```solidity constructor(uint8 _decimals, int256 _initialAnswer) ``` Initializes the aggregator with decimal precision and an initial answer. > **NOTE** > > If minAnswer is 1 and maxAnswer is 95780971304118053647396689196894323976171195136475135, then there is no min or max > for the feed. Other values indicate actual limits that need to be normalized using the decimals value. **Parameters:** | Parameter | Type | Description | | --------------- | -------- | --------------------------------------- | | _decimals | `uint8` | The number of decimal places in answers | | _initialAnswer | `int256` | The initial price answer | ### getRoundData ```solidity function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` Retrieves the complete round data for a specific round ID. **Parameters:** | Parameter | Type | Description | | --------- | -------- | --------------------- | | _roundId | `uint80` | The round ID to query | **Returns:** | Parameter | Type | Description | | --------------- | --------- | ----------------------------------------------- | | roundId | `uint80` | The round ID from the aggregator for this round | | answer | `int256` | The price answer for this round | | startedAt | `uint256` | Timestamp when the round started | | updatedAt | `uint256` | Timestamp when the round was updated | | answeredInRound | `uint80` | The round ID in which the answer was computed | ### latestRoundData ```solidity function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` Retrieves the latest round data from the aggregator. **Returns:** | Parameter | Type | Description | | --------------- | --------- | ----------------------------------------------- | | roundId | `uint80` | The round ID from the aggregator for this round | | answer | `int256` | The latest price answer | | startedAt | `uint256` | Timestamp when the round started | | updatedAt | `uint256` | Timestamp when the round was updated | | answeredInRound | `uint80` | The round ID in which the answer was computed | ### updateAnswer ```solidity function updateAnswer(int256 _answer) public ``` Updates the latest answer and associated round data. **Parameters:** | Parameter | Type | Description | | --------- | -------- | -------------------- | | _answer | `int256` | The new price answer | ### updateMinAndMaxAnswers ```solidity function updateMinAndMaxAnswers(int192 _minAnswer, int192 _maxAnswer) external ``` Updates the minimum and maximum allowed answer values. **Parameters:** | Parameter | Type | Description | | ----------- | -------- | ------------------------------ | | _minAnswer | `int192` | The new minimum allowed answer | | _maxAnswer | `int192` | The new maximum allowed answer | ### updateRoundData ```solidity function updateRoundData( uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt ) public ``` Updates all data for a specific round. **Parameters:** | Parameter | Type | Description | | ----------- | --------- | ----------------------------- | | _roundId | `uint80` | The round ID to update | | _answer | `int256` | The new price answer | | _timestamp | `uint256` | The new update timestamp | | _startedAt | `uint256` | The new round start timestamp | --- # MockV3Aggregator v0.2.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-v3-aggregator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@ba1f4636e657f161df634379a5057a5a394e2fbb > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockV3Aggregator [`MockV3Aggregator`](https://github.com/smartcontractkit/chainlink-local/blob/ba1f4636e657f161df634379a5057a5a394e2fbb/src/data-feeds/MockV3Aggregator.sol) implements the AggregatorV2V3Interface for testing purposes. This contract acts as a proxy to a MockOffchainAggregator instance and supports aggregator upgrades. ## Variables ### aggregator ```solidity address public aggregator ``` The address of the current MockOffchainAggregator implementation. ### proposedAggregator ```solidity address public proposedAggregator ``` The address of the proposed new aggregator implementation. ### version ```solidity uint256 public constant override version = 0 ``` The version number of this aggregator implementation. ## Functions ### confirmAggregator ```solidity function confirmAggregator(address _aggregator) external ``` Confirms a proposed aggregator upgrade. **Parameters:** | Parameter | Type | Description | | ------------ | --------- | ------------------------------------------ | | _aggregator | `address` | The proposed aggregator address to confirm | ### constructor ```solidity constructor(uint8 _decimals, int256 _initialAnswer) ``` Initializes the contract by deploying a new MockOffchainAggregator instance. **Parameters:** | Parameter | Type | Description | | --------------- | -------- | --------------------------------------- | | _decimals | `uint8` | The number of decimal places in answers | | _initialAnswer | `int256` | The initial price answer | ### decimals ```solidity function decimals() external view returns (uint8) ``` Retrieves the number of decimal places in the answer values. **Returns:** | Type | Description | | ------- | -------------------------------------- | | `uint8` | The number of decimals in the response | ### description ```solidity function description() external pure returns (string memory) ``` Returns the source file path of this contract. **Returns:** | Type | Description | | -------- | --------------------------------- | | `string` | The description of the price feed | ### getAnswer ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` Retrieves the answer for a specific round. **Parameters:** | Parameter | Type | Description | | --------- | --------- | --------------------- | | roundId | `uint256` | The round ID to query | **Returns:** | Type | Description | | -------- | ---------------------------------------- | | `int256` | The price answer for the specified round | ### getRoundData ```solidity function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` Retrieves the complete round data for a specific round ID. **Parameters:** | Parameter | Type | Description | | --------- | -------- | --------------------- | | _roundId | `uint80` | The round ID to query | **Returns:** | Parameter | Type | Description | | --------------- | --------- | ----------------------------------------------- | | roundId | `uint80` | The round ID from the aggregator for this round | | answer | `int256` | The price answer for this round | | startedAt | `uint256` | Timestamp when the round started | | updatedAt | `uint256` | Timestamp when the round was updated | | answeredInRound | `uint80` | The round ID in which the answer was computed | ### getTimestamp ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` Retrieves the timestamp for a specific round. **Parameters:** | Parameter | Type | Description | | --------- | --------- | --------------------- | | roundId | `uint256` | The round ID to query | **Returns:** | Type | Description | | --------- | ---------------------------------------- | | `uint256` | The timestamp when the round was updated | ### latestAnswer ```solidity function latestAnswer() external view returns (int256) ``` Retrieves the most recent answer. **Returns:** | Type | Description | | -------- | ---------------------------- | | `int256` | The latest price feed answer | ### latestRound ```solidity function latestRound() external view returns (uint256) ``` Retrieves the most recent round ID. **Returns:** | Type | Description | | --------- | ------------------- | | `uint256` | The latest round ID | ### latestRoundData ```solidity function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` Retrieves the latest round data from the aggregator. **Returns:** | Parameter | Type | Description | | --------------- | --------- | ----------------------------------------------- | | roundId | `uint80` | The round ID from the aggregator for this round | | answer | `int256` | The latest price answer | | startedAt | `uint256` | Timestamp when the round started | | updatedAt | `uint256` | Timestamp when the round was updated | | answeredInRound | `uint80` | The round ID in which the answer was computed | ### latestTimestamp ```solidity function latestTimestamp() external view returns (uint256) ``` Retrieves the timestamp of the latest answer. **Returns:** | Type | Description | | --------- | ------------------------------------------------ | | `uint256` | The timestamp when the latest answer was updated | ### proposeAggregator ```solidity function proposeAggregator(AggregatorV2V3Interface _aggregator) external ``` Proposes a new aggregator implementation. **Parameters:** | Parameter | Type | Description | | ------------ | ------------------------- | --------------------------------- | | _aggregator | `AggregatorV2V3Interface` | The new aggregator implementation | ### updateAnswer ```solidity function updateAnswer(int256 _answer) public ``` Updates the latest answer and associated round data. **Parameters:** | Parameter | Type | Description | | --------- | -------- | -------------------- | | _answer | `int256` | The new price answer | ### updateRoundData ```solidity function updateRoundData( uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt ) public ``` Updates all data for a specific round. **Parameters:** | Parameter | Type | Description | | ----------- | --------- | ----------------------------- | | _roundId | `uint80` | The round ID to update | | _answer | `int256` | The new price answer | | _timestamp | `uint256` | The new update timestamp | | _startedAt | `uint256` | The new round start timestamp | --- # Register v0.2.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.1/register > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@ba1f4636e657f161df634379a5057a5a394e2fbb > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## Register [`Register`](https://github.com/smartcontractkit/chainlink-local/blob/ba1f4636e657f161df634379a5057a5a394e2fbb/src/ccip/Register.sol) maintains a registry of CCIP network configurations for different blockchain networks. This contract provides pre-configured settings for various test networks and allows custom network configurations. ## Structs ### NetworkDetails ```solidity struct NetworkDetails { uint64 chainSelector; address routerAddress; address linkAddress; address wrappedNativeAddress; address ccipBnMAddress; address ccipLnMAddress; } ``` Configuration details for a CCIP-enabled network: • chainSelector - Unique identifier for the blockchain network in CCIP • routerAddress - Address of the CCIP Router contract • linkAddress - Address of the LINK token contract • wrappedNativeAddress - Address of the wrapped native token • ccipBnMAddress - Address of the CCIP BnM token • ccipLnMAddress - Address of the CCIP LnM token ## Variables ### s_networkDetails ```solidity mapping(uint256 chainId => NetworkDetails) internal s_networkDetails ``` Stores network configurations indexed by chain ID. Contains pre-configured settings for test networks including Sepolia, Mumbai, Fuji, and others. ## Functions ### constructor ```solidity constructor() public ``` Initializes the contract with pre-configured network details for various test networks including: - Ethereum Sepolia (11155111) - OP Sepolia (11155420) - Polygon Mumbai (80001) - Avalanche Fuji (43113) - BNB Chain Testnet (97) - Arbitrum Sepolia (421614) - Base Sepolia (84532) - Wemix Testnet (1112) - Kroma Sepolia (2358) - Gnosis Chiado (10200) ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (NetworkDetails memory) ``` Retrieves the CCIP configuration for a specific blockchain network. **Parameters:** | Parameter | Type | Description | | --------- | --------- | ------------------------------------ | | chainId | `uint256` | The blockchain network ID to look up | **Returns:** | Type | Description | | ---------------- | ----------------------------------------------- | | `NetworkDetails` | The network configuration details for the chain | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, NetworkDetails memory networkDetails) external ``` Updates or adds CCIP configuration for a blockchain network. **Parameters:** | Parameter | Type | Description | | -------------- | ---------------- | -------------------------------------- | | chainId | `uint256` | The blockchain network ID to configure | | networkDetails | `NetworkDetails` | The network configuration to set | --- # WETH9 v0.2.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.1/weth9 > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@ba1f4636e657f161df634379a5057a5a394e2fbb > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## WETH9 [`WETH9`](https://github.com/smartcontractkit/chainlink-local/blob/ba1f4636e657f161df634379a5057a5a394e2fbb/src/shared/WETH9.sol) implements the Wrapped Ether (WETH) token standard. This contract allows users to wrap ETH into an ERC20-compatible token and unwrap it back to ETH. ## Events ### Approval ```solidity event Approval(address indexed src, address indexed guy, uint256 wad) ``` Emitted when an approval is set. | Parameter | Type | Description | | --------- | --------- | ---------------------------------------- | | src | `address` | The address giving approval (indexed) | | guy | `address` | The address receiving approval (indexed) | | wad | `uint256` | The amount of tokens approved | ### Deposit ```solidity event Deposit(address indexed dst, uint256 wad) ``` Emitted when ETH is wrapped to WETH. | Parameter | Type | Description | | --------- | --------- | ------------------------------------ | | dst | `address` | The address receiving WETH (indexed) | | wad | `uint256` | The amount of ETH wrapped | ### Transfer ```solidity event Transfer(address indexed src, address indexed dst, uint256 wad) ``` Emitted when tokens are transferred. | Parameter | Type | Description | | --------- | --------- | --------------------------------- | | src | `address` | The sender's address (indexed) | | dst | `address` | The recipient's address (indexed) | | wad | `uint256` | The amount of tokens transferred | ### Withdrawal ```solidity event Withdrawal(address indexed src, uint256 wad) ``` Emitted when WETH is unwrapped back to ETH. | Parameter | Type | Description | | --------- | --------- | ------------------------------------- | | src | `address` | The address unwrapping WETH (indexed) | | wad | `uint256` | The amount of WETH unwrapped | ## Variables ### allowance ```solidity mapping(address => mapping(address => uint256)) public allowance ``` Maps owner addresses to spender addresses to approved amounts. ### balanceOf ```solidity mapping(address => uint256) public balanceOf ``` Maps addresses to their token balances. ### decimals ```solidity uint8 public decimals = 18 ``` The number of decimal places used by the token. ### name ```solidity string public name = "Wrapped Ether" ``` The name of the token. ### symbol ```solidity string public symbol = "WETH" ``` The symbol of the token. ## Functions ### _deposit ```solidity function _deposit() internal ``` Internal function to handle ETH deposits and mint corresponding WETH tokens. ### approve ```solidity function approve(address guy, uint256 wad) public returns (bool) ``` Approves another address to spend tokens. **Parameters:** | Parameter | Type | Description | | --------- | --------- | ------------------------------- | | guy | `address` | The address to approve | | wad | `uint256` | The amount of tokens to approve | **Returns:** | Type | Description | | ------ | ------------------- | | `bool` | Always returns true | ### deposit ```solidity function deposit() external payable ``` Deposits ETH and mints WETH tokens. ### receive ```solidity receive() external payable ``` Fallback function to handle direct ETH transfers. Calls `_deposit()` to wrap received ETH into WETH. ### totalSupply ```solidity function totalSupply() public view returns (uint256) ``` Returns the total supply of WETH tokens. **Returns:** | Type | Description | | --------- | ---------------------------------------- | | `uint256` | The total amount of WETH in the contract | ### transfer ```solidity function transfer(address dst, uint256 wad) public returns (bool) ``` Transfers tokens to another address. **Parameters:** | Parameter | Type | Description | | --------- | --------- | -------------------------------- | | dst | `address` | The recipient's address | | wad | `uint256` | The amount of tokens to transfer | **Returns:** | Type | Description | | ------ | ------------------------------ | | `bool` | True if the transfer succeeded | ### transferFrom ```solidity function transferFrom(address src, address dst, uint256 wad) public returns (bool) ``` Transfers tokens from one address to another. > **NOTE** > > If the sender is not the source and allowance is not uint128.max, the allowance is decreased by the transfer amount. > Reverts if the source address has insufficient balance or if the sender has insufficient allowance. **Parameters:** | Parameter | Type | Description | | --------- | --------- | -------------------------------- | | src | `address` | The source address | | dst | `address` | The destination address | | wad | `uint256` | The amount of tokens to transfer | **Returns:** | Type | Description | | ------ | ------------------------------ | | `bool` | True if the transfer succeeded | ### withdraw ```solidity function withdraw(uint256 wad) external ``` Withdraws ETH by burning WETH tokens. > **CAUTION** > > Reverts if the sender's balance is less than the withdrawal amount. **Parameters:** | Parameter | Type | Description | | --------- | --------- | ---------------------- | | wad | `uint256` | The amount to withdraw | --- # AggregatorInterface v0.2.2 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.2 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.2 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@cd3bfb8c42716cfb791174314eba2c0d178551b9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.2/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorInterface An interface that defines the standard methods for accessing price feed data from an aggregator contract. [`AggregatorInterface`](https://github.com/smartcontractkit/chainlink-local/blob/cd3bfb8c42716cfb791174314eba2c0d178551b9/src/data-feeds/interfaces/AggregatorInterface.sol) ## Events ### AnswerUpdated ```solidity event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt) ``` > **NOTE** > > Emitted when the answer is updated. #### Parameters | Parameter | Type | Description | | --------- | ------- | --------------------------------------------- | | current | int256 | The updated answer | | roundId | uint256 | The round ID for which the answer was updated | | updatedAt | uint256 | The timestamp when the answer was updated | ### NewRound ```solidity event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt) ``` > **NOTE** > > Emitted when a new round is started. #### Parameters | Parameter | Type | Description | | --------- | ------- | ------------------------------------------------- | | roundId | uint256 | The round ID of the new round | | startedBy | address | The address of the account that started the round | | startedAt | uint256 | The timestamp when the round was started | ## Functions ### getAnswer Retrieves the price answer for a specific round. ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` > **NOTE** > > Gets the answer for a specific round ID. #### Parameters | Parameter | Type | Description | | --------- | ------- | ---------------------------------- | | roundId | uint256 | The round ID to get the answer for | #### Returns | Parameter | Type | Description | | --------- | ------ | --------------------------------- | | (unnamed) | int256 | The answer for the given round ID | ### getTimestamp Retrieves the timestamp for a specific round. ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` > **NOTE** > > Gets the timestamp for a specific round ID. #### Parameters | Parameter | Type | Description | | --------- | ------- | ------------------------------------- | | roundId | uint256 | The round ID to get the timestamp for | #### Returns | Parameter | Type | Description | | --------- | ------- | ------------------------------------ | | (unnamed) | uint256 | The timestamp for the given round ID | ### latestAnswer Retrieves the most recent price answer. ```solidity function latestAnswer() external view returns (int256) ``` > **NOTE** > > Gets the latest answer from the aggregator. #### Returns | Parameter | Type | Description | | --------- | ------ | ----------------- | | (unnamed) | int256 | The latest answer | ### latestRound Retrieves the most recent round ID. ```solidity function latestRound() external view returns (uint256) ``` > **NOTE** > > Gets the latest round ID from the aggregator. #### Returns | Parameter | Type | Description | | --------- | ------- | ------------------- | | (unnamed) | uint256 | The latest round ID | ### latestTimestamp Retrieves the timestamp of the most recent answer. ```solidity function latestTimestamp() external view returns (uint256) ``` > **NOTE** > > Gets the timestamp of the latest answer from the aggregator. #### Returns | Parameter | Type | Description | | --------- | ------- | ---------------------------------- | | (unnamed) | uint256 | The timestamp of the latest answer | --- # AggregatorV2V3Interface v0.2.2 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-v2-v3-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.2 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.2 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@cd3bfb8c42716cfb791174314eba2c0d178551b9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.2/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorV2V3Interface A combined interface that inherits functionality from both AggregatorInterface and AggregatorV3Interface, providing a complete set of methods for accessing price feed data. [`AggregatorV2V3Interface`](https://github.com/smartcontractkit/chainlink-local/blob/cd3bfb8c42716cfb791174314eba2c0d178551b9/src/data-feeds/interfaces/AggregatorV2V3Interface.sol) ## Inheritance This interface inherits from: - [`AggregatorInterface`](/chainlink-local/api-reference/v0.2.2/aggregator-interface) - Provides basic price feed functionality - [`AggregatorV3Interface`](/chainlink-local/api-reference/v0.2.2/aggregator-v3-interface) - Provides extended price feed functionality > **NOTE** > > This interface combines all methods from both AggregatorInterface and AggregatorV3Interface. Please refer to the documentation of each parent interface for detailed information about available functions, events, and their usage. --- # AggregatorV3Interface v0.2.2 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-v3-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.2 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.2 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@cd3bfb8c42716cfb791174314eba2c0d178551b9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.2/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorV3Interface An interface for accessing detailed price feed data and metadata from an aggregator contract, providing enhanced functionality for retrieving round data and contract information. [`AggregatorV3Interface`](https://github.com/smartcontractkit/chainlink-local/blob/cd3bfb8c42716cfb791174314eba2c0d178551b9/src/data-feeds/interfaces/AggregatorV3Interface.sol) ## Functions ### decimals Retrieves the number of decimal places used by the aggregator. ```solidity function decimals() external view returns (uint8) ``` > **NOTE** > > Gets the number of decimals used by the aggregator. #### Returns | Parameter | Type | Description | | --------- | ----- | ---------------------- | | (unnamed) | uint8 | The number of decimals | ### description Retrieves the description of the aggregator. ```solidity function description() external view returns (string memory) ``` > **NOTE** > > Gets the description of the aggregator. #### Returns | Parameter | Type | Description | | --------- | ------ | --------------------------------- | | (unnamed) | string | The description of the aggregator | ### getRoundData Retrieves the complete round data for a specific round ID. ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` > **NOTE** > > Gets the round data for a specific round ID. > > This function should raise "No data present" if no data is available for the given round ID. #### Parameters | Parameter | Type | Description | | --------- | ------ | -------------------------------- | | _roundId | uint80 | The round ID to get the data for | #### Returns | Parameter | Type | Description | | --------------- | ------- | --------------------------------------------- | | roundId | uint80 | The round ID | | answer | int256 | The answer for the round | | startedAt | uint256 | The timestamp when the round started | | updatedAt | uint256 | The timestamp when the round was updated | | answeredInRound | uint80 | The round ID in which the answer was computed | ### latestRoundData Retrieves the complete round data for the most recent round. ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` > **NOTE** > > Gets the latest round data. > > This function should raise "No data present" if no data is available. #### Returns | Parameter | Type | Description | | --------------- | ------- | ---------------------------------------------------- | | roundId | uint80 | The latest round ID | | answer | int256 | The latest answer | | startedAt | uint256 | The timestamp when the latest round started | | updatedAt | uint256 | The timestamp when the latest round was updated | | answeredInRound | uint80 | The round ID in which the latest answer was computed | ### version Retrieves the version number of the aggregator. ```solidity function version() external view returns (uint256) ``` > **NOTE** > > Gets the version of the aggregator. #### Returns | Parameter | Type | Description | | --------- | ------- | ----------------------------- | | (unnamed) | uint256 | The version of the aggregator | --- # BurnMintERC677Helper v0.2.2 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.2/burn-mint-erc677-helper > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.2 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.2 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@cd3bfb8c42716cfb791174314eba2c0d178551b9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.2/src/ccip/CCIPLocalSimulator.sol"; > ``` ## BurnMintERC677Helper A helper contract that extends the BurnMintERC677 token contract with additional minting functionality for testing and development purposes. [`BurnMintERC677Helper`](https://github.com/smartcontractkit/chainlink-local/blob/cd3bfb8c42716cfb791174314eba2c0d178551b9/src/ccip/BurnMintERC677Helper.sol) ## Functions ### constructor Creates a new BurnMintERC677Helper token with the specified name and symbol. ```solidity constructor( string memory name, string memory symbol ) BurnMintERC677(name, symbol, 18, 0) ``` > **NOTE** > > Constructor to initialize the BurnMintERC677Helper contract with a name and symbol. > Calls the parent constructor of BurnMintERC677 with fixed decimals (18) and initial supply (0). #### Parameters | Parameter | Type | Description | | --------- | ------ | ----------------------- | | name | string | The name of the token | | symbol | string | The symbol of the token | ### drip Mints a single token to the specified address for testing purposes. ```solidity function drip(address to) external ``` > **NOTE** > > Mints one full token (1e18) to the specified address. > Calls the internal `_mint` function from the BurnMintERC677 contract. #### Parameters | Parameter | Type | Description | | --------- | ------- | --------------------------------------- | | to | address | The address to receive the minted token | --- # CCIPLocalSimulatorFork v0.2.2 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork-js > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.2 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.2 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@cd3bfb8c42716cfb791174314eba2c0d178551b9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.2/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulatorFork A JavaScript module that provides utilities for simulating CCIP (Cross-Chain Interoperability Protocol) message routing in a local or forked environment. [`CCIPLocalSimulatorFork`](https://github.com/smartcontractkit/chainlink-local/blob/cd3bfb8c42716cfb791174314eba2c0d178551b9/scripts/CCIPLocalSimulatorFork.js) ## Types ### Evm2EvmMessage Represents a cross-chain message in the EVM-to-EVM communication protocol. Contains all necessary information for message routing and token transfers across chains. | Property | Type | Description | | ------------------- | ---------------------------------------- | ---------------------------------------------- | | sourceChainSelector | `bigint` | The identifier of the source chain | | sender | `string` | The address that sent the message | | receiver | `string` | The address that will receive the message | | sequenceNumber | `bigint` | The sequence number of the message | | gasLimit | `bigint` | The gas limit for executing the message | | strict | `boolean` | Whether the message requires strict execution | | nonce | `bigint` | The nonce of the message | | feeToken | `string` | The token used to pay fees | | feeTokenAmount | `bigint` | The amount of fee token to be paid | | data | `string` | The message payload data | | tokenAmounts | `Array<{token: string, amount: bigint}>` | Array of tokens and amounts being transferred | | sourceTokenData | `Array` | Array of token-specific data from source chain | | messageId | `string` | The unique identifier of the message | ## Functions ### getEvm2EvmMessage Extracts and parses a CCIP message from a transaction receipt by looking for the CCIPSendRequested event. ```javascript function getEvm2EvmMessage(receipt) => Evm2EvmMessage | null ``` #### Parameters | Parameter | Type | Description | | --------- | -------- | ------------------------------------------------ | | receipt | `object` | The transaction receipt from the `ccipSend` call | #### Returns | Type | Description | | ---------------------- | ---------------------------------------------------------------------------------------------- | | `Evm2EvmMessage\|null` | The parsed EVM-to-EVM message if found in the receipt logs, or null if no relevant event found | ### requestLinkFromTheFaucet Requests LINK tokens from a faucet contract for testing purposes. ```javascript async function requestLinkFromTheFaucet(linkAddress, to, amount) => Promise ``` #### Parameters | Parameter | Type | Description | | ----------- | -------- | ------------------------------------------------------- | | linkAddress | `string` | The address of the LINK contract on the current network | | to | `string` | The address to send LINK to | | amount | `bigint` | The amount of LINK to request | #### Returns | Type | Description | | ----------------- | -------------------------------------------------------------- | | `Promise` | Promise resolving to the transaction hash of the fund transfer | ### routeMessage Routes a cross-chain message on the destination network by finding the appropriate off-ramp and executing the message. ```javascript async function routeMessage(routerAddress, evm2EvmMessage) => Promise ``` #### Parameters | Parameter | Type | Description | | -------------- | ---------------- | --------------------------------- | | routerAddress | `string` | Address of the destination Router | | evm2EvmMessage | `Evm2EvmMessage` | Sent cross-chain message | #### Returns | Type | Description | | --------------- | ------------------------------------------------------------ | | `Promise` | Resolves with no value if the message is successfully routed | > **CAUTION** > > **Possible Errors** > > - Throws if no off-ramp matches the message's source chain selector > - Throws if calling `router.getOffRamps()` fails > - Throws if no matching off-ramp contract is found for routing --- # CCIPLocalSimulatorFork v0.2.2 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.2 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.2 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@cd3bfb8c42716cfb791174314eba2c0d178551b9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.2/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulatorFork A contract that simulates CCIP (Cross-Chain Interoperability Protocol) message routing in forked network environments, specifically designed to work with Foundry for testing cross-chain applications. [`CCIPLocalSimulatorFork`](https://github.com/smartcontractkit/chainlink-local/blob/cd3bfb8c42716cfb791174314eba2c0d178551b9/src/ccip/CCIPLocalSimulatorFork.sol) ## Events ### CCIPSendRequested ```solidity event CCIPSendRequested(Internal.EVM2EVMMessage message) ``` > **NOTE** > > Event emitted when a CCIP send request is made. #### Parameters | Parameter | Type | Description | | --------- | ----------------------- | --------------------------------- | | message | Internal.EVM2EVMMessage | The EVM2EVM message that was sent | ## Interfaces ### IEVM2EVMOffRampFork Interface for executing CCIP messages on the off-ramp. ```solidity interface IEVM2EVMOffRampFork { function executeSingleMessage( Internal.EVM2EVMMessage memory message, bytes[] memory offchainTokenData, uint32[] memory tokenGasOverrides ) external; } ``` > **NOTE** > > Executes a single CCIP message on the offRamp. ### IRouterFork Interface for accessing off-ramp configurations. ```solidity interface IRouterFork { struct OffRamp { uint64 sourceChainSelector; address offRamp; } function getOffRamps() external view returns (OffRamp[] memory); } ``` > **NOTE** > > Gets the list of offRamps. ## Structs ### OffRamp Configuration for a CCIP off-ramp. ```solidity struct OffRamp { uint64 sourceChainSelector; address offRamp; } ``` #### Fields | Field | Type | Description | | ------------------- | ------- | --------------------------------------- | | sourceChainSelector | uint64 | The chain selector for the source chain | | offRamp | address | The address of the offRamp contract | ## Variables ### i_register ```solidity Register immutable i_register ``` > **NOTE** > > The immutable register instance. ### LINK_FAUCET ```solidity address constant LINK_FAUCET = 0x4281eCF07378Ee595C564a59048801330f3084eE ``` > **NOTE** > > The address of the LINK faucet. ### s_processedMessages ```solidity mapping(bytes32 messageId => bool isProcessed) internal s_processedMessages ``` > **NOTE** > > Mapping to track processed messages. ## Functions ### constructor Sets up the simulator environment by creating a persistent register instance and enabling event recording. ```solidity constructor() ``` > **NOTE** > > Constructor to initialize the contract: > > - Records logs for event tracking > - Creates a new Register instance > - Makes the register instance persistent ### getNetworkDetails Fetches the network configuration for a specified blockchain network ID. ```solidity function getNetworkDetails(uint256 chainId) external view returns (Register.NetworkDetails memory) ``` > **NOTE** > > Returns the default values for currently CCIP supported networks. If network is not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Parameter | Type | Description | | --------- | ------- | --------------------------------------------------------------------------------------------------- | | chainId | uint256 | The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector | #### Returns | Parameter | Type | Description | | -------------- | ----------------------- | --------------------------------------------------------------------------------------------------------------------- | | networkDetails | Register.NetworkDetails | The tuple containing: chainSelector, routerAddress, linkAddress, wrappedNativeAddress, ccipBnMAddress, ccipLnMAddress | ### requestLinkFromFaucet Transfers LINK tokens from the faucet to a specified recipient address. ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` > **NOTE** > > Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Parameter | Type | Description | | --------- | ------- | ----------------------------------------------- | | to | address | The address to which LINK tokens are to be sent | | amount | uint256 | The amount of LINK tokens to send | #### Returns | Parameter | Type | Description | | --------- | ---- | ---------------------------------------------------------------------- | | success | bool | Returns true if the transfer of tokens was successful, otherwise false | ### setNetworkDetails Registers or updates the network configuration for a specific blockchain. ```solidity function setNetworkDetails(uint256 chainId, Register.NetworkDetails memory networkDetails) external ``` > **NOTE** > > If network details are not present or some of the values are changed, user can manually add new network details using this function. #### Parameters | Parameter | Type | Description | | -------------- | ----------------------- | --------------------------------------------------------------------------------------------------------------------- | | chainId | uint256 | The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector | | networkDetails | Register.NetworkDetails | The tuple containing: chainSelector, routerAddress, linkAddress, wrappedNativeAddress, ccipBnMAddress, ccipLnMAddress | ### switchChainAndRouteMessage Routes a cross-chain message by finding it in the event logs, switching to the destination chain, and executing it through the appropriate off-ramp. ```solidity function switchChainAndRouteMessage(uint256 forkId) external ``` > **NOTE** > > To be called after the sending of the cross-chain message (`ccipSend`). Goes through the list of past logs and looks for the `CCIPSendRequested` event. Switches to a destination network fork. Routes the sent cross-chain message on the destination network. #### Parameters | Parameter | Type | Description | | --------- | ------- | ------------------------------------------------------------------------------------------------------------ | | forkId | uint256 | The ID of the destination network fork. This is the returned value of `createFork()` or `createSelectFork()` | --- # CCIPLocalSimulator v0.2.2 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.2 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.2 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@cd3bfb8c42716cfb791174314eba2c0d178551b9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.2/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulator A contract that simulates local CCIP (Cross-Chain Interoperability Protocol) operations for testing and development purposes. [`CCIPLocalSimulator`](https://github.com/smartcontractkit/chainlink-local/blob/cd3bfb8c42716cfb791174314eba2c0d178551b9/src/ccip/CCIPLocalSimulator.sol) ## Errors ### CCIPLocalSimulator__MsgSenderIsNotTokenOwner ```solidity error CCIPLocalSimulator__MsgSenderIsNotTokenOwner() ``` Thrown when a caller attempts to add a token but is not the token owner or CCIP admin. ## Variables ### CHAIN_SELECTOR ```solidity uint64 constant CHAIN_SELECTOR = 16015286601757825753 ``` > **NOTE** > > The unique CCIP Chain Selector constant. ### i_ccipBnM ```solidity BurnMintERC677Helper internal immutable i_ccipBnM ``` > **NOTE** > > The BurnMintERC677Helper instance for CCIP-BnM token. ### i_ccipLnM ```solidity BurnMintERC677Helper internal immutable i_ccipLnM ``` > **NOTE** > > The BurnMintERC677Helper instance for CCIP-LnM token. ### i_linkToken ```solidity LinkToken internal immutable i_linkToken ``` > **NOTE** > > The LINK token instance. ### i_mockRouter ```solidity MockCCIPRouter internal immutable i_mockRouter ``` > **NOTE** > > The mock CCIP router instance. ### i_wrappedNative ```solidity WETH9 internal immutable i_wrappedNative ``` > **NOTE** > > The wrapped native token instance. ### s_supportedTokens ```solidity address[] internal s_supportedTokens ``` > **NOTE** > > The list of supported token addresses. ## Functions ### constructor Initializes the contract by deploying and configuring all required token instances. ```solidity constructor() ``` > **NOTE** > > Constructor to initialize the contract and pre-deployed token instances. ### configuration Retrieves the complete configuration for local CCIP simulations. ```solidity function configuration() public view returns ( uint64 chainSelector_, IRouterClient sourceRouter_, IRouterClient destinationRouter_, WETH9 wrappedNative_, LinkToken linkToken_, BurnMintERC677Helper ccipBnM_, BurnMintERC677Helper ccipLnM_ ) ``` > **NOTE** > > Returns configuration details for pre-deployed contracts and services needed for local CCIP simulations. #### Returns | Parameter | Type | Description | | ------------------- | -------------------- | -------------------------------------------------------- | | chainSelector_ | uint64 | The unique CCIP Chain Selector | | sourceRouter_ | IRouterClient | The source chain Router contract | | destinationRouter_ | IRouterClient | The destination chain Router contract | | wrappedNative_ | WETH9 | The wrapped native token which can be used for CCIP fees | | linkToken_ | LinkToken | The LINK token | | ccipBnM_ | BurnMintERC677Helper | The ccipBnM token | | ccipLnM_ | BurnMintERC677Helper | The ccipLnM token | ### getSupportedTokens Retrieves the list of tokens supported for cross-chain transfers. ```solidity function getSupportedTokens(uint64 chainSelector) external view returns (address[] memory tokens) ``` > **NOTE** > > Gets a list of token addresses that are supported for cross-chain transfers by the simulator. #### Parameters | Parameter | Type | Description | | ------------- | ------ | ------------------------------ | | chainSelector | uint64 | The unique CCIP Chain Selector | #### Returns | Parameter | Type | Description | | --------- | ---------- | ----------------------------------------------------------------------------------------------- | | tokens | address[] | Returns a list of token addresses that are supported for cross-chain transfers by the simulator | ### isChainSupported Verifies if a given chain selector is supported by the simulator. ```solidity function isChainSupported(uint64 chainSelector) public pure returns (bool supported) ``` > **NOTE** > > Checks whether the provided `chainSelector` is supported by the simulator. #### Parameters | Parameter | Type | Description | | ------------- | ------ | ------------------------------ | | chainSelector | uint64 | The unique CCIP Chain Selector | #### Returns | Parameter | Type | Description | | --------- | ---- | ------------------------------------------------------------- | | supported | bool | Returns true if `chainSelector` is supported by the simulator | ### requestLinkFromFaucet Transfers LINK tokens from the faucet to a specified recipient address. ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` > **NOTE** > > Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Parameter | Type | Description | | --------- | ------- | ----------------------------------------------- | | to | address | The address to which LINK tokens are to be sent | | amount | uint256 | The amount of LINK tokens to send | #### Returns | Parameter | Type | Description | | --------- | ---- | ---------------------------------------------------------------------- | | success | bool | Returns true if the transfer of tokens was successful, otherwise false | ### supportNewTokenViaGetCCIPAdmin Adds support for a new token using CCIP admin verification. ```solidity function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external ``` > **NOTE** > > Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. > Reverts if token does not implement getCCIPAdmin() function. > Reverts if the caller is not the token CCIPAdmin. #### Parameters | Parameter | Type | Description | | ------------ | ------- | --------------------------------------------------------------- | | tokenAddress | address | The address of the token to add to the list of supported tokens | ### supportNewTokenViaOwner Adds support for a new token using owner verification. ```solidity function supportNewTokenViaOwner(address tokenAddress) external ``` > **NOTE** > > Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. > Reverts if token does not implement owner() function. > Reverts if the caller is not the token owner. #### Parameters | Parameter | Type | Description | | ------------ | ------- | --------------------------------------------------------------- | | tokenAddress | address | The address of the token to add to the list of supported tokens | --- # Chainlink Local v0.2.2 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.2 > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.2 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.2 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@cd3bfb8c42716cfb791174314eba2c0d178551b9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.2/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIP These contracts provide Cross-Chain Interoperability Protocol (CCIP) functionality in a local testing environment: - [CCIPLocalSimulator](/chainlink-local/api-reference/v0.2.2/ccip-local-simulator) - Local CCIP message routing simulator - [CCIPLocalSimulatorFork](/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork) - CCIP simulator for forked networks - [CCIPLocalSimulatorFork JS](/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork-js) - JavaScript utilities for CCIP simulation - [Register](/chainlink-local/api-reference/v0.2.2/register) - CCIP network configuration registry ## Data Feeds Contracts for simulating Chainlink Data Feeds: - [AggregatorInterface](/chainlink-local/api-reference/v0.2.2/aggregator-interface) - Basic price feed interface - [AggregatorV2V3Interface](/chainlink-local/api-reference/v0.2.2/aggregator-v2-v3-interface) - Combined V2/V3 price feed interface - [AggregatorV3Interface](/chainlink-local/api-reference/v0.2.2/aggregator-v3-interface) - Extended price feed interface - [MockOffchainAggregator](/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator) - Mock implementation of off-chain aggregator - [MockV3Aggregator](/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator) - Mock implementation of V3 aggregator ## Token Contracts Standard token implementations for testing: - [BurnMintERC677Helper](/chainlink-local/api-reference/v0.2.2/burn-mint-erc677-helper) - Helper contract for ERC677 token operations - [LinkToken](/chainlink-local/api-reference/v0.2.2/link-token) - LINK token implementation - [WETH9](/chainlink-local/api-reference/v0.2.2/weth9) - Wrapped Ether implementation --- # LinkToken v0.2.2 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.2/link-token > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.2 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.2 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@cd3bfb8c42716cfb791174314eba2c0d178551b9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.2/src/ccip/CCIPLocalSimulator.sol"; > ``` ## LinkToken A contract that implements the ChainLink Token (LINK) using the ERC677 standard with a fixed total supply and standard token details. [`LinkToken`](https://github.com/smartcontractkit/chainlink-local/blob/cd3bfb8c42716cfb791174314eba2c0d178551b9/src/shared/LinkToken.sol) ## Functions ### constructor Initializes a new LINK token with standard token details. ```solidity constructor() ``` > **NOTE** > > Constructor to initialize the LinkToken contract with a fixed total supply, name, and symbol. > > Calls the ERC677 constructor with the name and symbol, and then mints the total supply to the contract deployer. ### _onCreate Internal hook that handles the initial token supply minting. ```solidity function _onCreate() internal virtual ``` > **NOTE** > > Hook that is called when this contract is created. > > Useful to override constructor behaviour in child contracts (e.g., LINK bridge tokens). > The default implementation mints 10^27 tokens to the contract deployer. --- # MockOffchainAggregator v0.2.2 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.2 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.2 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@cd3bfb8c42716cfb791174314eba2c0d178551b9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.2/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockOffchainAggregator A mock implementation of an offchain aggregator contract used for testing purposes, simulating price feed behavior with configurable parameters. [`MockOffchainAggregator`](https://github.com/smartcontractkit/chainlink-local/blob/cd3bfb8c42716cfb791174314eba2c0d178551b9/src/data-feeds/MockOffchainAggregator.sol) ## Variables ### decimals ```solidity uint8 public decimals ``` > **NOTE** > > The number of decimals used by the aggregator. ### getAnswer ```solidity mapping(uint256 => int256) public getAnswer ``` > **NOTE** > > Mapping to get the answer for a specific round ID. ### getTimestamp ```solidity mapping(uint256 => uint256) public getTimestamp ``` > **NOTE** > > Mapping to get the timestamp for a specific round ID. ### latestAnswer ```solidity int256 public latestAnswer ``` > **NOTE** > > The latest answer reported by the aggregator. ### latestRound ```solidity uint256 public latestRound ``` > **NOTE** > > The latest round ID. ### latestTimestamp ```solidity uint256 public latestTimestamp ``` > **NOTE** > > The timestamp of the latest answer. ### maxAnswer ```solidity int192 public maxAnswer ``` > **NOTE** > > The maximum answer the aggregator is allowed to report. ### minAnswer ```solidity int192 public minAnswer ``` > **NOTE** > > The minimum answer the aggregator is allowed to report. ## Functions ### constructor Initializes a new mock aggregator with the specified decimal precision and starting price. ```solidity constructor(uint8 _decimals, int256 _initialAnswer) ``` > **NOTE** > > Constructor to initialize the MockOffchainAggregator contract with initial parameters. #### Parameters | Parameter | Type | Description | | --------------- | ------ | --------------------------------------------------- | | _decimals | uint8 | The number of decimals for the aggregator | | _initialAnswer | int256 | The initial answer to be set in the mock aggregator | ### getRoundData Retrieves the complete round data for a specific round ID. ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` > **NOTE** > > Gets the round data for a specific round ID. #### Parameters | Parameter | Type | Description | | --------- | ------ | -------------------------------- | | _roundId | uint80 | The round ID to get the data for | #### Returns | Parameter | Type | Description | | --------------- | ------- | --------------------------------------------- | | roundId | uint80 | The round ID | | answer | int256 | The answer for the round | | startedAt | uint256 | The timestamp when the round started | | updatedAt | uint256 | The timestamp when the round was updated | | answeredInRound | uint80 | The round ID in which the answer was computed | ### latestRoundData Retrieves the complete round data for the most recent round. ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` > **NOTE** > > Gets the latest round data. #### Returns | Parameter | Type | Description | | --------------- | ------- | ---------------------------------------------------- | | roundId | uint80 | The latest round ID | | answer | int256 | The latest answer | | startedAt | uint256 | The timestamp when the latest round started | | updatedAt | uint256 | The timestamp when the latest round was updated | | answeredInRound | uint80 | The round ID in which the latest answer was computed | ### updateAnswer Updates the latest answer and associated data. ```solidity function updateAnswer(int256 _answer) public ``` > **NOTE** > > Updates the answer in the mock aggregator. #### Parameters | Parameter | Type | Description | | --------- | ------ | ------------------------ | | _answer | int256 | The new answer to be set | ### updateMinAndMaxAnswers Updates the minimum and maximum allowed answers for the aggregator. ```solidity function updateMinAndMaxAnswers(int192 _minAnswer, int192 _maxAnswer) external ``` > **NOTE** > > Updates the minimum and maximum answers the aggregator can report. #### Parameters | Parameter | Type | Description | | ----------- | ------ | ---------------------- | | _minAnswer | int192 | The new minimum answer | | _maxAnswer | int192 | The new maximum answer | > **CAUTION** > > **Possible Reverts** > > - Reverts with "minAnswer must be less than maxAnswer" if `_minAnswer >= _maxAnswer` > - Reverts with "minAnswer is too low" if `_minAnswer < MIN_ANSWER_POSSIBLE` > - Reverts with "maxAnswer is too high" if `_maxAnswer > MAX_ANSWER_POSSIBLE` ### updateRoundData Updates all data for a specific round. ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` > **NOTE** > > Updates the round data in the mock aggregator. #### Parameters | Parameter | Type | Description | | ----------- | ------- | ------------------------------------ | | _roundId | uint80 | The round ID to be updated | | _answer | int256 | The new answer to be set | | _timestamp | uint256 | The timestamp to be set | | _startedAt | uint256 | The timestamp when the round started | --- # MockV3Aggregator v0.2.2 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.2 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.2 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@cd3bfb8c42716cfb791174314eba2c0d178551b9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.2/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockV3Aggregator A mock implementation of the AggregatorV2V3Interface for testing purposes, providing a simulated price feed through interaction with a MockOffchainAggregator. [`MockV3Aggregator`](https://github.com/smartcontractkit/chainlink-local/blob/cd3bfb8c42716cfb791174314eba2c0d178551b9/src/data-feeds/MockV3Aggregator.sol) ## Inheritance This contract inherits from: - [`AggregatorV2V3Interface`](/chainlink-local/api-reference/v0.2.2/aggregator-v2-v3-interface) - Combined interface that includes both AggregatorInterface and AggregatorV3Interface functionality > **NOTE** > > This contract implements all methods from AggregatorV2V3Interface, delegating most calls to an underlying MockOffchainAggregator instance. ## Variables ### aggregator ```solidity address public aggregator ``` > **NOTE** > > The address of the current aggregator. ### proposedAggregator ```solidity address public proposedAggregator ``` > **NOTE** > > The address of the proposed aggregator. ### version ```solidity uint256 public constant version ``` > **NOTE** > > The version of the aggregator. ## Functions ### confirmAggregator Confirms and sets a previously proposed aggregator as the current one. ```solidity function confirmAggregator(address _aggregator) external ``` > **NOTE** > > Confirms the proposed aggregator. #### Parameters | Parameter | Type | Description | | ------------ | ------- | -------------------------------------- | | _aggregator | address | The address of the proposed aggregator | > **CAUTION** > > **Possible Reverts** > > - Reverts with "Invalid proposed aggregator" if `_aggregator` does not match the proposed aggregator address ### constructor Initializes the mock aggregator with specified decimals and initial answer. ```solidity constructor(uint8 _decimals, int256 _initialAnswer) ``` > **NOTE** > > Constructor to initialize the MockV3Aggregator contract with initial parameters. #### Parameters | Parameter | Type | Description | | --------------- | ------ | --------------------------------------------------- | | _decimals | uint8 | The number of decimals for the aggregator | | _initialAnswer | int256 | The initial answer to be set in the mock aggregator | ### decimals Retrieves the number of decimal places used by the aggregator. ```solidity function decimals() external view returns (uint8) ``` > **NOTE** > > Inherited from AggregatorV3Interface. #### Returns | Parameter | Type | Description | | --------- | ----- | ---------------------- | | (unnamed) | uint8 | The number of decimals | ### description Returns the description of the aggregator. ```solidity function description() external pure returns (string memory) ``` > **NOTE** > > Inherited from AggregatorV3Interface. #### Returns | Parameter | Type | Description | | --------- | ------ | ------------------------------------------- | | (unnamed) | string | The source file path of the mock aggregator | ### getAnswer Retrieves the answer for a specific round. ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` > **NOTE** > > Inherited from AggregatorInterface. #### Parameters | Parameter | Type | Description | | --------- | ------- | ---------------------------------- | | roundId | uint256 | The round ID to get the answer for | #### Returns | Parameter | Type | Description | | --------- | ------ | --------------------------------- | | (unnamed) | int256 | The answer for the given round ID | ### getRoundData Retrieves the complete round data for a specific round ID. ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` > **NOTE** > > Inherited from AggregatorV3Interface. #### Parameters | Parameter | Type | Description | | --------- | ------ | -------------------------------- | | _roundId | uint80 | The round ID to get the data for | #### Returns | Parameter | Type | Description | | --------------- | ------- | --------------------------------------------- | | roundId | uint80 | The round ID | | answer | int256 | The answer for the round | | startedAt | uint256 | The timestamp when the round started | | updatedAt | uint256 | The timestamp when the round was updated | | answeredInRound | uint80 | The round ID in which the answer was computed | ### getTimestamp Retrieves the timestamp for a specific round. ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` > **NOTE** > > Inherited from AggregatorInterface. #### Parameters | Parameter | Type | Description | | --------- | ------- | ------------------------------------- | | roundId | uint256 | The round ID to get the timestamp for | #### Returns | Parameter | Type | Description | | --------- | ------- | ------------------------------------ | | (unnamed) | uint256 | The timestamp for the given round ID | ### latestAnswer Retrieves the most recent answer. ```solidity function latestAnswer() external view returns (int256) ``` > **NOTE** > > Inherited from AggregatorInterface. #### Returns | Parameter | Type | Description | | --------- | ------ | ----------------- | | (unnamed) | int256 | The latest answer | ### latestRound Retrieves the most recent round ID. ```solidity function latestRound() external view returns (uint256) ``` > **NOTE** > > Inherited from AggregatorInterface. #### Returns | Parameter | Type | Description | | --------- | ------- | ------------------- | | (unnamed) | uint256 | The latest round ID | ### latestRoundData Retrieves the complete round data for the most recent round. ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` > **NOTE** > > Inherited from AggregatorV3Interface. #### Returns | Parameter | Type | Description | | --------------- | ------- | ---------------------------------------------------- | | roundId | uint80 | The latest round ID | | answer | int256 | The latest answer | | startedAt | uint256 | The timestamp when the latest round started | | updatedAt | uint256 | The timestamp when the latest round was updated | | answeredInRound | uint80 | The round ID in which the latest answer was computed | ### latestTimestamp Retrieves the timestamp of the most recent answer. ```solidity function latestTimestamp() external view returns (uint256) ``` > **NOTE** > > Inherited from AggregatorInterface. #### Returns | Parameter | Type | Description | | --------- | ------- | ---------------------------------- | | (unnamed) | uint256 | The timestamp of the latest answer | ### proposeAggregator Proposes a new aggregator for future use. ```solidity function proposeAggregator(AggregatorV2V3Interface _aggregator) external ``` > **NOTE** > > Proposes a new aggregator. #### Parameters | Parameter | Type | Description | | ------------ | ----------------------- | -------------------------------------- | | _aggregator | AggregatorV2V3Interface | The address of the proposed aggregator | > **CAUTION** > > **Possible Reverts** > > - Reverts with "Proposed aggregator cannot be zero address" if `_aggregator` is the zero address > - Reverts with "Proposed aggregator cannot be current aggregator" if `_aggregator` is the current aggregator ### updateAnswer Updates the latest answer in the underlying mock aggregator. ```solidity function updateAnswer(int256 _answer) public ``` > **NOTE** > > Updates the answer in the mock aggregator. #### Parameters | Parameter | Type | Description | | --------- | ------ | ------------------------ | | _answer | int256 | The new answer to be set | ### updateRoundData Updates all data for a specific round in the underlying mock aggregator. ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` > **NOTE** > > Updates the round data in the mock aggregator. #### Parameters | Parameter | Type | Description | | ----------- | ------- | ------------------------------------ | | _roundId | uint80 | The round ID to be updated | | _answer | int256 | The new answer to be set | | _timestamp | uint256 | The timestamp to be set | | _startedAt | uint256 | The timestamp when the round started | --- # Register v0.2.2 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.2/register > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.2 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.2 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@cd3bfb8c42716cfb791174314eba2c0d178551b9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.2/src/ccip/CCIPLocalSimulator.sol"; > ``` ## Register A contract that manages network configuration details for various blockchain networks, storing and retrieving network-specific parameters. [`Register`](https://github.com/smartcontractkit/chainlink-local/blob/cd3bfb8c42716cfb791174314eba2c0d178551b9/src/ccip/Register.sol) ## Structs ### NetworkDetails Configuration details for a CCIP network. ```solidity struct NetworkDetails { uint64 chainSelector; address routerAddress; address linkAddress; address wrappedNativeAddress; address ccipBnMAddress; address ccipLnMAddress; address rmnProxyAddress; address registryModuleOwnerCustomAddress; address tokenAdminRegistryAddress; } ``` #### Fields | Field | Type | Description | | -------------------------------- | ------- | -------------------------------------------------------- | | chainSelector | uint64 | The unique identifier for the chain | | routerAddress | address | The address of the CCIP router contract | | linkAddress | address | The address of the LINK token | | wrappedNativeAddress | address | The address of the wrapped native token | | ccipBnMAddress | address | The address of the CCIP BnM token | | ccipLnMAddress | address | The address of the CCIP LnM token | | rmnProxyAddress | address | The address of the RMN proxy | | registryModuleOwnerCustomAddress | address | The address of the registry module owner custom contract | | tokenAdminRegistryAddress | address | The address of the token admin registry | ## Variables ### s_networkDetails ```solidity mapping(uint256 chainId => NetworkDetails) internal s_networkDetails ``` > **NOTE** > > Mapping to store network details based on chain ID. ## Functions ### constructor Initializes the contract with predefined network configurations for various test networks. ```solidity constructor() ``` > **NOTE** > > Constructor to initialize the network details for various chains: > > - Polygon Amoy (Chain ID: 80002) > - Arbitrum Sepolia (Chain ID: 421614) > - Base Sepolia (Chain ID: 84532) > - Blast Sepolia (Chain ID: 168587773) > - BNB Chain Testnet (Chain ID: 97) > - Celo Testnet Alfajores (Chain ID: 44787) > - Avalanche Fuji (Chain ID: 43113) > - Gnosis Chiado (Chain ID: 10200) > - Kroma Sepolia (Chain ID: 2358) > - Metis Sepolia (Chain ID: 59902) > - Mode Sepolia (Chain ID: 919) > - OP Sepolia (Chain ID: 11155420) > - Ethereum Sepolia (Chain ID: 11155111) > - WEMIX Testnet (Chain ID: 1112) > - zkSync Sepolia (Chain ID: 300) ### getNetworkDetails Fetches the network configuration for a specified chain ID. ```solidity function getNetworkDetails(uint256 chainId) external view returns (NetworkDetails memory networkDetails) ``` > **NOTE** > > Retrieves network details for a given chain ID. #### Parameters | Parameter | Type | Description | | --------- | ------- | ------------------------------------------ | | chainId | uint256 | The ID of the chain to get the details for | #### Returns | Parameter | Type | Description | | -------------- | -------------- | ---------------------------------------------- | | networkDetails | NetworkDetails | The network details for the specified chain ID | ### setNetworkDetails Updates or adds network configuration details for a specific chain ID. ```solidity function setNetworkDetails(uint256 chainId, NetworkDetails memory networkDetails) external ``` > **NOTE** > > Sets the network details for a given chain ID. #### Parameters | Parameter | Type | Description | | -------------- | -------------- | ----------------------------------------------------- | | chainId | uint256 | The ID of the chain to set the details for | | networkDetails | NetworkDetails | The network details to set for the specified chain ID | --- # WETH9 v0.2.2 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9 > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.2 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.2 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@cd3bfb8c42716cfb791174314eba2c0d178551b9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.2/src/ccip/CCIPLocalSimulator.sol"; > ``` ## WETH9 A contract that implements Wrapped Ether (WETH), allowing users to wrap and unwrap ETH to use it as an ERC20-compatible token. [`WETH9`](https://github.com/smartcontractkit/chainlink-local/blob/cd3bfb8c42716cfb791174314eba2c0d178551b9/src/shared/WETH9.sol) ## Variables ### allowance ```solidity mapping(address => mapping(address => uint256)) public allowance ``` > **NOTE** > > Tracks the amount of tokens that an owner has allowed a spender to use. ### balanceOf ```solidity mapping(address => uint256) public balanceOf ``` > **NOTE** > > Tracks the WETH balance of each address. ### decimals ```solidity uint8 public decimals ``` > **NOTE** > > The number of decimal places used by the token (18). ### name ```solidity string public name ``` > **NOTE** > > The name of the token ("Wrapped Ether"). ### symbol ```solidity string public symbol ``` > **NOTE** > > The symbol of the token ("WETH"). ## Events ### Approval ```solidity event Approval(address indexed src, address indexed guy, uint256 wad) ``` Emitted when an approval is set. #### Parameters | Parameter | Type | Description | | --------- | ------- | ----------------------------- | | src | address | The owner of the tokens | | guy | address | The approved spender | | wad | uint256 | The amount of tokens approved | ### Deposit ```solidity event Deposit(address indexed dst, uint256 wad) ``` Emitted when ETH is wrapped to WETH. #### Parameters | Parameter | Type | Description | | --------- | ------- | ------------------------- | | dst | address | The recipient of the WETH | | wad | uint256 | The amount of ETH wrapped | ### Transfer ```solidity event Transfer(address indexed src, address indexed dst, uint256 wad) ``` Emitted when tokens are transferred. #### Parameters | Parameter | Type | Description | | --------- | ------- | -------------------------------- | | src | address | The sender of the tokens | | dst | address | The recipient of the tokens | | wad | uint256 | The amount of tokens transferred | ### Withdrawal ```solidity event Withdrawal(address indexed src, uint256 wad) ``` Emitted when WETH is unwrapped back to ETH. #### Parameters | Parameter | Type | Description | | --------- | ------- | ---------------------------- | | src | address | The address unwrapping WETH | | wad | uint256 | The amount of WETH unwrapped | ## Functions ### approve Approves a spender to transfer tokens on behalf of the owner. ```solidity function approve(address guy, uint256 wad) public returns (bool) ``` #### Parameters | Parameter | Type | Description | | --------- | ------- | ------------------------------- | | guy | address | The address to approve | | wad | uint256 | The amount of tokens to approve | #### Returns | Parameter | Type | Description | | --------- | ---- | ------------------- | | (unnamed) | bool | Always returns true | ### deposit Wraps ETH to WETH by sending ETH to the contract. ```solidity function deposit() external payable ``` ### totalSupply Returns the total amount of WETH in circulation. ```solidity function totalSupply() public view returns (uint256) ``` #### Returns | Parameter | Type | Description | | --------- | ------- | ------------------------------------------------- | | (unnamed) | uint256 | The total supply of WETH (contract's ETH balance) | ### transfer Transfers tokens to a specified address. ```solidity function transfer(address dst, uint256 wad) public returns (bool) ``` #### Parameters | Parameter | Type | Description | | --------- | ------- | -------------------------------- | | dst | address | The recipient address | | wad | uint256 | The amount of tokens to transfer | #### Returns | Parameter | Type | Description | | --------- | ---- | ------------------- | | (unnamed) | bool | Always returns true | ### transferFrom Transfers tokens from one address to another. ```solidity function transferFrom(address src, address dst, uint256 wad) public returns (bool) ``` #### Parameters | Parameter | Type | Description | | --------- | ------- | -------------------------------- | | src | address | The source address | | dst | address | The destination address | | wad | uint256 | The amount of tokens to transfer | #### Returns | Parameter | Type | Description | | --------- | ---- | ------------------- | | (unnamed) | bool | Always returns true | > **CAUTION** > > **Possible Reverts** > > - Reverts if the source address has insufficient balance > - Reverts if the sender has insufficient allowance (unless allowance is maximum uint128 or sender is the source) ### withdraw Unwraps WETH back to ETH. ```solidity function withdraw(uint256 wad) external ``` #### Parameters | Parameter | Type | Description | | --------- | ------- | ---------------------------- | | wad | uint256 | The amount of WETH to unwrap | > **CAUTION** > > **Possible Reverts** > > - Reverts if the sender has insufficient WETH balance --- # AggregatorInterface v0.2.3 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.3 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.3 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.3/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorInterface Interface for accessing price feed data from an aggregator contract. [`AggregatorInterface`](https://github.com/smartcontractkit/chainlink-local/blob/7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab/src/data-feeds/interfaces/AggregatorInterface.sol) > **NOTE** > > Provides methods to get the latest and historical price data for specific rounds. ## Events ### AnswerUpdated ```solidity event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt) ``` > **NOTE** > > Emitted when the answer is updated. #### Parameters | Parameter | Type | Description | | --------- | --------- | --------------------------------------------- | | current | `int256` | The updated answer | | roundId | `uint256` | The round ID for which the answer was updated | | updatedAt | `uint256` | The timestamp when the answer was updated | ### NewRound ```solidity event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt) ``` > **NOTE** > > Emitted when a new round is started. #### Parameters | Parameter | Type | Description | | --------- | --------- | ------------------------------------------------- | | roundId | `uint256` | The round ID of the new round | | startedBy | `address` | The address of the account that started the round | | startedAt | `uint256` | The timestamp when the round was started | ## Functions ### getAnswer Gets the answer for a specific round ID. ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` > **NOTE** > > Gets the answer for a specific round ID. #### Parameters | Parameter | Type | Description | | --------- | --------- | ---------------------------------- | | roundId | `uint256` | The round ID to get the answer for | #### Returns | Parameter | Type | Description | | --------- | -------- | --------------------------------- | | (unnamed) | `int256` | The answer for the given round ID | ### getTimestamp Gets the timestamp for a specific round ID. ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` > **NOTE** > > Gets the timestamp for a specific round ID. #### Parameters | Parameter | Type | Description | | --------- | --------- | ------------------------------------- | | roundId | `uint256` | The round ID to get the timestamp for | #### Returns | Parameter | Type | Description | | --------- | --------- | ------------------------------------ | | (unnamed) | `uint256` | The timestamp for the given round ID | ### latestAnswer Gets the latest answer from the aggregator. ```solidity function latestAnswer() external view returns (int256) ``` > **NOTE** > > Gets the latest answer from the aggregator. #### Returns | Parameter | Type | Description | | --------- | -------- | ----------------- | | (unnamed) | `int256` | The latest answer | ### latestRound Gets the latest round ID from the aggregator. ```solidity function latestRound() external view returns (uint256) ``` > **NOTE** > > Gets the latest round ID from the aggregator. #### Returns | Parameter | Type | Description | | --------- | --------- | ------------------- | | (unnamed) | `uint256` | The latest round ID | ### latestTimestamp Gets the timestamp of the latest answer from the aggregator. ```solidity function latestTimestamp() external view returns (uint256) ``` > **NOTE** > > Gets the timestamp of the latest answer from the aggregator. #### Returns | Parameter | Type | Description | | --------- | --------- | ---------------------------------- | | (unnamed) | `uint256` | The timestamp of the latest answer | --- # AggregatorV2V3Interface v0.2.3 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-v2-v3-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.3 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.3 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.3/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorV2V3Interface Interface that combines functionality from both AggregatorInterface and AggregatorV3Interface. [`AggregatorV2V3Interface`](https://github.com/smartcontractkit/chainlink-local/blob/7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab/src/data-feeds/interfaces/AggregatorV2V3Interface.sol) > **NOTE** > > This interface inherits from: > > - [AggregatorInterface](/chainlink-local/api-reference/v0.2.3/aggregator-interface) > - [AggregatorV3Interface](/chainlink-local/api-reference/v0.2.3/aggregator-v3-interface) --- # AggregatorV3Interface v0.2.3 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-v3-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.3 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.3 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.3/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorV3Interface Interface for accessing detailed data from an aggregator contract, including round data and metadata. [`AggregatorV3Interface`](https://github.com/smartcontractkit/chainlink-local/blob/7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab/src/data-feeds/interfaces/AggregatorV3Interface.sol) > **NOTE** > > Provides methods to get the latest data, historical data for specific rounds, and metadata such as decimals and > description. ## Functions ### decimals Gets the number of decimals used by the aggregator. ```solidity function decimals() external view returns (uint8) ``` > **NOTE** > > Gets the number of decimals used by the aggregator. #### Returns | Parameter | Type | Description | | --------- | ------- | ---------------------- | | (unnamed) | `uint8` | The number of decimals | ### description Gets the description of the aggregator. ```solidity function description() external view returns (string memory) ``` > **NOTE** > > Gets the description of the aggregator. #### Returns | Parameter | Type | Description | | --------- | -------- | --------------------------------- | | (unnamed) | `string` | The description of the aggregator | ### getRoundData Gets the round data for a specific round ID. ```solidity function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` > **NOTE** > > Gets the round data for a specific round ID. Reverts with "No data present" if no data is available for the given > round ID. #### Parameters | Parameter | Type | Description | | --------- | -------- | -------------------------------- | | _roundId | `uint80` | The round ID to get the data for | #### Returns | Parameter | Type | Description | | --------------- | --------- | --------------------------------------------- | | roundId | `uint80` | The round ID | | answer | `int256` | The answer for the round | | startedAt | `uint256` | The timestamp when the round started | | updatedAt | `uint256` | The timestamp when the round was updated | | answeredInRound | `uint80` | The round ID in which the answer was computed | ### latestRoundData Gets the latest round data. ```solidity function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` > **NOTE** > > Gets the latest round data. Reverts with "No data present" if no data is available. #### Returns | Parameter | Type | Description | | --------------- | --------- | ---------------------------------------------------- | | roundId | `uint80` | The latest round ID | | answer | `int256` | The latest answer | | startedAt | `uint256` | The timestamp when the latest round started | | updatedAt | `uint256` | The timestamp when the latest round was updated | | answeredInRound | `uint80` | The round ID in which the latest answer was computed | ### version Gets the version of the aggregator. ```solidity function version() external view returns (uint256) ``` > **NOTE** > > Gets the version of the aggregator. #### Returns | Parameter | Type | Description | | --------- | --------- | ----------------------------- | | (unnamed) | `uint256` | The version of the aggregator | --- # BurnMintERC677Helper v0.2.3 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.3/burn-mint-erc677-helper > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.3 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.3 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.3/src/ccip/CCIPLocalSimulator.sol"; > ``` ## BurnMintERC677Helper A helper contract that extends the BurnMintERC677 token contract to provide additional minting functionality. [`BurnMintERC677Helper`](https://github.com/smartcontractkit/chainlink-local/blob/7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab/src/ccip/BurnMintERC677Helper.sol) > **NOTE** > > This contract extends the functionality of the BurnMintERC677 token contract to include a `drip` function that mints one full token to a specified address. > > Inherits from the BurnMintERC677 contract and sets the token name, symbol, decimals, and initial supply in the constructor. ## Functions ### constructor Initializes the token with a name and symbol, setting fixed decimals and initial supply. ```solidity constructor(string memory name, string memory symbol) ``` > **NOTE** > > Constructor to initialize the BurnMintERC677Helper contract with a name and symbol. > > Calls the parent constructor of BurnMintERC677 with fixed decimals (18) and initial supply (0). #### Parameters | Parameter | Type | Description | | --------- | -------- | ----------------------- | | name | `string` | The name of the token | | symbol | `string` | The symbol of the token | ### drip Mints exactly one token (1e18 units) to a specified address. ```solidity function drip(address to) external ``` > **NOTE** > > Mints one full token (1e18) to the specified address. > > Calls the internal `_mint` function from the BurnMintERC677 contract. #### Parameters | Parameter | Type | Description | | --------- | --------- | --------------------------------------- | | to | `address` | The address to receive the minted token | --- # CCIPLocalSimulatorFork v0.2.3 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork-js > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.3 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.3 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.3/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulatorFork A JavaScript module that provides utilities for simulating CCIP (Cross-Chain Interoperability Protocol) message routing in a local or forked environment. [`CCIPLocalSimulatorFork`](https://github.com/smartcontractkit/chainlink-local/blob/7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab/scripts/CCIPLocalSimulatorFork.js) ## Types ### Evm2EvmMessage Represents a cross-chain message in the EVM-to-EVM communication protocol. Contains all necessary information for message routing and token transfers across chains. | Property | Type | Description | | ------------------- | ---------------------------------------- | ---------------------------------------------- | | sourceChainSelector | `bigint` | The identifier of the source chain | | sender | `string` | The address that sent the message | | receiver | `string` | The address that will receive the message | | sequenceNumber | `bigint` | The sequence number of the message | | gasLimit | `bigint` | The gas limit for executing the message | | strict | `boolean` | Whether the message requires strict execution | | nonce | `bigint` | The nonce of the message | | feeToken | `string` | The token used to pay fees | | feeTokenAmount | `bigint` | The amount of fee token to be paid | | data | `string` | The message payload data | | tokenAmounts | `Array<{token: string, amount: bigint}>` | Array of tokens and amounts being transferred | | sourceTokenData | `Array` | Array of token-specific data from source chain | | messageId | `string` | The unique identifier of the message | ## Functions ### getEvm2EvmMessage Extracts and parses a CCIP message from a transaction receipt by looking for the CCIPSendRequested event. ```javascript function getEvm2EvmMessage(receipt) => Evm2EvmMessage | null ``` #### Parameters | Parameter | Type | Description | | --------- | -------- | ------------------------------------------------ | | receipt | `object` | The transaction receipt from the `ccipSend` call | #### Returns | Type | Description | | ---------------------- | ---------------------------------------------------------------------------------------------- | | `Evm2EvmMessage\|null` | The parsed EVM-to-EVM message if found in the receipt logs, or null if no relevant event found | ### requestLinkFromTheFaucet Requests LINK tokens from a faucet contract for testing purposes. ```javascript async function requestLinkFromTheFaucet(linkAddress, to, amount) => Promise ``` #### Parameters | Parameter | Type | Description | | ----------- | -------- | ------------------------------------------------------- | | linkAddress | `string` | The address of the LINK contract on the current network | | to | `string` | The address to send LINK to | | amount | `bigint` | The amount of LINK to request | #### Returns | Type | Description | | ----------------- | -------------------------------------------------------------- | | `Promise` | Promise resolving to the transaction hash of the fund transfer | ### routeMessage Routes a cross-chain message on the destination network by finding the appropriate off-ramp and executing the message. ```javascript async function routeMessage(routerAddress, evm2EvmMessage) => Promise ``` #### Parameters | Parameter | Type | Description | | -------------- | ---------------- | --------------------------------- | | routerAddress | `string` | Address of the destination Router | | evm2EvmMessage | `Evm2EvmMessage` | Sent cross-chain message | #### Returns | Type | Description | | --------------- | ------------------------------------------------------------ | | `Promise` | Resolves with no value if the message is successfully routed | > **CAUTION** > > **Possible Errors** > > - Throws if no off-ramp matches the message's source chain selector > - Throws if calling `router.getOffRamps()` fails > - Throws if no matching off-ramp contract is found for routing --- # CCIPLocalSimulatorFork v0.2.3 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.3 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.3 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.3/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulatorFork A contract that simulates CCIP (Cross-Chain Interoperability Protocol) message routing in a Foundry test environment. [`CCIPLocalSimulatorFork`](https://github.com/smartcontractkit/chainlink-local/blob/7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab/src/ccip/CCIPLocalSimulatorFork.sol) > **NOTE** > > This contract provides utilities for testing cross-chain message routing by simulating message sending and receiving > between different blockchain networks in a Foundry test environment. ## Interfaces ### IRouterFork Interface for interacting with the CCIP Router contract in a forked environment. #### OffRamp ```solidity struct OffRamp { uint64 sourceChainSelector; address offRamp; } ``` | Field | Type | Description | | ------------------- | --------- | --------------------------------------- | | sourceChainSelector | `uint64` | The chain selector for the source chain | | offRamp | `address` | The address of the offRamp contract | #### getOffRamps ```solidity function getOffRamps() external view returns (OffRamp[] memory) ``` > **NOTE** > > Gets the list of off-ramp configurations from the router contract. #### Returns | Parameter | Type | Description | | --------- | ----------- | -------------------------------- | | (unnamed) | `OffRamp[]` | Array of off-ramp configurations | ### IEVM2EVMOffRampFork Interface for executing CCIP messages on an off-ramp contract in a forked environment. #### executeSingleMessage ```solidity function executeSingleMessage( Internal.EVM2EVMMessage memory message, bytes[] memory offchainTokenData, uint32[] memory tokenGasOverrides ) external ``` > **NOTE** > > Executes a single CCIP message on the off-ramp contract. #### Parameters | Parameter | Type | Description | | ----------------- | ---------------- | --------------------------------------- | | message | `EVM2EVMMessage` | The CCIP message to be executed | | offchainTokenData | `bytes[]` | Additional off-chain token data | | tokenGasOverrides | `uint32[]` | Gas limit overrides for token transfers | ## Events ### CCIPSendRequested ```solidity event CCIPSendRequested(Internal.EVM2EVMMessage message) ``` > **NOTE** > > Emitted when a CCIP send request is made. #### Parameters | Parameter | Type | Description | | --------- | ---------------- | --------------------------------- | | message | `EVM2EVMMessage` | The EVM2EVM message that was sent | ## Variables ### i_register ```solidity Register immutable i_register ``` > **NOTE** > > The immutable Register contract instance used to store network configuration details. ### LINK_FAUCET ```solidity address constant LINK_FAUCET = 0x4281eCF07378Ee595C564a59048801330f3084eE ``` > **NOTE** > > The address of the LINK token faucet contract. ### s_processedMessages ```solidity mapping(bytes32 messageId => bool isProcessed) internal s_processedMessages ``` > **NOTE** > > Internal mapping to track which messages have been processed to prevent duplicate processing. ## Functions ### constructor Initializes the contract and sets up logging and persistence. ```solidity constructor() ``` > **NOTE** > > Initializes the contract by: > > - Setting up log recording > - Creating a new Register instance > - Making the Register contract address persistent ### switchChainAndRouteMessage Routes a cross-chain message on the destination network after switching to the specified fork. ```solidity function switchChainAndRouteMessage(uint256 forkId) external ``` > **NOTE** > > To be called after sending a cross-chain message (`ccipSend`). The function: > > - Searches past logs for CCIPSendRequested events > - Switches to the destination network fork > - Routes the sent message on the destination network #### Parameters | Parameter | Type | Description | | --------- | --------- | ------------------------------------------------------------------------------------------- | | forkId | `uint256` | The ID of the destination network fork (returned by `createFork()` or `createSelectFork()`) | ### getNetworkDetails Returns the network configuration details for a specified chain ID. ```solidity function getNetworkDetails(uint256 chainId) external view returns (Register.NetworkDetails memory) ``` > **NOTE** > > Returns the default values for currently CCIP supported networks. If a network is not present or values have changed, > new network details can be added using setNetworkDetails. #### Parameters | Parameter | Type | Description | | --------- | --------- | --------------------------------------------------------------------- | | chainId | `uint256` | The blockchain network chain ID (e.g., 11155111 for Ethereum Sepolia) | #### Returns | Parameter | Type | Description | | --------- | ---------------- | --------------------------------------------------------- | | (unnamed) | `NetworkDetails` | The network configuration details for the specified chain | ### setNetworkDetails Updates or adds new network configuration details for a specified chain ID. ```solidity function setNetworkDetails(uint256 chainId, Register.NetworkDetails memory networkDetails) external ``` > **NOTE** > > Used to add or update network details when they are not present or have changed from default values. #### Parameters | Parameter | Type | Description | | -------------- | ---------------- | --------------------------------------------------------------------- | | chainId | `uint256` | The blockchain network chain ID (e.g., 11155111 for Ethereum Sepolia) | | networkDetails | `NetworkDetails` | The network configuration details to be stored | ### requestLinkFromFaucet Requests LINK tokens from the faucet for a specified address. ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` > **NOTE** > > Transfers the specified amount of LINK tokens from the faucet to the provided destination address. #### Parameters | Parameter | Type | Description | | --------- | --------- | -------------------------------------- | | to | `address` | The address to receive the LINK tokens | | amount | `uint256` | The amount of LINK tokens to transfer | #### Returns | Parameter | Type | Description | | --------- | ------ | ------------------------------------------------- | | success | `bool` | Returns true if the token transfer was successful | --- # CCIPLocalSimulator v0.2.3 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.3 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.3 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.3/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulator A contract that simulates local CCIP (Cross-Chain Interoperability Protocol) operations for testing and development purposes. [`CCIPLocalSimulator`](https://github.com/smartcontractkit/chainlink-local/blob/7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab/src/ccip/CCIPLocalSimulator.sol) > **NOTE** > > This contract includes methods to manage supported tokens and configurations for local simulations. ## Variables ### CHAIN_SELECTOR ```solidity uint64 constant CHAIN_SELECTOR = 16015286601757825753 ``` > **NOTE** > > The unique CCIP Chain Selector constant ### i_ccipBnM ```solidity BurnMintERC677Helper internal immutable i_ccipBnM ``` > **NOTE** > > The BurnMintERC677Helper instance for CCIP-BnM token ### i_ccipLnM ```solidity BurnMintERC677Helper internal immutable i_ccipLnM ``` > **NOTE** > > The BurnMintERC677Helper instance for CCIP-LnM token ### i_linkToken ```solidity LinkToken internal immutable i_linkToken ``` > **NOTE** > > The LINK token instance ### i_mockRouter ```solidity MockCCIPRouter internal immutable i_mockRouter ``` > **NOTE** > > The mock CCIP router instance ### i_wrappedNative ```solidity WETH9 internal immutable i_wrappedNative ``` > **NOTE** > > The wrapped native token instance ### s_supportedTokens ```solidity address[] internal s_supportedTokens ``` > **NOTE** > > The list of supported token addresses ## Errors ### CCIPLocalSimulator__MsgSenderIsNotTokenOwner ```solidity error CCIPLocalSimulator__MsgSenderIsNotTokenOwner() ``` ### CCIPLocalSimulator__RequiredRoleNotFound ```solidity error CCIPLocalSimulator__RequiredRoleNotFound(address account, bytes32 role, address token) ``` ## Functions ### configuration Returns the configuration details for pre-deployed contracts and services needed for local CCIP simulations. ```solidity function configuration() public view returns (uint64 chainSelector_, IRouterClient sourceRouter_, IRouterClient destinationRouter_, WETH9 wrappedNative_, LinkToken linkToken_, BurnMintERC677Helper ccipBnM_, BurnMintERC677Helper ccipLnM_) ``` > **NOTE** > > Returns configuration details for pre-deployed contracts and services needed for local CCIP simulations. #### Returns | Parameter | Type | Description | | ------------------- | ---------------------- | -------------------------------------------------------- | | chainSelector_ | `uint64` | The unique CCIP Chain Selector | | sourceRouter_ | `IRouterClient` | The source chain Router contract | | destinationRouter_ | `IRouterClient` | The destination chain Router contract | | wrappedNative_ | `WETH9` | The wrapped native token which can be used for CCIP fees | | linkToken_ | `LinkToken` | The LINK token | | ccipBnM_ | `BurnMintERC677Helper` | The ccipBnM token | | ccipLnM_ | `BurnMintERC677Helper` | The ccipLnM token | ### constructor Initializes the contract with pre-deployed token instances. ```solidity constructor() ``` > **NOTE** > > Constructor to initialize the contract and pre-deployed token instances ### getSupportedTokens Gets the list of supported token addresses for a given chain selector. ```solidity function getSupportedTokens(uint64 chainSelector) external view returns (address[] memory tokens) ``` > **NOTE** > > Gets a list of token addresses that are supported for cross-chain transfers by the simulator. #### Parameters | Parameter | Type | Description | | ------------- | -------- | ------------------------------ | | chainSelector | `uint64` | The unique CCIP Chain Selector | #### Returns | Parameter | Type | Description | | --------- | ----------- | ------------------------------------------------------------------------------ | | tokens | `address[]` | Returns a list of token addresses that are supported for cross-chain transfers | ### isChainSupported Checks if a given chain selector is supported. ```solidity function isChainSupported(uint64 chainSelector) public pure returns (bool supported) ``` > **NOTE** > > Checks whether the provided `chainSelector` is supported by the simulator. #### Parameters | Parameter | Type | Description | | ------------- | -------- | ------------------------------ | | chainSelector | `uint64` | The unique CCIP Chain Selector | #### Returns | Parameter | Type | Description | | --------- | ------ | ------------------------------------------------------------- | | supported | `bool` | Returns true if `chainSelector` is supported by the simulator | ### requestLinkFromFaucet Transfers LINK tokens from the faucet to a specified address. ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` > **NOTE** > > Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Parameter | Type | Description | | --------- | --------- | ----------------------------------------------- | | to | `address` | The address to which LINK tokens are to be sent | | amount | `uint256` | The amount of LINK tokens to send | #### Returns | Parameter | Type | Description | | --------- | ------ | ------------------------------------------------------- | | success | `bool` | Returns `true` if the transfer of tokens was successful | ### supportNewTokenViaAccessControlDefaultAdmin Adds a new token to supported tokens list via AccessControl's DEFAULT_ADMIN_ROLE. ```solidity function supportNewTokenViaAccessControlDefaultAdmin(address tokenAddress) external ``` > **NOTE** > > Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. The caller must have > the DEFAULT_ADMIN_ROLE as defined by the contract itself. #### Parameters | Parameter | Type | Description | | ------------ | --------- | --------------------------------------------------------------- | | tokenAddress | `address` | The address of the token to add to the list of supported tokens | > **CAUTION** > > **Possible Reverts** > > - Reverts if the caller is not the admin of the token using OZ's AccessControl DEFAULT_ADMIN_ROLE ### supportNewTokenViaGetCCIPAdmin Adds a new token to supported tokens list via CCIP admin role. ```solidity function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external ``` > **NOTE** > > Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. #### Parameters | Parameter | Type | Description | | ------------ | --------- | --------------------------------------------------------------- | | tokenAddress | `address` | The address of the token to add to the list of supported tokens | > **CAUTION** > > **Possible Reverts** > > - Reverts if token does not implement getCCIPAdmin() function > - Reverts if the caller is not the token CCIPAdmin ### supportNewTokenViaOwner Adds a new token to supported tokens list via token owner. ```solidity function supportNewTokenViaOwner(address tokenAddress) external ``` > **NOTE** > > Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. #### Parameters | Parameter | Type | Description | | ------------ | --------- | --------------------------------------------------------------- | | tokenAddress | `address` | The address of the token to add to the list of supported tokens | > **CAUTION** > > **Possible Reverts** > > - Reverts if token does not implement owner() function > - Reverts if the caller is not the token owner --- # Chainlink Local v0.2.3 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.3 > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.3 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.3 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.3/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIP These contracts provide Cross-Chain Interoperability Protocol (CCIP) functionality in a local testing environment: - [CCIPLocalSimulator](/chainlink-local/api-reference/v0.2.3/ccip-local-simulator) - Local CCIP message routing simulator - [CCIPLocalSimulatorFork](/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork) - CCIP simulator for forked networks - [CCIPLocalSimulatorFork JS](/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork-js) - JavaScript utilities for CCIP simulation - [Register](/chainlink-local/api-reference/v0.2.3/register) - CCIP network configuration registry ## Data Feeds Contracts for simulating Chainlink Data Feeds: - [AggregatorInterface](/chainlink-local/api-reference/v0.2.3/aggregator-interface) - Basic price feed interface - [AggregatorV2V3Interface](/chainlink-local/api-reference/v0.2.3/aggregator-v2-v3-interface) - Combined V2/V3 price feed interface - [AggregatorV3Interface](/chainlink-local/api-reference/v0.2.3/aggregator-v3-interface) - Extended price feed interface - [MockOffchainAggregator](/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator) - Mock implementation of off-chain aggregator - [MockV3Aggregator](/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator) - Mock implementation of V3 aggregator ## Token Contracts Standard token implementations for testing: - [BurnMintERC677Helper](/chainlink-local/api-reference/v0.2.3/burn-mint-erc677-helper) - Helper contract for ERC677 token operations - [LinkToken](/chainlink-local/api-reference/v0.2.3/link-token) - LINK token implementation - [WETH9](/chainlink-local/api-reference/v0.2.3/weth9) - Wrapped Ether implementation --- # LinkToken v0.2.3 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.3/link-token > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.3 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.3 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.3/src/ccip/CCIPLocalSimulator.sol"; > ``` ## LinkToken A contract that implements the ChainLink Token (LINK) using the ERC677 standard. [`LinkToken`](https://github.com/smartcontractkit/chainlink-local/blob/7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab/src/shared/LinkToken.sol) > **NOTE** > > This contract inherits from ERC677 token contract and initializes with a fixed total supply and standard token > details. ## Functions ### constructor Initializes the contract with fixed token details. ```solidity constructor() ``` > **NOTE** > > Constructor to initialize the LinkToken contract with a fixed total supply, name, and symbol. Calls the ERC677 > constructor with the name "ChainLink Token" and symbol "LINK", then mints the total supply (10^27 tokens) to the > contract deployer. ### _onCreate Internal hook called during contract creation. ```solidity function _onCreate() internal virtual ``` > **NOTE** > > Hook that is called when this contract is created. Useful to override constructor behaviour in child contracts (e.g., > LINK bridge tokens). The default implementation mints 10^27 tokens to the contract deployer. --- # MockOffchainAggregator v0.2.3 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.3 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.3 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.3/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockOffchainAggregator A mock implementation of an offchain aggregator for testing purposes. [`MockOffchainAggregator`](https://github.com/smartcontractkit/chainlink-local/blob/7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab/src/data-feeds/MockOffchainAggregator.sol) > **NOTE** > > Simulates the behavior of an offchain aggregator and allows for updating answers and round data. ## Variables ### decimals ```solidity uint8 public decimals ``` > **NOTE** > > The number of decimals used by the aggregator. ### getAnswer ```solidity mapping(uint256 => int256) public getAnswer ``` > **NOTE** > > Mapping to get the answer for a specific round ID. ### getTimestamp ```solidity mapping(uint256 => uint256) public getTimestamp ``` > **NOTE** > > Mapping to get the timestamp for a specific round ID. ### latestAnswer ```solidity int256 public latestAnswer ``` > **NOTE** > > The latest answer reported by the aggregator. ### latestRound ```solidity uint256 public latestRound ``` > **NOTE** > > The latest round ID. ### latestTimestamp ```solidity uint256 public latestTimestamp ``` > **NOTE** > > The timestamp of the latest answer. ### maxAnswer ```solidity int192 public maxAnswer ``` > **NOTE** > > The maximum answer the aggregator is allowed to report. ### minAnswer ```solidity int192 public minAnswer ``` > **NOTE** > > The minimum answer the aggregator is allowed to report. ## Functions ### constructor Initializes the contract with decimals and initial answer. ```solidity constructor(uint8 _decimals, int256 _initialAnswer) ``` > **NOTE** > > Constructor to initialize the MockOffchainAggregator contract with initial parameters. #### Parameters | Parameter | Type | Description | | --------------- | -------- | ----------------------------------------- | | _decimals | `uint8` | The number of decimals for the aggregator | | _initialAnswer | `int256` | The initial answer to be set | ### getRoundData Gets the round data for a specific round ID. ```solidity function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` > **NOTE** > > Gets the round data for a specific round ID. #### Parameters | Parameter | Type | Description | | --------- | -------- | -------------------------------- | | _roundId | `uint80` | The round ID to get the data for | #### Returns | Parameter | Type | Description | | --------------- | --------- | --------------------------------------------- | | roundId | `uint80` | The round ID | | answer | `int256` | The answer for the round | | startedAt | `uint256` | The timestamp when the round started | | updatedAt | `uint256` | The timestamp when the round was updated | | answeredInRound | `uint80` | The round ID in which the answer was computed | ### latestRoundData Gets the latest round data. ```solidity function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` > **NOTE** > > Gets the latest round data. #### Returns | Parameter | Type | Description | | --------------- | --------- | ---------------------------------------------------- | | roundId | `uint80` | The latest round ID | | answer | `int256` | The latest answer | | startedAt | `uint256` | The timestamp when the latest round started | | updatedAt | `uint256` | The timestamp when the latest round was updated | | answeredInRound | `uint80` | The round ID in which the latest answer was computed | ### updateAnswer Updates the answer in the mock aggregator. ```solidity function updateAnswer(int256 _answer) public ``` > **NOTE** > > Updates the answer in the mock aggregator. #### Parameters | Parameter | Type | Description | | --------- | -------- | ------------------------ | | _answer | `int256` | The new answer to be set | ### updateMinAndMaxAnswers Updates the minimum and maximum answers the aggregator can report. ```solidity function updateMinAndMaxAnswers(int192 _minAnswer, int192 _maxAnswer) external ``` > **NOTE** > > Updates the minimum and maximum answers the aggregator can report. #### Parameters | Parameter | Type | Description | | ----------- | -------- | ---------------------- | | _minAnswer | `int192` | The new minimum answer | | _maxAnswer | `int192` | The new maximum answer | #### Possible Reverts - Reverts if minAnswer is not less than maxAnswer with "minAnswer must be less than maxAnswer" - Reverts if minAnswer is too low with "minAnswer is too low" - Reverts if maxAnswer is too high with "maxAnswer is too high" ### updateRoundData Updates the round data in the mock aggregator. ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` > **NOTE** > > Updates the round data in the mock aggregator. #### Parameters | Parameter | Type | Description | | ----------- | --------- | ------------------------------------ | | _roundId | `uint80` | The round ID to be updated | | _answer | `int256` | The new answer to be set | | _timestamp | `uint256` | The timestamp to be set | | _startedAt | `uint256` | The timestamp when the round started | --- # MockV3Aggregator v0.2.3 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.3 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.3 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.3/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockV3Aggregator A mock implementation of the AggregatorV2V3Interface for testing purposes. [`MockV3Aggregator`](https://github.com/smartcontractkit/chainlink-local/blob/7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab/src/data-feeds/MockV3Aggregator.sol) > **NOTE** > > This contract inherits from AggregatorV2V3Interface and interacts with a MockOffchainAggregator to simulate price > feeds. ## Variables ### aggregator ```solidity address public aggregator ``` > **NOTE** > > The address of the current aggregator. ### proposedAggregator ```solidity address public proposedAggregator ``` > **NOTE** > > The address of the proposed aggregator. ### version ```solidity uint256 public constant override version = 0 ``` > **NOTE** > > The version of the aggregator. ## Functions ### confirmAggregator Confirms the proposed aggregator. ```solidity function confirmAggregator(address _aggregator) external ``` > **NOTE** > > Confirms the proposed aggregator. #### Parameters | Parameter | Type | Description | | ------------ | --------- | -------------------------------------- | | _aggregator | `address` | The address of the proposed aggregator | #### Possible Reverts - Reverts if the provided aggregator address does not match the proposed aggregator with "Invalid proposed aggregator" ### constructor Initializes the contract with decimals and initial answer. ```solidity constructor(uint8 _decimals, int256 _initialAnswer) ``` > **NOTE** > > Constructor to initialize the MockV3Aggregator contract with initial parameters. #### Parameters | Parameter | Type | Description | | --------------- | -------- | ----------------------------------------- | | _decimals | `uint8` | The number of decimals for the aggregator | | _initialAnswer | `int256` | The initial answer to be set | ### decimals Gets the number of decimals used by the aggregator. ```solidity function decimals() external view returns (uint8) ``` > **NOTE** > > Gets the number of decimals from the underlying aggregator. #### Returns | Parameter | Type | Description | | --------- | ------- | ---------------------- | | (unnamed) | `uint8` | The number of decimals | ### description Gets the description of the aggregator. ```solidity function description() external pure returns (string memory) ``` > **NOTE** > > Gets the description of the aggregator. #### Returns | Parameter | Type | Description | | --------- | -------- | ------------------------------------ | | (unnamed) | `string` | The contract path as the description | ### getAnswer Gets the answer for a specific round ID. ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` > **NOTE** > > Gets the answer for a specific round ID from the underlying aggregator. #### Parameters | Parameter | Type | Description | | --------- | --------- | ------------------------------ | | roundId | `uint256` | The round ID to get answer for | #### Returns | Parameter | Type | Description | | --------- | -------- | --------------------------------- | | (unnamed) | `int256` | The answer for the given round ID | ### getRoundData Gets the round data for a specific round ID. ```solidity function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` > **NOTE** > > Gets the round data for a specific round ID from the underlying aggregator. #### Parameters | Parameter | Type | Description | | --------- | -------- | -------------------------------- | | _roundId | `uint80` | The round ID to get the data for | #### Returns | Parameter | Type | Description | | --------------- | --------- | --------------------------------------------- | | roundId | `uint80` | The round ID | | answer | `int256` | The answer for the round | | startedAt | `uint256` | The timestamp when the round started | | updatedAt | `uint256` | The timestamp when the round was updated | | answeredInRound | `uint80` | The round ID in which the answer was computed | ### getTimestamp Gets the timestamp for a specific round ID. ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` > **NOTE** > > Gets the timestamp for a specific round ID from the underlying aggregator. #### Parameters | Parameter | Type | Description | | --------- | --------- | --------------------------------- | | roundId | `uint256` | The round ID to get timestamp for | #### Returns | Parameter | Type | Description | | --------- | --------- | ------------------------------------ | | (unnamed) | `uint256` | The timestamp for the given round ID | ### latestAnswer Gets the latest answer from the aggregator. ```solidity function latestAnswer() external view returns (int256) ``` > **NOTE** > > Gets the latest answer from the underlying aggregator. #### Returns | Parameter | Type | Description | | --------- | -------- | ----------------- | | (unnamed) | `int256` | The latest answer | ### latestRound Gets the latest round ID from the aggregator. ```solidity function latestRound() external view returns (uint256) ``` > **NOTE** > > Gets the latest round ID from the underlying aggregator. #### Returns | Parameter | Type | Description | | --------- | --------- | ------------------- | | (unnamed) | `uint256` | The latest round ID | ### latestRoundData Gets the latest round data. ```solidity function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` > **NOTE** > > Gets the latest round data from the underlying aggregator. #### Returns | Parameter | Type | Description | | --------------- | --------- | ---------------------------------------------------- | | roundId | `uint80` | The latest round ID | | answer | `int256` | The latest answer | | startedAt | `uint256` | The timestamp when the latest round started | | updatedAt | `uint256` | The timestamp when the latest round was updated | | answeredInRound | `uint80` | The round ID in which the latest answer was computed | ### latestTimestamp Gets the timestamp of the latest answer. ```solidity function latestTimestamp() external view returns (uint256) ``` > **NOTE** > > Gets the timestamp of the latest answer from the underlying aggregator. #### Returns | Parameter | Type | Description | | --------- | --------- | ---------------------------------- | | (unnamed) | `uint256` | The timestamp of the latest answer | ### proposeAggregator Proposes a new aggregator. ```solidity function proposeAggregator(AggregatorV2V3Interface _aggregator) external ``` > **NOTE** > > Proposes a new aggregator. #### Parameters | Parameter | Type | Description | | ------------ | ------------------------- | -------------------------------------- | | _aggregator | `AggregatorV2V3Interface` | The address of the proposed aggregator | #### Possible Reverts - Reverts if the proposed aggregator is the zero address with "Proposed aggregator cannot be zero address" - Reverts if the proposed aggregator is the current aggregator with "Proposed aggregator cannot be current aggregator" ### updateAnswer Updates the answer in the mock aggregator. ```solidity function updateAnswer(int256 _answer) public ``` > **NOTE** > > Updates the answer in the underlying mock aggregator. #### Parameters | Parameter | Type | Description | | --------- | -------- | ------------------------ | | _answer | `int256` | The new answer to be set | ### updateRoundData Updates the round data in the mock aggregator. ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` > **NOTE** > > Updates the round data in the underlying mock aggregator. #### Parameters | Parameter | Type | Description | | ----------- | --------- | ------------------------------------ | | _roundId | `uint80` | The round ID to be updated | | _answer | `int256` | The new answer to be set | | _timestamp | `uint256` | The timestamp to be set | | _startedAt | `uint256` | The timestamp when the round started | --- # Register v0.2.3 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.3/register > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.3 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.3 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.3/src/ccip/CCIPLocalSimulator.sol"; > ``` ## Register A contract that stores and manages network configuration details for various blockchain networks supported by CCIP (Cross-Chain Interoperability Protocol). [`Register`](https://github.com/smartcontractkit/chainlink-local/blob/7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab/src/ccip/Register.sol) > **NOTE** > > This contract maintains a registry of network-specific details including chain selectors, router addresses, and token > addresses for various supported networks. ## Structs ### NetworkDetails Contains configuration details for a specific network/chain. | Field | Type | Description | | -------------------------------- | --------- | -------------------------------------------- | | chainSelector | `uint64` | Unique identifier for the chain in CCIP | | routerAddress | `address` | Address of the CCIP Router contract | | linkAddress | `address` | Address of the LINK token contract | | wrappedNativeAddress | `address` | Address of the wrapped native token contract | | ccipBnMAddress | `address` | Address of the CCIP BnM token contract | | ccipLnMAddress | `address` | Address of the CCIP LnM token contract | | rmnProxyAddress | `address` | Address of the RMN proxy contract | | registryModuleOwnerCustomAddress | `address` | Address of the registry module owner | | tokenAdminRegistryAddress | `address` | Address of the token admin registry contract | ## Variables ### s_networkDetails ```solidity mapping(uint256 chainId => NetworkDetails) internal s_networkDetails ``` > **NOTE** > > Internal mapping that stores network details for each supported chain ID. ## Functions ### constructor Initializes the contract with predefined network details for various supported chains. ```solidity constructor() ``` > **NOTE** > > Initializes the contract by setting up network details for multiple chains including: > > - Polygon Amoy (80002) > - Arbitrum Sepolia (421614) > - Base Sepolia (84532) > - Blast Sepolia (168587773) > - BNB Chain Testnet (97) > - Celo Testnet Alfajores (44787) > - Avalanche Fuji (43113) > - Gnosis Chiado (10200) > - Kroma Sepolia (2358) > - Metis Sepolia (59902) > - Mode Sepolia (919) > - OP Sepolia (11155420) > - Ethereum Sepolia (11155111) > - WEMIX Testnet (1112) > - zkSync Sepolia (300) ### getNetworkDetails Retrieves the network details for a specified chain ID. ```solidity function getNetworkDetails(uint256 chainId) external view returns (NetworkDetails memory networkDetails) ``` > **NOTE** > > Returns the complete network configuration for the specified chain ID. #### Parameters | Parameter | Type | Description | | --------- | --------- | -------------------------------------- | | chainId | `uint256` | The ID of the chain to get details for | #### Returns | Type | Description | | ---------------- | ----------------------------------------------- | | `NetworkDetails` | The network configuration details for the chain | ### setNetworkDetails Sets or updates the network details for a specified chain ID. ```solidity function setNetworkDetails(uint256 chainId, NetworkDetails memory networkDetails) external ``` > **NOTE** > > Updates or adds new network configuration details for the specified chain ID. #### Parameters | Parameter | Type | Description | | -------------- | ---------------- | ---------------------------------------------- | | chainId | `uint256` | The ID of the chain to set details for | | networkDetails | `NetworkDetails` | The network configuration details to be stored | --- # WETH9 v0.2.3 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9 > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.3 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.3 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.3/src/ccip/CCIPLocalSimulator.sol"; > ``` ## WETH9 A contract that implements Wrapped Ether (WETH), allowing users to wrap and unwrap ETH. [`WETH9`](https://github.com/smartcontractkit/chainlink-local/blob/7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab/src/shared/WETH9.sol) > **NOTE** > > This contract provides functionality to wrap ETH into WETH and unwrap WETH back to ETH, along with standard ERC20 > operations. ## Variables ### allowance ```solidity mapping(address => mapping(address => uint256)) public allowance ``` > **NOTE** > > Mapping of owner addresses to spender addresses to approved amounts. ### balanceOf ```solidity mapping(address => uint256) public balanceOf ``` > **NOTE** > > Mapping of addresses to their WETH balances. ### decimals ```solidity uint8 public decimals = 18 ``` > **NOTE** > > The number of decimals used for WETH token amounts. ### name ```solidity string public name = "Wrapped Ether" ``` > **NOTE** > > The name of the token. ### symbol ```solidity string public symbol = "WETH" ``` > **NOTE** > > The symbol of the token. ## Events ### Approval ```solidity event Approval(address indexed src, address indexed guy, uint256 wad) ``` > **NOTE** > > Emitted when an approval is set. #### Parameters | Parameter | Type | Description | | --------- | --------- | ----------------------------------- | | src | `address` | The address giving the approval | | guy | `address` | The address receiving the approval | | wad | `uint256` | The amount of tokens being approved | ### Deposit ```solidity event Deposit(address indexed dst, uint256 wad) ``` > **NOTE** > > Emitted when ETH is wrapped to WETH. #### Parameters | Parameter | Type | Description | | --------- | --------- | ------------------------------- | | dst | `address` | The address receiving the WETH | | wad | `uint256` | The amount of ETH being wrapped | ### Transfer ```solidity event Transfer(address indexed src, address indexed dst, uint256 wad) ``` > **NOTE** > > Emitted when tokens are transferred. #### Parameters | Parameter | Type | Description | | --------- | --------- | -------------------------------------- | | src | `address` | The address sending the tokens | | dst | `address` | The address receiving the tokens | | wad | `uint256` | The amount of tokens being transferred | ### Withdrawal ```solidity event Withdrawal(address indexed src, uint256 wad) ``` > **NOTE** > > Emitted when WETH is unwrapped to ETH. #### Parameters | Parameter | Type | Description | | --------- | --------- | ---------------------------------- | | src | `address` | The address unwrapping the WETH | | wad | `uint256` | The amount of WETH being unwrapped | ## Functions ### approve Approves another address to spend tokens. ```solidity function approve(address guy, uint256 wad) public returns (bool) ``` > **NOTE** > > Sets the allowance that a spender has to access the caller's tokens. #### Parameters | Parameter | Type | Description | | --------- | --------- | ------------------------------- | | guy | `address` | The address to approve | | wad | `uint256` | The amount of tokens to approve | #### Returns | Parameter | Type | Description | | --------- | ------ | ------------------- | | (unnamed) | `bool` | Always returns true | ### deposit Deposits ETH to receive WETH. ```solidity function deposit() external payable ``` > **NOTE** > > Allows users to deposit ETH and receive WETH tokens. ### totalSupply Gets the total supply of WETH. ```solidity function totalSupply() public view returns (uint256) ``` > **NOTE** > > Returns the total amount of ETH held by this contract. #### Returns | Parameter | Type | Description | | --------- | --------- | ------------------------ | | (unnamed) | `uint256` | The total supply of WETH | ### transfer Transfers tokens to another address. ```solidity function transfer(address dst, uint256 wad) public returns (bool) ``` > **NOTE** > > Transfers tokens from the caller to another address. #### Parameters | Parameter | Type | Description | | --------- | --------- | -------------------------------- | | dst | `address` | The recipient address | | wad | `uint256` | The amount of tokens to transfer | #### Returns | Parameter | Type | Description | | --------- | ------ | ------------------------------------- | | (unnamed) | `bool` | Returns true if the transfer succeeds | ### transferFrom Transfers tokens from one address to another. ```solidity function transferFrom(address src, address dst, uint256 wad) public returns (bool) ``` > **NOTE** > > Transfers tokens between addresses, respecting allowances. #### Parameters | Parameter | Type | Description | | --------- | --------- | -------------------------------- | | src | `address` | The source address | | dst | `address` | The destination address | | wad | `uint256` | The amount of tokens to transfer | #### Returns | Parameter | Type | Description | | --------- | ------ | ------------------------------------- | | (unnamed) | `bool` | Returns true if the transfer succeeds | #### Possible Reverts - Reverts if the source address has insufficient balance - Reverts if the caller has insufficient allowance (unless caller is source or has maximum allowance) ### withdraw Withdraws ETH by unwrapping WETH. ```solidity function withdraw(uint256 wad) external ``` > **NOTE** > > Allows users to withdraw ETH by burning WETH tokens. #### Parameters | Parameter | Type | Description | | --------- | --------- | ---------------------------- | | wad | `uint256` | The amount of WETH to unwrap | #### Possible Reverts - Reverts if the caller has insufficient WETH balance --- # AggregatorInterface v0.2.4 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.4/aggregator-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.4 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.4 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.4 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.4/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorInterface Basic price feed interface. [AggregatorInterface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-feeds/interfaces/AggregatorInterface.sol) ## Events ### AnswerUpdated ```solidity event AnswerUpdated(int256 current, uint256 roundId, uint256 updatedAt) ``` Emitted when the answer is updated. #### Parameters | Name | Type | Description | | --------- | ------- | ------------------------------------------------ | | current | int256 | - The updated answer. | | roundId | uint256 | - The round ID for which the answer was updated. | | updatedAt | uint256 | - The timestamp when the answer was updated. | ### NewRound ```solidity event NewRound(uint256 roundId, address startedBy, uint256 startedAt) ``` Emitted when a new round is started. #### Parameters | Name | Type | Description | | --------- | ------- | ---------------------------------------------------- | | roundId | uint256 | - The round ID of the new round. | | startedBy | address | - The address of the account that started the round. | | startedAt | uint256 | - The timestamp when the round was started. | ## Functions ### getAnswer ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` Gets the answer for a specific round ID. #### Parameters | Name | Type | Description | | ------- | ------- | ------------------------------------- | | roundId | uint256 | - The round ID to get the answer for. | #### Returns | Name | Type | Description | | ---- | ------ | ------------------------------------------- | | [0] | int256 | int256 - The answer for the given round ID. | ### getTimestamp ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` Gets the timestamp for a specific round ID. #### Parameters | Name | Type | Description | | ------- | ------- | ---------------------------------------- | | roundId | uint256 | - The round ID to get the timestamp for. | #### Returns | Name | Type | Description | | ---- | ------- | ----------------------------------------------- | | [0] | uint256 | uint256 - The timestamp for the given round ID. | ### latestAnswer ```solidity function latestAnswer() external view returns (int256) ``` Gets the latest answer from the aggregator. #### Returns | Name | Type | Description | | ---- | ------ | --------------------------- | | [0] | int256 | int256 - The latest answer. | ### latestRound ```solidity function latestRound() external view returns (uint256) ``` Gets the latest round ID from the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | ------------------------------ | | [0] | uint256 | uint256 - The latest round ID. | ### latestTimestamp ```solidity function latestTimestamp() external view returns (uint256) ``` Gets the timestamp of the latest answer from the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | --------------------------------------------- | | [0] | uint256 | uint256 - The timestamp of the latest answer. | --- # AggregatorV2V3Interface v0.2.4 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.4/aggregator-v2-v3-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.4 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.4 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.4 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.4/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorV2V3Interface Combined V2/V3 price feed interface. [AggregatorV2V3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-feeds/interfaces/AggregatorV2V3Interface.sol) --- # AggregatorV3Interface v0.2.4 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.4/aggregator-v3-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.4 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.4 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.4 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.4/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorV3Interface Extended price feed interface. [AggregatorV3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-feeds/interfaces/AggregatorV3Interface.sol) ## Functions ### decimals ```solidity function decimals() external view returns (uint8) ``` Gets the number of decimals used by the aggregator. #### Returns | Name | Type | Description | | ---- | ----- | ------------------------------- | | [0] | uint8 | uint8 - The number of decimals. | ### description ```solidity function description() external view returns (string) ``` Gets the description of the aggregator. #### Returns | Name | Type | Description | | ---- | ------ | -------------------------------------------------- | | [0] | string | string memory - The description of the aggregator. | ### getRoundData ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the round data for a specific round ID. *This function should raise "No data present" if no data is available for the given round ID.* #### Parameters | Name | Type | Description | | --------- | ------ | ----------------------------------- | | _roundId | uint80 | - The round ID to get the data for. | #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------ | | roundId | uint80 | - The round ID. | | answer | int256 | - The answer for the round. | | startedAt | uint256 | - The timestamp when the round started. | | updatedAt | uint256 | - The timestamp when the round was updated. | | answeredInRound | uint80 | - The round ID in which the answer was computed. | ### latestRoundData ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the latest round data. *This function should raise "No data present" if no data is available.* #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------------- | | roundId | uint80 | - The latest round ID. | | answer | int256 | - The latest answer. | | startedAt | uint256 | - The timestamp when the latest round started. | | updatedAt | uint256 | - The timestamp when the latest round was updated. | | answeredInRound | uint80 | - The round ID in which the latest answer was computed. | ### version ```solidity function version() external view returns (uint256) ``` Gets the version of the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | ---------------------------------------- | | [0] | uint256 | uint256 - The version of the aggregator. | --- # BurnMintERC677Helper v0.2.4 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.4/burn-mint-erc677-helper > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.4 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.4 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.4 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.4/src/ccip/CCIPLocalSimulator.sol"; > ``` ## BurnMintERC677Helper Helper contract for ERC677 token operations. [BurnMintERC677Helper](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/ccip/BurnMintERC677Helper.sol) ## Functions ### constructor ```solidity constructor(string name, string symbol) public ``` Constructor to initialize the BurnMintERC677Helper contract with a name and symbol. *Calls the parent constructor of BurnMintERC677 with fixed decimals (18) and initial supply (0).* #### Parameters | Name | Type | Description | | ------ | ------ | -------------------------- | | name | string | - The name of the token. | | symbol | string | - The symbol of the token. | ### drip ```solidity function drip(address to) external ``` Mints one full token (1e18) to the specified address. *Calls the internal `_mint` function from the BurnMintERC677 contract.* #### Parameters | Name | Type | Description | | ---- | ------- | ------------------------------------------ | | to | address | - The address to receive the minted token. | --- # CCIPLocalSimulatorFork JS v0.2.4 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.4/ccip-local-simulator-fork-js > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.4 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.4 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.4 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.4/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulatorFork JS Hardhat 2 JavaScript helpers for fork routing. [CCIPLocalSimulatorFork JS](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/scripts/CCIPLocalSimulatorFork.js) ## Types ### Evm2EvmMessage : `Object` **Properties** | Name | Type | | ------------------- | ------------------------------------------ | | sourceChainSelector | `bigint` | | sender | `string` | | receiver | `string` | | sequenceNumber | `bigint` | | gasLimit | `bigint` | | strict | `boolean` | | nonce | `bigint` | | feeToken | `string` | | feeTokenAmount | `bigint` | | data | `string` | | tokenAmounts | `Array.<\{token: string, amount: bigint}>` | | sourceTokenData | `Array.` | | messageId | `string` | ## Functions ### requestLinkFromTheFaucet(linkAddress, to, amount) ⇒ `Promise.` Requests LINK tokens from the faucet and returns the transaction hash **Returns**: `Promise.` - Promise resolving to the transaction hash of the fund transfer | Param | Type | Description | | ----------- | -------- | ------------------------------------------------------- | | linkAddress | `string` | The address of the LINK contract on the current network | | to | `string` | The address to send LINK to | | amount | `bigint` | The amount of LINK to request | ### getEvm2EvmMessage(receipt) ⇒ `Evm2EvmMessage` | `null` Parses a transaction receipt to extract the sent message Scans through transaction logs to find a `CCIPSendRequested` event and then decodes it to an object **Returns**: `Evm2EvmMessage` | `null` - Returns either the sent message or null if provided receipt does not contain `CCIPSendRequested` log | Param | Type | Description | | ------- | -------- | ------------------------------------------------ | | receipt | `object` | The transaction receipt from the `ccipSend` call | ### routeMessage(routerAddress, evm2EvmMessage) ⇒ `Promise.` Routes the sent message from the source network on the destination (current) network **Returns**: `Promise.` - Either resolves with no value if the message is successfully routed, or reverts\ **Throws**: - `Error` Fails if no off-ramp matches the message's source chain selector or if calling `router.getOffRamps()` | Param | Type | Description | | -------------- | ---------------- | --------------------------------- | | routerAddress | `string` | Address of the destination Router | | evm2EvmMessage | `Evm2EvmMessage` | Sent cross-chain message | --- # CCIPLocalSimulatorFork v0.2.4 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.4/ccip-local-simulator-fork > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.4 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.4 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.4 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.4/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulatorFork CCIP simulator for forked networks. [CCIPLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/ccip/CCIPLocalSimulatorFork.sol) ## Structs ### OffRamp Structure representing an offRamp configuration #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | ```solidity struct OffRamp { uint64 sourceChainSelector; address offRamp; } ``` ## Variables ### i_register ```solidity contract Register i_register ``` The immutable register instance ### LINK_FAUCET ```solidity address LINK_FAUCET ``` The address of the LINK faucet ### s_processedMessages ```solidity mapping(bytes32 => bool) s_processedMessages ``` Mapping to track processed messages ## Events ### CCIPSendRequested ```solidity event CCIPSendRequested(struct Internal.EVM2EVMMessage message) ``` Event emitted when a CCIP send request is made #### Parameters | Name | Type | Description | | ------- | ------------------------------ | ----------------------------------- | | message | struct Internal.EVM2EVMMessage | - The EVM2EVM message that was sent | ## Functions ### constructor ```solidity constructor() public ``` Constructor to initialize the contract ### executeSingleMessage ```solidity function executeSingleMessage(struct Internal.EVM2EVMMessage message, bytes[] offchainTokenData, uint32[] tokenGasOverrides) external ``` Executes a single CCIP message on the offRamp #### Parameters | Name | Type | Description | | ----------------- | ------------------------------ | --------------------------------- | | message | struct Internal.EVM2EVMMessage | - The CCIP message to be executed | | offchainTokenData | bytes[] | - Additional offchain token data | | tokenGasOverrides | uint32[] | | Works with Foundry only ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) ``` Returns the default values for currently CCIP supported networks. If network is not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Name | Type | Description | | ------- | ------- | ------------------------------------------------------------------------------------------------------ | | chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | #### Returns | Name | Type | Description | | ---- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | ### getOffRamps ```solidity function getOffRamps() external view returns (struct IRouterFork.OffRamp[]) ``` Gets the list of offRamps #### Returns | Name | Type | Description | | ---- | ----------------------------- | ----------------------------------- | | [0] | struct IRouterFork.OffRamp[] | offRamps - Array of OffRamp structs | ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------- | | to | address | - The address to which LINK tokens are to be sent. | | amount | uint256 | - The amount of LINK tokens to send. | #### Returns | Name | Type | Description | | ------- | ---- | ----------------------------------------------------------------------------- | | success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external ``` If network details are not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Name | Type | Description | | -------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | | networkDetails | struct Register.NetworkDetails | - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | ### switchChainAndRouteMessage ```solidity function switchChainAndRouteMessage(uint256 forkId) external ``` To be called after the sending of the cross-chain message (`ccipSend`). Goes through the list of past logs and looks for the `CCIPSendRequested` event. Switches to a destination network fork. Routes the sent cross-chain message on the destination network. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------------------------------------------------------------------- | | forkId | uint256 | - The ID of the destination network fork. This is the returned value of `createFork()` or `createSelectFork()` | --- # CCIPLocalSimulator v0.2.4 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.4/ccip-local-simulator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.4 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.4 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.4 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.4/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulator Local CCIP simulator (no-fork mode). [CCIPLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/ccip/CCIPLocalSimulator.sol) ## Variables ### CHAIN_SELECTOR ```solidity uint64 CHAIN_SELECTOR ``` The unique CCIP Chain Selector constant ### i_ccipBnM ```solidity contract BurnMintERC677Helper i_ccipBnM ``` The BurnMintERC677Helper instance for CCIP-BnM token ### i_ccipLnM ```solidity contract BurnMintERC677Helper i_ccipLnM ``` The BurnMintERC677Helper instance for CCIP-LnM token ### i_linkToken ```solidity contract LinkToken i_linkToken ``` The LINK token instance ### i_mockRouter ```solidity contract MockCCIPRouter i_mockRouter ``` The mock CCIP router instance ### i_wrappedNative ```solidity contract WETH9 i_wrappedNative ``` The wrapped native token instance ### s_supportedTokens ```solidity address[] s_supportedTokens ``` The list of supported token addresses ## Errors ### CCIPLocalSimulator__MsgSenderIsNotTokenOwner ```solidity error CCIPLocalSimulator__MsgSenderIsNotTokenOwner() ``` ### CCIPLocalSimulator__RequiredRoleNotFound ```solidity error CCIPLocalSimulator__RequiredRoleNotFound(address account, bytes32 role, address token) ``` ## Functions ### configuration ```solidity function configuration() public view returns (uint64 chainSelector_, contract IRouterClient sourceRouter_, contract IRouterClient destinationRouter_, contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract BurnMintERC677Helper ccipBnM_, contract BurnMintERC677Helper ccipLnM_) ``` Returns configuration details for pre-deployed contracts and services needed for local CCIP simulations. #### Returns | Name | Type | Description | | ------------------- | ----------------------------- | ----------------------------------------------------------- | | chainSelector_ | uint64 | - The unique CCIP Chain Selector. | | sourceRouter_ | contract IRouterClient | - The source chain Router contract. | | destinationRouter_ | contract IRouterClient | - The destination chain Router contract. | | wrappedNative_ | contract WETH9 | - The wrapped native token which can be used for CCIP fees. | | linkToken_ | contract LinkToken | - The LINK token. | | ccipBnM_ | contract BurnMintERC677Helper | - The ccipBnM token. | | ccipLnM_ | contract BurnMintERC677Helper | - The ccipLnM token. | ### constructor ```solidity constructor() public ``` Constructor to initialize the contract and pre-deployed token instances ### getSupportedTokens ```solidity function getSupportedTokens(uint64 chainSelector) external view returns (address[] tokens) ``` Gets a list of token addresses that are supported for cross-chain transfers by the simulator. #### Parameters | Name | Type | Description | | ------------- | ------ | --------------------------------- | | chainSelector | uint64 | - The unique CCIP Chain Selector. | #### Returns | Name | Type | Description | | ------ | ---------- | -------------------------------------------------------------------------------------------------- | | tokens | address[] | - Returns a list of token addresses that are supported for cross-chain transfers by the simulator. | ### isChainSupported ```solidity function isChainSupported(uint64 chainSelector) public pure returns (bool supported) ``` Checks whether the provided `chainSelector` is supported by the simulator. #### Parameters | Name | Type | Description | | ------------- | ------ | --------------------------------- | | chainSelector | uint64 | - The unique CCIP Chain Selector. | #### Returns | Name | Type | Description | | --------- | ---- | ---------------------------------------------------------------- | | supported | bool | - Returns true if `chainSelector` is supported by the simulator. | ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------- | | to | address | - The address to which LINK tokens are to be sent. | | amount | uint256 | - The amount of LINK tokens to send. | #### Returns | Name | Type | Description | | ------- | ---- | ----------------------------------------------------------------------------- | | success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | ### supportNewTokenViaAccessControlDefaultAdmin ```solidity function supportNewTokenViaAccessControlDefaultAdmin(address tokenAddress) external ``` Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. The caller must have the DEFAULT_ADMIN_ROLE as defined by the contract itself. Reverts if the caller is not the admin of the token using OZ's AccessControl DEFAULT_ADMIN_ROLE. #### Parameters | Name | Type | Description | | ------------ | ------- | ------------------------------------------------------------------ | | tokenAddress | address | - The address of the token to add to the list of supported tokens. | ### supportNewTokenViaGetCCIPAdmin ```solidity function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external ``` Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. Reverts if token does not implement getCCIPAdmin() function. Reverts if the caller is not the token CCIPAdmin. #### Parameters | Name | Type | Description | | ------------ | ------- | ------------------------------------------------------------------ | | tokenAddress | address | - The address of the token to add to the list of supported tokens. | ### supportNewTokenViaOwner ```solidity function supportNewTokenViaOwner(address tokenAddress) external ``` Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. Reverts if token does not implement owner() function. Reverts if the caller is not the token owner. #### Parameters | Name | Type | Description | | ------------ | ------- | ------------------------------------------------------------------ | | tokenAddress | address | - The address of the token to add to the list of supported tokens. | --- # DataStreamsLocalSimulatorFork v0.2.4 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.4/data-streams-local-simulator-fork > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.4 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.4 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.4 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.4/src/ccip/CCIPLocalSimulator.sol"; > ``` ## DataStreamsLocalSimulatorFork Data Streams simulator for forked networks. [DataStreamsLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-streams/DataStreamsLocalSimulatorFork.sol) ## Variables ### i_register ```solidity contract Register i_register ``` The immutable register instance ### LINK_FAUCET ```solidity address LINK_FAUCET ``` The address of the LINK faucet ## Functions ### constructor ```solidity constructor() public ``` Constructor to initialize the contract ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) ``` Returns the default values for currently Data Streams supported networks. If network is not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Name | Type | Description | | ------- | ------- | ----------------------------------------------------------------------------- | | chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | #### Returns | Name | Type | Description | | ---- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | | [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------- | | to | address | - The address to which LINK tokens are to be sent. | | amount | uint256 | - The amount of LINK tokens to send. | #### Returns | Name | Type | Description | | ------- | ---- | ----------------------------------------------------------------------------- | | success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | ### requestNativeFromFaucet ```solidity function requestNativeFromFaucet(address to, uint256 amount) external ``` Requests native coints from the faucet. #### Parameters | Name | Type | Description | | ------ | ------- | --------------------------------------------------- | | to | address | - The address to which native coins are to be sent. | | amount | uint256 | - The amount of native coins to send. | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external ``` If network details are not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Name | Type | Description | | -------------- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- | | chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | | networkDetails | struct Register.NetworkDetails | - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | --- # DataStreamsLocalSimulator v0.2.4 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.4/data-streams-local-simulator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.4 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.4 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.4 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.4/src/ccip/CCIPLocalSimulator.sol"; > ``` ## DataStreamsLocalSimulator Local Data Streams simulator (no-fork mode). [DataStreamsLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-streams/DataStreamsLocalSimulator.sol) ## Variables ### i_linkToken ```solidity contract LinkToken i_linkToken ``` The LINK token instance ### i_wrappedNative ```solidity contract WETH9 i_wrappedNative ``` The wrapped native token instance ### s_mockFeeManager ```solidity contract MockFeeManager s_mockFeeManager ``` ### s_mockRewardManager ```solidity contract MockRewardManager s_mockRewardManager ``` ### s_mockVerifier ```solidity contract MockVerifier s_mockVerifier ``` ### s_mockVerifierProxy ```solidity contract MockVerifierProxy s_mockVerifierProxy ``` ## Functions ### configuration ```solidity function configuration() public view returns (contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract MockVerifier mockVerifier_, contract MockVerifierProxy mockVerifierProxy_, contract MockFeeManager mockFeeManager_, contract MockRewardManager mockRewardManager_) ``` @notice Returns configuration details for pre-deployed contracts and services needed for local Data Streams simulations. #### Returns | Name | Type | Description | | ------------------- | -------------------------- | ----------------------------------- | | wrappedNative_ | contract WETH9 | - The wrapped native token. | | linkToken_ | contract LinkToken | - The LINK token. | | mockVerifier_ | contract MockVerifier | - The mock verifier contract. | | mockVerifierProxy_ | contract MockVerifierProxy | - The mock verifier proxy contract. | | mockFeeManager_ | contract MockFeeManager | - The mock fee manager contract. | | mockRewardManager_ | contract MockRewardManager | - The mock reward manager contract. | ### constructor ```solidity constructor() public ``` ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------- | | to | address | - The address to which LINK tokens are to be sent. | | amount | uint256 | - The amount of LINK tokens to send. | #### Returns | Name | Type | Description | | ------- | ---- | ----------------------------------------------------------------------------- | | success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | --- # Register (Data Streams) v0.2.4 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.4/data-streams-register > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.4 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.4 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.4 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.4/src/ccip/CCIPLocalSimulator.sol"; > ``` ## Register (Data Streams) Data Streams network configuration registry. [Register (Data Streams)](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-streams/Register.sol) ## Structs ### NetworkDetails ```solidity struct NetworkDetails { address verifierProxyAddress; address linkAddress; } ``` ## Variables ### s_networkDetails ```solidity mapping(uint256 => struct Register.NetworkDetails) s_networkDetails ``` Mapping to store network details based on chain ID. ## Functions ### constructor ```solidity constructor() public ``` Constructor to initialize the network details for various chains. ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails networkDetails) ``` Retrieves network details for a given chain ID. #### Parameters | Name | Type | Description | | ------- | ------- | --------------------------------------------- | | chainId | uint256 | - The ID of the chain to get the details for. | #### Returns | Name | Type | Description | | -------------- | ------------------------------ | ------------------------------------------------- | | networkDetails | struct Register.NetworkDetails | - The network details for the specified chain ID. | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external ``` Sets the network details for a given chain ID. #### Parameters | Name | Type | Description | | -------------- | ------------------------------ | -------------------------------------------------------- | | chainId | uint256 | - The ID of the chain to set the details for. | | networkDetails | struct Register.NetworkDetails | - The network details to set for the specified chain ID. | --- # Chainlink Local v0.2.4 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.4 > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.4 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.4 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.4 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.4/src/ccip/CCIPLocalSimulator.sol"; > ``` Chainlink Local v0.2.4 adds the Data Streams local simulators (`DataStreamsLocalSimulator`, `DataStreamsLocalSimulatorFork`) and their mock verifier stack, and pins `@chainlink/contracts-ccip` 1.5.1-beta.0 and `@chainlink/contracts` 1.3.0. ## CCIP These contracts provide Cross-Chain Interoperability Protocol (CCIP) functionality in a local testing environment: - [CCIPLocalSimulator](/chainlink-local/api-reference/v0.2.4/ccip-local-simulator) - Local CCIP simulator (no-fork mode) - [CCIPLocalSimulatorFork](/chainlink-local/api-reference/v0.2.4/ccip-local-simulator-fork) - CCIP simulator for forked networks - [CCIPLocalSimulatorFork JS](/chainlink-local/api-reference/v0.2.4/ccip-local-simulator-fork-js) - JavaScript helpers for fork routing - [Register](/chainlink-local/api-reference/v0.2.4/register) - CCIP network configuration registry ## Data Streams Contracts for simulating Chainlink Data Streams: - [DataStreamsLocalSimulator](/chainlink-local/api-reference/v0.2.4/data-streams-local-simulator) - Local Data Streams simulator (no-fork mode) - [DataStreamsLocalSimulatorFork](/chainlink-local/api-reference/v0.2.4/data-streams-local-simulator-fork) - Data Streams simulator for forked networks - [MockVerifier](/chainlink-local/api-reference/v0.2.4/mock-verifier) - Mock Data Streams verifier - [MockVerifierProxy](/chainlink-local/api-reference/v0.2.4/mock-verifier-proxy) - Mock Data Streams verifier proxy - [MockReportGenerator](/chainlink-local/api-reference/v0.2.4/mock-report-generator) - Signed report generator for every report schema - [MockFeeManager](/chainlink-local/api-reference/v0.2.4/mock-fee-manager) - Mock verifier fee manager - [MockRewardManager](/chainlink-local/api-reference/v0.2.4/mock-reward-manager) - Mock reward manager - [ReportVersions](/chainlink-local/api-reference/v0.2.4/report-versions) - Data Streams report schemas - [Register (Data Streams)](/chainlink-local/api-reference/v0.2.4/data-streams-register) - Data Streams network configuration registry ## Data Feeds Contracts for simulating Chainlink Data Feeds: - [AggregatorInterface](/chainlink-local/api-reference/v0.2.4/aggregator-interface) - Basic price feed interface - [AggregatorV2V3Interface](/chainlink-local/api-reference/v0.2.4/aggregator-v2-v3-interface) - Combined V2/V3 price feed interface - [AggregatorV3Interface](/chainlink-local/api-reference/v0.2.4/aggregator-v3-interface) - Extended price feed interface - [MockOffchainAggregator](/chainlink-local/api-reference/v0.2.4/mock-offchain-aggregator) - Mock implementation of off-chain aggregator - [MockV3Aggregator](/chainlink-local/api-reference/v0.2.4/mock-v3-aggregator) - Mock implementation of V3 aggregator ## Token Contracts Standard token implementations for testing: - [BurnMintERC677Helper](/chainlink-local/api-reference/v0.2.4/burn-mint-erc677-helper) - Helper contract for ERC677 token operations - [LinkToken](/chainlink-local/api-reference/v0.2.4/link-token) - LINK token implementation - [WETH9](/chainlink-local/api-reference/v0.2.4/weth9) - Wrapped Ether implementation --- # LinkToken v0.2.4 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.4/link-token > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.4 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.4 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.4 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.4/src/ccip/CCIPLocalSimulator.sol"; > ``` ## LinkToken LINK token implementation. [LinkToken](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/shared/LinkToken.sol) ## Functions ### _onCreate ```solidity function _onCreate() internal virtual ``` Hook that is called when this contract is created. *Useful to override constructor behaviour in child contracts (e.g., LINK bridge tokens). The default implementation mints 10\*\*27 tokens to the contract deployer.* ### constructor ```solidity constructor() public ``` Constructor to initialize the LinkToken contract with a fixed total supply, name, and symbol. *Calls the ERC677 constructor with the name and symbol, and then mints the total supply to the contract deployer.* --- # MockFeeManager v0.2.4 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.4/mock-fee-manager > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.4 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.4 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.4 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.4/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockFeeManager Mock verifier fee manager. [MockFeeManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-streams/MockFeeManager.sol) ## Structs ### Asset ```solidity struct Asset { address assetAddress; uint256 amount; } ``` ## Variables ### i_linkAddress ```solidity address i_linkAddress ``` ### i_nativeAddress ```solidity address i_nativeAddress ``` ### i_proxyAddress ```solidity address i_proxyAddress ``` ### i_rewardManager ```solidity contract IRewardManager i_rewardManager ``` ### s_mockDiscounts ```solidity mapping(address => uint256) s_mockDiscounts ``` ### s_nativeSurcharge ```solidity uint256 s_nativeSurcharge ``` ## Errors ### ExpiredReport ```solidity error ExpiredReport() ``` ### InvalidAddress ```solidity error InvalidAddress() ``` ### InvalidDeposit ```solidity error InvalidDeposit() ``` ### InvalidDiscount ```solidity error InvalidDiscount() ``` ### InvalidQuote ```solidity error InvalidQuote() ``` ### InvalidSurcharge ```solidity error InvalidSurcharge() ``` ### Unauthorized ```solidity error Unauthorized() ``` ## Functions ### _processFee ```solidity function _processFee(bytes payload, bytes parameterPayload, address subscriber) internal ``` ### constructor ```solidity constructor(address linkAddress, address nativeAddress, address proxyAddress, address rewardManager) public ``` ### getFeeAndReward ```solidity function getFeeAndReward(address subscriber, bytes report, address quoteAddress) public view returns (struct Common.Asset, struct Common.Asset, uint256) ``` ### getMockDiscount ```solidity function getMockDiscount(address subscriber) external view returns (uint256) ``` ### processFee ```solidity function processFee(bytes payload, bytes parameterPayload, address subscriber) external payable ``` ### processFeeBulk ```solidity function processFeeBulk(bytes[] payloads, bytes parameterPayload, address subscriber) external payable ``` ### setMockDiscount ```solidity function setMockDiscount(address subscriber, uint256 discount) external ``` ### setNativeSurcharge ```solidity function setNativeSurcharge(uint64 surcharge) external ``` ### supportsInterface ```solidity function supportsInterface(bytes4 interfaceId) external pure returns (bool) ``` _Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding [https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP) section] to learn more about how these ids are created. This function call must use less than 30 000 gas._ --- # MockOffchainAggregator v0.2.4 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.4/mock-offchain-aggregator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.4 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.4 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.4 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.4/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockOffchainAggregator Mock implementation of off-chain aggregator. [MockOffchainAggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-feeds/MockOffchainAggregator.sol) ## Variables ### decimals ```solidity uint8 decimals ``` The number of decimals used by the aggregator. ### getAnswer ```solidity mapping(uint256 => int256) getAnswer ``` Mapping to get the answer for a specific round ID. ### getTimestamp ```solidity mapping(uint256 => uint256) getTimestamp ``` Mapping to get the timestamp for a specific round ID. ### latestAnswer ```solidity int256 latestAnswer ``` The latest answer reported by the aggregator. ### latestRound ```solidity uint256 latestRound ``` The latest round ID. ### latestTimestamp ```solidity uint256 latestTimestamp ``` The timestamp of the latest answer. ### maxAnswer ```solidity int192 maxAnswer ``` The maximum answer the aggregator is allowed to report. ### minAnswer ```solidity int192 minAnswer ``` The minimum answer the aggregator is allowed to report. ## Functions ### constructor ```solidity constructor(uint8 _decimals, int256 _initialAnswer) public ``` Constructor to initialize the MockOffchainAggregator contract with initial parameters. #### Parameters | Name | Type | Description | | --------------- | ------ | ------------------------------------------------------ | | _decimals | uint8 | - The number of decimals for the aggregator. | | _initialAnswer | int256 | - The initial answer to be set in the mock aggregator. | ### getRoundData ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the round data for a specific round ID. #### Parameters | Name | Type | Description | | --------- | ------ | ----------------------------------- | | _roundId | uint80 | - The round ID to get the data for. | #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------ | | roundId | uint80 | - The round ID. | | answer | int256 | - The answer for the round. | | startedAt | uint256 | - The timestamp when the round started. | | updatedAt | uint256 | - The timestamp when the round was updated. | | answeredInRound | uint80 | - The round ID in which the answer was computed. | ### latestRoundData ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the latest round data. #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------------- | | roundId | uint80 | - The latest round ID. | | answer | int256 | - The latest answer. | | startedAt | uint256 | - The timestamp when the latest round started. | | updatedAt | uint256 | - The timestamp when the latest round was updated. | | answeredInRound | uint80 | - The round ID in which the latest answer was computed. | ### updateAnswer ```solidity function updateAnswer(int256 _answer) public ``` Updates the answer in the mock aggregator. #### Parameters | Name | Type | Description | | -------- | ------ | --------------------------- | | _answer | int256 | - The new answer to be set. | ### updateMinAndMaxAnswers ```solidity function updateMinAndMaxAnswers(int192 _minAnswer, int192 _maxAnswer) external ``` Updates the minimum and maximum answers the aggregator can report. #### Parameters | Name | Type | Description | | ----------- | ------ | ------------------------- | | _minAnswer | int192 | - The new minimum answer. | | _maxAnswer | int192 | - The new maximum answer. | ### updateRoundData ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` Updates the round data in the mock aggregator. #### Parameters | Name | Type | Description | | ----------- | ------- | --------------------------------------- | | _roundId | uint80 | - The round ID to be updated. | | _answer | int256 | - The new answer to be set. | | _timestamp | uint256 | - The timestamp to be set. | | _startedAt | uint256 | - The timestamp when the round started. | --- # MockReportGenerator v0.2.4 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.4/mock-report-generator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.4 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.4 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.4 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.4/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockReportGenerator Signed report generator for every report schema. [MockReportGenerator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-streams/MockReportGenerator.sol) ## Variables ### i_donAddress ```solidity address i_donAddress ``` ### i_donDigest ```solidity uint256 i_donDigest ``` ### i_reportV2MockFeedId ```solidity bytes32 i_reportV2MockFeedId ``` ### i_reportV3MockFeedId ```solidity bytes32 i_reportV3MockFeedId ``` ### i_reportV4MockFeedId ```solidity bytes32 i_reportV4MockFeedId ``` ### s_ask ```solidity int192 s_ask ``` ### s_bid ```solidity int192 s_bid ``` ### s_expiresPeriod ```solidity uint32 s_expiresPeriod ``` ### s_linkFee ```solidity uint192 s_linkFee ``` ### s_marketStatus ```solidity uint32 s_marketStatus ``` ### s_nativeFee ```solidity uint192 s_nativeFee ``` ### s_price ```solidity int192 s_price ``` ## Errors ### MockReportGenerator__CastOverflow ```solidity error MockReportGenerator__CastOverflow() ``` ### MockReportGenerator__InvalidAsk ```solidity error MockReportGenerator__InvalidAsk() ``` ### MockReportGenerator__InvalidBid ```solidity error MockReportGenerator__InvalidBid() ``` ## Functions ### constructor ```solidity constructor(int192 initialPrice) public ``` ### generateReport ```solidity function generateReport(struct ReportVersions.ReportV2 report) external returns (bytes signedReport) ``` ### generateReport ```solidity function generateReport(struct ReportVersions.ReportV3 report) external returns (bytes signedReport) ``` ### generateReport ```solidity function generateReport(struct ReportVersions.ReportV4 report) external returns (bytes signedReport) ``` ### generateReportV2 ```solidity function generateReportV2() external returns (bytes signedReport, struct ReportVersions.ReportV2 report) ``` ### generateReportV3 ```solidity function generateReportV3() external returns (bytes signedReport, struct ReportVersions.ReportV3 report) ``` ### generateReportV4 ```solidity function generateReportV4() external returns (bytes signedReport, struct ReportVersions.ReportV4 report) ``` ### getMockDonAddress ```solidity function getMockDonAddress() external view returns (address) ``` ### updateExpiresPeriod ```solidity function updateExpiresPeriod(uint32 period) external ``` ### updateFees ```solidity function updateFees(uint192 nativeFee, uint192 linkFee) external ``` ### updateMarketStatus ```solidity function updateMarketStatus(uint32 status) external ``` ### updatePrice ```solidity function updatePrice(int192 price) public ``` ### updatePriceBidAndAsk ```solidity function updatePriceBidAndAsk(int192 price, int192 bid, int192 ask) external ``` --- # MockRewardManager v0.2.4 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.4/mock-reward-manager > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.4 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.4 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.4 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.4/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockRewardManager Mock reward manager. [MockRewardManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-streams/MockRewardManager.sol) ## Variables ### i_linkAddress ```solidity address i_linkAddress ``` ### s_feeManagerAddress ```solidity address s_feeManagerAddress ``` ## Errors ### Unauthorized ```solidity error Unauthorized() ``` ## Events ### FeePaid ```solidity event FeePaid(struct IRewardManager.FeePayment[] payments, address payer) ``` ## Functions ### claimRewards ```solidity function claimRewards(bytes32[]) external pure ``` ### constructor ```solidity constructor(address linkAddress) public ``` ### onFeePaid ```solidity function onFeePaid(struct IRewardManager.FeePayment[] payments, address payer) external ``` ### setFeeManager ```solidity function setFeeManager(address newFeeManager) external ``` ### supportsInterface ```solidity function supportsInterface(bytes4 interfaceId) external pure returns (bool) ``` _Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding [https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP) section] to learn more about how these ids are created. This function call must use less than 30 000 gas._ --- # MockV3Aggregator v0.2.4 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.4/mock-v3-aggregator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.4 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.4 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.4 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.4/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockV3Aggregator Mock implementation of V3 aggregator. [MockV3Aggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-feeds/MockV3Aggregator.sol) ## Variables ### aggregator ```solidity address aggregator ``` The address of the current aggregator. ### proposedAggregator ```solidity address proposedAggregator ``` The address of the proposed aggregator. ### version ```solidity uint256 version ``` The version of the aggregator. ## Functions ### confirmAggregator ```solidity function confirmAggregator(address _aggregator) external ``` Confirms the proposed aggregator. #### Parameters | Name | Type | Description | | ------------ | ------- | ----------------------------------------- | | _aggregator | address | - The address of the proposed aggregator. | ### constructor ```solidity constructor(uint8 _decimals, int256 _initialAnswer) public ``` Constructor to initialize the MockV3Aggregator contract with initial parameters. #### Parameters | Name | Type | Description | | --------------- | ------ | ------------------------------------------------------ | | _decimals | uint8 | - The number of decimals for the aggregator. | | _initialAnswer | int256 | - The initial answer to be set in the mock aggregator. | ### decimals ```solidity function decimals() external view returns (uint8) ``` Gets the number of decimals used by the aggregator. #### Returns | Name | Type | Description | | ---- | ----- | ------------------------------- | | [0] | uint8 | uint8 - The number of decimals. | ### description ```solidity function description() external pure returns (string) ``` Gets the description of the aggregator. #### Returns | Name | Type | Description | | ---- | ------ | -------------------------------------------------- | | [0] | string | string memory - The description of the aggregator. | ### getAnswer ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` Gets the answer for a specific round ID. #### Parameters | Name | Type | Description | | ------- | ------- | ------------------------------------- | | roundId | uint256 | - The round ID to get the answer for. | #### Returns | Name | Type | Description | | ---- | ------ | ------------------------------------------- | | [0] | int256 | int256 - The answer for the given round ID. | ### getRoundData ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the round data for a specific round ID. *This function should raise "No data present" if no data is available for the given round ID.* #### Parameters | Name | Type | Description | | --------- | ------ | ----------------------------------- | | _roundId | uint80 | - The round ID to get the data for. | #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------ | | roundId | uint80 | - The round ID. | | answer | int256 | - The answer for the round. | | startedAt | uint256 | - The timestamp when the round started. | | updatedAt | uint256 | - The timestamp when the round was updated. | | answeredInRound | uint80 | - The round ID in which the answer was computed. | ### getTimestamp ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` Gets the timestamp for a specific round ID. #### Parameters | Name | Type | Description | | ------- | ------- | ---------------------------------------- | | roundId | uint256 | - The round ID to get the timestamp for. | #### Returns | Name | Type | Description | | ---- | ------- | ----------------------------------------------- | | [0] | uint256 | uint256 - The timestamp for the given round ID. | ### latestAnswer ```solidity function latestAnswer() external view returns (int256) ``` Gets the latest answer from the aggregator. #### Returns | Name | Type | Description | | ---- | ------ | --------------------------- | | [0] | int256 | int256 - The latest answer. | ### latestRound ```solidity function latestRound() external view returns (uint256) ``` Gets the latest round ID from the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | ------------------------------ | | [0] | uint256 | uint256 - The latest round ID. | ### latestRoundData ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the latest round data. *This function should raise "No data present" if no data is available.* #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------------- | | roundId | uint80 | - The latest round ID. | | answer | int256 | - The latest answer. | | startedAt | uint256 | - The timestamp when the latest round started. | | updatedAt | uint256 | - The timestamp when the latest round was updated. | | answeredInRound | uint80 | - The round ID in which the latest answer was computed. | ### latestTimestamp ```solidity function latestTimestamp() external view returns (uint256) ``` Gets the timestamp of the latest answer from the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | --------------------------------------------- | | [0] | uint256 | uint256 - The timestamp of the latest answer. | ### proposeAggregator ```solidity function proposeAggregator(contract AggregatorV2V3Interface _aggregator) external ``` Proposes a new aggregator. #### Parameters | Name | Type | Description | | ------------ | -------------------------------- | ----------------------------------------- | | _aggregator | contract AggregatorV2V3Interface | - The address of the proposed aggregator. | ### updateAnswer ```solidity function updateAnswer(int256 _answer) public ``` Updates the answer in the mock aggregator. #### Parameters | Name | Type | Description | | -------- | ------ | --------------------------- | | _answer | int256 | - The new answer to be set. | ### updateRoundData ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` Updates the round data in the mock aggregator. #### Parameters | Name | Type | Description | | ----------- | ------- | --------------------------------------- | | _roundId | uint80 | - The round ID to be updated. | | _answer | int256 | - The new answer to be set. | | _timestamp | uint256 | - The timestamp to be set. | | _startedAt | uint256 | - The timestamp when the round started. | --- # MockVerifierProxy v0.2.4 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.4/mock-verifier-proxy > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.4 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.4 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.4 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.4/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockVerifierProxy Mock Data Streams verifier proxy. [MockVerifierProxy](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-streams/MockVerifierProxy.sol) ## Variables ### s_feeManager ```solidity contract IVerifierFeeManager s_feeManager ``` ### s_verifier ```solidity address s_verifier ``` ## Errors ### VerifierInvalid ```solidity error VerifierInvalid() ``` ### VerifierNotFound ```solidity error VerifierNotFound() ``` ### ZeroAddress ```solidity error ZeroAddress() ``` ## Events ### VerifierInitialized ```solidity event VerifierInitialized(address verifierAddress) ``` ## Functions ### _verify ```solidity function _verify(bytes payload) internal returns (bytes) ``` ### getVerifier ```solidity function getVerifier(bytes32) external view returns (address) ``` ### initializeVerifier ```solidity function initializeVerifier(address verifierAddress) external ``` ### setFeeManager ```solidity function setFeeManager(contract IVerifierFeeManager feeManager) external ``` ### verify ```solidity function verify(bytes payload, bytes parameterPayload) external payable returns (bytes) ``` ### verifyBulk ```solidity function verifyBulk(bytes[] payloads, bytes parameterPayload) external payable returns (bytes[] verifiedReports) ``` --- # MockVerifier v0.2.4 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.4/mock-verifier > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.4 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.4 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.4 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.4/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockVerifier Mock Data Streams verifier. [MockVerifier](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-streams/MockVerifier.sol) ## Variables ### i_verifierProxy ```solidity address i_verifierProxy ``` ### MOCK_DATA_STREAM_DON_ADDRESS ```solidity address MOCK_DATA_STREAM_DON_ADDRESS ``` ### N_2 ```solidity uint256 N_2 ``` ### s_inactiveDigests ```solidity mapping(bytes32 => mapping(bytes32 => bool)) s_inactiveDigests ``` ### s_inactiveFeeds ```solidity mapping(bytes32 => bool) s_inactiveFeeds ``` ### s_verifiedSignatures ```solidity mapping(bytes => bool) s_verifiedSignatures ``` ## Errors ### AccessForbidden ```solidity error AccessForbidden() ``` ### AlreadyUsedSignature ```solidity error AlreadyUsedSignature() ``` ### BadVerification ```solidity error BadVerification() ``` ### DigestInactive ```solidity error DigestInactive(bytes32 feedId, bytes32 configDigest) ``` ### InactiveFeed ```solidity error InactiveFeed(bytes32 feedId) ``` ### InvalidS ```solidity error InvalidS() ``` ### InvalidSignatureLength ```solidity error InvalidSignatureLength() ``` ### InvalidV ```solidity error InvalidV() ``` ## Events ### ReportVerified ```solidity event ReportVerified(bytes32 feedId, address sender) ``` ## Functions ### activateConfig ```solidity function activateConfig(bytes32 feedId, bytes32 configDigest) external ``` ### activateFeed ```solidity function activateFeed(bytes32 feedId) external ``` ### constructor ```solidity constructor(address verifierProxy) public ``` ### deactivateConfig ```solidity function deactivateConfig(bytes32 feedId, bytes32 configDigest) external ``` ### deactivateFeed ```solidity function deactivateFeed(bytes32 feedId) external ``` ### supportsInterface ```solidity function supportsInterface(bytes4 interfaceId) external pure returns (bool) ``` _Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding [https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP) section] to learn more about how these ids are created. This function call must use less than 30 000 gas._ ### verify ```solidity function verify(bytes signedReport, address sender) external returns (bytes verifierResponse) ``` --- # Register v0.2.4 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.4/register > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.4 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.4 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.4 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.4/src/ccip/CCIPLocalSimulator.sol"; > ``` ## Register CCIP network configuration registry. [Register](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/ccip/Register.sol) ## Structs ### NetworkDetails ```solidity struct NetworkDetails { uint64 chainSelector; address routerAddress; address linkAddress; address wrappedNativeAddress; address ccipBnMAddress; address ccipLnMAddress; address rmnProxyAddress; address registryModuleOwnerCustomAddress; address tokenAdminRegistryAddress; } ``` ## Variables ### s_networkDetails ```solidity mapping(uint256 => struct Register.NetworkDetails) s_networkDetails ``` Mapping to store network details based on chain ID. ## Functions ### constructor ```solidity constructor() public ``` Constructor to initialize the network details for various chains. ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails networkDetails) ``` Retrieves network details for a given chain ID. #### Parameters | Name | Type | Description | | ------- | ------- | --------------------------------------------- | | chainId | uint256 | - The ID of the chain to get the details for. | #### Returns | Name | Type | Description | | -------------- | ------------------------------ | ------------------------------------------------- | | networkDetails | struct Register.NetworkDetails | - The network details for the specified chain ID. | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external ``` Sets the network details for a given chain ID. #### Parameters | Name | Type | Description | | -------------- | ------------------------------ | -------------------------------------------------------- | | chainId | uint256 | - The ID of the chain to set the details for. | | networkDetails | struct Register.NetworkDetails | - The network details to set for the specified chain ID. | --- # ReportVersions v0.2.4 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.4/report-versions > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.4 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.4 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.4 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.4/src/ccip/CCIPLocalSimulator.sol"; > ``` ## ReportVersions Data Streams report schemas. [ReportVersions](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-streams/ReportVersions.sol) ## Structs ### ReportV2 *Represents a data report from a Data Streams stream for v2 schema (crypto streams). The `price` value is carried to either 8 or 18 decimal places, depending on the stream. For more information, see [https://docs.chain.link/data-streams/crypto-streams](https://docs.chain.link/data-streams/crypto-streams) and [https://docs.chain.link/data-streams/reference/report-schema](https://docs.chain.link/data-streams/reference/report-schema)* ```solidity struct ReportV2 { bytes32 feedId; uint32 validFromTimestamp; uint32 observationsTimestamp; uint192 nativeFee; uint192 linkFee; uint32 expiresAt; int192 benchmarkPrice; } ``` ### ReportV3 *Represents a data report from a Data Streams stream for v3 schema (crypto streams). The `price`, `bid`, and `ask` values are carried to either 8 or 18 decimal places, depending on the stream. For more information, see [https://docs.chain.link/data-streams/crypto-streams](https://docs.chain.link/data-streams/crypto-streams) and [https://docs.chain.link/data-streams/reference/report-schema](https://docs.chain.link/data-streams/reference/report-schema)* ```solidity struct ReportV3 { bytes32 feedId; uint32 validFromTimestamp; uint32 observationsTimestamp; uint192 nativeFee; uint192 linkFee; uint32 expiresAt; int192 price; int192 bid; int192 ask; } ``` ### ReportV4 *Represents a data report from a Data Streams stream for v4 schema (RWA stream). The `price` value is carried to either 8 or 18 decimal places, depending on the stream. The `marketStatus` indicates whether the market is currently open. Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). For more information, see [https://docs.chain.link/data-streams/rwa-streams](https://docs.chain.link/data-streams/rwa-streams) and [https://docs.chain.link/data-streams/reference/report-schema-v4](https://docs.chain.link/data-streams/reference/report-schema-v4)* ```solidity struct ReportV4 { bytes32 feedId; uint32 validFromTimestamp; uint32 observationsTimestamp; uint192 nativeFee; uint192 linkFee; uint32 expiresAt; int192 price; uint32 marketStatus; } ``` --- # WETH9 v0.2.4 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.4/weth9 > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.4 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.4 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.4 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.4/src/ccip/CCIPLocalSimulator.sol"; > ``` ## WETH9 Wrapped Ether implementation. [WETH9](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/shared/WETH9.sol) ## Variables ### allowance ```solidity mapping(address => mapping(address => uint256)) allowance ``` ### balanceOf ```solidity mapping(address => uint256) balanceOf ``` ### decimals ```solidity uint8 decimals ``` ### name ```solidity string name ``` ### symbol ```solidity string symbol ``` ## Events ### Approval ```solidity event Approval(address src, address guy, uint256 wad) ``` ### Deposit ```solidity event Deposit(address dst, uint256 wad) ``` ### Transfer ```solidity event Transfer(address src, address dst, uint256 wad) ``` ### Withdrawal ```solidity event Withdrawal(address src, uint256 wad) ``` ## Functions ### _deposit ```solidity function _deposit() internal ``` ### approve ```solidity function approve(address guy, uint256 wad) public returns (bool) ``` ### deposit ```solidity function deposit() external payable ``` ### receive ```solidity receive() external payable ``` ### totalSupply ```solidity function totalSupply() public view returns (uint256) ``` ### transfer ```solidity function transfer(address dst, uint256 wad) public returns (bool) ``` ### transferFrom ```solidity function transferFrom(address src, address dst, uint256 wad) public returns (bool) ``` ### withdraw ```solidity function withdraw(uint256 wad) external ``` --- # AggregatorInterface v0.2.5 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.5/aggregator-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.5 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.5 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.5 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.5/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorInterface Basic price feed interface. [AggregatorInterface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-feeds/interfaces/AggregatorInterface.sol) ## Events ### AnswerUpdated ```solidity event AnswerUpdated(int256 current, uint256 roundId, uint256 updatedAt) ``` Emitted when the answer is updated. #### Parameters | Name | Type | Description | | --------- | ------- | ------------------------------------------------ | | current | int256 | - The updated answer. | | roundId | uint256 | - The round ID for which the answer was updated. | | updatedAt | uint256 | - The timestamp when the answer was updated. | ### NewRound ```solidity event NewRound(uint256 roundId, address startedBy, uint256 startedAt) ``` Emitted when a new round is started. #### Parameters | Name | Type | Description | | --------- | ------- | ---------------------------------------------------- | | roundId | uint256 | - The round ID of the new round. | | startedBy | address | - The address of the account that started the round. | | startedAt | uint256 | - The timestamp when the round was started. | ## Functions ### getAnswer ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` Gets the answer for a specific round ID. #### Parameters | Name | Type | Description | | ------- | ------- | ------------------------------------- | | roundId | uint256 | - The round ID to get the answer for. | #### Returns | Name | Type | Description | | ---- | ------ | ------------------------------------------- | | [0] | int256 | int256 - The answer for the given round ID. | ### getTimestamp ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` Gets the timestamp for a specific round ID. #### Parameters | Name | Type | Description | | ------- | ------- | ---------------------------------------- | | roundId | uint256 | - The round ID to get the timestamp for. | #### Returns | Name | Type | Description | | ---- | ------- | ----------------------------------------------- | | [0] | uint256 | uint256 - The timestamp for the given round ID. | ### latestAnswer ```solidity function latestAnswer() external view returns (int256) ``` Gets the latest answer from the aggregator. #### Returns | Name | Type | Description | | ---- | ------ | --------------------------- | | [0] | int256 | int256 - The latest answer. | ### latestRound ```solidity function latestRound() external view returns (uint256) ``` Gets the latest round ID from the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | ------------------------------ | | [0] | uint256 | uint256 - The latest round ID. | ### latestTimestamp ```solidity function latestTimestamp() external view returns (uint256) ``` Gets the timestamp of the latest answer from the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | --------------------------------------------- | | [0] | uint256 | uint256 - The timestamp of the latest answer. | --- # AggregatorV2V3Interface v0.2.5 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.5/aggregator-v2-v3-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.5 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.5 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.5 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.5/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorV2V3Interface Combined V2/V3 price feed interface. [AggregatorV2V3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-feeds/interfaces/AggregatorV2V3Interface.sol) --- # AggregatorV3Interface v0.2.5 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.5/aggregator-v3-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.5 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.5 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.5 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.5/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorV3Interface Extended price feed interface. [AggregatorV3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-feeds/interfaces/AggregatorV3Interface.sol) ## Functions ### decimals ```solidity function decimals() external view returns (uint8) ``` Gets the number of decimals used by the aggregator. #### Returns | Name | Type | Description | | ---- | ----- | ------------------------------- | | [0] | uint8 | uint8 - The number of decimals. | ### description ```solidity function description() external view returns (string) ``` Gets the description of the aggregator. #### Returns | Name | Type | Description | | ---- | ------ | -------------------------------------------------- | | [0] | string | string memory - The description of the aggregator. | ### getRoundData ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the round data for a specific round ID. *This function should raise "No data present" if no data is available for the given round ID.* #### Parameters | Name | Type | Description | | --------- | ------ | ----------------------------------- | | _roundId | uint80 | - The round ID to get the data for. | #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------ | | roundId | uint80 | - The round ID. | | answer | int256 | - The answer for the round. | | startedAt | uint256 | - The timestamp when the round started. | | updatedAt | uint256 | - The timestamp when the round was updated. | | answeredInRound | uint80 | - The round ID in which the answer was computed. | ### latestRoundData ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the latest round data. *This function should raise "No data present" if no data is available.* #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------------- | | roundId | uint80 | - The latest round ID. | | answer | int256 | - The latest answer. | | startedAt | uint256 | - The timestamp when the latest round started. | | updatedAt | uint256 | - The timestamp when the latest round was updated. | | answeredInRound | uint80 | - The round ID in which the latest answer was computed. | ### version ```solidity function version() external view returns (uint256) ``` Gets the version of the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | ---------------------------------------- | | [0] | uint256 | uint256 - The version of the aggregator. | --- # BurnMintERC677Helper v0.2.5 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.5/burn-mint-erc677-helper > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.5 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.5 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.5 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.5/src/ccip/CCIPLocalSimulator.sol"; > ``` ## BurnMintERC677Helper Helper contract for ERC677 token operations. [BurnMintERC677Helper](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/ccip/BurnMintERC677Helper.sol) ## Functions ### constructor ```solidity constructor(string name, string symbol) public ``` Constructor to initialize the BurnMintERC677Helper contract with a name and symbol. *Calls the parent constructor of BurnMintERC677 with fixed decimals (18) and initial supply (0).* #### Parameters | Name | Type | Description | | ------ | ------ | -------------------------- | | name | string | - The name of the token. | | symbol | string | - The symbol of the token. | ### drip ```solidity function drip(address to) external ``` Mints one full token (1e18) to the specified address. *Calls the internal `_mint` function from the BurnMintERC677 contract.* #### Parameters | Name | Type | Description | | ---- | ------- | ------------------------------------------ | | to | address | - The address to receive the minted token. | --- # CCIPLocalSimulatorFork JS v0.2.5 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.5/ccip-local-simulator-fork-js > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.5 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.5 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.5 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.5/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulatorFork JS Hardhat 2 JavaScript helpers for fork routing. [CCIPLocalSimulatorFork JS](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/scripts/CCIPLocalSimulatorFork.js) ## Types ### Evm2EvmMessage : `Object` **Properties** | Name | Type | | ------------------- | ------------------------------------------ | | sourceChainSelector | `bigint` | | sender | `string` | | receiver | `string` | | sequenceNumber | `bigint` | | gasLimit | `bigint` | | strict | `boolean` | | nonce | `bigint` | | feeToken | `string` | | feeTokenAmount | `bigint` | | data | `string` | | tokenAmounts | `Array.<\{token: string, amount: bigint}>` | | sourceTokenData | `Array.` | | messageId | `string` | ## Functions ### requestLinkFromTheFaucet(linkAddress, to, amount) ⇒ `Promise.` Requests LINK tokens from the faucet and returns the transaction hash **Returns**: `Promise.` - Promise resolving to the transaction hash of the fund transfer | Param | Type | Description | | ----------- | -------- | ------------------------------------------------------- | | linkAddress | `string` | The address of the LINK contract on the current network | | to | `string` | The address to send LINK to | | amount | `bigint` | The amount of LINK to request | ### getEvm2EvmMessage(receipt) ⇒ `Evm2EvmMessage` | `null` Parses a transaction receipt to extract the sent message Scans through transaction logs to find a `CCIPSendRequested` event and then decodes it to an object **Returns**: `Evm2EvmMessage` | `null` - Returns either the sent message or null if provided receipt does not contain `CCIPSendRequested` log | Param | Type | Description | | ------- | -------- | ------------------------------------------------ | | receipt | `object` | The transaction receipt from the `ccipSend` call | ### routeMessage(routerAddress, evm2EvmMessage) ⇒ `Promise.` Routes the sent message from the source network on the destination (current) network **Returns**: `Promise.` - Either resolves with no value if the message is successfully routed, or reverts\ **Throws**: - `Error` Fails if no off-ramp matches the message's source chain selector or if calling `router.getOffRamps()` | Param | Type | Description | | -------------- | ---------------- | --------------------------------- | | routerAddress | `string` | Address of the destination Router | | evm2EvmMessage | `Evm2EvmMessage` | Sent cross-chain message | --- # CCIPLocalSimulatorFork v0.2.5 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.5/ccip-local-simulator-fork > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.5 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.5 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.5 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.5/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulatorFork CCIP simulator for forked networks. [CCIPLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/ccip/CCIPLocalSimulatorFork.sol) ## Structs ### OffRamp Structure representing an offRamp configuration #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | ```solidity struct OffRamp { uint64 sourceChainSelector; address offRamp; } ``` ## Variables ### i_register ```solidity contract Register i_register ``` The immutable register instance ### LINK_FAUCET ```solidity address LINK_FAUCET ``` The address of the LINK faucet ### s_processedMessages ```solidity mapping(bytes32 => bool) s_processedMessages ``` Mapping to track processed messages ## Events ### CCIPSendRequested ```solidity event CCIPSendRequested(struct Internal.EVM2EVMMessage message) ``` Event emitted when a CCIP send request is made #### Parameters | Name | Type | Description | | ------- | ------------------------------ | ----------------------------------- | | message | struct Internal.EVM2EVMMessage | - The EVM2EVM message that was sent | ## Functions ### constructor ```solidity constructor() public ``` Constructor to initialize the contract ### executeSingleMessage ```solidity function executeSingleMessage(struct Internal.EVM2EVMMessage message, bytes[] offchainTokenData, uint32[] tokenGasOverrides) external ``` Executes a single CCIP message on the offRamp #### Parameters | Name | Type | Description | | ----------------- | ------------------------------ | --------------------------------- | | message | struct Internal.EVM2EVMMessage | - The CCIP message to be executed | | offchainTokenData | bytes[] | - Additional offchain token data | | tokenGasOverrides | uint32[] | | Works with Foundry only ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) ``` Returns the default values for currently CCIP supported networks. If network is not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Name | Type | Description | | ------- | ------- | ------------------------------------------------------------------------------------------------------ | | chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | #### Returns | Name | Type | Description | | ---- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | ### getOffRamps ```solidity function getOffRamps() external view returns (struct IRouterFork.OffRamp[]) ``` Gets the list of offRamps #### Returns | Name | Type | Description | | ---- | ----------------------------- | ----------------------------------- | | [0] | struct IRouterFork.OffRamp[] | offRamps - Array of OffRamp structs | ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------- | | to | address | - The address to which LINK tokens are to be sent. | | amount | uint256 | - The amount of LINK tokens to send. | #### Returns | Name | Type | Description | | ------- | ---- | ----------------------------------------------------------------------------- | | success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external ``` If network details are not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Name | Type | Description | | -------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | | networkDetails | struct Register.NetworkDetails | - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | ### switchChainAndRouteMessage ```solidity function switchChainAndRouteMessage(uint256 forkId) external ``` To be called after the sending of the cross-chain message (`ccipSend`). Goes through the list of past logs and looks for the `CCIPSendRequested` event. Switches to a destination network fork. Routes the sent cross-chain message on the destination network. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------------------------------------------------------------------- | | forkId | uint256 | - The ID of the destination network fork. This is the returned value of `createFork()` or `createSelectFork()` | --- # CCIPLocalSimulator v0.2.5 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.5/ccip-local-simulator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.5 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.5 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.5 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.5/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulator Local CCIP simulator (no-fork mode). [CCIPLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/ccip/CCIPLocalSimulator.sol) ## Variables ### CHAIN_SELECTOR ```solidity uint64 CHAIN_SELECTOR ``` The unique CCIP Chain Selector constant ### i_ccipBnM ```solidity contract BurnMintERC677Helper i_ccipBnM ``` The BurnMintERC677Helper instance for CCIP-BnM token ### i_ccipLnM ```solidity contract BurnMintERC677Helper i_ccipLnM ``` The BurnMintERC677Helper instance for CCIP-LnM token ### i_linkToken ```solidity contract LinkToken i_linkToken ``` The LINK token instance ### i_mockRouter ```solidity contract MockCCIPRouter i_mockRouter ``` The mock CCIP router instance ### i_wrappedNative ```solidity contract WETH9 i_wrappedNative ``` The wrapped native token instance ### s_supportedTokens ```solidity address[] s_supportedTokens ``` The list of supported token addresses ## Errors ### CCIPLocalSimulator__MsgSenderIsNotTokenOwner ```solidity error CCIPLocalSimulator__MsgSenderIsNotTokenOwner() ``` ### CCIPLocalSimulator__RequiredRoleNotFound ```solidity error CCIPLocalSimulator__RequiredRoleNotFound(address account, bytes32 role, address token) ``` ## Functions ### configuration ```solidity function configuration() public view returns (uint64 chainSelector_, contract IRouterClient sourceRouter_, contract IRouterClient destinationRouter_, contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract BurnMintERC677Helper ccipBnM_, contract BurnMintERC677Helper ccipLnM_) ``` Returns configuration details for pre-deployed contracts and services needed for local CCIP simulations. #### Returns | Name | Type | Description | | ------------------- | ----------------------------- | ----------------------------------------------------------- | | chainSelector_ | uint64 | - The unique CCIP Chain Selector. | | sourceRouter_ | contract IRouterClient | - The source chain Router contract. | | destinationRouter_ | contract IRouterClient | - The destination chain Router contract. | | wrappedNative_ | contract WETH9 | - The wrapped native token which can be used for CCIP fees. | | linkToken_ | contract LinkToken | - The LINK token. | | ccipBnM_ | contract BurnMintERC677Helper | - The ccipBnM token. | | ccipLnM_ | contract BurnMintERC677Helper | - The ccipLnM token. | ### constructor ```solidity constructor() public ``` Constructor to initialize the contract and pre-deployed token instances ### getSupportedTokens ```solidity function getSupportedTokens(uint64 chainSelector) external view returns (address[] tokens) ``` Gets a list of token addresses that are supported for cross-chain transfers by the simulator. #### Parameters | Name | Type | Description | | ------------- | ------ | --------------------------------- | | chainSelector | uint64 | - The unique CCIP Chain Selector. | #### Returns | Name | Type | Description | | ------ | ---------- | -------------------------------------------------------------------------------------------------- | | tokens | address[] | - Returns a list of token addresses that are supported for cross-chain transfers by the simulator. | ### isChainSupported ```solidity function isChainSupported(uint64 chainSelector) public pure returns (bool supported) ``` Checks whether the provided `chainSelector` is supported by the simulator. #### Parameters | Name | Type | Description | | ------------- | ------ | --------------------------------- | | chainSelector | uint64 | - The unique CCIP Chain Selector. | #### Returns | Name | Type | Description | | --------- | ---- | ---------------------------------------------------------------- | | supported | bool | - Returns true if `chainSelector` is supported by the simulator. | ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------- | | to | address | - The address to which LINK tokens are to be sent. | | amount | uint256 | - The amount of LINK tokens to send. | #### Returns | Name | Type | Description | | ------- | ---- | ----------------------------------------------------------------------------- | | success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | ### supportNewTokenViaAccessControlDefaultAdmin ```solidity function supportNewTokenViaAccessControlDefaultAdmin(address tokenAddress) external ``` Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. The caller must have the DEFAULT_ADMIN_ROLE as defined by the contract itself. Reverts if the caller is not the admin of the token using OZ's AccessControl DEFAULT_ADMIN_ROLE. #### Parameters | Name | Type | Description | | ------------ | ------- | ------------------------------------------------------------------ | | tokenAddress | address | - The address of the token to add to the list of supported tokens. | ### supportNewTokenViaGetCCIPAdmin ```solidity function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external ``` Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. Reverts if token does not implement getCCIPAdmin() function. Reverts if the caller is not the token CCIPAdmin. #### Parameters | Name | Type | Description | | ------------ | ------- | ------------------------------------------------------------------ | | tokenAddress | address | - The address of the token to add to the list of supported tokens. | ### supportNewTokenViaOwner ```solidity function supportNewTokenViaOwner(address tokenAddress) external ``` Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. Reverts if token does not implement owner() function. Reverts if the caller is not the token owner. #### Parameters | Name | Type | Description | | ------------ | ------- | ------------------------------------------------------------------ | | tokenAddress | address | - The address of the token to add to the list of supported tokens. | --- # DataStreamsLocalSimulatorFork v0.2.5 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.5/data-streams-local-simulator-fork > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.5 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.5 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.5 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.5/src/ccip/CCIPLocalSimulator.sol"; > ``` ## DataStreamsLocalSimulatorFork Data Streams simulator for forked networks. [DataStreamsLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-streams/DataStreamsLocalSimulatorFork.sol) ## Variables ### i_register ```solidity contract Register i_register ``` The immutable register instance ### LINK_FAUCET ```solidity address LINK_FAUCET ``` The address of the LINK faucet ## Functions ### constructor ```solidity constructor() public ``` Constructor to initialize the contract ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) ``` Returns the default values for currently Data Streams supported networks. If network is not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Name | Type | Description | | ------- | ------- | ----------------------------------------------------------------------------- | | chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | #### Returns | Name | Type | Description | | ---- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | | [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------- | | to | address | - The address to which LINK tokens are to be sent. | | amount | uint256 | - The amount of LINK tokens to send. | #### Returns | Name | Type | Description | | ------- | ---- | ----------------------------------------------------------------------------- | | success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | ### requestNativeFromFaucet ```solidity function requestNativeFromFaucet(address to, uint256 amount) external ``` Requests native coints from the faucet. #### Parameters | Name | Type | Description | | ------ | ------- | --------------------------------------------------- | | to | address | - The address to which native coins are to be sent. | | amount | uint256 | - The amount of native coins to send. | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external ``` If network details are not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Name | Type | Description | | -------------- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- | | chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | | networkDetails | struct Register.NetworkDetails | - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | --- # DataStreamsLocalSimulator v0.2.5 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.5/data-streams-local-simulator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.5 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.5 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.5 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.5/src/ccip/CCIPLocalSimulator.sol"; > ``` ## DataStreamsLocalSimulator Local Data Streams simulator (no-fork mode). [DataStreamsLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-streams/DataStreamsLocalSimulator.sol) ## Variables ### i_linkToken ```solidity contract LinkToken i_linkToken ``` The LINK token instance ### i_wrappedNative ```solidity contract WETH9 i_wrappedNative ``` The wrapped native token instance ### s_mockFeeManager ```solidity contract MockFeeManager s_mockFeeManager ``` ### s_mockRewardManager ```solidity contract MockRewardManager s_mockRewardManager ``` ### s_mockVerifier ```solidity contract MockVerifier s_mockVerifier ``` ### s_mockVerifierProxy ```solidity contract MockVerifierProxy s_mockVerifierProxy ``` ## Functions ### configuration ```solidity function configuration() public view returns (contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract MockVerifier mockVerifier_, contract MockVerifierProxy mockVerifierProxy_, contract MockFeeManager mockFeeManager_, contract MockRewardManager mockRewardManager_) ``` @notice Returns configuration details for pre-deployed contracts and services needed for local Data Streams simulations. #### Returns | Name | Type | Description | | ------------------- | -------------------------- | ----------------------------------- | | wrappedNative_ | contract WETH9 | - The wrapped native token. | | linkToken_ | contract LinkToken | - The LINK token. | | mockVerifier_ | contract MockVerifier | - The mock verifier contract. | | mockVerifierProxy_ | contract MockVerifierProxy | - The mock verifier proxy contract. | | mockFeeManager_ | contract MockFeeManager | - The mock fee manager contract. | | mockRewardManager_ | contract MockRewardManager | - The mock reward manager contract. | ### constructor ```solidity constructor() public ``` ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------- | | to | address | - The address to which LINK tokens are to be sent. | | amount | uint256 | - The amount of LINK tokens to send. | #### Returns | Name | Type | Description | | ------- | ---- | ----------------------------------------------------------------------------- | | success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | --- # Register (Data Streams) v0.2.5 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.5/data-streams-register > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.5 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.5 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.5 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.5/src/ccip/CCIPLocalSimulator.sol"; > ``` ## Register (Data Streams) Data Streams network configuration registry. [Register (Data Streams)](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-streams/Register.sol) ## Structs ### NetworkDetails ```solidity struct NetworkDetails { address verifierProxyAddress; address linkAddress; } ``` ## Variables ### s_networkDetails ```solidity mapping(uint256 => struct Register.NetworkDetails) s_networkDetails ``` Mapping to store network details based on chain ID. ## Functions ### constructor ```solidity constructor() public ``` Constructor to initialize the network details for various chains. ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails networkDetails) ``` Retrieves network details for a given chain ID. #### Parameters | Name | Type | Description | | ------- | ------- | --------------------------------------------- | | chainId | uint256 | - The ID of the chain to get the details for. | #### Returns | Name | Type | Description | | -------------- | ------------------------------ | ------------------------------------------------- | | networkDetails | struct Register.NetworkDetails | - The network details for the specified chain ID. | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external ``` Sets the network details for a given chain ID. #### Parameters | Name | Type | Description | | -------------- | ------------------------------ | -------------------------------------------------------- | | chainId | uint256 | - The ID of the chain to set the details for. | | networkDetails | struct Register.NetworkDetails | - The network details to set for the specified chain ID. | --- # Chainlink Local v0.2.5 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.5 > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.5 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.5 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.5 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.5/src/ccip/CCIPLocalSimulator.sol"; > ``` Chainlink Local v0.2.5 upgrades to CCIP v1.6: it pins `@chainlink/contracts-ccip` 1.6.0 and `@chainlink/contracts` 1.4.0, the fork simulator routes messages on 1.6 lanes, and the JavaScript helper gains `getEvm2AnyRampMessage` for parsing 1.6 `CCIPMessageSent` events. ## CCIP These contracts provide Cross-Chain Interoperability Protocol (CCIP) functionality in a local testing environment: - [CCIPLocalSimulator](/chainlink-local/api-reference/v0.2.5/ccip-local-simulator) - Local CCIP simulator (no-fork mode) - [CCIPLocalSimulatorFork](/chainlink-local/api-reference/v0.2.5/ccip-local-simulator-fork) - CCIP simulator for forked networks - [CCIPLocalSimulatorFork JS](/chainlink-local/api-reference/v0.2.5/ccip-local-simulator-fork-js) - JavaScript helpers for fork routing - [Register](/chainlink-local/api-reference/v0.2.5/register) - CCIP network configuration registry ## Data Streams Contracts for simulating Chainlink Data Streams: - [DataStreamsLocalSimulator](/chainlink-local/api-reference/v0.2.5/data-streams-local-simulator) - Local Data Streams simulator (no-fork mode) - [DataStreamsLocalSimulatorFork](/chainlink-local/api-reference/v0.2.5/data-streams-local-simulator-fork) - Data Streams simulator for forked networks - [MockVerifier](/chainlink-local/api-reference/v0.2.5/mock-verifier) - Mock Data Streams verifier - [MockVerifierProxy](/chainlink-local/api-reference/v0.2.5/mock-verifier-proxy) - Mock Data Streams verifier proxy - [MockReportGenerator](/chainlink-local/api-reference/v0.2.5/mock-report-generator) - Signed report generator for every report schema - [MockFeeManager](/chainlink-local/api-reference/v0.2.5/mock-fee-manager) - Mock verifier fee manager - [MockRewardManager](/chainlink-local/api-reference/v0.2.5/mock-reward-manager) - Mock reward manager - [ReportVersions](/chainlink-local/api-reference/v0.2.5/report-versions) - Data Streams report schemas - [Register (Data Streams)](/chainlink-local/api-reference/v0.2.5/data-streams-register) - Data Streams network configuration registry ## Data Feeds Contracts for simulating Chainlink Data Feeds: - [AggregatorInterface](/chainlink-local/api-reference/v0.2.5/aggregator-interface) - Basic price feed interface - [AggregatorV2V3Interface](/chainlink-local/api-reference/v0.2.5/aggregator-v2-v3-interface) - Combined V2/V3 price feed interface - [AggregatorV3Interface](/chainlink-local/api-reference/v0.2.5/aggregator-v3-interface) - Extended price feed interface - [MockOffchainAggregator](/chainlink-local/api-reference/v0.2.5/mock-offchain-aggregator) - Mock implementation of off-chain aggregator - [MockV3Aggregator](/chainlink-local/api-reference/v0.2.5/mock-v3-aggregator) - Mock implementation of V3 aggregator ## Token Contracts Standard token implementations for testing: - [BurnMintERC677Helper](/chainlink-local/api-reference/v0.2.5/burn-mint-erc677-helper) - Helper contract for ERC677 token operations - [LinkToken](/chainlink-local/api-reference/v0.2.5/link-token) - LINK token implementation - [WETH9](/chainlink-local/api-reference/v0.2.5/weth9) - Wrapped Ether implementation --- # LinkToken v0.2.5 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.5/link-token > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.5 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.5 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.5 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.5/src/ccip/CCIPLocalSimulator.sol"; > ``` ## LinkToken LINK token implementation. [LinkToken](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/shared/LinkToken.sol) ## Functions ### _onCreate ```solidity function _onCreate() internal virtual ``` Hook that is called when this contract is created. *Useful to override constructor behaviour in child contracts (e.g., LINK bridge tokens). The default implementation mints 10\*\*27 tokens to the contract deployer.* ### constructor ```solidity constructor() public ``` Constructor to initialize the LinkToken contract with a fixed total supply, name, and symbol. *Calls the ERC677 constructor with the name and symbol, and then mints the total supply to the contract deployer.* --- # MockFeeManager v0.2.5 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.5/mock-fee-manager > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.5 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.5 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.5 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.5/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockFeeManager Mock verifier fee manager. [MockFeeManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-streams/MockFeeManager.sol) ## Structs ### Asset ```solidity struct Asset { address assetAddress; uint256 amount; } ``` ## Variables ### i_linkAddress ```solidity address i_linkAddress ``` ### i_nativeAddress ```solidity address i_nativeAddress ``` ### i_proxyAddress ```solidity address i_proxyAddress ``` ### i_rewardManager ```solidity contract IRewardManager i_rewardManager ``` ### s_mockDiscounts ```solidity mapping(address => uint256) s_mockDiscounts ``` ### s_nativeSurcharge ```solidity uint256 s_nativeSurcharge ``` ## Errors ### ExpiredReport ```solidity error ExpiredReport() ``` ### InvalidAddress ```solidity error InvalidAddress() ``` ### InvalidDeposit ```solidity error InvalidDeposit() ``` ### InvalidDiscount ```solidity error InvalidDiscount() ``` ### InvalidQuote ```solidity error InvalidQuote() ``` ### InvalidSurcharge ```solidity error InvalidSurcharge() ``` ### Unauthorized ```solidity error Unauthorized() ``` ## Functions ### _processFee ```solidity function _processFee(bytes payload, bytes parameterPayload, address subscriber) internal ``` ### constructor ```solidity constructor(address linkAddress, address nativeAddress, address proxyAddress, address rewardManager) public ``` ### getFeeAndReward ```solidity function getFeeAndReward(address subscriber, bytes report, address quoteAddress) public view returns (struct Common.Asset, struct Common.Asset, uint256) ``` ### getMockDiscount ```solidity function getMockDiscount(address subscriber) external view returns (uint256) ``` ### processFee ```solidity function processFee(bytes payload, bytes parameterPayload, address subscriber) external payable ``` ### processFeeBulk ```solidity function processFeeBulk(bytes[] payloads, bytes parameterPayload, address subscriber) external payable ``` ### setMockDiscount ```solidity function setMockDiscount(address subscriber, uint256 discount) external ``` ### setNativeSurcharge ```solidity function setNativeSurcharge(uint64 surcharge) external ``` ### supportsInterface ```solidity function supportsInterface(bytes4 interfaceId) external pure returns (bool) ``` _Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding [https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP) section] to learn more about how these ids are created. This function call must use less than 30 000 gas._ --- # MockOffchainAggregator v0.2.5 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.5/mock-offchain-aggregator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.5 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.5 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.5 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.5/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockOffchainAggregator Mock implementation of off-chain aggregator. [MockOffchainAggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-feeds/MockOffchainAggregator.sol) ## Variables ### decimals ```solidity uint8 decimals ``` The number of decimals used by the aggregator. ### getAnswer ```solidity mapping(uint256 => int256) getAnswer ``` Mapping to get the answer for a specific round ID. ### getTimestamp ```solidity mapping(uint256 => uint256) getTimestamp ``` Mapping to get the timestamp for a specific round ID. ### latestAnswer ```solidity int256 latestAnswer ``` The latest answer reported by the aggregator. ### latestRound ```solidity uint256 latestRound ``` The latest round ID. ### latestTimestamp ```solidity uint256 latestTimestamp ``` The timestamp of the latest answer. ### maxAnswer ```solidity int192 maxAnswer ``` The maximum answer the aggregator is allowed to report. ### minAnswer ```solidity int192 minAnswer ``` The minimum answer the aggregator is allowed to report. ## Functions ### constructor ```solidity constructor(uint8 _decimals, int256 _initialAnswer) public ``` Constructor to initialize the MockOffchainAggregator contract with initial parameters. #### Parameters | Name | Type | Description | | --------------- | ------ | ------------------------------------------------------ | | _decimals | uint8 | - The number of decimals for the aggregator. | | _initialAnswer | int256 | - The initial answer to be set in the mock aggregator. | ### getRoundData ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the round data for a specific round ID. #### Parameters | Name | Type | Description | | --------- | ------ | ----------------------------------- | | _roundId | uint80 | - The round ID to get the data for. | #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------ | | roundId | uint80 | - The round ID. | | answer | int256 | - The answer for the round. | | startedAt | uint256 | - The timestamp when the round started. | | updatedAt | uint256 | - The timestamp when the round was updated. | | answeredInRound | uint80 | - The round ID in which the answer was computed. | ### latestRoundData ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the latest round data. #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------------- | | roundId | uint80 | - The latest round ID. | | answer | int256 | - The latest answer. | | startedAt | uint256 | - The timestamp when the latest round started. | | updatedAt | uint256 | - The timestamp when the latest round was updated. | | answeredInRound | uint80 | - The round ID in which the latest answer was computed. | ### updateAnswer ```solidity function updateAnswer(int256 _answer) public ``` Updates the answer in the mock aggregator. #### Parameters | Name | Type | Description | | -------- | ------ | --------------------------- | | _answer | int256 | - The new answer to be set. | ### updateMinAndMaxAnswers ```solidity function updateMinAndMaxAnswers(int192 _minAnswer, int192 _maxAnswer) external ``` Updates the minimum and maximum answers the aggregator can report. #### Parameters | Name | Type | Description | | ----------- | ------ | ------------------------- | | _minAnswer | int192 | - The new minimum answer. | | _maxAnswer | int192 | - The new maximum answer. | ### updateRoundData ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` Updates the round data in the mock aggregator. #### Parameters | Name | Type | Description | | ----------- | ------- | --------------------------------------- | | _roundId | uint80 | - The round ID to be updated. | | _answer | int256 | - The new answer to be set. | | _timestamp | uint256 | - The timestamp to be set. | | _startedAt | uint256 | - The timestamp when the round started. | --- # MockReportGenerator v0.2.5 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.5/mock-report-generator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.5 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.5 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.5 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.5/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockReportGenerator Signed report generator for every report schema. [MockReportGenerator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-streams/MockReportGenerator.sol) ## Variables ### i_donAddress ```solidity address i_donAddress ``` ### i_donDigest ```solidity uint256 i_donDigest ``` ### i_reportV2MockFeedId ```solidity bytes32 i_reportV2MockFeedId ``` ### i_reportV3MockFeedId ```solidity bytes32 i_reportV3MockFeedId ``` ### i_reportV4MockFeedId ```solidity bytes32 i_reportV4MockFeedId ``` ### s_ask ```solidity int192 s_ask ``` ### s_bid ```solidity int192 s_bid ``` ### s_expiresPeriod ```solidity uint32 s_expiresPeriod ``` ### s_linkFee ```solidity uint192 s_linkFee ``` ### s_marketStatus ```solidity uint32 s_marketStatus ``` ### s_nativeFee ```solidity uint192 s_nativeFee ``` ### s_price ```solidity int192 s_price ``` ## Errors ### MockReportGenerator__CastOverflow ```solidity error MockReportGenerator__CastOverflow() ``` ### MockReportGenerator__InvalidAsk ```solidity error MockReportGenerator__InvalidAsk() ``` ### MockReportGenerator__InvalidBid ```solidity error MockReportGenerator__InvalidBid() ``` ## Functions ### constructor ```solidity constructor(int192 initialPrice) public ``` ### generateReport ```solidity function generateReport(struct ReportVersions.ReportV2 report) external returns (bytes signedReport) ``` ### generateReport ```solidity function generateReport(struct ReportVersions.ReportV3 report) external returns (bytes signedReport) ``` ### generateReport ```solidity function generateReport(struct ReportVersions.ReportV4 report) external returns (bytes signedReport) ``` ### generateReportV2 ```solidity function generateReportV2() external returns (bytes signedReport, struct ReportVersions.ReportV2 report) ``` ### generateReportV3 ```solidity function generateReportV3() external returns (bytes signedReport, struct ReportVersions.ReportV3 report) ``` ### generateReportV4 ```solidity function generateReportV4() external returns (bytes signedReport, struct ReportVersions.ReportV4 report) ``` ### getMockDonAddress ```solidity function getMockDonAddress() external view returns (address) ``` ### updateExpiresPeriod ```solidity function updateExpiresPeriod(uint32 period) external ``` ### updateFees ```solidity function updateFees(uint192 nativeFee, uint192 linkFee) external ``` ### updateMarketStatus ```solidity function updateMarketStatus(uint32 status) external ``` ### updatePrice ```solidity function updatePrice(int192 price) public ``` ### updatePriceBidAndAsk ```solidity function updatePriceBidAndAsk(int192 price, int192 bid, int192 ask) external ``` --- # MockRewardManager v0.2.5 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.5/mock-reward-manager > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.5 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.5 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.5 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.5/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockRewardManager Mock reward manager. [MockRewardManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-streams/MockRewardManager.sol) ## Variables ### i_linkAddress ```solidity address i_linkAddress ``` ### s_feeManagerAddress ```solidity address s_feeManagerAddress ``` ## Errors ### Unauthorized ```solidity error Unauthorized() ``` ## Events ### FeePaid ```solidity event FeePaid(struct IRewardManager.FeePayment[] payments, address payer) ``` ## Functions ### claimRewards ```solidity function claimRewards(bytes32[]) external pure ``` ### constructor ```solidity constructor(address linkAddress) public ``` ### onFeePaid ```solidity function onFeePaid(struct IRewardManager.FeePayment[] payments, address payer) external ``` ### setFeeManager ```solidity function setFeeManager(address newFeeManager) external ``` ### supportsInterface ```solidity function supportsInterface(bytes4 interfaceId) external pure returns (bool) ``` _Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding [https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP) section] to learn more about how these ids are created. This function call must use less than 30 000 gas._ --- # MockV3Aggregator v0.2.5 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.5/mock-v3-aggregator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.5 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.5 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.5 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.5/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockV3Aggregator Mock implementation of V3 aggregator. [MockV3Aggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-feeds/MockV3Aggregator.sol) ## Variables ### aggregator ```solidity address aggregator ``` The address of the current aggregator. ### proposedAggregator ```solidity address proposedAggregator ``` The address of the proposed aggregator. ### version ```solidity uint256 version ``` The version of the aggregator. ## Functions ### confirmAggregator ```solidity function confirmAggregator(address _aggregator) external ``` Confirms the proposed aggregator. #### Parameters | Name | Type | Description | | ------------ | ------- | ----------------------------------------- | | _aggregator | address | - The address of the proposed aggregator. | ### constructor ```solidity constructor(uint8 _decimals, int256 _initialAnswer) public ``` Constructor to initialize the MockV3Aggregator contract with initial parameters. #### Parameters | Name | Type | Description | | --------------- | ------ | ------------------------------------------------------ | | _decimals | uint8 | - The number of decimals for the aggregator. | | _initialAnswer | int256 | - The initial answer to be set in the mock aggregator. | ### decimals ```solidity function decimals() external view returns (uint8) ``` Gets the number of decimals used by the aggregator. #### Returns | Name | Type | Description | | ---- | ----- | ------------------------------- | | [0] | uint8 | uint8 - The number of decimals. | ### description ```solidity function description() external pure returns (string) ``` Gets the description of the aggregator. #### Returns | Name | Type | Description | | ---- | ------ | -------------------------------------------------- | | [0] | string | string memory - The description of the aggregator. | ### getAnswer ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` Gets the answer for a specific round ID. #### Parameters | Name | Type | Description | | ------- | ------- | ------------------------------------- | | roundId | uint256 | - The round ID to get the answer for. | #### Returns | Name | Type | Description | | ---- | ------ | ------------------------------------------- | | [0] | int256 | int256 - The answer for the given round ID. | ### getRoundData ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the round data for a specific round ID. *This function should raise "No data present" if no data is available for the given round ID.* #### Parameters | Name | Type | Description | | --------- | ------ | ----------------------------------- | | _roundId | uint80 | - The round ID to get the data for. | #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------ | | roundId | uint80 | - The round ID. | | answer | int256 | - The answer for the round. | | startedAt | uint256 | - The timestamp when the round started. | | updatedAt | uint256 | - The timestamp when the round was updated. | | answeredInRound | uint80 | - The round ID in which the answer was computed. | ### getTimestamp ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` Gets the timestamp for a specific round ID. #### Parameters | Name | Type | Description | | ------- | ------- | ---------------------------------------- | | roundId | uint256 | - The round ID to get the timestamp for. | #### Returns | Name | Type | Description | | ---- | ------- | ----------------------------------------------- | | [0] | uint256 | uint256 - The timestamp for the given round ID. | ### latestAnswer ```solidity function latestAnswer() external view returns (int256) ``` Gets the latest answer from the aggregator. #### Returns | Name | Type | Description | | ---- | ------ | --------------------------- | | [0] | int256 | int256 - The latest answer. | ### latestRound ```solidity function latestRound() external view returns (uint256) ``` Gets the latest round ID from the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | ------------------------------ | | [0] | uint256 | uint256 - The latest round ID. | ### latestRoundData ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the latest round data. *This function should raise "No data present" if no data is available.* #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------------- | | roundId | uint80 | - The latest round ID. | | answer | int256 | - The latest answer. | | startedAt | uint256 | - The timestamp when the latest round started. | | updatedAt | uint256 | - The timestamp when the latest round was updated. | | answeredInRound | uint80 | - The round ID in which the latest answer was computed. | ### latestTimestamp ```solidity function latestTimestamp() external view returns (uint256) ``` Gets the timestamp of the latest answer from the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | --------------------------------------------- | | [0] | uint256 | uint256 - The timestamp of the latest answer. | ### proposeAggregator ```solidity function proposeAggregator(contract AggregatorV2V3Interface _aggregator) external ``` Proposes a new aggregator. #### Parameters | Name | Type | Description | | ------------ | -------------------------------- | ----------------------------------------- | | _aggregator | contract AggregatorV2V3Interface | - The address of the proposed aggregator. | ### updateAnswer ```solidity function updateAnswer(int256 _answer) public ``` Updates the answer in the mock aggregator. #### Parameters | Name | Type | Description | | -------- | ------ | --------------------------- | | _answer | int256 | - The new answer to be set. | ### updateRoundData ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` Updates the round data in the mock aggregator. #### Parameters | Name | Type | Description | | ----------- | ------- | --------------------------------------- | | _roundId | uint80 | - The round ID to be updated. | | _answer | int256 | - The new answer to be set. | | _timestamp | uint256 | - The timestamp to be set. | | _startedAt | uint256 | - The timestamp when the round started. | --- # MockVerifierProxy v0.2.5 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.5/mock-verifier-proxy > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.5 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.5 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.5 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.5/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockVerifierProxy Mock Data Streams verifier proxy. [MockVerifierProxy](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-streams/MockVerifierProxy.sol) ## Variables ### s_feeManager ```solidity contract IVerifierFeeManager s_feeManager ``` ### s_verifier ```solidity address s_verifier ``` ## Errors ### VerifierInvalid ```solidity error VerifierInvalid() ``` ### VerifierNotFound ```solidity error VerifierNotFound() ``` ### ZeroAddress ```solidity error ZeroAddress() ``` ## Events ### VerifierInitialized ```solidity event VerifierInitialized(address verifierAddress) ``` ## Functions ### _verify ```solidity function _verify(bytes payload) internal returns (bytes) ``` ### getVerifier ```solidity function getVerifier(bytes32) external view returns (address) ``` ### initializeVerifier ```solidity function initializeVerifier(address verifierAddress) external ``` ### setFeeManager ```solidity function setFeeManager(contract IVerifierFeeManager feeManager) external ``` ### verify ```solidity function verify(bytes payload, bytes parameterPayload) external payable returns (bytes) ``` ### verifyBulk ```solidity function verifyBulk(bytes[] payloads, bytes parameterPayload) external payable returns (bytes[] verifiedReports) ``` --- # MockVerifier v0.2.5 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.5/mock-verifier > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.5 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.5 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.5 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.5/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockVerifier Mock Data Streams verifier. [MockVerifier](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-streams/MockVerifier.sol) ## Variables ### i_verifierProxy ```solidity address i_verifierProxy ``` ### MOCK_DATA_STREAM_DON_ADDRESS ```solidity address MOCK_DATA_STREAM_DON_ADDRESS ``` ### N_2 ```solidity uint256 N_2 ``` ### s_inactiveDigests ```solidity mapping(bytes32 => mapping(bytes32 => bool)) s_inactiveDigests ``` ### s_inactiveFeeds ```solidity mapping(bytes32 => bool) s_inactiveFeeds ``` ### s_verifiedSignatures ```solidity mapping(bytes => bool) s_verifiedSignatures ``` ## Errors ### AccessForbidden ```solidity error AccessForbidden() ``` ### AlreadyUsedSignature ```solidity error AlreadyUsedSignature() ``` ### BadVerification ```solidity error BadVerification() ``` ### DigestInactive ```solidity error DigestInactive(bytes32 feedId, bytes32 configDigest) ``` ### InactiveFeed ```solidity error InactiveFeed(bytes32 feedId) ``` ### InvalidS ```solidity error InvalidS() ``` ### InvalidSignatureLength ```solidity error InvalidSignatureLength() ``` ### InvalidV ```solidity error InvalidV() ``` ## Events ### ReportVerified ```solidity event ReportVerified(bytes32 feedId, address sender) ``` ## Functions ### activateConfig ```solidity function activateConfig(bytes32 feedId, bytes32 configDigest) external ``` ### activateFeed ```solidity function activateFeed(bytes32 feedId) external ``` ### constructor ```solidity constructor(address verifierProxy) public ``` ### deactivateConfig ```solidity function deactivateConfig(bytes32 feedId, bytes32 configDigest) external ``` ### deactivateFeed ```solidity function deactivateFeed(bytes32 feedId) external ``` ### supportsInterface ```solidity function supportsInterface(bytes4 interfaceId) external pure returns (bool) ``` _Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding [https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP) section] to learn more about how these ids are created. This function call must use less than 30 000 gas._ ### verify ```solidity function verify(bytes signedReport, address sender) external returns (bytes verifierResponse) ``` --- # Register v0.2.5 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.5/register > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.5 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.5 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.5 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.5/src/ccip/CCIPLocalSimulator.sol"; > ``` ## Register CCIP network configuration registry. [Register](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/ccip/Register.sol) ## Structs ### NetworkDetails ```solidity struct NetworkDetails { uint64 chainSelector; address routerAddress; address linkAddress; address wrappedNativeAddress; address ccipBnMAddress; address ccipLnMAddress; address rmnProxyAddress; address registryModuleOwnerCustomAddress; address tokenAdminRegistryAddress; } ``` ## Variables ### s_networkDetails ```solidity mapping(uint256 => struct Register.NetworkDetails) s_networkDetails ``` Mapping to store network details based on chain ID. ## Functions ### constructor ```solidity constructor() public ``` Constructor to initialize the network details for various chains. ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails networkDetails) ``` Retrieves network details for a given chain ID. #### Parameters | Name | Type | Description | | ------- | ------- | --------------------------------------------- | | chainId | uint256 | - The ID of the chain to get the details for. | #### Returns | Name | Type | Description | | -------------- | ------------------------------ | ------------------------------------------------- | | networkDetails | struct Register.NetworkDetails | - The network details for the specified chain ID. | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external ``` Sets the network details for a given chain ID. #### Parameters | Name | Type | Description | | -------------- | ------------------------------ | -------------------------------------------------------- | | chainId | uint256 | - The ID of the chain to set the details for. | | networkDetails | struct Register.NetworkDetails | - The network details to set for the specified chain ID. | --- # ReportVersions v0.2.5 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.5/report-versions > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.5 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.5 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.5 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.5/src/ccip/CCIPLocalSimulator.sol"; > ``` ## ReportVersions Data Streams report schemas. [ReportVersions](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-streams/ReportVersions.sol) ## Structs ### ReportV2 *Represents a data report from a Data Streams stream for v2 schema (crypto streams). The `price` value is carried to either 8 or 18 decimal places, depending on the stream. For more information, see [https://docs.chain.link/data-streams/crypto-streams](https://docs.chain.link/data-streams/crypto-streams) and [https://docs.chain.link/data-streams/reference/report-schema](https://docs.chain.link/data-streams/reference/report-schema)* ```solidity struct ReportV2 { bytes32 feedId; uint32 validFromTimestamp; uint32 observationsTimestamp; uint192 nativeFee; uint192 linkFee; uint32 expiresAt; int192 benchmarkPrice; } ``` ### ReportV3 *Represents a data report from a Data Streams stream for v3 schema (crypto streams). The `price`, `bid`, and `ask` values are carried to either 8 or 18 decimal places, depending on the stream. For more information, see [https://docs.chain.link/data-streams/crypto-streams](https://docs.chain.link/data-streams/crypto-streams) and [https://docs.chain.link/data-streams/reference/report-schema](https://docs.chain.link/data-streams/reference/report-schema)* ```solidity struct ReportV3 { bytes32 feedId; uint32 validFromTimestamp; uint32 observationsTimestamp; uint192 nativeFee; uint192 linkFee; uint32 expiresAt; int192 price; int192 bid; int192 ask; } ``` ### ReportV4 *Represents a data report from a Data Streams stream for v4 schema (RWA stream). The `price` value is carried to either 8 or 18 decimal places, depending on the stream. The `marketStatus` indicates whether the market is currently open. Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). For more information, see [https://docs.chain.link/data-streams/rwa-streams](https://docs.chain.link/data-streams/rwa-streams) and [https://docs.chain.link/data-streams/reference/report-schema-v4](https://docs.chain.link/data-streams/reference/report-schema-v4)* ```solidity struct ReportV4 { bytes32 feedId; uint32 validFromTimestamp; uint32 observationsTimestamp; uint192 nativeFee; uint192 linkFee; uint32 expiresAt; int192 price; uint32 marketStatus; } ``` --- # WETH9 v0.2.5 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.5/weth9 > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.5 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.5 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.5 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.5/src/ccip/CCIPLocalSimulator.sol"; > ``` ## WETH9 Wrapped Ether implementation. [WETH9](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/shared/WETH9.sol) ## Variables ### allowance ```solidity mapping(address => mapping(address => uint256)) allowance ``` ### balanceOf ```solidity mapping(address => uint256) balanceOf ``` ### decimals ```solidity uint8 decimals ``` ### name ```solidity string name ``` ### symbol ```solidity string symbol ``` ## Events ### Approval ```solidity event Approval(address src, address guy, uint256 wad) ``` ### Deposit ```solidity event Deposit(address dst, uint256 wad) ``` ### Transfer ```solidity event Transfer(address src, address dst, uint256 wad) ``` ### Withdrawal ```solidity event Withdrawal(address src, uint256 wad) ``` ## Functions ### _deposit ```solidity function _deposit() internal ``` ### approve ```solidity function approve(address guy, uint256 wad) public returns (bool) ``` ### deposit ```solidity function deposit() external payable ``` ### receive ```solidity receive() external payable ``` ### totalSupply ```solidity function totalSupply() public view returns (uint256) ``` ### transfer ```solidity function transfer(address dst, uint256 wad) public returns (bool) ``` ### transferFrom ```solidity function transferFrom(address src, address dst, uint256 wad) public returns (bool) ``` ### withdraw ```solidity function withdraw(uint256 wad) external ``` --- # AggregatorInterface v0.2.6 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.6/aggregator-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.6 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.6 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.6 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.6/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorInterface Basic price feed interface. [AggregatorInterface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-feeds/interfaces/AggregatorInterface.sol) ## Events ### AnswerUpdated ```solidity event AnswerUpdated(int256 current, uint256 roundId, uint256 updatedAt) ``` Emitted when the answer is updated. #### Parameters | Name | Type | Description | | --------- | ------- | ------------------------------------------------ | | current | int256 | - The updated answer. | | roundId | uint256 | - The round ID for which the answer was updated. | | updatedAt | uint256 | - The timestamp when the answer was updated. | ### NewRound ```solidity event NewRound(uint256 roundId, address startedBy, uint256 startedAt) ``` Emitted when a new round is started. #### Parameters | Name | Type | Description | | --------- | ------- | ---------------------------------------------------- | | roundId | uint256 | - The round ID of the new round. | | startedBy | address | - The address of the account that started the round. | | startedAt | uint256 | - The timestamp when the round was started. | ## Functions ### getAnswer ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` Gets the answer for a specific round ID. #### Parameters | Name | Type | Description | | ------- | ------- | ------------------------------------- | | roundId | uint256 | - The round ID to get the answer for. | #### Returns | Name | Type | Description | | ---- | ------ | ------------------------------------------- | | [0] | int256 | int256 - The answer for the given round ID. | ### getTimestamp ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` Gets the timestamp for a specific round ID. #### Parameters | Name | Type | Description | | ------- | ------- | ---------------------------------------- | | roundId | uint256 | - The round ID to get the timestamp for. | #### Returns | Name | Type | Description | | ---- | ------- | ----------------------------------------------- | | [0] | uint256 | uint256 - The timestamp for the given round ID. | ### latestAnswer ```solidity function latestAnswer() external view returns (int256) ``` Gets the latest answer from the aggregator. #### Returns | Name | Type | Description | | ---- | ------ | --------------------------- | | [0] | int256 | int256 - The latest answer. | ### latestRound ```solidity function latestRound() external view returns (uint256) ``` Gets the latest round ID from the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | ------------------------------ | | [0] | uint256 | uint256 - The latest round ID. | ### latestTimestamp ```solidity function latestTimestamp() external view returns (uint256) ``` Gets the timestamp of the latest answer from the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | --------------------------------------------- | | [0] | uint256 | uint256 - The timestamp of the latest answer. | --- # AggregatorV2V3Interface v0.2.6 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.6/aggregator-v2-v3-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.6 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.6 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.6 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.6/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorV2V3Interface Combined V2/V3 price feed interface. [AggregatorV2V3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-feeds/interfaces/AggregatorV2V3Interface.sol) --- # AggregatorV3Interface v0.2.6 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.6/aggregator-v3-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.6 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.6 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.6 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.6/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorV3Interface Extended price feed interface. [AggregatorV3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-feeds/interfaces/AggregatorV3Interface.sol) ## Functions ### decimals ```solidity function decimals() external view returns (uint8) ``` Gets the number of decimals used by the aggregator. #### Returns | Name | Type | Description | | ---- | ----- | ------------------------------- | | [0] | uint8 | uint8 - The number of decimals. | ### description ```solidity function description() external view returns (string) ``` Gets the description of the aggregator. #### Returns | Name | Type | Description | | ---- | ------ | -------------------------------------------------- | | [0] | string | string memory - The description of the aggregator. | ### getRoundData ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the round data for a specific round ID. *This function should raise "No data present" if no data is available for the given round ID.* #### Parameters | Name | Type | Description | | --------- | ------ | ----------------------------------- | | _roundId | uint80 | - The round ID to get the data for. | #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------ | | roundId | uint80 | - The round ID. | | answer | int256 | - The answer for the round. | | startedAt | uint256 | - The timestamp when the round started. | | updatedAt | uint256 | - The timestamp when the round was updated. | | answeredInRound | uint80 | - The round ID in which the answer was computed. | ### latestRoundData ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the latest round data. *This function should raise "No data present" if no data is available.* #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------------- | | roundId | uint80 | - The latest round ID. | | answer | int256 | - The latest answer. | | startedAt | uint256 | - The timestamp when the latest round started. | | updatedAt | uint256 | - The timestamp when the latest round was updated. | | answeredInRound | uint80 | - The round ID in which the latest answer was computed. | ### version ```solidity function version() external view returns (uint256) ``` Gets the version of the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | ---------------------------------------- | | [0] | uint256 | uint256 - The version of the aggregator. | --- # BurnMintERC677Helper v0.2.6 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.6/burn-mint-erc677-helper > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.6 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.6 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.6 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.6/src/ccip/CCIPLocalSimulator.sol"; > ``` ## BurnMintERC677Helper Helper contract for ERC677 token operations. [BurnMintERC677Helper](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/ccip/BurnMintERC677Helper.sol) ## Functions ### constructor ```solidity constructor(string name, string symbol) public ``` Constructor to initialize the BurnMintERC677Helper contract with a name and symbol. *Calls the parent constructor of BurnMintERC677 with fixed decimals (18) and initial supply (0).* #### Parameters | Name | Type | Description | | ------ | ------ | -------------------------- | | name | string | - The name of the token. | | symbol | string | - The symbol of the token. | ### drip ```solidity function drip(address to) external ``` Mints one full token (1e18) to the specified address. *Calls the internal `_mint` function from the BurnMintERC677 contract.* #### Parameters | Name | Type | Description | | ---- | ------- | ------------------------------------------ | | to | address | - The address to receive the minted token. | --- # CCIPLocalSimulatorFork JS v0.2.6 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.6/ccip-local-simulator-fork-js > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.6 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.6 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.6 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.6/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulatorFork JS Hardhat 2 JavaScript helpers for fork routing. [CCIPLocalSimulatorFork JS](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/scripts/CCIPLocalSimulatorFork.js) ## Types ### Evm2EvmMessage : `Object` **Properties** | Name | Type | | ------------------- | ------------------------------------------ | | sourceChainSelector | `bigint` | | sender | `string` | | receiver | `string` | | sequenceNumber | `bigint` | | gasLimit | `bigint` | | strict | `boolean` | | nonce | `bigint` | | feeToken | `string` | | feeTokenAmount | `bigint` | | data | `string` | | tokenAmounts | `Array.<\{token: string, amount: bigint}>` | | sourceTokenData | `Array.` | | messageId | `string` | ## Functions ### requestLinkFromTheFaucet(linkAddress, to, amount) ⇒ `Promise.` Requests LINK tokens from the faucet and returns the transaction hash **Returns**: `Promise.` - Promise resolving to the transaction hash of the fund transfer | Param | Type | Description | | ----------- | -------- | ------------------------------------------------------- | | linkAddress | `string` | The address of the LINK contract on the current network | | to | `string` | The address to send LINK to | | amount | `bigint` | The amount of LINK to request | ### getEvm2EvmMessage(receipt) ⇒ `Evm2EvmMessage` | `null` Parses a transaction receipt to extract the sent message Scans through transaction logs to find a `CCIPSendRequested` event and then decodes it to an object **Returns**: `Evm2EvmMessage` | `null` - Returns either the sent message or null if provided receipt does not contain `CCIPSendRequested` log | Param | Type | Description | | ------- | -------- | ------------------------------------------------ | | receipt | `object` | The transaction receipt from the `ccipSend` call | ### getEvm2AnyRampMessage(receipt) ⇒ `object` | `null` Parses a transaction receipt to extract the sent message from CCIPMessageSent **Returns**: `object` | `null` - Returns \{ destChainSelector, sequenceNumber, EVM2AnyRampMessage message } or null | Param | Type | Description | | ------- | -------- | ------------------------------------------ | | receipt | `object` | – The tx receipt from the on-ramp contract | ### routeMessage(routerAddress, evm2EvmMessage) ⇒ `Promise.` Routes the sent message from the source network on the destination (current) network **Returns**: `Promise.` - Either resolves with no value if the message is successfully routed, or reverts\ **Throws**: - `Error` Fails if no off-ramp matches the message's source chain selector or if calling `router.getOffRamps()` | Param | Type | Description | | -------------- | ---------------- | --------------------------------- | | routerAddress | `string` | Address of the destination Router | | evm2EvmMessage | `Evm2EvmMessage` | Sent cross-chain message | --- # CCIPLocalSimulatorFork v0.2.6 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.6/ccip-local-simulator-fork > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.6 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.6 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.6 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.6/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulatorFork CCIP simulator for forked networks. [CCIPLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/ccip/CCIPLocalSimulatorFork.sol) ## Structs ### EVM2EVMMessage ```solidity struct EVM2EVMMessage { uint64 sourceChainSelector; address sender; address receiver; uint64 sequenceNumber; uint256 gasLimit; bool strict; uint64 nonce; address feeToken; uint256 feeTokenAmount; bytes data; struct Client.EVMTokenAmount[] tokenAmounts; bytes[] sourceTokenData; bytes32 messageId; } ``` ### OffRamp Structure representing an offRamp configuration #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | ```solidity struct OffRamp { uint64 sourceChainSelector; address offRamp; } ``` ## Variables ### DEFAULT_GAS_LIMIT ```solidity uint32 DEFAULT_GAS_LIMIT ``` ### i_register ```solidity contract Register i_register ``` The immutable register instance ### LINK_FAUCET ```solidity address LINK_FAUCET ``` The address of the LINK faucet ### s_processedMessages ```solidity mapping(bytes32 => bool) s_processedMessages ``` Mapping to track processed messages ## Errors ### InvalidExtraArgsTag ```solidity error InvalidExtraArgsTag() ``` ## Events ### CCIPMessageSent ```solidity event CCIPMessageSent(uint64 destChainSelector, uint64 sequenceNumber, struct Internal.EVM2AnyRampMessage message) ``` ### CCIPSendRequested ```solidity event CCIPSendRequested(struct InternalPreV1dot6.EVM2EVMMessage message) ``` Events emitted when a CCIP send request is made ## Functions ### _fromBytes ```solidity function _fromBytes(bytes extraArgs) internal pure returns (struct Client.GenericExtraArgsV2) ``` Internal helper function to decode extraArgs bytes to GenericExtraArgsV2 struct. Supports decoding of both GenericExtraArgsV2 and EVMExtraArgsV1 structs. #### Parameters | Name | Type | Description | | --------- | ----- | --------------------------------------------- | | extraArgs | bytes | - The bytes representing the extra arguments. | #### Returns | Name | Type | Description | | ---- | -------------------------------- | --------------------------------------------------------- | | [0] | struct Client.GenericExtraArgsV2 | genericExtraArgs - The decoded GenericExtraArgsV2 struct. | ### _routeCapturedMessages ```solidity function _routeCapturedMessages(uint256[] forkIds, uint256 sourceForkId, address sourceRouterAddress) internal ``` Internal function to route captured messages to their respective destination forks. #### Parameters | Name | Type | Description | | ------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------- | | forkIds | uint256[] | - The IDs of the destination network forks. These are the returned values of `createFork()` or `createSelectFork()`, not chainIds. | | sourceForkId | uint256 | - The ID of the source network fork. This is the returned value of `createFork()` or `createSelectFork()`, not chainId. | | sourceRouterAddress | address | - The address of the Router on the source chain. | ### constructor ```solidity constructor() public ``` Constructor to initialize the contract ### executeSingleMessage ```solidity function executeSingleMessage(struct Internal.Any2EVMRampMessage message, bytes[] offchainTokenData, uint32[] tokenGasOverrides) external ``` Executes a single CCIP message on the offRamp #### Parameters | Name | Type | Description | | ----------------- | ---------------------------------- | --------------------------------- | | message | struct Internal.Any2EVMRampMessage | - The CCIP message to be executed | | offchainTokenData | bytes[] | - Additional offchain token data | | tokenGasOverrides | uint32[] | | ### executeSingleMessage ```solidity function executeSingleMessage(struct InternalPreV1dot6.EVM2EVMMessage message, bytes[] offchainTokenData, uint32[] tokenGasOverrides) external ``` Works with Foundry only ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) ``` Returns the default values for currently CCIP supported networks. If network is not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Name | Type | Description | | ------- | ------- | ------------------------------------------------------------------------------------------------------ | | chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | #### Returns | Name | Type | Description | | ---- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | ### getOffRamps ```solidity function getOffRamps() external view returns (struct IRouterFork.OffRamp[]) ``` Gets the list of offRamps #### Returns | Name | Type | Description | | ---- | ----------------------------- | ----------------------------------- | | [0] | struct IRouterFork.OffRamp[] | offRamps - Array of OffRamp structs | ### getOnRamp ```solidity function getOnRamp(uint64 destChainSelector) external view returns (address) ``` Return the configured onramp for specific a destination chain. @param destChainSelector The destination chain Id to get the onRamp for. #### Returns | Name | Type | Description | | ---- | ------- | -------------------------- | | [0] | address | The address of the onRamp. | ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------- | | to | address | - The address to which LINK tokens are to be sent. | | amount | uint256 | - The amount of LINK tokens to send. | #### Returns | Name | Type | Description | | ------- | ---- | ----------------------------------------------------------------------------- | | success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external ``` If network details are not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Name | Type | Description | | -------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | | networkDetails | struct Register.NetworkDetails | - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | ### switchChainAndRouteMessage ```solidity function switchChainAndRouteMessage(uint256 forkId) external ``` To be called after the sending of the cross-chain message (`ccipSend`). Goes through the list of past logs and looks for the `CCIPSendRequested` and `CCIPMessageSent` events. Switches to a destination network fork. Routes the sent cross-chain message on the destination network. If you sent more than one message, it will try to route all of them to `forkId`. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------------------------------------------------------------------- | | forkId | uint256 | - The ID of the destination network fork. This is the returned value of `createFork()` or `createSelectFork()` | ### switchChainAndRouteMessage ```solidity function switchChainAndRouteMessage(uint256[] forkIds) external ``` To be called after the sending of the cross-chain message (`ccipSend`). Override variant of the `switchChainAndRouteMessage(uint256 forkId)` function in case of multiple destination forks. Goes through the list of past logs and looks for the `CCIPSendRequested` and `CCIPMessageSent` events. Loops through provided `forkIds` and tries to route the message to correct destination. If you haven't provide correct `forkId`, the message will get lost. If you sent more than one message, it will try to route all of them to correct destinations. #### Parameters | Name | Type | Description | | ------- | ---------- | ------------------------------------------------------------------------------------------------------------------- | | forkIds | uint256[] | - The IDs of the destination network forks. These are the returned values of `createFork()` or `createSelectFork()` | --- # CCIPLocalSimulator v0.2.6 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.6/ccip-local-simulator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.6 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.6 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.6 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.6/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulator Local CCIP simulator (no-fork mode). [CCIPLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/ccip/CCIPLocalSimulator.sol) ## Variables ### CHAIN_SELECTOR ```solidity uint64 CHAIN_SELECTOR ``` The unique CCIP Chain Selector constant ### i_ccipBnM ```solidity contract BurnMintERC677Helper i_ccipBnM ``` The BurnMintERC677Helper instance for CCIP-BnM token ### i_ccipLnM ```solidity contract BurnMintERC677Helper i_ccipLnM ``` The BurnMintERC677Helper instance for CCIP-LnM token ### i_linkToken ```solidity contract LinkToken i_linkToken ``` The LINK token instance ### i_mockRouter ```solidity contract MockCCIPRouter i_mockRouter ``` The mock CCIP router instance ### i_wrappedNative ```solidity contract WETH9 i_wrappedNative ``` The wrapped native token instance ### s_supportedTokens ```solidity address[] s_supportedTokens ``` The list of supported token addresses ## Errors ### CCIPLocalSimulator__MsgSenderIsNotTokenOwner ```solidity error CCIPLocalSimulator__MsgSenderIsNotTokenOwner() ``` ### CCIPLocalSimulator__RequiredRoleNotFound ```solidity error CCIPLocalSimulator__RequiredRoleNotFound(address account, bytes32 role, address token) ``` ## Functions ### configuration ```solidity function configuration() public view returns (uint64 chainSelector_, contract IRouterClient sourceRouter_, contract IRouterClient destinationRouter_, contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract BurnMintERC677Helper ccipBnM_, contract BurnMintERC677Helper ccipLnM_) ``` Returns configuration details for pre-deployed contracts and services needed for local CCIP simulations. #### Returns | Name | Type | Description | | ------------------- | ----------------------------- | ----------------------------------------------------------- | | chainSelector_ | uint64 | - The unique CCIP Chain Selector. | | sourceRouter_ | contract IRouterClient | - The source chain Router contract. | | destinationRouter_ | contract IRouterClient | - The destination chain Router contract. | | wrappedNative_ | contract WETH9 | - The wrapped native token which can be used for CCIP fees. | | linkToken_ | contract LinkToken | - The LINK token. | | ccipBnM_ | contract BurnMintERC677Helper | - The ccipBnM token. | | ccipLnM_ | contract BurnMintERC677Helper | - The ccipLnM token. | ### constructor ```solidity constructor() public ``` Constructor to initialize the contract and pre-deployed token instances ### getSupportedTokens ```solidity function getSupportedTokens(uint64 chainSelector) external view returns (address[] tokens) ``` Gets a list of token addresses that are supported for cross-chain transfers by the simulator. #### Parameters | Name | Type | Description | | ------------- | ------ | --------------------------------- | | chainSelector | uint64 | - The unique CCIP Chain Selector. | #### Returns | Name | Type | Description | | ------ | ---------- | -------------------------------------------------------------------------------------------------- | | tokens | address[] | - Returns a list of token addresses that are supported for cross-chain transfers by the simulator. | ### isChainSupported ```solidity function isChainSupported(uint64 chainSelector) public pure returns (bool supported) ``` Checks whether the provided `chainSelector` is supported by the simulator. #### Parameters | Name | Type | Description | | ------------- | ------ | --------------------------------- | | chainSelector | uint64 | - The unique CCIP Chain Selector. | #### Returns | Name | Type | Description | | --------- | ---- | ---------------------------------------------------------------- | | supported | bool | - Returns true if `chainSelector` is supported by the simulator. | ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------- | | to | address | - The address to which LINK tokens are to be sent. | | amount | uint256 | - The amount of LINK tokens to send. | #### Returns | Name | Type | Description | | ------- | ---- | ----------------------------------------------------------------------------- | | success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | ### supportNewTokenViaAccessControlDefaultAdmin ```solidity function supportNewTokenViaAccessControlDefaultAdmin(address tokenAddress) external ``` Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. The caller must have the DEFAULT_ADMIN_ROLE as defined by the contract itself. Reverts if the caller is not the admin of the token using OZ's AccessControl DEFAULT_ADMIN_ROLE. #### Parameters | Name | Type | Description | | ------------ | ------- | ------------------------------------------------------------------ | | tokenAddress | address | - The address of the token to add to the list of supported tokens. | ### supportNewTokenViaGetCCIPAdmin ```solidity function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external ``` Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. Reverts if token does not implement getCCIPAdmin() function. Reverts if the caller is not the token CCIPAdmin. #### Parameters | Name | Type | Description | | ------------ | ------- | ------------------------------------------------------------------ | | tokenAddress | address | - The address of the token to add to the list of supported tokens. | ### supportNewTokenViaOwner ```solidity function supportNewTokenViaOwner(address tokenAddress) external ``` Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. Reverts if token does not implement owner() function. Reverts if the caller is not the token owner. #### Parameters | Name | Type | Description | | ------------ | ------- | ------------------------------------------------------------------ | | tokenAddress | address | - The address of the token to add to the list of supported tokens. | --- # DataStreamsLocalSimulatorFork v0.2.6 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.6/data-streams-local-simulator-fork > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.6 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.6 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.6 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.6/src/ccip/CCIPLocalSimulator.sol"; > ``` ## DataStreamsLocalSimulatorFork Data Streams simulator for forked networks. [DataStreamsLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-streams/DataStreamsLocalSimulatorFork.sol) ## Variables ### i_register ```solidity contract Register i_register ``` The immutable register instance ### LINK_FAUCET ```solidity address LINK_FAUCET ``` The address of the LINK faucet ## Functions ### constructor ```solidity constructor() public ``` Constructor to initialize the contract ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) ``` Returns the default values for currently Data Streams supported networks. If network is not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Name | Type | Description | | ------- | ------- | ----------------------------------------------------------------------------- | | chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | #### Returns | Name | Type | Description | | ---- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | | [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------- | | to | address | - The address to which LINK tokens are to be sent. | | amount | uint256 | - The amount of LINK tokens to send. | #### Returns | Name | Type | Description | | ------- | ---- | ----------------------------------------------------------------------------- | | success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | ### requestNativeFromFaucet ```solidity function requestNativeFromFaucet(address to, uint256 amount) external ``` Requests native coints from the faucet. #### Parameters | Name | Type | Description | | ------ | ------- | --------------------------------------------------- | | to | address | - The address to which native coins are to be sent. | | amount | uint256 | - The amount of native coins to send. | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external ``` If network details are not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Name | Type | Description | | -------------- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- | | chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | | networkDetails | struct Register.NetworkDetails | - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | --- # DataStreamsLocalSimulator v0.2.6 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.6/data-streams-local-simulator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.6 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.6 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.6 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.6/src/ccip/CCIPLocalSimulator.sol"; > ``` ## DataStreamsLocalSimulator Local Data Streams simulator (no-fork mode). [DataStreamsLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-streams/DataStreamsLocalSimulator.sol) ## Variables ### i_linkToken ```solidity contract LinkToken i_linkToken ``` The LINK token instance ### i_wrappedNative ```solidity contract WETH9 i_wrappedNative ``` The wrapped native token instance ### s_mockFeeManager ```solidity contract MockFeeManager s_mockFeeManager ``` ### s_mockRewardManager ```solidity contract MockRewardManager s_mockRewardManager ``` ### s_mockVerifier ```solidity contract MockVerifier s_mockVerifier ``` ### s_mockVerifierProxy ```solidity contract MockVerifierProxy s_mockVerifierProxy ``` ## Functions ### configuration ```solidity function configuration() public view returns (contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract MockVerifier mockVerifier_, contract MockVerifierProxy mockVerifierProxy_, contract MockFeeManager mockFeeManager_, contract MockRewardManager mockRewardManager_) ``` @notice Returns configuration details for pre-deployed contracts and services needed for local Data Streams simulations. #### Returns | Name | Type | Description | | ------------------- | -------------------------- | ----------------------------------- | | wrappedNative_ | contract WETH9 | - The wrapped native token. | | linkToken_ | contract LinkToken | - The LINK token. | | mockVerifier_ | contract MockVerifier | - The mock verifier contract. | | mockVerifierProxy_ | contract MockVerifierProxy | - The mock verifier proxy contract. | | mockFeeManager_ | contract MockFeeManager | - The mock fee manager contract. | | mockRewardManager_ | contract MockRewardManager | - The mock reward manager contract. | ### constructor ```solidity constructor() public ``` ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------- | | to | address | - The address to which LINK tokens are to be sent. | | amount | uint256 | - The amount of LINK tokens to send. | #### Returns | Name | Type | Description | | ------- | ---- | ----------------------------------------------------------------------------- | | success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | --- # Register (Data Streams) v0.2.6 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.6/data-streams-register > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.6 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.6 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.6 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.6/src/ccip/CCIPLocalSimulator.sol"; > ``` ## Register (Data Streams) Data Streams network configuration registry. [Register (Data Streams)](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-streams/Register.sol) ## Structs ### NetworkDetails ```solidity struct NetworkDetails { address verifierProxyAddress; address linkAddress; } ``` ## Variables ### s_networkDetails ```solidity mapping(uint256 => struct Register.NetworkDetails) s_networkDetails ``` Mapping to store network details based on chain ID. ## Functions ### constructor ```solidity constructor() public ``` Constructor to initialize the network details for various chains. ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails networkDetails) ``` Retrieves network details for a given chain ID. #### Parameters | Name | Type | Description | | ------- | ------- | --------------------------------------------- | | chainId | uint256 | - The ID of the chain to get the details for. | #### Returns | Name | Type | Description | | -------------- | ------------------------------ | ------------------------------------------------- | | networkDetails | struct Register.NetworkDetails | - The network details for the specified chain ID. | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external ``` Sets the network details for a given chain ID. #### Parameters | Name | Type | Description | | -------------- | ------------------------------ | -------------------------------------------------------- | | chainId | uint256 | - The ID of the chain to set the details for. | | networkDetails | struct Register.NetworkDetails | - The network details to set for the specified chain ID. | --- # Chainlink Local v0.2.6 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.6 > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.6 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.6 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.6 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.6/src/ccip/CCIPLocalSimulator.sol"; > ``` Chainlink Local v0.2.6 adds `CCIPLocalSimulatorFork.switchChainAndRouteMessage(uint256[] memory chainIds)` for routing multiple CCIP messages to multiple chains in a single call, and refactors the fork simulator so it routes every message sent from a loop, not just the first one. ## CCIP These contracts provide Cross-Chain Interoperability Protocol (CCIP) functionality in a local testing environment: - [CCIPLocalSimulator](/chainlink-local/api-reference/v0.2.6/ccip-local-simulator) - Local CCIP simulator (no-fork mode) - [CCIPLocalSimulatorFork](/chainlink-local/api-reference/v0.2.6/ccip-local-simulator-fork) - CCIP simulator for forked networks - [CCIPLocalSimulatorFork JS](/chainlink-local/api-reference/v0.2.6/ccip-local-simulator-fork-js) - JavaScript helpers for fork routing - [Register](/chainlink-local/api-reference/v0.2.6/register) - CCIP network configuration registry ## Data Streams Contracts for simulating Chainlink Data Streams: - [DataStreamsLocalSimulator](/chainlink-local/api-reference/v0.2.6/data-streams-local-simulator) - Local Data Streams simulator (no-fork mode) - [DataStreamsLocalSimulatorFork](/chainlink-local/api-reference/v0.2.6/data-streams-local-simulator-fork) - Data Streams simulator for forked networks - [MockVerifier](/chainlink-local/api-reference/v0.2.6/mock-verifier) - Mock Data Streams verifier - [MockVerifierProxy](/chainlink-local/api-reference/v0.2.6/mock-verifier-proxy) - Mock Data Streams verifier proxy - [MockReportGenerator](/chainlink-local/api-reference/v0.2.6/mock-report-generator) - Signed report generator for every report schema - [MockFeeManager](/chainlink-local/api-reference/v0.2.6/mock-fee-manager) - Mock verifier fee manager - [MockRewardManager](/chainlink-local/api-reference/v0.2.6/mock-reward-manager) - Mock reward manager - [ReportVersions](/chainlink-local/api-reference/v0.2.6/report-versions) - Data Streams report schemas - [Register (Data Streams)](/chainlink-local/api-reference/v0.2.6/data-streams-register) - Data Streams network configuration registry ## Data Feeds Contracts for simulating Chainlink Data Feeds: - [AggregatorInterface](/chainlink-local/api-reference/v0.2.6/aggregator-interface) - Basic price feed interface - [AggregatorV2V3Interface](/chainlink-local/api-reference/v0.2.6/aggregator-v2-v3-interface) - Combined V2/V3 price feed interface - [AggregatorV3Interface](/chainlink-local/api-reference/v0.2.6/aggregator-v3-interface) - Extended price feed interface - [MockOffchainAggregator](/chainlink-local/api-reference/v0.2.6/mock-offchain-aggregator) - Mock implementation of off-chain aggregator - [MockV3Aggregator](/chainlink-local/api-reference/v0.2.6/mock-v3-aggregator) - Mock implementation of V3 aggregator ## Token Contracts Standard token implementations for testing: - [BurnMintERC677Helper](/chainlink-local/api-reference/v0.2.6/burn-mint-erc677-helper) - Helper contract for ERC677 token operations - [LinkToken](/chainlink-local/api-reference/v0.2.6/link-token) - LINK token implementation - [WETH9](/chainlink-local/api-reference/v0.2.6/weth9) - Wrapped Ether implementation --- # LinkToken v0.2.6 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.6/link-token > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.6 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.6 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.6 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.6/src/ccip/CCIPLocalSimulator.sol"; > ``` ## LinkToken LINK token implementation. [LinkToken](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/shared/LinkToken.sol) ## Functions ### _onCreate ```solidity function _onCreate() internal virtual ``` Hook that is called when this contract is created. *Useful to override constructor behaviour in child contracts (e.g., LINK bridge tokens). The default implementation mints 10\*\*27 tokens to the contract deployer.* ### constructor ```solidity constructor() public ``` Constructor to initialize the LinkToken contract with a fixed total supply, name, and symbol. *Calls the ERC677 constructor with the name and symbol, and then mints the total supply to the contract deployer.* --- # MockFeeManager v0.2.6 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.6/mock-fee-manager > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.6 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.6 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.6 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.6/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockFeeManager Mock verifier fee manager. [MockFeeManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-streams/MockFeeManager.sol) ## Structs ### Asset ```solidity struct Asset { address assetAddress; uint256 amount; } ``` ## Variables ### i_linkAddress ```solidity address i_linkAddress ``` ### i_nativeAddress ```solidity address i_nativeAddress ``` ### i_proxyAddress ```solidity address i_proxyAddress ``` ### i_rewardManager ```solidity contract IRewardManager i_rewardManager ``` ### s_mockDiscounts ```solidity mapping(address => uint256) s_mockDiscounts ``` ### s_nativeSurcharge ```solidity uint256 s_nativeSurcharge ``` ## Errors ### ExpiredReport ```solidity error ExpiredReport() ``` ### InvalidAddress ```solidity error InvalidAddress() ``` ### InvalidDeposit ```solidity error InvalidDeposit() ``` ### InvalidDiscount ```solidity error InvalidDiscount() ``` ### InvalidQuote ```solidity error InvalidQuote() ``` ### InvalidSurcharge ```solidity error InvalidSurcharge() ``` ### Unauthorized ```solidity error Unauthorized() ``` ## Functions ### _processFee ```solidity function _processFee(bytes payload, bytes parameterPayload, address subscriber) internal ``` ### constructor ```solidity constructor(address linkAddress, address nativeAddress, address proxyAddress, address rewardManager) public ``` ### getFeeAndReward ```solidity function getFeeAndReward(address subscriber, bytes report, address quoteAddress) public view returns (struct Common.Asset, struct Common.Asset, uint256) ``` ### getMockDiscount ```solidity function getMockDiscount(address subscriber) external view returns (uint256) ``` ### processFee ```solidity function processFee(bytes payload, bytes parameterPayload, address subscriber) external payable ``` ### processFeeBulk ```solidity function processFeeBulk(bytes[] payloads, bytes parameterPayload, address subscriber) external payable ``` ### setMockDiscount ```solidity function setMockDiscount(address subscriber, uint256 discount) external ``` ### setNativeSurcharge ```solidity function setNativeSurcharge(uint64 surcharge) external ``` ### supportsInterface ```solidity function supportsInterface(bytes4 interfaceId) external pure returns (bool) ``` _Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding [https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP) section] to learn more about how these ids are created. This function call must use less than 30 000 gas._ --- # MockOffchainAggregator v0.2.6 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.6/mock-offchain-aggregator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.6 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.6 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.6 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.6/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockOffchainAggregator Mock implementation of off-chain aggregator. [MockOffchainAggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-feeds/MockOffchainAggregator.sol) ## Variables ### decimals ```solidity uint8 decimals ``` The number of decimals used by the aggregator. ### getAnswer ```solidity mapping(uint256 => int256) getAnswer ``` Mapping to get the answer for a specific round ID. ### getTimestamp ```solidity mapping(uint256 => uint256) getTimestamp ``` Mapping to get the timestamp for a specific round ID. ### latestAnswer ```solidity int256 latestAnswer ``` The latest answer reported by the aggregator. ### latestRound ```solidity uint256 latestRound ``` The latest round ID. ### latestTimestamp ```solidity uint256 latestTimestamp ``` The timestamp of the latest answer. ### maxAnswer ```solidity int192 maxAnswer ``` The maximum answer the aggregator is allowed to report. ### minAnswer ```solidity int192 minAnswer ``` The minimum answer the aggregator is allowed to report. ## Functions ### constructor ```solidity constructor(uint8 _decimals, int256 _initialAnswer) public ``` Constructor to initialize the MockOffchainAggregator contract with initial parameters. #### Parameters | Name | Type | Description | | --------------- | ------ | ------------------------------------------------------ | | _decimals | uint8 | - The number of decimals for the aggregator. | | _initialAnswer | int256 | - The initial answer to be set in the mock aggregator. | ### getRoundData ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the round data for a specific round ID. #### Parameters | Name | Type | Description | | --------- | ------ | ----------------------------------- | | _roundId | uint80 | - The round ID to get the data for. | #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------ | | roundId | uint80 | - The round ID. | | answer | int256 | - The answer for the round. | | startedAt | uint256 | - The timestamp when the round started. | | updatedAt | uint256 | - The timestamp when the round was updated. | | answeredInRound | uint80 | - The round ID in which the answer was computed. | ### latestRoundData ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the latest round data. #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------------- | | roundId | uint80 | - The latest round ID. | | answer | int256 | - The latest answer. | | startedAt | uint256 | - The timestamp when the latest round started. | | updatedAt | uint256 | - The timestamp when the latest round was updated. | | answeredInRound | uint80 | - The round ID in which the latest answer was computed. | ### updateAnswer ```solidity function updateAnswer(int256 _answer) public ``` Updates the answer in the mock aggregator. #### Parameters | Name | Type | Description | | -------- | ------ | --------------------------- | | _answer | int256 | - The new answer to be set. | ### updateMinAndMaxAnswers ```solidity function updateMinAndMaxAnswers(int192 _minAnswer, int192 _maxAnswer) external ``` Updates the minimum and maximum answers the aggregator can report. #### Parameters | Name | Type | Description | | ----------- | ------ | ------------------------- | | _minAnswer | int192 | - The new minimum answer. | | _maxAnswer | int192 | - The new maximum answer. | ### updateRoundData ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` Updates the round data in the mock aggregator. #### Parameters | Name | Type | Description | | ----------- | ------- | --------------------------------------- | | _roundId | uint80 | - The round ID to be updated. | | _answer | int256 | - The new answer to be set. | | _timestamp | uint256 | - The timestamp to be set. | | _startedAt | uint256 | - The timestamp when the round started. | --- # MockReportGenerator v0.2.6 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.6/mock-report-generator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.6 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.6 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.6 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.6/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockReportGenerator Signed report generator for every report schema. [MockReportGenerator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-streams/MockReportGenerator.sol) ## Variables ### i_donAddress ```solidity address i_donAddress ``` ### i_donDigest ```solidity uint256 i_donDigest ``` ### i_reportV2MockFeedId ```solidity bytes32 i_reportV2MockFeedId ``` ### i_reportV3MockFeedId ```solidity bytes32 i_reportV3MockFeedId ``` ### i_reportV4MockFeedId ```solidity bytes32 i_reportV4MockFeedId ``` ### s_ask ```solidity int192 s_ask ``` ### s_bid ```solidity int192 s_bid ``` ### s_expiresPeriod ```solidity uint32 s_expiresPeriod ``` ### s_linkFee ```solidity uint192 s_linkFee ``` ### s_marketStatus ```solidity uint32 s_marketStatus ``` ### s_nativeFee ```solidity uint192 s_nativeFee ``` ### s_price ```solidity int192 s_price ``` ## Errors ### MockReportGenerator__CastOverflow ```solidity error MockReportGenerator__CastOverflow() ``` ### MockReportGenerator__InvalidAsk ```solidity error MockReportGenerator__InvalidAsk() ``` ### MockReportGenerator__InvalidBid ```solidity error MockReportGenerator__InvalidBid() ``` ## Functions ### constructor ```solidity constructor(int192 initialPrice) public ``` ### generateReport ```solidity function generateReport(struct ReportVersions.ReportV2 report) external returns (bytes signedReport) ``` ### generateReport ```solidity function generateReport(struct ReportVersions.ReportV3 report) external returns (bytes signedReport) ``` ### generateReport ```solidity function generateReport(struct ReportVersions.ReportV4 report) external returns (bytes signedReport) ``` ### generateReportV2 ```solidity function generateReportV2() external returns (bytes signedReport, struct ReportVersions.ReportV2 report) ``` ### generateReportV3 ```solidity function generateReportV3() external returns (bytes signedReport, struct ReportVersions.ReportV3 report) ``` ### generateReportV4 ```solidity function generateReportV4() external returns (bytes signedReport, struct ReportVersions.ReportV4 report) ``` ### getMockDonAddress ```solidity function getMockDonAddress() external view returns (address) ``` ### updateExpiresPeriod ```solidity function updateExpiresPeriod(uint32 period) external ``` ### updateFees ```solidity function updateFees(uint192 nativeFee, uint192 linkFee) external ``` ### updateMarketStatus ```solidity function updateMarketStatus(uint32 status) external ``` ### updatePrice ```solidity function updatePrice(int192 price) public ``` ### updatePriceBidAndAsk ```solidity function updatePriceBidAndAsk(int192 price, int192 bid, int192 ask) external ``` --- # MockRewardManager v0.2.6 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.6/mock-reward-manager > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.6 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.6 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.6 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.6/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockRewardManager Mock reward manager. [MockRewardManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-streams/MockRewardManager.sol) ## Variables ### i_linkAddress ```solidity address i_linkAddress ``` ### s_feeManagerAddress ```solidity address s_feeManagerAddress ``` ## Errors ### Unauthorized ```solidity error Unauthorized() ``` ## Events ### FeePaid ```solidity event FeePaid(struct IRewardManager.FeePayment[] payments, address payer) ``` ## Functions ### claimRewards ```solidity function claimRewards(bytes32[]) external pure ``` ### constructor ```solidity constructor(address linkAddress) public ``` ### onFeePaid ```solidity function onFeePaid(struct IRewardManager.FeePayment[] payments, address payer) external ``` ### setFeeManager ```solidity function setFeeManager(address newFeeManager) external ``` ### supportsInterface ```solidity function supportsInterface(bytes4 interfaceId) external pure returns (bool) ``` _Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding [https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP) section] to learn more about how these ids are created. This function call must use less than 30 000 gas._ --- # MockV3Aggregator v0.2.6 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.6/mock-v3-aggregator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.6 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.6 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.6 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.6/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockV3Aggregator Mock implementation of V3 aggregator. [MockV3Aggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-feeds/MockV3Aggregator.sol) ## Variables ### aggregator ```solidity address aggregator ``` The address of the current aggregator. ### proposedAggregator ```solidity address proposedAggregator ``` The address of the proposed aggregator. ### version ```solidity uint256 version ``` The version of the aggregator. ## Functions ### confirmAggregator ```solidity function confirmAggregator(address _aggregator) external ``` Confirms the proposed aggregator. #### Parameters | Name | Type | Description | | ------------ | ------- | ----------------------------------------- | | _aggregator | address | - The address of the proposed aggregator. | ### constructor ```solidity constructor(uint8 _decimals, int256 _initialAnswer) public ``` Constructor to initialize the MockV3Aggregator contract with initial parameters. #### Parameters | Name | Type | Description | | --------------- | ------ | ------------------------------------------------------ | | _decimals | uint8 | - The number of decimals for the aggregator. | | _initialAnswer | int256 | - The initial answer to be set in the mock aggregator. | ### decimals ```solidity function decimals() external view returns (uint8) ``` Gets the number of decimals used by the aggregator. #### Returns | Name | Type | Description | | ---- | ----- | ------------------------------- | | [0] | uint8 | uint8 - The number of decimals. | ### description ```solidity function description() external pure returns (string) ``` Gets the description of the aggregator. #### Returns | Name | Type | Description | | ---- | ------ | -------------------------------------------------- | | [0] | string | string memory - The description of the aggregator. | ### getAnswer ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` Gets the answer for a specific round ID. #### Parameters | Name | Type | Description | | ------- | ------- | ------------------------------------- | | roundId | uint256 | - The round ID to get the answer for. | #### Returns | Name | Type | Description | | ---- | ------ | ------------------------------------------- | | [0] | int256 | int256 - The answer for the given round ID. | ### getRoundData ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the round data for a specific round ID. *This function should raise "No data present" if no data is available for the given round ID.* #### Parameters | Name | Type | Description | | --------- | ------ | ----------------------------------- | | _roundId | uint80 | - The round ID to get the data for. | #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------ | | roundId | uint80 | - The round ID. | | answer | int256 | - The answer for the round. | | startedAt | uint256 | - The timestamp when the round started. | | updatedAt | uint256 | - The timestamp when the round was updated. | | answeredInRound | uint80 | - The round ID in which the answer was computed. | ### getTimestamp ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` Gets the timestamp for a specific round ID. #### Parameters | Name | Type | Description | | ------- | ------- | ---------------------------------------- | | roundId | uint256 | - The round ID to get the timestamp for. | #### Returns | Name | Type | Description | | ---- | ------- | ----------------------------------------------- | | [0] | uint256 | uint256 - The timestamp for the given round ID. | ### latestAnswer ```solidity function latestAnswer() external view returns (int256) ``` Gets the latest answer from the aggregator. #### Returns | Name | Type | Description | | ---- | ------ | --------------------------- | | [0] | int256 | int256 - The latest answer. | ### latestRound ```solidity function latestRound() external view returns (uint256) ``` Gets the latest round ID from the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | ------------------------------ | | [0] | uint256 | uint256 - The latest round ID. | ### latestRoundData ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the latest round data. *This function should raise "No data present" if no data is available.* #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------------- | | roundId | uint80 | - The latest round ID. | | answer | int256 | - The latest answer. | | startedAt | uint256 | - The timestamp when the latest round started. | | updatedAt | uint256 | - The timestamp when the latest round was updated. | | answeredInRound | uint80 | - The round ID in which the latest answer was computed. | ### latestTimestamp ```solidity function latestTimestamp() external view returns (uint256) ``` Gets the timestamp of the latest answer from the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | --------------------------------------------- | | [0] | uint256 | uint256 - The timestamp of the latest answer. | ### proposeAggregator ```solidity function proposeAggregator(contract AggregatorV2V3Interface _aggregator) external ``` Proposes a new aggregator. #### Parameters | Name | Type | Description | | ------------ | -------------------------------- | ----------------------------------------- | | _aggregator | contract AggregatorV2V3Interface | - The address of the proposed aggregator. | ### updateAnswer ```solidity function updateAnswer(int256 _answer) public ``` Updates the answer in the mock aggregator. #### Parameters | Name | Type | Description | | -------- | ------ | --------------------------- | | _answer | int256 | - The new answer to be set. | ### updateRoundData ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` Updates the round data in the mock aggregator. #### Parameters | Name | Type | Description | | ----------- | ------- | --------------------------------------- | | _roundId | uint80 | - The round ID to be updated. | | _answer | int256 | - The new answer to be set. | | _timestamp | uint256 | - The timestamp to be set. | | _startedAt | uint256 | - The timestamp when the round started. | --- # MockVerifierProxy v0.2.6 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.6/mock-verifier-proxy > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.6 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.6 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.6 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.6/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockVerifierProxy Mock Data Streams verifier proxy. [MockVerifierProxy](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-streams/MockVerifierProxy.sol) ## Variables ### s_feeManager ```solidity contract IVerifierFeeManager s_feeManager ``` ### s_verifier ```solidity address s_verifier ``` ## Errors ### VerifierInvalid ```solidity error VerifierInvalid() ``` ### VerifierNotFound ```solidity error VerifierNotFound() ``` ### ZeroAddress ```solidity error ZeroAddress() ``` ## Events ### VerifierInitialized ```solidity event VerifierInitialized(address verifierAddress) ``` ## Functions ### _verify ```solidity function _verify(bytes payload) internal returns (bytes) ``` ### getVerifier ```solidity function getVerifier(bytes32) external view returns (address) ``` ### initializeVerifier ```solidity function initializeVerifier(address verifierAddress) external ``` ### setFeeManager ```solidity function setFeeManager(contract IVerifierFeeManager feeManager) external ``` ### verify ```solidity function verify(bytes payload, bytes parameterPayload) external payable returns (bytes) ``` ### verifyBulk ```solidity function verifyBulk(bytes[] payloads, bytes parameterPayload) external payable returns (bytes[] verifiedReports) ``` --- # MockVerifier v0.2.6 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.6/mock-verifier > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.6 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.6 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.6 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.6/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockVerifier Mock Data Streams verifier. [MockVerifier](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-streams/MockVerifier.sol) ## Variables ### i_verifierProxy ```solidity address i_verifierProxy ``` ### MOCK_DATA_STREAM_DON_ADDRESS ```solidity address MOCK_DATA_STREAM_DON_ADDRESS ``` ### N_2 ```solidity uint256 N_2 ``` ### s_inactiveDigests ```solidity mapping(bytes32 => mapping(bytes32 => bool)) s_inactiveDigests ``` ### s_inactiveFeeds ```solidity mapping(bytes32 => bool) s_inactiveFeeds ``` ### s_verifiedSignatures ```solidity mapping(bytes => bool) s_verifiedSignatures ``` ## Errors ### AccessForbidden ```solidity error AccessForbidden() ``` ### AlreadyUsedSignature ```solidity error AlreadyUsedSignature() ``` ### BadVerification ```solidity error BadVerification() ``` ### DigestInactive ```solidity error DigestInactive(bytes32 feedId, bytes32 configDigest) ``` ### InactiveFeed ```solidity error InactiveFeed(bytes32 feedId) ``` ### InvalidS ```solidity error InvalidS() ``` ### InvalidSignatureLength ```solidity error InvalidSignatureLength() ``` ### InvalidV ```solidity error InvalidV() ``` ## Events ### ReportVerified ```solidity event ReportVerified(bytes32 feedId, address sender) ``` ## Functions ### activateConfig ```solidity function activateConfig(bytes32 feedId, bytes32 configDigest) external ``` ### activateFeed ```solidity function activateFeed(bytes32 feedId) external ``` ### constructor ```solidity constructor(address verifierProxy) public ``` ### deactivateConfig ```solidity function deactivateConfig(bytes32 feedId, bytes32 configDigest) external ``` ### deactivateFeed ```solidity function deactivateFeed(bytes32 feedId) external ``` ### supportsInterface ```solidity function supportsInterface(bytes4 interfaceId) external pure returns (bool) ``` _Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding [https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP) section] to learn more about how these ids are created. This function call must use less than 30 000 gas._ ### verify ```solidity function verify(bytes signedReport, address sender) external returns (bytes verifierResponse) ``` --- # Register v0.2.6 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.6/register > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.6 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.6 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.6 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.6/src/ccip/CCIPLocalSimulator.sol"; > ``` ## Register CCIP network configuration registry. [Register](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/ccip/Register.sol) ## Structs ### NetworkDetails ```solidity struct NetworkDetails { uint64 chainSelector; address routerAddress; address linkAddress; address wrappedNativeAddress; address ccipBnMAddress; address ccipLnMAddress; address rmnProxyAddress; address registryModuleOwnerCustomAddress; address tokenAdminRegistryAddress; } ``` ## Variables ### s_networkDetails ```solidity mapping(uint256 => struct Register.NetworkDetails) s_networkDetails ``` Mapping to store network details based on chain ID. ## Functions ### constructor ```solidity constructor() public ``` Constructor to initialize the network details for various chains. ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails networkDetails) ``` Retrieves network details for a given chain ID. #### Parameters | Name | Type | Description | | ------- | ------- | --------------------------------------------- | | chainId | uint256 | - The ID of the chain to get the details for. | #### Returns | Name | Type | Description | | -------------- | ------------------------------ | ------------------------------------------------- | | networkDetails | struct Register.NetworkDetails | - The network details for the specified chain ID. | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external ``` Sets the network details for a given chain ID. #### Parameters | Name | Type | Description | | -------------- | ------------------------------ | -------------------------------------------------------- | | chainId | uint256 | - The ID of the chain to set the details for. | | networkDetails | struct Register.NetworkDetails | - The network details to set for the specified chain ID. | --- # ReportVersions v0.2.6 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.6/report-versions > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.6 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.6 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.6 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.6/src/ccip/CCIPLocalSimulator.sol"; > ``` ## ReportVersions Data Streams report schemas. [ReportVersions](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-streams/ReportVersions.sol) ## Structs ### ReportV2 *Represents a data report from a Data Streams stream for v2 schema (crypto streams). The `price` value is carried to either 8 or 18 decimal places, depending on the stream. For more information, see [https://docs.chain.link/data-streams/crypto-streams](https://docs.chain.link/data-streams/crypto-streams) and [https://docs.chain.link/data-streams/reference/report-schema](https://docs.chain.link/data-streams/reference/report-schema)* ```solidity struct ReportV2 { bytes32 feedId; uint32 validFromTimestamp; uint32 observationsTimestamp; uint192 nativeFee; uint192 linkFee; uint32 expiresAt; int192 benchmarkPrice; } ``` ### ReportV3 *Represents a data report from a Data Streams stream for v3 schema (crypto streams). The `price`, `bid`, and `ask` values are carried to either 8 or 18 decimal places, depending on the stream. For more information, see [https://docs.chain.link/data-streams/crypto-streams](https://docs.chain.link/data-streams/crypto-streams) and [https://docs.chain.link/data-streams/reference/report-schema](https://docs.chain.link/data-streams/reference/report-schema)* ```solidity struct ReportV3 { bytes32 feedId; uint32 validFromTimestamp; uint32 observationsTimestamp; uint192 nativeFee; uint192 linkFee; uint32 expiresAt; int192 price; int192 bid; int192 ask; } ``` ### ReportV4 *Represents a data report from a Data Streams stream for v4 schema (RWA stream). The `price` value is carried to either 8 or 18 decimal places, depending on the stream. The `marketStatus` indicates whether the market is currently open. Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). For more information, see [https://docs.chain.link/data-streams/rwa-streams](https://docs.chain.link/data-streams/rwa-streams) and [https://docs.chain.link/data-streams/reference/report-schema-v4](https://docs.chain.link/data-streams/reference/report-schema-v4)* ```solidity struct ReportV4 { bytes32 feedId; uint32 validFromTimestamp; uint32 observationsTimestamp; uint192 nativeFee; uint192 linkFee; uint32 expiresAt; int192 price; uint32 marketStatus; } ``` --- # WETH9 v0.2.6 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.6/weth9 > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.6 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.6 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.6 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.6/src/ccip/CCIPLocalSimulator.sol"; > ``` ## WETH9 Wrapped Ether implementation. [WETH9](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/shared/WETH9.sol) ## Variables ### allowance ```solidity mapping(address => mapping(address => uint256)) allowance ``` ### balanceOf ```solidity mapping(address => uint256) balanceOf ``` ### decimals ```solidity uint8 decimals ``` ### name ```solidity string name ``` ### symbol ```solidity string symbol ``` ## Events ### Approval ```solidity event Approval(address src, address guy, uint256 wad) ``` ### Deposit ```solidity event Deposit(address dst, uint256 wad) ``` ### Transfer ```solidity event Transfer(address src, address dst, uint256 wad) ``` ### Withdrawal ```solidity event Withdrawal(address src, uint256 wad) ``` ## Functions ### _deposit ```solidity function _deposit() internal ``` ### approve ```solidity function approve(address guy, uint256 wad) public returns (bool) ``` ### deposit ```solidity function deposit() external payable ``` ### receive ```solidity receive() external payable ``` ### totalSupply ```solidity function totalSupply() public view returns (uint256) ``` ### transfer ```solidity function transfer(address dst, uint256 wad) public returns (bool) ``` ### transferFrom ```solidity function transferFrom(address src, address dst, uint256 wad) public returns (bool) ``` ### withdraw ```solidity function withdraw(uint256 wad) external ``` --- # AggregatorInterface v0.2.7 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.7/aggregator-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.7 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.7 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.7 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.7/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorInterface Basic price feed interface. [AggregatorInterface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-feeds/interfaces/AggregatorInterface.sol) ## Events ### AnswerUpdated ```solidity event AnswerUpdated(int256 current, uint256 roundId, uint256 updatedAt) ``` Emitted when the answer is updated. #### Parameters | Name | Type | Description | | --------- | ------- | ------------------------------------------------ | | current | int256 | - The updated answer. | | roundId | uint256 | - The round ID for which the answer was updated. | | updatedAt | uint256 | - The timestamp when the answer was updated. | ### NewRound ```solidity event NewRound(uint256 roundId, address startedBy, uint256 startedAt) ``` Emitted when a new round is started. #### Parameters | Name | Type | Description | | --------- | ------- | ---------------------------------------------------- | | roundId | uint256 | - The round ID of the new round. | | startedBy | address | - The address of the account that started the round. | | startedAt | uint256 | - The timestamp when the round was started. | ## Functions ### getAnswer ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` Gets the answer for a specific round ID. #### Parameters | Name | Type | Description | | ------- | ------- | ------------------------------------- | | roundId | uint256 | - The round ID to get the answer for. | #### Returns | Name | Type | Description | | ---- | ------ | ------------------------------------------- | | [0] | int256 | int256 - The answer for the given round ID. | ### getTimestamp ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` Gets the timestamp for a specific round ID. #### Parameters | Name | Type | Description | | ------- | ------- | ---------------------------------------- | | roundId | uint256 | - The round ID to get the timestamp for. | #### Returns | Name | Type | Description | | ---- | ------- | ----------------------------------------------- | | [0] | uint256 | uint256 - The timestamp for the given round ID. | ### latestAnswer ```solidity function latestAnswer() external view returns (int256) ``` Gets the latest answer from the aggregator. #### Returns | Name | Type | Description | | ---- | ------ | --------------------------- | | [0] | int256 | int256 - The latest answer. | ### latestRound ```solidity function latestRound() external view returns (uint256) ``` Gets the latest round ID from the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | ------------------------------ | | [0] | uint256 | uint256 - The latest round ID. | ### latestTimestamp ```solidity function latestTimestamp() external view returns (uint256) ``` Gets the timestamp of the latest answer from the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | --------------------------------------------- | | [0] | uint256 | uint256 - The timestamp of the latest answer. | --- # AggregatorV2V3Interface v0.2.7 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.7/aggregator-v2-v3-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.7 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.7 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.7 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.7/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorV2V3Interface Combined V2/V3 price feed interface. [AggregatorV2V3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-feeds/interfaces/AggregatorV2V3Interface.sol) --- # AggregatorV3Interface v0.2.7 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.7/aggregator-v3-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.7 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.7 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.7 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.7/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorV3Interface Extended price feed interface. [AggregatorV3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-feeds/interfaces/AggregatorV3Interface.sol) ## Functions ### decimals ```solidity function decimals() external view returns (uint8) ``` Gets the number of decimals used by the aggregator. #### Returns | Name | Type | Description | | ---- | ----- | ------------------------------- | | [0] | uint8 | uint8 - The number of decimals. | ### description ```solidity function description() external view returns (string) ``` Gets the description of the aggregator. #### Returns | Name | Type | Description | | ---- | ------ | -------------------------------------------------- | | [0] | string | string memory - The description of the aggregator. | ### getRoundData ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the round data for a specific round ID. *This function should raise "No data present" if no data is available for the given round ID.* #### Parameters | Name | Type | Description | | --------- | ------ | ----------------------------------- | | _roundId | uint80 | - The round ID to get the data for. | #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------ | | roundId | uint80 | - The round ID. | | answer | int256 | - The answer for the round. | | startedAt | uint256 | - The timestamp when the round started. | | updatedAt | uint256 | - The timestamp when the round was updated. | | answeredInRound | uint80 | - The round ID in which the answer was computed. | ### latestRoundData ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the latest round data. *This function should raise "No data present" if no data is available.* #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------------- | | roundId | uint80 | - The latest round ID. | | answer | int256 | - The latest answer. | | startedAt | uint256 | - The timestamp when the latest round started. | | updatedAt | uint256 | - The timestamp when the latest round was updated. | | answeredInRound | uint80 | - The round ID in which the latest answer was computed. | ### version ```solidity function version() external view returns (uint256) ``` Gets the version of the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | ---------------------------------------- | | [0] | uint256 | uint256 - The version of the aggregator. | --- # BurnMintERC677Helper v0.2.7 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.7/burn-mint-erc677-helper > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.7 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.7 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.7 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.7/src/ccip/CCIPLocalSimulator.sol"; > ``` ## BurnMintERC677Helper Helper contract for ERC677 token operations. [BurnMintERC677Helper](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/ccip/BurnMintERC677Helper.sol) ## Functions ### constructor ```solidity constructor(string name, string symbol) public ``` Constructor to initialize the BurnMintERC677Helper contract with a name and symbol. *Calls the parent constructor of BurnMintERC677 with fixed decimals (18) and initial supply (0).* #### Parameters | Name | Type | Description | | ------ | ------ | -------------------------- | | name | string | - The name of the token. | | symbol | string | - The symbol of the token. | ### drip ```solidity function drip(address to) external ``` Mints one full token (1e18) to the specified address. *Calls the internal `_mint` function from the BurnMintERC677 contract.* #### Parameters | Name | Type | Description | | ---- | ------- | ------------------------------------------ | | to | address | - The address to receive the minted token. | --- # CCIPLocalSimulatorFork JS v0.2.7 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.7/ccip-local-simulator-fork-js > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.7 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.7 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.7 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.7/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulatorFork JS Hardhat 2 JavaScript helpers for fork routing. [CCIPLocalSimulatorFork JS](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/scripts/CCIPLocalSimulatorFork.js) ## Types ### Evm2EvmMessage : `Object` **Properties** | Name | Type | | ------------------- | ------------------------------------------ | | sourceChainSelector | `bigint` | | sender | `string` | | receiver | `string` | | sequenceNumber | `bigint` | | gasLimit | `bigint` | | strict | `boolean` | | nonce | `bigint` | | feeToken | `string` | | feeTokenAmount | `bigint` | | data | `string` | | tokenAmounts | `Array.<\{token: string, amount: bigint}>` | | sourceTokenData | `Array.` | | messageId | `string` | ## Functions ### requestLinkFromTheFaucet(linkAddress, to, amount) ⇒ `Promise.` Requests LINK tokens from the faucet and returns the transaction hash **Returns**: `Promise.` - Promise resolving to the transaction hash of the fund transfer | Param | Type | Description | | ----------- | -------- | ------------------------------------------------------- | | linkAddress | `string` | The address of the LINK contract on the current network | | to | `string` | The address to send LINK to | | amount | `bigint` | The amount of LINK to request | ### getEvm2EvmMessage(receipt) ⇒ `Evm2EvmMessage` | `null` Parses a transaction receipt to extract the sent message Scans through transaction logs to find a `CCIPSendRequested` event and then decodes it to an object **Returns**: `Evm2EvmMessage` | `null` - Returns either the sent message or null if provided receipt does not contain `CCIPSendRequested` log | Param | Type | Description | | ------- | -------- | ------------------------------------------------ | | receipt | `object` | The transaction receipt from the `ccipSend` call | ### getEvm2AnyRampMessage(receipt) ⇒ `object` | `null` Parses a transaction receipt to extract the sent message from CCIPMessageSent **Returns**: `object` | `null` - Returns \{ destChainSelector, sequenceNumber, EVM2AnyRampMessage message } or null | Param | Type | Description | | ------- | -------- | ------------------------------------------ | | receipt | `object` | – The tx receipt from the on-ramp contract | ### routeMessage(routerAddress, evm2EvmMessage) ⇒ `Promise.` Routes the sent message from the source network on the destination (current) network **Returns**: `Promise.` - Either resolves with no value if the message is successfully routed, or reverts\ **Throws**: - `Error` Fails if no off-ramp matches the message's source chain selector or if calling `router.getOffRamps()` | Param | Type | Description | | -------------- | ---------------- | --------------------------------- | | routerAddress | `string` | Address of the destination Router | | evm2EvmMessage | `Evm2EvmMessage` | Sent cross-chain message | --- # CCIPLocalSimulatorFork v0.2.7 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.7/ccip-local-simulator-fork > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.7 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.7 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.7 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.7/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulatorFork CCIP simulator for forked networks. [CCIPLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/ccip/CCIPLocalSimulatorFork.sol) ## Structs ### EVM2EVMMessage ```solidity struct EVM2EVMMessage { uint64 sourceChainSelector; address sender; address receiver; uint64 sequenceNumber; uint256 gasLimit; bool strict; uint64 nonce; address feeToken; uint256 feeTokenAmount; bytes data; struct Client.EVMTokenAmount[] tokenAmounts; bytes[] sourceTokenData; bytes32 messageId; } ``` ### OffRamp Structure representing an offRamp configuration #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | ```solidity struct OffRamp { uint64 sourceChainSelector; address offRamp; } ``` ## Variables ### DEFAULT_GAS_LIMIT ```solidity uint32 DEFAULT_GAS_LIMIT ``` ### i_register ```solidity contract Register i_register ``` The immutable register instance ### LINK_FAUCET ```solidity address LINK_FAUCET ``` The address of the LINK faucet ### s_processedMessages ```solidity mapping(bytes32 => bool) s_processedMessages ``` Mapping to track processed messages ## Errors ### InvalidExtraArgsTag ```solidity error InvalidExtraArgsTag() ``` ## Events ### CCIPMessageSent ```solidity event CCIPMessageSent(uint64 destChainSelector, uint64 sequenceNumber, struct Internal.EVM2AnyRampMessage message) ``` ### CCIPSendRequested ```solidity event CCIPSendRequested(struct InternalPreV1dot6.EVM2EVMMessage message) ``` Events emitted when a CCIP send request is made ## Functions ### _fromBytes ```solidity function _fromBytes(bytes extraArgs) internal pure returns (struct Client.GenericExtraArgsV2) ``` Internal helper function to decode extraArgs bytes to GenericExtraArgsV2 struct. Supports decoding of both GenericExtraArgsV2 and EVMExtraArgsV1 structs. #### Parameters | Name | Type | Description | | --------- | ----- | --------------------------------------------- | | extraArgs | bytes | - The bytes representing the extra arguments. | #### Returns | Name | Type | Description | | ---- | -------------------------------- | --------------------------------------------------------- | | [0] | struct Client.GenericExtraArgsV2 | genericExtraArgs - The decoded GenericExtraArgsV2 struct. | ### _routeCapturedMessages ```solidity function _routeCapturedMessages(uint256[] forkIds, uint256 sourceForkId, address sourceRouterAddress) internal ``` Internal function to route captured messages to their respective destination forks. #### Parameters | Name | Type | Description | | ------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------- | | forkIds | uint256[] | - The IDs of the destination network forks. These are the returned values of `createFork()` or `createSelectFork()`, not chainIds. | | sourceForkId | uint256 | - The ID of the source network fork. This is the returned value of `createFork()` or `createSelectFork()`, not chainId. | | sourceRouterAddress | address | - The address of the Router on the source chain. | ### constructor ```solidity constructor() public ``` Constructor to initialize the contract ### executeSingleMessage ```solidity function executeSingleMessage(struct Internal.Any2EVMRampMessage message, bytes[] offchainTokenData, uint32[] tokenGasOverrides) external ``` Executes a single CCIP message on the offRamp #### Parameters | Name | Type | Description | | ----------------- | ---------------------------------- | --------------------------------- | | message | struct Internal.Any2EVMRampMessage | - The CCIP message to be executed | | offchainTokenData | bytes[] | - Additional offchain token data | | tokenGasOverrides | uint32[] | | ### executeSingleMessage ```solidity function executeSingleMessage(struct InternalPreV1dot6.EVM2EVMMessage message, bytes[] offchainTokenData, uint32[] tokenGasOverrides) external ``` Works with Foundry only ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) ``` Returns the default values for currently CCIP supported networks. If network is not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Name | Type | Description | | ------- | ------- | ------------------------------------------------------------------------------------------------------ | | chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | #### Returns | Name | Type | Description | | ---- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | ### getOffRamps ```solidity function getOffRamps() external view returns (struct IRouterFork.OffRamp[]) ``` Gets the list of offRamps #### Returns | Name | Type | Description | | ---- | ----------------------------- | ----------------------------------- | | [0] | struct IRouterFork.OffRamp[] | offRamps - Array of OffRamp structs | ### getOnRamp ```solidity function getOnRamp(uint64 destChainSelector) external view returns (address) ``` Return the configured onramp for specific a destination chain. @param destChainSelector The destination chain Id to get the onRamp for. #### Returns | Name | Type | Description | | ---- | ------- | -------------------------- | | [0] | address | The address of the onRamp. | ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------- | | to | address | - The address to which LINK tokens are to be sent. | | amount | uint256 | - The amount of LINK tokens to send. | #### Returns | Name | Type | Description | | ------- | ---- | ----------------------------------------------------------------------------- | | success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external ``` If network details are not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Name | Type | Description | | -------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | | networkDetails | struct Register.NetworkDetails | - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | ### switchChainAndRouteMessage ```solidity function switchChainAndRouteMessage(uint256 forkId) external ``` To be called after the sending of the cross-chain message (`ccipSend`). Goes through the list of past logs and looks for the `CCIPSendRequested` and `CCIPMessageSent` events. Switches to a destination network fork. Routes the sent cross-chain message on the destination network. If you sent more than one message, it will try to route all of them to `forkId`. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------------------------------------------------------------------- | | forkId | uint256 | - The ID of the destination network fork. This is the returned value of `createFork()` or `createSelectFork()` | ### switchChainAndRouteMessage ```solidity function switchChainAndRouteMessage(uint256[] forkIds) external ``` To be called after the sending of the cross-chain message (`ccipSend`). Override variant of the `switchChainAndRouteMessage(uint256 forkId)` function in case of multiple destination forks. Goes through the list of past logs and looks for the `CCIPSendRequested` and `CCIPMessageSent` events. Loops through provided `forkIds` and tries to route the message to correct destination. If you haven't provide correct `forkId`, the message will get lost. If you sent more than one message, it will try to route all of them to correct destinations. #### Parameters | Name | Type | Description | | ------- | ---------- | ------------------------------------------------------------------------------------------------------------------- | | forkIds | uint256[] | - The IDs of the destination network forks. These are the returned values of `createFork()` or `createSelectFork()` | --- # CCIPLocalSimulator v0.2.7 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.7/ccip-local-simulator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.7 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.7 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.7 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.7/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulator Local CCIP simulator (no-fork mode). [CCIPLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/ccip/CCIPLocalSimulator.sol) ## Variables ### CHAIN_SELECTOR ```solidity uint64 CHAIN_SELECTOR ``` The unique CCIP Chain Selector constant ### i_ccipBnM ```solidity contract BurnMintERC677Helper i_ccipBnM ``` The BurnMintERC677Helper instance for CCIP-BnM token ### i_ccipLnM ```solidity contract BurnMintERC677Helper i_ccipLnM ``` The BurnMintERC677Helper instance for CCIP-LnM token ### i_linkToken ```solidity contract LinkToken i_linkToken ``` The LINK token instance ### i_mockRouter ```solidity contract MockCCIPRouter i_mockRouter ``` The mock CCIP router instance ### i_wrappedNative ```solidity contract WETH9 i_wrappedNative ``` The wrapped native token instance ### s_supportedTokens ```solidity address[] s_supportedTokens ``` The list of supported token addresses ## Errors ### CCIPLocalSimulator__MsgSenderIsNotTokenOwner ```solidity error CCIPLocalSimulator__MsgSenderIsNotTokenOwner() ``` ### CCIPLocalSimulator__RequiredRoleNotFound ```solidity error CCIPLocalSimulator__RequiredRoleNotFound(address account, bytes32 role, address token) ``` ## Functions ### configuration ```solidity function configuration() public view returns (uint64 chainSelector_, contract IRouterClient sourceRouter_, contract IRouterClient destinationRouter_, contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract BurnMintERC677Helper ccipBnM_, contract BurnMintERC677Helper ccipLnM_) ``` Returns configuration details for pre-deployed contracts and services needed for local CCIP simulations. #### Returns | Name | Type | Description | | ------------------- | ----------------------------- | ----------------------------------------------------------- | | chainSelector_ | uint64 | - The unique CCIP Chain Selector. | | sourceRouter_ | contract IRouterClient | - The source chain Router contract. | | destinationRouter_ | contract IRouterClient | - The destination chain Router contract. | | wrappedNative_ | contract WETH9 | - The wrapped native token which can be used for CCIP fees. | | linkToken_ | contract LinkToken | - The LINK token. | | ccipBnM_ | contract BurnMintERC677Helper | - The ccipBnM token. | | ccipLnM_ | contract BurnMintERC677Helper | - The ccipLnM token. | ### constructor ```solidity constructor() public ``` Constructor to initialize the contract and pre-deployed token instances ### getSupportedTokens ```solidity function getSupportedTokens(uint64 chainSelector) external view returns (address[] tokens) ``` Gets a list of token addresses that are supported for cross-chain transfers by the simulator. #### Parameters | Name | Type | Description | | ------------- | ------ | --------------------------------- | | chainSelector | uint64 | - The unique CCIP Chain Selector. | #### Returns | Name | Type | Description | | ------ | ---------- | -------------------------------------------------------------------------------------------------- | | tokens | address[] | - Returns a list of token addresses that are supported for cross-chain transfers by the simulator. | ### isChainSupported ```solidity function isChainSupported(uint64 chainSelector) public pure returns (bool supported) ``` Checks whether the provided `chainSelector` is supported by the simulator. #### Parameters | Name | Type | Description | | ------------- | ------ | --------------------------------- | | chainSelector | uint64 | - The unique CCIP Chain Selector. | #### Returns | Name | Type | Description | | --------- | ---- | ---------------------------------------------------------------- | | supported | bool | - Returns true if `chainSelector` is supported by the simulator. | ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------- | | to | address | - The address to which LINK tokens are to be sent. | | amount | uint256 | - The amount of LINK tokens to send. | #### Returns | Name | Type | Description | | ------- | ---- | ----------------------------------------------------------------------------- | | success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | ### supportNewTokenViaAccessControlDefaultAdmin ```solidity function supportNewTokenViaAccessControlDefaultAdmin(address tokenAddress) external ``` Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. The caller must have the DEFAULT_ADMIN_ROLE as defined by the contract itself. Reverts if the caller is not the admin of the token using OZ's AccessControl DEFAULT_ADMIN_ROLE. #### Parameters | Name | Type | Description | | ------------ | ------- | ------------------------------------------------------------------ | | tokenAddress | address | - The address of the token to add to the list of supported tokens. | ### supportNewTokenViaGetCCIPAdmin ```solidity function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external ``` Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. Reverts if token does not implement getCCIPAdmin() function. Reverts if the caller is not the token CCIPAdmin. #### Parameters | Name | Type | Description | | ------------ | ------- | ------------------------------------------------------------------ | | tokenAddress | address | - The address of the token to add to the list of supported tokens. | ### supportNewTokenViaOwner ```solidity function supportNewTokenViaOwner(address tokenAddress) external ``` Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. Reverts if token does not implement owner() function. Reverts if the caller is not the token owner. #### Parameters | Name | Type | Description | | ------------ | ------- | ------------------------------------------------------------------ | | tokenAddress | address | - The address of the token to add to the list of supported tokens. | --- # DataStreamsLocalSimulatorFork v0.2.7 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.7/data-streams-local-simulator-fork > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.7 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.7 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.7 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.7/src/ccip/CCIPLocalSimulator.sol"; > ``` ## DataStreamsLocalSimulatorFork Data Streams simulator for forked networks. [DataStreamsLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-streams/DataStreamsLocalSimulatorFork.sol) ## Variables ### i_register ```solidity contract Register i_register ``` The immutable register instance ### LINK_FAUCET ```solidity address LINK_FAUCET ``` The address of the LINK faucet ## Functions ### constructor ```solidity constructor() public ``` Constructor to initialize the contract ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) ``` Returns the default values for currently Data Streams supported networks. If network is not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Name | Type | Description | | ------- | ------- | ----------------------------------------------------------------------------- | | chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | #### Returns | Name | Type | Description | | ---- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | | [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------- | | to | address | - The address to which LINK tokens are to be sent. | | amount | uint256 | - The amount of LINK tokens to send. | #### Returns | Name | Type | Description | | ------- | ---- | ----------------------------------------------------------------------------- | | success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | ### requestNativeFromFaucet ```solidity function requestNativeFromFaucet(address to, uint256 amount) external ``` Requests native coints from the faucet. #### Parameters | Name | Type | Description | | ------ | ------- | --------------------------------------------------- | | to | address | - The address to which native coins are to be sent. | | amount | uint256 | - The amount of native coins to send. | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external ``` If network details are not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Name | Type | Description | | -------------- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- | | chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | | networkDetails | struct Register.NetworkDetails | - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | --- # DataStreamsLocalSimulator v0.2.7 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.7/data-streams-local-simulator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.7 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.7 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.7 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.7/src/ccip/CCIPLocalSimulator.sol"; > ``` ## DataStreamsLocalSimulator Local Data Streams simulator (no-fork mode). [DataStreamsLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-streams/DataStreamsLocalSimulator.sol) ## Variables ### i_linkToken ```solidity contract LinkToken i_linkToken ``` The LINK token instance ### i_wrappedNative ```solidity contract WETH9 i_wrappedNative ``` The wrapped native token instance ### s_mockFeeManager ```solidity contract MockFeeManager s_mockFeeManager ``` ### s_mockRewardManager ```solidity contract MockRewardManager s_mockRewardManager ``` ### s_mockVerifier ```solidity contract MockVerifier s_mockVerifier ``` ### s_mockVerifierProxy ```solidity contract MockVerifierProxy s_mockVerifierProxy ``` ## Functions ### configuration ```solidity function configuration() public view returns (contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract MockVerifier mockVerifier_, contract MockVerifierProxy mockVerifierProxy_, contract MockFeeManager mockFeeManager_, contract MockRewardManager mockRewardManager_) ``` @notice Returns configuration details for pre-deployed contracts and services needed for local Data Streams simulations. #### Returns | Name | Type | Description | | ------------------- | -------------------------- | ----------------------------------- | | wrappedNative_ | contract WETH9 | - The wrapped native token. | | linkToken_ | contract LinkToken | - The LINK token. | | mockVerifier_ | contract MockVerifier | - The mock verifier contract. | | mockVerifierProxy_ | contract MockVerifierProxy | - The mock verifier proxy contract. | | mockFeeManager_ | contract MockFeeManager | - The mock fee manager contract. | | mockRewardManager_ | contract MockRewardManager | - The mock reward manager contract. | ### constructor ```solidity constructor() public ``` ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------- | | to | address | - The address to which LINK tokens are to be sent. | | amount | uint256 | - The amount of LINK tokens to send. | #### Returns | Name | Type | Description | | ------- | ---- | ----------------------------------------------------------------------------- | | success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | --- # Register (Data Streams) v0.2.7 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.7/data-streams-register > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.7 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.7 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.7 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.7/src/ccip/CCIPLocalSimulator.sol"; > ``` ## Register (Data Streams) Data Streams network configuration registry. [Register (Data Streams)](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-streams/Register.sol) ## Structs ### NetworkDetails ```solidity struct NetworkDetails { address verifierProxyAddress; address linkAddress; } ``` ## Variables ### s_networkDetails ```solidity mapping(uint256 => struct Register.NetworkDetails) s_networkDetails ``` Mapping to store network details based on chain ID. ## Functions ### constructor ```solidity constructor() public ``` Constructor to initialize the network details for various chains. ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails networkDetails) ``` Retrieves network details for a given chain ID. #### Parameters | Name | Type | Description | | ------- | ------- | --------------------------------------------- | | chainId | uint256 | - The ID of the chain to get the details for. | #### Returns | Name | Type | Description | | -------------- | ------------------------------ | ------------------------------------------------- | | networkDetails | struct Register.NetworkDetails | - The network details for the specified chain ID. | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external ``` Sets the network details for a given chain ID. #### Parameters | Name | Type | Description | | -------------- | ------------------------------ | -------------------------------------------------------- | | chainId | uint256 | - The ID of the chain to set the details for. | | networkDetails | struct Register.NetworkDetails | - The network details to set for the specified chain ID. | --- # Chainlink Local v0.2.7 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.7 > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.7 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.7 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.7 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.7/src/ccip/CCIPLocalSimulator.sol"; > ``` Chainlink Local v0.2.7 pins `@chainlink/contracts-ccip` 1.6.2 and `@chainlink/contracts` 1.5.0, and adds the Data Streams billing mechanism toggle in `DataStreamsLocalSimulator`. ## CCIP These contracts provide Cross-Chain Interoperability Protocol (CCIP) functionality in a local testing environment: - [CCIPLocalSimulator](/chainlink-local/api-reference/v0.2.7/ccip-local-simulator) - Local CCIP simulator (no-fork mode) - [CCIPLocalSimulatorFork](/chainlink-local/api-reference/v0.2.7/ccip-local-simulator-fork) - CCIP simulator for forked networks - [CCIPLocalSimulatorFork JS](/chainlink-local/api-reference/v0.2.7/ccip-local-simulator-fork-js) - JavaScript helpers for fork routing - [Register](/chainlink-local/api-reference/v0.2.7/register) - CCIP network configuration registry ## Data Streams Contracts for simulating Chainlink Data Streams: - [DataStreamsLocalSimulator](/chainlink-local/api-reference/v0.2.7/data-streams-local-simulator) - Local Data Streams simulator (no-fork mode) - [DataStreamsLocalSimulatorFork](/chainlink-local/api-reference/v0.2.7/data-streams-local-simulator-fork) - Data Streams simulator for forked networks - [MockVerifier](/chainlink-local/api-reference/v0.2.7/mock-verifier) - Mock Data Streams verifier - [MockVerifierProxy](/chainlink-local/api-reference/v0.2.7/mock-verifier-proxy) - Mock Data Streams verifier proxy - [MockReportGenerator](/chainlink-local/api-reference/v0.2.7/mock-report-generator) - Signed report generator for every report schema - [MockFeeManager](/chainlink-local/api-reference/v0.2.7/mock-fee-manager) - Mock verifier fee manager - [MockRewardManager](/chainlink-local/api-reference/v0.2.7/mock-reward-manager) - Mock reward manager - [ReportVersions](/chainlink-local/api-reference/v0.2.7/report-versions) - Data Streams report schemas - [Register (Data Streams)](/chainlink-local/api-reference/v0.2.7/data-streams-register) - Data Streams network configuration registry ## Data Feeds Contracts for simulating Chainlink Data Feeds: - [AggregatorInterface](/chainlink-local/api-reference/v0.2.7/aggregator-interface) - Basic price feed interface - [AggregatorV2V3Interface](/chainlink-local/api-reference/v0.2.7/aggregator-v2-v3-interface) - Combined V2/V3 price feed interface - [AggregatorV3Interface](/chainlink-local/api-reference/v0.2.7/aggregator-v3-interface) - Extended price feed interface - [MockOffchainAggregator](/chainlink-local/api-reference/v0.2.7/mock-offchain-aggregator) - Mock implementation of off-chain aggregator - [MockV3Aggregator](/chainlink-local/api-reference/v0.2.7/mock-v3-aggregator) - Mock implementation of V3 aggregator ## Token Contracts Standard token implementations for testing: - [BurnMintERC677Helper](/chainlink-local/api-reference/v0.2.7/burn-mint-erc677-helper) - Helper contract for ERC677 token operations - [LinkToken](/chainlink-local/api-reference/v0.2.7/link-token) - LINK token implementation - [WETH9](/chainlink-local/api-reference/v0.2.7/weth9) - Wrapped Ether implementation --- # LinkToken v0.2.7 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.7/link-token > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.7 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.7 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.7 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.7/src/ccip/CCIPLocalSimulator.sol"; > ``` ## LinkToken LINK token implementation. [LinkToken](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/shared/LinkToken.sol) ## Functions ### _onCreate ```solidity function _onCreate() internal virtual ``` Hook that is called when this contract is created. *Useful to override constructor behaviour in child contracts (e.g., LINK bridge tokens). The default implementation mints 10\*\*27 tokens to the contract deployer.* ### constructor ```solidity constructor() public ``` Constructor to initialize the LinkToken contract with a fixed total supply, name, and symbol. *Calls the ERC677 constructor with the name and symbol, and then mints the total supply to the contract deployer.* --- # MockFeeManager v0.2.7 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.7/mock-fee-manager > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.7 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.7 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.7 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.7/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockFeeManager Mock verifier fee manager. [MockFeeManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-streams/MockFeeManager.sol) ## Structs ### Asset ```solidity struct Asset { address assetAddress; uint256 amount; } ``` ## Variables ### i_linkAddress ```solidity address i_linkAddress ``` ### i_nativeAddress ```solidity address i_nativeAddress ``` ### i_proxyAddress ```solidity address i_proxyAddress ``` ### i_rewardManager ```solidity contract IRewardManager i_rewardManager ``` ### s_mockDiscounts ```solidity mapping(address => uint256) s_mockDiscounts ``` ### s_nativeSurcharge ```solidity uint256 s_nativeSurcharge ``` ## Errors ### ExpiredReport ```solidity error ExpiredReport() ``` ### InvalidAddress ```solidity error InvalidAddress() ``` ### InvalidDeposit ```solidity error InvalidDeposit() ``` ### InvalidDiscount ```solidity error InvalidDiscount() ``` ### InvalidQuote ```solidity error InvalidQuote() ``` ### InvalidSurcharge ```solidity error InvalidSurcharge() ``` ### Unauthorized ```solidity error Unauthorized() ``` ## Functions ### _processFee ```solidity function _processFee(bytes payload, bytes parameterPayload, address subscriber) internal ``` ### constructor ```solidity constructor(address linkAddress, address nativeAddress, address proxyAddress, address rewardManager) public ``` ### getFeeAndReward ```solidity function getFeeAndReward(address subscriber, bytes report, address quoteAddress) public view returns (struct Common.Asset, struct Common.Asset, uint256) ``` ### getMockDiscount ```solidity function getMockDiscount(address subscriber) external view returns (uint256) ``` ### processFee ```solidity function processFee(bytes payload, bytes parameterPayload, address subscriber) external payable ``` ### processFeeBulk ```solidity function processFeeBulk(bytes[] payloads, bytes parameterPayload, address subscriber) external payable ``` ### setMockDiscount ```solidity function setMockDiscount(address subscriber, uint256 discount) external ``` ### setNativeSurcharge ```solidity function setNativeSurcharge(uint64 surcharge) external ``` ### supportsInterface ```solidity function supportsInterface(bytes4 interfaceId) external pure returns (bool) ``` _Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding [https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP) section] to learn more about how these ids are created. This function call must use less than 30 000 gas._ --- # MockOffchainAggregator v0.2.7 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.7/mock-offchain-aggregator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.7 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.7 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.7 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.7/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockOffchainAggregator Mock implementation of off-chain aggregator. [MockOffchainAggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-feeds/MockOffchainAggregator.sol) ## Variables ### decimals ```solidity uint8 decimals ``` The number of decimals used by the aggregator. ### getAnswer ```solidity mapping(uint256 => int256) getAnswer ``` Mapping to get the answer for a specific round ID. ### getTimestamp ```solidity mapping(uint256 => uint256) getTimestamp ``` Mapping to get the timestamp for a specific round ID. ### latestAnswer ```solidity int256 latestAnswer ``` The latest answer reported by the aggregator. ### latestRound ```solidity uint256 latestRound ``` The latest round ID. ### latestTimestamp ```solidity uint256 latestTimestamp ``` The timestamp of the latest answer. ### maxAnswer ```solidity int192 maxAnswer ``` The maximum answer the aggregator is allowed to report. ### minAnswer ```solidity int192 minAnswer ``` The minimum answer the aggregator is allowed to report. ## Functions ### constructor ```solidity constructor(uint8 _decimals, int256 _initialAnswer) public ``` Constructor to initialize the MockOffchainAggregator contract with initial parameters. #### Parameters | Name | Type | Description | | --------------- | ------ | ------------------------------------------------------ | | _decimals | uint8 | - The number of decimals for the aggregator. | | _initialAnswer | int256 | - The initial answer to be set in the mock aggregator. | ### getRoundData ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the round data for a specific round ID. #### Parameters | Name | Type | Description | | --------- | ------ | ----------------------------------- | | _roundId | uint80 | - The round ID to get the data for. | #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------ | | roundId | uint80 | - The round ID. | | answer | int256 | - The answer for the round. | | startedAt | uint256 | - The timestamp when the round started. | | updatedAt | uint256 | - The timestamp when the round was updated. | | answeredInRound | uint80 | - The round ID in which the answer was computed. | ### latestRoundData ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the latest round data. #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------------- | | roundId | uint80 | - The latest round ID. | | answer | int256 | - The latest answer. | | startedAt | uint256 | - The timestamp when the latest round started. | | updatedAt | uint256 | - The timestamp when the latest round was updated. | | answeredInRound | uint80 | - The round ID in which the latest answer was computed. | ### updateAnswer ```solidity function updateAnswer(int256 _answer) public ``` Updates the answer in the mock aggregator. #### Parameters | Name | Type | Description | | -------- | ------ | --------------------------- | | _answer | int256 | - The new answer to be set. | ### updateMinAndMaxAnswers ```solidity function updateMinAndMaxAnswers(int192 _minAnswer, int192 _maxAnswer) external ``` Updates the minimum and maximum answers the aggregator can report. #### Parameters | Name | Type | Description | | ----------- | ------ | ------------------------- | | _minAnswer | int192 | - The new minimum answer. | | _maxAnswer | int192 | - The new maximum answer. | ### updateRoundData ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` Updates the round data in the mock aggregator. #### Parameters | Name | Type | Description | | ----------- | ------- | --------------------------------------- | | _roundId | uint80 | - The round ID to be updated. | | _answer | int256 | - The new answer to be set. | | _timestamp | uint256 | - The timestamp to be set. | | _startedAt | uint256 | - The timestamp when the round started. | --- # MockReportGenerator v0.2.7 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.7/mock-report-generator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.7 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.7 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.7 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.7/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockReportGenerator Signed report generator for every report schema. [MockReportGenerator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-streams/MockReportGenerator.sol) ## Variables ### i_donAddress ```solidity address i_donAddress ``` ### i_donDigest ```solidity uint256 i_donDigest ``` ### i_reportV2MockFeedId ```solidity bytes32 i_reportV2MockFeedId ``` ### i_reportV3MockFeedId ```solidity bytes32 i_reportV3MockFeedId ``` ### i_reportV4MockFeedId ```solidity bytes32 i_reportV4MockFeedId ``` ### s_ask ```solidity int192 s_ask ``` ### s_bid ```solidity int192 s_bid ``` ### s_expiresPeriod ```solidity uint32 s_expiresPeriod ``` ### s_linkFee ```solidity uint192 s_linkFee ``` ### s_marketStatus ```solidity uint32 s_marketStatus ``` ### s_nativeFee ```solidity uint192 s_nativeFee ``` ### s_price ```solidity int192 s_price ``` ## Errors ### MockReportGenerator__CastOverflow ```solidity error MockReportGenerator__CastOverflow() ``` ### MockReportGenerator__InvalidAsk ```solidity error MockReportGenerator__InvalidAsk() ``` ### MockReportGenerator__InvalidBid ```solidity error MockReportGenerator__InvalidBid() ``` ## Functions ### constructor ```solidity constructor(int192 initialPrice) public ``` ### generateReport ```solidity function generateReport(struct ReportVersions.ReportV2 report) external returns (bytes signedReport) ``` ### generateReport ```solidity function generateReport(struct ReportVersions.ReportV3 report) external returns (bytes signedReport) ``` ### generateReport ```solidity function generateReport(struct ReportVersions.ReportV4 report) external returns (bytes signedReport) ``` ### generateReportV2 ```solidity function generateReportV2() external returns (bytes signedReport, struct ReportVersions.ReportV2 report) ``` ### generateReportV3 ```solidity function generateReportV3() external returns (bytes signedReport, struct ReportVersions.ReportV3 report) ``` ### generateReportV4 ```solidity function generateReportV4() external returns (bytes signedReport, struct ReportVersions.ReportV4 report) ``` ### getMockDonAddress ```solidity function getMockDonAddress() external view returns (address) ``` ### updateExpiresPeriod ```solidity function updateExpiresPeriod(uint32 period) external ``` ### updateFees ```solidity function updateFees(uint192 nativeFee, uint192 linkFee) external ``` ### updateMarketStatus ```solidity function updateMarketStatus(uint32 status) external ``` ### updatePrice ```solidity function updatePrice(int192 price) public ``` ### updatePriceBidAndAsk ```solidity function updatePriceBidAndAsk(int192 price, int192 bid, int192 ask) external ``` --- # MockRewardManager v0.2.7 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.7/mock-reward-manager > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.7 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.7 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.7 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.7/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockRewardManager Mock reward manager. [MockRewardManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-streams/MockRewardManager.sol) ## Variables ### i_linkAddress ```solidity address i_linkAddress ``` ### s_feeManagerAddress ```solidity address s_feeManagerAddress ``` ## Errors ### Unauthorized ```solidity error Unauthorized() ``` ## Events ### FeePaid ```solidity event FeePaid(struct IRewardManager.FeePayment[] payments, address payer) ``` ## Functions ### claimRewards ```solidity function claimRewards(bytes32[]) external pure ``` ### constructor ```solidity constructor(address linkAddress) public ``` ### onFeePaid ```solidity function onFeePaid(struct IRewardManager.FeePayment[] payments, address payer) external ``` ### setFeeManager ```solidity function setFeeManager(address newFeeManager) external ``` ### supportsInterface ```solidity function supportsInterface(bytes4 interfaceId) external pure returns (bool) ``` _Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding [https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP) section] to learn more about how these ids are created. This function call must use less than 30 000 gas._ --- # MockV3Aggregator v0.2.7 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.7/mock-v3-aggregator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.7 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.7 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.7 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.7/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockV3Aggregator Mock implementation of V3 aggregator. [MockV3Aggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-feeds/MockV3Aggregator.sol) ## Variables ### aggregator ```solidity address aggregator ``` The address of the current aggregator. ### proposedAggregator ```solidity address proposedAggregator ``` The address of the proposed aggregator. ### version ```solidity uint256 version ``` The version of the aggregator. ## Functions ### confirmAggregator ```solidity function confirmAggregator(address _aggregator) external ``` Confirms the proposed aggregator. #### Parameters | Name | Type | Description | | ------------ | ------- | ----------------------------------------- | | _aggregator | address | - The address of the proposed aggregator. | ### constructor ```solidity constructor(uint8 _decimals, int256 _initialAnswer) public ``` Constructor to initialize the MockV3Aggregator contract with initial parameters. #### Parameters | Name | Type | Description | | --------------- | ------ | ------------------------------------------------------ | | _decimals | uint8 | - The number of decimals for the aggregator. | | _initialAnswer | int256 | - The initial answer to be set in the mock aggregator. | ### decimals ```solidity function decimals() external view returns (uint8) ``` Gets the number of decimals used by the aggregator. #### Returns | Name | Type | Description | | ---- | ----- | ------------------------------- | | [0] | uint8 | uint8 - The number of decimals. | ### description ```solidity function description() external pure returns (string) ``` Gets the description of the aggregator. #### Returns | Name | Type | Description | | ---- | ------ | -------------------------------------------------- | | [0] | string | string memory - The description of the aggregator. | ### getAnswer ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` Gets the answer for a specific round ID. #### Parameters | Name | Type | Description | | ------- | ------- | ------------------------------------- | | roundId | uint256 | - The round ID to get the answer for. | #### Returns | Name | Type | Description | | ---- | ------ | ------------------------------------------- | | [0] | int256 | int256 - The answer for the given round ID. | ### getRoundData ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the round data for a specific round ID. *This function should raise "No data present" if no data is available for the given round ID.* #### Parameters | Name | Type | Description | | --------- | ------ | ----------------------------------- | | _roundId | uint80 | - The round ID to get the data for. | #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------ | | roundId | uint80 | - The round ID. | | answer | int256 | - The answer for the round. | | startedAt | uint256 | - The timestamp when the round started. | | updatedAt | uint256 | - The timestamp when the round was updated. | | answeredInRound | uint80 | - The round ID in which the answer was computed. | ### getTimestamp ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` Gets the timestamp for a specific round ID. #### Parameters | Name | Type | Description | | ------- | ------- | ---------------------------------------- | | roundId | uint256 | - The round ID to get the timestamp for. | #### Returns | Name | Type | Description | | ---- | ------- | ----------------------------------------------- | | [0] | uint256 | uint256 - The timestamp for the given round ID. | ### latestAnswer ```solidity function latestAnswer() external view returns (int256) ``` Gets the latest answer from the aggregator. #### Returns | Name | Type | Description | | ---- | ------ | --------------------------- | | [0] | int256 | int256 - The latest answer. | ### latestRound ```solidity function latestRound() external view returns (uint256) ``` Gets the latest round ID from the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | ------------------------------ | | [0] | uint256 | uint256 - The latest round ID. | ### latestRoundData ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the latest round data. *This function should raise "No data present" if no data is available.* #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------------- | | roundId | uint80 | - The latest round ID. | | answer | int256 | - The latest answer. | | startedAt | uint256 | - The timestamp when the latest round started. | | updatedAt | uint256 | - The timestamp when the latest round was updated. | | answeredInRound | uint80 | - The round ID in which the latest answer was computed. | ### latestTimestamp ```solidity function latestTimestamp() external view returns (uint256) ``` Gets the timestamp of the latest answer from the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | --------------------------------------------- | | [0] | uint256 | uint256 - The timestamp of the latest answer. | ### proposeAggregator ```solidity function proposeAggregator(contract AggregatorV2V3Interface _aggregator) external ``` Proposes a new aggregator. #### Parameters | Name | Type | Description | | ------------ | -------------------------------- | ----------------------------------------- | | _aggregator | contract AggregatorV2V3Interface | - The address of the proposed aggregator. | ### updateAnswer ```solidity function updateAnswer(int256 _answer) public ``` Updates the answer in the mock aggregator. #### Parameters | Name | Type | Description | | -------- | ------ | --------------------------- | | _answer | int256 | - The new answer to be set. | ### updateRoundData ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` Updates the round data in the mock aggregator. #### Parameters | Name | Type | Description | | ----------- | ------- | --------------------------------------- | | _roundId | uint80 | - The round ID to be updated. | | _answer | int256 | - The new answer to be set. | | _timestamp | uint256 | - The timestamp to be set. | | _startedAt | uint256 | - The timestamp when the round started. | --- # MockVerifierProxy v0.2.7 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.7/mock-verifier-proxy > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.7 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.7 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.7 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.7/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockVerifierProxy Mock Data Streams verifier proxy. [MockVerifierProxy](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-streams/MockVerifierProxy.sol) ## Variables ### s_feeManager ```solidity contract IVerifierFeeManager s_feeManager ``` ### s_verifier ```solidity address s_verifier ``` ## Errors ### VerifierInvalid ```solidity error VerifierInvalid() ``` ### VerifierNotFound ```solidity error VerifierNotFound() ``` ### ZeroAddress ```solidity error ZeroAddress() ``` ## Events ### VerifierInitialized ```solidity event VerifierInitialized(address verifierAddress) ``` ## Functions ### _verify ```solidity function _verify(bytes payload) internal returns (bytes) ``` ### getVerifier ```solidity function getVerifier(bytes32) external view returns (address) ``` ### initializeVerifier ```solidity function initializeVerifier(address verifierAddress) external ``` ### setFeeManager ```solidity function setFeeManager(contract IVerifierFeeManager feeManager) external ``` ### verify ```solidity function verify(bytes payload, bytes parameterPayload) external payable returns (bytes) ``` ### verifyBulk ```solidity function verifyBulk(bytes[] payloads, bytes parameterPayload) external payable returns (bytes[] verifiedReports) ``` --- # MockVerifier v0.2.7 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.7/mock-verifier > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.7 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.7 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.7 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.7/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockVerifier Mock Data Streams verifier. [MockVerifier](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-streams/MockVerifier.sol) ## Variables ### i_verifierProxy ```solidity address i_verifierProxy ``` ### MOCK_DATA_STREAM_DON_ADDRESS ```solidity address MOCK_DATA_STREAM_DON_ADDRESS ``` ### N_2 ```solidity uint256 N_2 ``` ### s_inactiveDigests ```solidity mapping(bytes32 => mapping(bytes32 => bool)) s_inactiveDigests ``` ### s_inactiveFeeds ```solidity mapping(bytes32 => bool) s_inactiveFeeds ``` ### s_verifiedSignatures ```solidity mapping(bytes => bool) s_verifiedSignatures ``` ## Errors ### AccessForbidden ```solidity error AccessForbidden() ``` ### AlreadyUsedSignature ```solidity error AlreadyUsedSignature() ``` ### BadVerification ```solidity error BadVerification() ``` ### DigestInactive ```solidity error DigestInactive(bytes32 feedId, bytes32 configDigest) ``` ### InactiveFeed ```solidity error InactiveFeed(bytes32 feedId) ``` ### InvalidS ```solidity error InvalidS() ``` ### InvalidSignatureLength ```solidity error InvalidSignatureLength() ``` ### InvalidV ```solidity error InvalidV() ``` ## Events ### ReportVerified ```solidity event ReportVerified(bytes32 feedId, address sender) ``` ## Functions ### activateConfig ```solidity function activateConfig(bytes32 feedId, bytes32 configDigest) external ``` ### activateFeed ```solidity function activateFeed(bytes32 feedId) external ``` ### constructor ```solidity constructor(address verifierProxy) public ``` ### deactivateConfig ```solidity function deactivateConfig(bytes32 feedId, bytes32 configDigest) external ``` ### deactivateFeed ```solidity function deactivateFeed(bytes32 feedId) external ``` ### supportsInterface ```solidity function supportsInterface(bytes4 interfaceId) external pure returns (bool) ``` _Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding [https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP) section] to learn more about how these ids are created. This function call must use less than 30 000 gas._ ### verify ```solidity function verify(bytes signedReport, address sender) external returns (bytes verifierResponse) ``` --- # Register v0.2.7 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.7/register > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.7 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.7 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.7 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.7/src/ccip/CCIPLocalSimulator.sol"; > ``` ## Register CCIP network configuration registry. [Register](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/ccip/Register.sol) ## Structs ### NetworkDetails ```solidity struct NetworkDetails { uint64 chainSelector; address routerAddress; address linkAddress; address wrappedNativeAddress; address ccipBnMAddress; address ccipLnMAddress; address rmnProxyAddress; address registryModuleOwnerCustomAddress; address tokenAdminRegistryAddress; } ``` ## Variables ### s_networkDetails ```solidity mapping(uint256 => struct Register.NetworkDetails) s_networkDetails ``` Mapping to store network details based on chain ID. ## Functions ### constructor ```solidity constructor() public ``` Constructor to initialize the network details for various chains. ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails networkDetails) ``` Retrieves network details for a given chain ID. #### Parameters | Name | Type | Description | | ------- | ------- | --------------------------------------------- | | chainId | uint256 | - The ID of the chain to get the details for. | #### Returns | Name | Type | Description | | -------------- | ------------------------------ | ------------------------------------------------- | | networkDetails | struct Register.NetworkDetails | - The network details for the specified chain ID. | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external ``` Sets the network details for a given chain ID. #### Parameters | Name | Type | Description | | -------------- | ------------------------------ | -------------------------------------------------------- | | chainId | uint256 | - The ID of the chain to set the details for. | | networkDetails | struct Register.NetworkDetails | - The network details to set for the specified chain ID. | --- # ReportVersions v0.2.7 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.7/report-versions > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.7 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.7 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.7 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.7/src/ccip/CCIPLocalSimulator.sol"; > ``` ## ReportVersions Data Streams report schemas. [ReportVersions](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-streams/ReportVersions.sol) ## Structs ### ReportV2 *Represents a data report from a Data Streams stream for v2 schema (crypto streams). The `price` value is carried to either 8 or 18 decimal places, depending on the stream. For more information, see [https://docs.chain.link/data-streams/crypto-streams](https://docs.chain.link/data-streams/crypto-streams) and [https://docs.chain.link/data-streams/reference/report-schema](https://docs.chain.link/data-streams/reference/report-schema)* ```solidity struct ReportV2 { bytes32 feedId; uint32 validFromTimestamp; uint32 observationsTimestamp; uint192 nativeFee; uint192 linkFee; uint32 expiresAt; int192 benchmarkPrice; } ``` ### ReportV3 *Represents a data report from a Data Streams stream for v3 schema (crypto streams). The `price`, `bid`, and `ask` values are carried to either 8 or 18 decimal places, depending on the stream. For more information, see [https://docs.chain.link/data-streams/crypto-streams](https://docs.chain.link/data-streams/crypto-streams) and [https://docs.chain.link/data-streams/reference/report-schema](https://docs.chain.link/data-streams/reference/report-schema)* ```solidity struct ReportV3 { bytes32 feedId; uint32 validFromTimestamp; uint32 observationsTimestamp; uint192 nativeFee; uint192 linkFee; uint32 expiresAt; int192 price; int192 bid; int192 ask; } ``` ### ReportV4 *Represents a data report from a Data Streams stream for v4 schema (RWA stream). The `price` value is carried to either 8 or 18 decimal places, depending on the stream. The `marketStatus` indicates whether the market is currently open. Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). For more information, see [https://docs.chain.link/data-streams/rwa-streams](https://docs.chain.link/data-streams/rwa-streams) and [https://docs.chain.link/data-streams/reference/report-schema-v4](https://docs.chain.link/data-streams/reference/report-schema-v4)* ```solidity struct ReportV4 { bytes32 feedId; uint32 validFromTimestamp; uint32 observationsTimestamp; uint192 nativeFee; uint192 linkFee; uint32 expiresAt; int192 price; uint32 marketStatus; } ``` --- # WETH9 v0.2.7 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.7/weth9 > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.7 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.7 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.7 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.7/src/ccip/CCIPLocalSimulator.sol"; > ``` ## WETH9 Wrapped Ether implementation. [WETH9](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/shared/WETH9.sol) ## Variables ### allowance ```solidity mapping(address => mapping(address => uint256)) allowance ``` ### balanceOf ```solidity mapping(address => uint256) balanceOf ``` ### decimals ```solidity uint8 decimals ``` ### name ```solidity string name ``` ### symbol ```solidity string symbol ``` ## Events ### Approval ```solidity event Approval(address src, address guy, uint256 wad) ``` ### Deposit ```solidity event Deposit(address dst, uint256 wad) ``` ### Transfer ```solidity event Transfer(address src, address dst, uint256 wad) ``` ### Withdrawal ```solidity event Withdrawal(address src, uint256 wad) ``` ## Functions ### _deposit ```solidity function _deposit() internal ``` ### approve ```solidity function approve(address guy, uint256 wad) public returns (bool) ``` ### deposit ```solidity function deposit() external payable ``` ### receive ```solidity receive() external payable ``` ### totalSupply ```solidity function totalSupply() public view returns (uint256) ``` ### transfer ```solidity function transfer(address dst, uint256 wad) public returns (bool) ``` ### transferFrom ```solidity function transferFrom(address src, address dst, uint256 wad) public returns (bool) ``` ### withdraw ```solidity function withdraw(uint256 wad) external ``` --- # AggregatorInterface v0.2.8 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.8/aggregator-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.8 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.8 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.8 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.8/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorInterface Basic price feed interface. [AggregatorInterface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-feeds/interfaces/AggregatorInterface.sol) ## Events ### AnswerUpdated ```solidity event AnswerUpdated(int256 current, uint256 roundId, uint256 updatedAt) ``` Emitted when the answer is updated. #### Parameters | Name | Type | Description | | --------- | ------- | ------------------------------------------------ | | current | int256 | - The updated answer. | | roundId | uint256 | - The round ID for which the answer was updated. | | updatedAt | uint256 | - The timestamp when the answer was updated. | ### NewRound ```solidity event NewRound(uint256 roundId, address startedBy, uint256 startedAt) ``` Emitted when a new round is started. #### Parameters | Name | Type | Description | | --------- | ------- | ---------------------------------------------------- | | roundId | uint256 | - The round ID of the new round. | | startedBy | address | - The address of the account that started the round. | | startedAt | uint256 | - The timestamp when the round was started. | ## Functions ### getAnswer ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` Gets the answer for a specific round ID. #### Parameters | Name | Type | Description | | ------- | ------- | ------------------------------------- | | roundId | uint256 | - The round ID to get the answer for. | #### Returns | Name | Type | Description | | ---- | ------ | ------------------------------------------- | | [0] | int256 | int256 - The answer for the given round ID. | ### getTimestamp ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` Gets the timestamp for a specific round ID. #### Parameters | Name | Type | Description | | ------- | ------- | ---------------------------------------- | | roundId | uint256 | - The round ID to get the timestamp for. | #### Returns | Name | Type | Description | | ---- | ------- | ----------------------------------------------- | | [0] | uint256 | uint256 - The timestamp for the given round ID. | ### latestAnswer ```solidity function latestAnswer() external view returns (int256) ``` Gets the latest answer from the aggregator. #### Returns | Name | Type | Description | | ---- | ------ | --------------------------- | | [0] | int256 | int256 - The latest answer. | ### latestRound ```solidity function latestRound() external view returns (uint256) ``` Gets the latest round ID from the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | ------------------------------ | | [0] | uint256 | uint256 - The latest round ID. | ### latestTimestamp ```solidity function latestTimestamp() external view returns (uint256) ``` Gets the timestamp of the latest answer from the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | --------------------------------------------- | | [0] | uint256 | uint256 - The timestamp of the latest answer. | --- # AggregatorV2V3Interface v0.2.8 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.8/aggregator-v2-v3-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.8 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.8 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.8 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.8/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorV2V3Interface Combined V2/V3 price feed interface. [AggregatorV2V3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-feeds/interfaces/AggregatorV2V3Interface.sol) --- # AggregatorV3Interface v0.2.8 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.8/aggregator-v3-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.8 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.8 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.8 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.8/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorV3Interface Extended price feed interface. [AggregatorV3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-feeds/interfaces/AggregatorV3Interface.sol) ## Functions ### decimals ```solidity function decimals() external view returns (uint8) ``` Gets the number of decimals used by the aggregator. #### Returns | Name | Type | Description | | ---- | ----- | ------------------------------- | | [0] | uint8 | uint8 - The number of decimals. | ### description ```solidity function description() external view returns (string) ``` Gets the description of the aggregator. #### Returns | Name | Type | Description | | ---- | ------ | -------------------------------------------------- | | [0] | string | string memory - The description of the aggregator. | ### getRoundData ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the round data for a specific round ID. *This function should raise "No data present" if no data is available for the given round ID.* #### Parameters | Name | Type | Description | | --------- | ------ | ----------------------------------- | | _roundId | uint80 | - The round ID to get the data for. | #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------ | | roundId | uint80 | - The round ID. | | answer | int256 | - The answer for the round. | | startedAt | uint256 | - The timestamp when the round started. | | updatedAt | uint256 | - The timestamp when the round was updated. | | answeredInRound | uint80 | - The round ID in which the answer was computed. | ### latestRoundData ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the latest round data. *This function should raise "No data present" if no data is available.* #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------------- | | roundId | uint80 | - The latest round ID. | | answer | int256 | - The latest answer. | | startedAt | uint256 | - The timestamp when the latest round started. | | updatedAt | uint256 | - The timestamp when the latest round was updated. | | answeredInRound | uint80 | - The round ID in which the latest answer was computed. | ### version ```solidity function version() external view returns (uint256) ``` Gets the version of the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | ---------------------------------------- | | [0] | uint256 | uint256 - The version of the aggregator. | --- # BurnMintERC677Helper v0.2.8 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.8/burn-mint-erc677-helper > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.8 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.8 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.8 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.8/src/ccip/CCIPLocalSimulator.sol"; > ``` ## BurnMintERC677Helper Helper contract for ERC677 token operations. [BurnMintERC677Helper](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/ccip/BurnMintERC677Helper.sol) ## Functions ### constructor ```solidity constructor(string name, string symbol) public ``` Constructor to initialize the BurnMintERC677Helper contract with a name and symbol. *Calls the parent constructor of BurnMintERC677 with fixed decimals (18) and initial supply (0).* #### Parameters | Name | Type | Description | | ------ | ------ | -------------------------- | | name | string | - The name of the token. | | symbol | string | - The symbol of the token. | ### drip ```solidity function drip(address to) external ``` Mints one full token (1e18) to the specified address. *Calls the internal `_mint` function from the BurnMintERC677 contract.* #### Parameters | Name | Type | Description | | ---- | ------- | ------------------------------------------ | | to | address | - The address to receive the minted token. | --- # CCIPLocalSimulatorFork JS v0.2.8 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.8/ccip-local-simulator-fork-js > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.8 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.8 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.8 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.8/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulatorFork JS Hardhat 2 JavaScript helpers for fork routing. [CCIPLocalSimulatorFork JS](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/scripts/CCIPLocalSimulatorFork.js) ## Types ### Evm2EvmMessage : `Object` **Properties** | Name | Type | | ------------------- | ------------------------------------------ | | sourceChainSelector | `bigint` | | sender | `string` | | receiver | `string` | | sequenceNumber | `bigint` | | gasLimit | `bigint` | | strict | `boolean` | | nonce | `bigint` | | feeToken | `string` | | feeTokenAmount | `bigint` | | data | `string` | | tokenAmounts | `Array.<\{token: string, amount: bigint}>` | | sourceTokenData | `Array.` | | messageId | `string` | ## Functions ### requestLinkFromTheFaucet(linkAddress, to, amount) ⇒ `Promise.` Requests LINK tokens from the faucet and returns the transaction hash **Returns**: `Promise.` - Promise resolving to the transaction hash of the fund transfer | Param | Type | Description | | ----------- | -------- | ------------------------------------------------------- | | linkAddress | `string` | The address of the LINK contract on the current network | | to | `string` | The address to send LINK to | | amount | `bigint` | The amount of LINK to request | ### getEvm2EvmMessage(receipt) ⇒ `Evm2EvmMessage` | `null` Parses a transaction receipt to extract the sent message Scans through transaction logs to find a `CCIPSendRequested` event and then decodes it to an object **Returns**: `Evm2EvmMessage` | `null` - Returns either the sent message or null if provided receipt does not contain `CCIPSendRequested` log | Param | Type | Description | | ------- | -------- | ------------------------------------------------ | | receipt | `object` | The transaction receipt from the `ccipSend` call | ### getEvm2AnyRampMessage(receipt) ⇒ `object` | `null` Parses a transaction receipt to extract the sent message from CCIPMessageSent **Returns**: `object` | `null` - Returns \{ destChainSelector, sequenceNumber, EVM2AnyRampMessage message } or null | Param | Type | Description | | ------- | -------- | ------------------------------------------ | | receipt | `object` | – The tx receipt from the on-ramp contract | ### routeMessage(routerAddress, evm2EvmMessage) ⇒ `Promise.` Routes the sent message from the source network on the destination (current) network **Returns**: `Promise.` - Either resolves with no value if the message is successfully routed, or reverts\ **Throws**: - `Error` Fails if no off-ramp matches the message's source chain selector or if calling `router.getOffRamps()` | Param | Type | Description | | -------------- | ---------------- | --------------------------------- | | routerAddress | `string` | Address of the destination Router | | evm2EvmMessage | `Evm2EvmMessage` | Sent cross-chain message | --- # CCIPLocalSimulatorFork v0.2.8 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.8/ccip-local-simulator-fork > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.8 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.8 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.8 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.8/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulatorFork CCIP simulator for forked networks. [CCIPLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/ccip/CCIPLocalSimulatorFork.sol) ## Structs ### EVM2EVMMessage ```solidity struct EVM2EVMMessage { uint64 sourceChainSelector; address sender; address receiver; uint64 sequenceNumber; uint256 gasLimit; bool strict; uint64 nonce; address feeToken; uint256 feeTokenAmount; bytes data; struct Client.EVMTokenAmount[] tokenAmounts; bytes[] sourceTokenData; bytes32 messageId; } ``` ### OffRamp Structure representing an offRamp configuration #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | ```solidity struct OffRamp { uint64 sourceChainSelector; address offRamp; } ``` ## Variables ### DEFAULT_GAS_LIMIT ```solidity uint32 DEFAULT_GAS_LIMIT ``` ### i_register ```solidity contract Register i_register ``` The immutable register instance ### LINK_FAUCET ```solidity address LINK_FAUCET ``` The address of the LINK faucet ### s_processedMessages ```solidity mapping(bytes32 => bool) s_processedMessages ``` Mapping to track processed messages ## Errors ### InvalidExtraArgsTag ```solidity error InvalidExtraArgsTag() ``` ## Events ### CCIPMessageSent ```solidity event CCIPMessageSent(uint64 destChainSelector, uint64 sequenceNumber, struct Internal.EVM2AnyRampMessage message) ``` ### CCIPSendRequested ```solidity event CCIPSendRequested(struct InternalPreV1dot6.EVM2EVMMessage message) ``` Events emitted when a CCIP send request is made ## Functions ### _fromBytes ```solidity function _fromBytes(bytes extraArgs) internal pure returns (struct Client.GenericExtraArgsV2) ``` Internal helper function to decode extraArgs bytes to GenericExtraArgsV2 struct. Supports decoding of both GenericExtraArgsV2 and EVMExtraArgsV1 structs. #### Parameters | Name | Type | Description | | --------- | ----- | --------------------------------------------- | | extraArgs | bytes | - The bytes representing the extra arguments. | #### Returns | Name | Type | Description | | ---- | -------------------------------- | --------------------------------------------------------- | | [0] | struct Client.GenericExtraArgsV2 | genericExtraArgs - The decoded GenericExtraArgsV2 struct. | ### _routeCapturedMessages ```solidity function _routeCapturedMessages(uint256[] forkIds, uint256 sourceForkId, address sourceRouterAddress) internal ``` Internal function to route captured messages to their respective destination forks. #### Parameters | Name | Type | Description | | ------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------- | | forkIds | uint256[] | - The IDs of the destination network forks. These are the returned values of `createFork()` or `createSelectFork()`, not chainIds. | | sourceForkId | uint256 | - The ID of the source network fork. This is the returned value of `createFork()` or `createSelectFork()`, not chainId. | | sourceRouterAddress | address | - The address of the Router on the source chain. | ### constructor ```solidity constructor() public ``` Constructor to initialize the contract ### executeSingleMessage ```solidity function executeSingleMessage(struct Internal.Any2EVMRampMessage message, bytes[] offchainTokenData, uint32[] tokenGasOverrides) external ``` Executes a single CCIP message on the offRamp #### Parameters | Name | Type | Description | | ----------------- | ---------------------------------- | --------------------------------- | | message | struct Internal.Any2EVMRampMessage | - The CCIP message to be executed | | offchainTokenData | bytes[] | - Additional offchain token data | | tokenGasOverrides | uint32[] | | ### executeSingleMessage ```solidity function executeSingleMessage(struct InternalPreV1dot6.EVM2EVMMessage message, bytes[] offchainTokenData, uint32[] tokenGasOverrides) external ``` Works with Foundry only ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) ``` Returns the default values for currently CCIP supported networks. If network is not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Name | Type | Description | | ------- | ------- | ------------------------------------------------------------------------------------------------------ | | chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | #### Returns | Name | Type | Description | | ---- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | ### getOffRamps ```solidity function getOffRamps() external view returns (struct IRouterFork.OffRamp[]) ``` Gets the list of offRamps #### Returns | Name | Type | Description | | ---- | ----------------------------- | ----------------------------------- | | [0] | struct IRouterFork.OffRamp[] | offRamps - Array of OffRamp structs | ### getOnRamp ```solidity function getOnRamp(uint64 destChainSelector) external view returns (address) ``` Return the configured onramp for specific a destination chain. @param destChainSelector The destination chain Id to get the onRamp for. #### Returns | Name | Type | Description | | ---- | ------- | -------------------------- | | [0] | address | The address of the onRamp. | ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------- | | to | address | - The address to which LINK tokens are to be sent. | | amount | uint256 | - The amount of LINK tokens to send. | #### Returns | Name | Type | Description | | ------- | ---- | ----------------------------------------------------------------------------- | | success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external ``` If network details are not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Name | Type | Description | | -------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | | networkDetails | struct Register.NetworkDetails | - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | ### switchChainAndRouteMessage ```solidity function switchChainAndRouteMessage(uint256 forkId) external ``` To be called after the sending of the cross-chain message (`ccipSend`). Goes through the list of past logs and looks for the `CCIPSendRequested` and `CCIPMessageSent` events. Switches to a destination network fork. Routes the sent cross-chain message on the destination network. If you sent more than one message, it will try to route all of them to `forkId`. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------------------------------------------------------------------- | | forkId | uint256 | - The ID of the destination network fork. This is the returned value of `createFork()` or `createSelectFork()` | ### switchChainAndRouteMessage ```solidity function switchChainAndRouteMessage(uint256[] forkIds) external ``` To be called after the sending of the cross-chain message (`ccipSend`). Override variant of the `switchChainAndRouteMessage(uint256 forkId)` function in case of multiple destination forks. Goes through the list of past logs and looks for the `CCIPSendRequested` and `CCIPMessageSent` events. Loops through provided `forkIds` and tries to route the message to correct destination. If you haven't provide correct `forkId`, the message will get lost. If you sent more than one message, it will try to route all of them to correct destinations. #### Parameters | Name | Type | Description | | ------- | ---------- | ------------------------------------------------------------------------------------------------------------------- | | forkIds | uint256[] | - The IDs of the destination network forks. These are the returned values of `createFork()` or `createSelectFork()` | --- # CCIPLocalSimulator v0.2.8 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.8/ccip-local-simulator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.8 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.8 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.8 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.8/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulator Local CCIP simulator (no-fork mode). [CCIPLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/ccip/CCIPLocalSimulator.sol) ## Variables ### CHAIN_SELECTOR ```solidity uint64 CHAIN_SELECTOR ``` The unique CCIP Chain Selector constant ### i_ccipBnM ```solidity contract BurnMintERC677Helper i_ccipBnM ``` The BurnMintERC677Helper instance for CCIP-BnM token ### i_ccipLnM ```solidity contract BurnMintERC677Helper i_ccipLnM ``` The BurnMintERC677Helper instance for CCIP-LnM token ### i_linkToken ```solidity contract LinkToken i_linkToken ``` The LINK token instance ### i_mockRouter ```solidity contract MockCCIPRouter i_mockRouter ``` The mock CCIP router instance ### i_wrappedNative ```solidity contract WETH9 i_wrappedNative ``` The wrapped native token instance ### s_supportedTokens ```solidity address[] s_supportedTokens ``` The list of supported token addresses ## Errors ### CCIPLocalSimulator__MsgSenderIsNotTokenOwner ```solidity error CCIPLocalSimulator__MsgSenderIsNotTokenOwner() ``` ### CCIPLocalSimulator__RequiredRoleNotFound ```solidity error CCIPLocalSimulator__RequiredRoleNotFound(address account, bytes32 role, address token) ``` ## Functions ### configuration ```solidity function configuration() public view returns (uint64 chainSelector_, contract IRouterClient sourceRouter_, contract IRouterClient destinationRouter_, contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract BurnMintERC677Helper ccipBnM_, contract BurnMintERC677Helper ccipLnM_) ``` Returns configuration details for pre-deployed contracts and services needed for local CCIP simulations. #### Returns | Name | Type | Description | | ------------------- | ----------------------------- | ----------------------------------------------------------- | | chainSelector_ | uint64 | - The unique CCIP Chain Selector. | | sourceRouter_ | contract IRouterClient | - The source chain Router contract. | | destinationRouter_ | contract IRouterClient | - The destination chain Router contract. | | wrappedNative_ | contract WETH9 | - The wrapped native token which can be used for CCIP fees. | | linkToken_ | contract LinkToken | - The LINK token. | | ccipBnM_ | contract BurnMintERC677Helper | - The ccipBnM token. | | ccipLnM_ | contract BurnMintERC677Helper | - The ccipLnM token. | ### constructor ```solidity constructor() public ``` Constructor to initialize the contract and pre-deployed token instances ### getSupportedTokens ```solidity function getSupportedTokens(uint64 chainSelector) external view returns (address[] tokens) ``` Gets a list of token addresses that are supported for cross-chain transfers by the simulator. #### Parameters | Name | Type | Description | | ------------- | ------ | --------------------------------- | | chainSelector | uint64 | - The unique CCIP Chain Selector. | #### Returns | Name | Type | Description | | ------ | ---------- | -------------------------------------------------------------------------------------------------- | | tokens | address[] | - Returns a list of token addresses that are supported for cross-chain transfers by the simulator. | ### isChainSupported ```solidity function isChainSupported(uint64 chainSelector) public pure returns (bool supported) ``` Checks whether the provided `chainSelector` is supported by the simulator. #### Parameters | Name | Type | Description | | ------------- | ------ | --------------------------------- | | chainSelector | uint64 | - The unique CCIP Chain Selector. | #### Returns | Name | Type | Description | | --------- | ---- | ---------------------------------------------------------------- | | supported | bool | - Returns true if `chainSelector` is supported by the simulator. | ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------- | | to | address | - The address to which LINK tokens are to be sent. | | amount | uint256 | - The amount of LINK tokens to send. | #### Returns | Name | Type | Description | | ------- | ---- | ----------------------------------------------------------------------------- | | success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | ### supportNewTokenViaAccessControlDefaultAdmin ```solidity function supportNewTokenViaAccessControlDefaultAdmin(address tokenAddress) external ``` Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. The caller must have the DEFAULT_ADMIN_ROLE as defined by the contract itself. Reverts if the caller is not the admin of the token using OZ's AccessControl DEFAULT_ADMIN_ROLE. #### Parameters | Name | Type | Description | | ------------ | ------- | ------------------------------------------------------------------ | | tokenAddress | address | - The address of the token to add to the list of supported tokens. | ### supportNewTokenViaGetCCIPAdmin ```solidity function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external ``` Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. Reverts if token does not implement getCCIPAdmin() function. Reverts if the caller is not the token CCIPAdmin. #### Parameters | Name | Type | Description | | ------------ | ------- | ------------------------------------------------------------------ | | tokenAddress | address | - The address of the token to add to the list of supported tokens. | ### supportNewTokenViaOwner ```solidity function supportNewTokenViaOwner(address tokenAddress) external ``` Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. Reverts if token does not implement owner() function. Reverts if the caller is not the token owner. #### Parameters | Name | Type | Description | | ------------ | ------- | ------------------------------------------------------------------ | | tokenAddress | address | - The address of the token to add to the list of supported tokens. | --- # DataStreamsLocalSimulatorFork v0.2.8 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.8/data-streams-local-simulator-fork > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.8 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.8 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.8 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.8/src/ccip/CCIPLocalSimulator.sol"; > ``` ## DataStreamsLocalSimulatorFork Data Streams simulator for forked networks. [DataStreamsLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-streams/DataStreamsLocalSimulatorFork.sol) ## Variables ### i_register ```solidity contract Register i_register ``` The immutable register instance ### LINK_FAUCET ```solidity address LINK_FAUCET ``` The address of the LINK faucet ## Functions ### constructor ```solidity constructor() public ``` Constructor to initialize the contract ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) ``` Returns the default values for currently Data Streams supported networks. If network is not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Name | Type | Description | | ------- | ------- | ----------------------------------------------------------------------------- | | chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | #### Returns | Name | Type | Description | | ---- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | | [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------- | | to | address | - The address to which LINK tokens are to be sent. | | amount | uint256 | - The amount of LINK tokens to send. | #### Returns | Name | Type | Description | | ------- | ---- | ----------------------------------------------------------------------------- | | success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | ### requestNativeFromFaucet ```solidity function requestNativeFromFaucet(address to, uint256 amount) external ``` Requests native coints from the faucet. #### Parameters | Name | Type | Description | | ------ | ------- | --------------------------------------------------- | | to | address | - The address to which native coins are to be sent. | | amount | uint256 | - The amount of native coins to send. | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external ``` If network details are not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Name | Type | Description | | -------------- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- | | chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | | networkDetails | struct Register.NetworkDetails | - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | --- # DataStreamsLocalSimulator v0.2.8 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.8/data-streams-local-simulator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.8 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.8 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.8 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.8/src/ccip/CCIPLocalSimulator.sol"; > ``` ## DataStreamsLocalSimulator Local Data Streams simulator (no-fork mode). [DataStreamsLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-streams/DataStreamsLocalSimulator.sol) ## Variables ### i_linkToken ```solidity contract LinkToken i_linkToken ``` The LINK token instance ### i_wrappedNative ```solidity contract WETH9 i_wrappedNative ``` The wrapped native token instance ### s_mockFeeManager ```solidity contract MockFeeManager s_mockFeeManager ``` ### s_mockRewardManager ```solidity contract MockRewardManager s_mockRewardManager ``` ### s_mockVerifier ```solidity contract MockVerifier s_mockVerifier ``` ### s_mockVerifierProxy ```solidity contract MockVerifierProxy s_mockVerifierProxy ``` ## Functions ### configuration ```solidity function configuration() public view returns (contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract MockVerifier mockVerifier_, contract MockVerifierProxy mockVerifierProxy_, contract MockFeeManager mockFeeManager_, contract MockRewardManager mockRewardManager_) ``` @notice Returns configuration details for pre-deployed contracts and services needed for local Data Streams simulations. #### Returns | Name | Type | Description | | ------------------- | -------------------------- | ----------------------------------- | | wrappedNative_ | contract WETH9 | - The wrapped native token. | | linkToken_ | contract LinkToken | - The LINK token. | | mockVerifier_ | contract MockVerifier | - The mock verifier contract. | | mockVerifierProxy_ | contract MockVerifierProxy | - The mock verifier proxy contract. | | mockFeeManager_ | contract MockFeeManager | - The mock fee manager contract. | | mockRewardManager_ | contract MockRewardManager | - The mock reward manager contract. | ### constructor ```solidity constructor() public ``` ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------- | | to | address | - The address to which LINK tokens are to be sent. | | amount | uint256 | - The amount of LINK tokens to send. | #### Returns | Name | Type | Description | | ------- | ---- | ----------------------------------------------------------------------------- | | success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | --- # Register (Data Streams) v0.2.8 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.8/data-streams-register > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.8 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.8 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.8 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.8/src/ccip/CCIPLocalSimulator.sol"; > ``` ## Register (Data Streams) Data Streams network configuration registry. [Register (Data Streams)](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-streams/Register.sol) ## Structs ### NetworkDetails ```solidity struct NetworkDetails { address verifierProxyAddress; address linkAddress; } ``` ## Variables ### s_networkDetails ```solidity mapping(uint256 => struct Register.NetworkDetails) s_networkDetails ``` Mapping to store network details based on chain ID. ## Functions ### constructor ```solidity constructor() public ``` Constructor to initialize the network details for various chains. ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails networkDetails) ``` Retrieves network details for a given chain ID. #### Parameters | Name | Type | Description | | ------- | ------- | --------------------------------------------- | | chainId | uint256 | - The ID of the chain to get the details for. | #### Returns | Name | Type | Description | | -------------- | ------------------------------ | ------------------------------------------------- | | networkDetails | struct Register.NetworkDetails | - The network details for the specified chain ID. | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external ``` Sets the network details for a given chain ID. #### Parameters | Name | Type | Description | | -------------- | ------------------------------ | -------------------------------------------------------- | | chainId | uint256 | - The ID of the chain to set the details for. | | networkDetails | struct Register.NetworkDetails | - The network details to set for the specified chain ID. | --- # Chainlink Local v0.2.8 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.8 > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.8 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.8 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.8 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.8/src/ccip/CCIPLocalSimulator.sol"; > ``` Chainlink Local v0.2.8 adds Data Streams report versions V1 and V5-V13 to `ReportVersions`, and expands the built-in `Register` network details to 145 chains, mainnets included, via the new CCIP network details update script. ## CCIP These contracts provide Cross-Chain Interoperability Protocol (CCIP) functionality in a local testing environment: - [CCIPLocalSimulator](/chainlink-local/api-reference/v0.2.8/ccip-local-simulator) - Local CCIP simulator (no-fork mode) - [CCIPLocalSimulatorFork](/chainlink-local/api-reference/v0.2.8/ccip-local-simulator-fork) - CCIP simulator for forked networks - [CCIPLocalSimulatorFork JS](/chainlink-local/api-reference/v0.2.8/ccip-local-simulator-fork-js) - JavaScript helpers for fork routing - [Register](/chainlink-local/api-reference/v0.2.8/register) - CCIP network configuration registry ## Data Streams Contracts for simulating Chainlink Data Streams: - [DataStreamsLocalSimulator](/chainlink-local/api-reference/v0.2.8/data-streams-local-simulator) - Local Data Streams simulator (no-fork mode) - [DataStreamsLocalSimulatorFork](/chainlink-local/api-reference/v0.2.8/data-streams-local-simulator-fork) - Data Streams simulator for forked networks - [MockVerifier](/chainlink-local/api-reference/v0.2.8/mock-verifier) - Mock Data Streams verifier - [MockVerifierProxy](/chainlink-local/api-reference/v0.2.8/mock-verifier-proxy) - Mock Data Streams verifier proxy - [MockReportGenerator](/chainlink-local/api-reference/v0.2.8/mock-report-generator) - Signed report generator for every report schema - [MockFeeManager](/chainlink-local/api-reference/v0.2.8/mock-fee-manager) - Mock verifier fee manager - [MockRewardManager](/chainlink-local/api-reference/v0.2.8/mock-reward-manager) - Mock reward manager - [ReportVersions](/chainlink-local/api-reference/v0.2.8/report-versions) - Data Streams report schemas - [Register (Data Streams)](/chainlink-local/api-reference/v0.2.8/data-streams-register) - Data Streams network configuration registry ## Data Feeds Contracts for simulating Chainlink Data Feeds: - [AggregatorInterface](/chainlink-local/api-reference/v0.2.8/aggregator-interface) - Basic price feed interface - [AggregatorV2V3Interface](/chainlink-local/api-reference/v0.2.8/aggregator-v2-v3-interface) - Combined V2/V3 price feed interface - [AggregatorV3Interface](/chainlink-local/api-reference/v0.2.8/aggregator-v3-interface) - Extended price feed interface - [MockOffchainAggregator](/chainlink-local/api-reference/v0.2.8/mock-offchain-aggregator) - Mock implementation of off-chain aggregator - [MockV3Aggregator](/chainlink-local/api-reference/v0.2.8/mock-v3-aggregator) - Mock implementation of V3 aggregator ## Token Contracts Standard token implementations for testing: - [BurnMintERC677Helper](/chainlink-local/api-reference/v0.2.8/burn-mint-erc677-helper) - Helper contract for ERC677 token operations - [LinkToken](/chainlink-local/api-reference/v0.2.8/link-token) - LINK token implementation - [WETH9](/chainlink-local/api-reference/v0.2.8/weth9) - Wrapped Ether implementation --- # LinkToken v0.2.8 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.8/link-token > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.8 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.8 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.8 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.8/src/ccip/CCIPLocalSimulator.sol"; > ``` ## LinkToken LINK token implementation. [LinkToken](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/shared/LinkToken.sol) ## Functions ### _onCreate ```solidity function _onCreate() internal virtual ``` Hook that is called when this contract is created. *Useful to override constructor behaviour in child contracts (e.g., LINK bridge tokens). The default implementation mints 10\*\*27 tokens to the contract deployer.* ### constructor ```solidity constructor() public ``` Constructor to initialize the LinkToken contract with a fixed total supply, name, and symbol. *Calls the ERC677 constructor with the name and symbol, and then mints the total supply to the contract deployer.* --- # MockFeeManager v0.2.8 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.8/mock-fee-manager > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.8 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.8 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.8 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.8/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockFeeManager Mock verifier fee manager. [MockFeeManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-streams/MockFeeManager.sol) ## Structs ### Asset ```solidity struct Asset { address assetAddress; uint256 amount; } ``` ## Variables ### i_linkAddress ```solidity address i_linkAddress ``` ### i_nativeAddress ```solidity address i_nativeAddress ``` ### i_proxyAddress ```solidity address i_proxyAddress ``` ### i_rewardManager ```solidity contract IRewardManager i_rewardManager ``` ### s_mockDiscounts ```solidity mapping(address => uint256) s_mockDiscounts ``` ### s_nativeSurcharge ```solidity uint256 s_nativeSurcharge ``` ## Errors ### ExpiredReport ```solidity error ExpiredReport() ``` ### InvalidAddress ```solidity error InvalidAddress() ``` ### InvalidDeposit ```solidity error InvalidDeposit() ``` ### InvalidDiscount ```solidity error InvalidDiscount() ``` ### InvalidQuote ```solidity error InvalidQuote() ``` ### InvalidSurcharge ```solidity error InvalidSurcharge() ``` ### Unauthorized ```solidity error Unauthorized() ``` ## Functions ### _processFee ```solidity function _processFee(bytes payload, bytes parameterPayload, address subscriber) internal ``` ### constructor ```solidity constructor(address linkAddress, address nativeAddress, address proxyAddress, address rewardManager) public ``` ### getFeeAndReward ```solidity function getFeeAndReward(address subscriber, bytes report, address quoteAddress) public view returns (struct Common.Asset, struct Common.Asset, uint256) ``` ### getMockDiscount ```solidity function getMockDiscount(address subscriber) external view returns (uint256) ``` ### processFee ```solidity function processFee(bytes payload, bytes parameterPayload, address subscriber) external payable ``` ### processFeeBulk ```solidity function processFeeBulk(bytes[] payloads, bytes parameterPayload, address subscriber) external payable ``` ### setMockDiscount ```solidity function setMockDiscount(address subscriber, uint256 discount) external ``` ### setNativeSurcharge ```solidity function setNativeSurcharge(uint64 surcharge) external ``` ### supportsInterface ```solidity function supportsInterface(bytes4 interfaceId) external pure returns (bool) ``` _Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding [https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP) section] to learn more about how these ids are created. This function call must use less than 30 000 gas._ --- # MockOffchainAggregator v0.2.8 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.8/mock-offchain-aggregator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.8 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.8 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.8 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.8/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockOffchainAggregator Mock implementation of off-chain aggregator. [MockOffchainAggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-feeds/MockOffchainAggregator.sol) ## Variables ### decimals ```solidity uint8 decimals ``` The number of decimals used by the aggregator. ### getAnswer ```solidity mapping(uint256 => int256) getAnswer ``` Mapping to get the answer for a specific round ID. ### getTimestamp ```solidity mapping(uint256 => uint256) getTimestamp ``` Mapping to get the timestamp for a specific round ID. ### latestAnswer ```solidity int256 latestAnswer ``` The latest answer reported by the aggregator. ### latestRound ```solidity uint256 latestRound ``` The latest round ID. ### latestTimestamp ```solidity uint256 latestTimestamp ``` The timestamp of the latest answer. ### maxAnswer ```solidity int192 maxAnswer ``` The maximum answer the aggregator is allowed to report. ### minAnswer ```solidity int192 minAnswer ``` The minimum answer the aggregator is allowed to report. ## Functions ### constructor ```solidity constructor(uint8 _decimals, int256 _initialAnswer) public ``` Constructor to initialize the MockOffchainAggregator contract with initial parameters. #### Parameters | Name | Type | Description | | --------------- | ------ | ------------------------------------------------------ | | _decimals | uint8 | - The number of decimals for the aggregator. | | _initialAnswer | int256 | - The initial answer to be set in the mock aggregator. | ### getRoundData ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the round data for a specific round ID. #### Parameters | Name | Type | Description | | --------- | ------ | ----------------------------------- | | _roundId | uint80 | - The round ID to get the data for. | #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------ | | roundId | uint80 | - The round ID. | | answer | int256 | - The answer for the round. | | startedAt | uint256 | - The timestamp when the round started. | | updatedAt | uint256 | - The timestamp when the round was updated. | | answeredInRound | uint80 | - The round ID in which the answer was computed. | ### latestRoundData ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the latest round data. #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------------- | | roundId | uint80 | - The latest round ID. | | answer | int256 | - The latest answer. | | startedAt | uint256 | - The timestamp when the latest round started. | | updatedAt | uint256 | - The timestamp when the latest round was updated. | | answeredInRound | uint80 | - The round ID in which the latest answer was computed. | ### updateAnswer ```solidity function updateAnswer(int256 _answer) public ``` Updates the answer in the mock aggregator. #### Parameters | Name | Type | Description | | -------- | ------ | --------------------------- | | _answer | int256 | - The new answer to be set. | ### updateMinAndMaxAnswers ```solidity function updateMinAndMaxAnswers(int192 _minAnswer, int192 _maxAnswer) external ``` Updates the minimum and maximum answers the aggregator can report. #### Parameters | Name | Type | Description | | ----------- | ------ | ------------------------- | | _minAnswer | int192 | - The new minimum answer. | | _maxAnswer | int192 | - The new maximum answer. | ### updateRoundData ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` Updates the round data in the mock aggregator. #### Parameters | Name | Type | Description | | ----------- | ------- | --------------------------------------- | | _roundId | uint80 | - The round ID to be updated. | | _answer | int256 | - The new answer to be set. | | _timestamp | uint256 | - The timestamp to be set. | | _startedAt | uint256 | - The timestamp when the round started. | --- # MockReportGenerator v0.2.8 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.8/mock-report-generator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.8 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.8 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.8 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.8/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockReportGenerator Signed report generator for every report schema. [MockReportGenerator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-streams/MockReportGenerator.sol) ## Variables ### i_donAddress ```solidity address i_donAddress ``` ### i_donDigest ```solidity uint256 i_donDigest ``` ### i_reportV2MockFeedId ```solidity bytes32 i_reportV2MockFeedId ``` ### i_reportV3MockFeedId ```solidity bytes32 i_reportV3MockFeedId ``` ### i_reportV4MockFeedId ```solidity bytes32 i_reportV4MockFeedId ``` ### s_ask ```solidity int192 s_ask ``` ### s_bid ```solidity int192 s_bid ``` ### s_expiresPeriod ```solidity uint32 s_expiresPeriod ``` ### s_linkFee ```solidity uint192 s_linkFee ``` ### s_marketStatus ```solidity uint32 s_marketStatus ``` ### s_nativeFee ```solidity uint192 s_nativeFee ``` ### s_price ```solidity int192 s_price ``` ## Errors ### MockReportGenerator__CastOverflow ```solidity error MockReportGenerator__CastOverflow() ``` ### MockReportGenerator__InvalidAsk ```solidity error MockReportGenerator__InvalidAsk() ``` ### MockReportGenerator__InvalidBid ```solidity error MockReportGenerator__InvalidBid() ``` ## Functions ### constructor ```solidity constructor(int192 initialPrice) public ``` ### generateReport ```solidity function generateReport(struct ReportVersions.ReportV2 report) external returns (bytes signedReport) ``` ### generateReport ```solidity function generateReport(struct ReportVersions.ReportV3 report) external returns (bytes signedReport) ``` ### generateReport ```solidity function generateReport(struct ReportVersions.ReportV4 report) external returns (bytes signedReport) ``` ### generateReportV2 ```solidity function generateReportV2() external returns (bytes signedReport, struct ReportVersions.ReportV2 report) ``` ### generateReportV3 ```solidity function generateReportV3() external returns (bytes signedReport, struct ReportVersions.ReportV3 report) ``` ### generateReportV4 ```solidity function generateReportV4() external returns (bytes signedReport, struct ReportVersions.ReportV4 report) ``` ### getMockDonAddress ```solidity function getMockDonAddress() external view returns (address) ``` ### updateExpiresPeriod ```solidity function updateExpiresPeriod(uint32 period) external ``` ### updateFees ```solidity function updateFees(uint192 nativeFee, uint192 linkFee) external ``` ### updateMarketStatus ```solidity function updateMarketStatus(uint32 status) external ``` ### updatePrice ```solidity function updatePrice(int192 price) public ``` ### updatePriceBidAndAsk ```solidity function updatePriceBidAndAsk(int192 price, int192 bid, int192 ask) external ``` --- # MockRewardManager v0.2.8 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.8/mock-reward-manager > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.8 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.8 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.8 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.8/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockRewardManager Mock reward manager. [MockRewardManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-streams/MockRewardManager.sol) ## Variables ### i_linkAddress ```solidity address i_linkAddress ``` ### s_feeManagerAddress ```solidity address s_feeManagerAddress ``` ## Errors ### Unauthorized ```solidity error Unauthorized() ``` ## Events ### FeePaid ```solidity event FeePaid(struct IRewardManager.FeePayment[] payments, address payer) ``` ## Functions ### claimRewards ```solidity function claimRewards(bytes32[]) external pure ``` ### constructor ```solidity constructor(address linkAddress) public ``` ### onFeePaid ```solidity function onFeePaid(struct IRewardManager.FeePayment[] payments, address payer) external ``` ### setFeeManager ```solidity function setFeeManager(address newFeeManager) external ``` ### supportsInterface ```solidity function supportsInterface(bytes4 interfaceId) external pure returns (bool) ``` _Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding [https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP) section] to learn more about how these ids are created. This function call must use less than 30 000 gas._ --- # MockV3Aggregator v0.2.8 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.8/mock-v3-aggregator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.8 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.8 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.8 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.8/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockV3Aggregator Mock implementation of V3 aggregator. [MockV3Aggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-feeds/MockV3Aggregator.sol) ## Variables ### aggregator ```solidity address aggregator ``` The address of the current aggregator. ### proposedAggregator ```solidity address proposedAggregator ``` The address of the proposed aggregator. ### version ```solidity uint256 version ``` The version of the aggregator. ## Functions ### confirmAggregator ```solidity function confirmAggregator(address _aggregator) external ``` Confirms the proposed aggregator. #### Parameters | Name | Type | Description | | ------------ | ------- | ----------------------------------------- | | _aggregator | address | - The address of the proposed aggregator. | ### constructor ```solidity constructor(uint8 _decimals, int256 _initialAnswer) public ``` Constructor to initialize the MockV3Aggregator contract with initial parameters. #### Parameters | Name | Type | Description | | --------------- | ------ | ------------------------------------------------------ | | _decimals | uint8 | - The number of decimals for the aggregator. | | _initialAnswer | int256 | - The initial answer to be set in the mock aggregator. | ### decimals ```solidity function decimals() external view returns (uint8) ``` Gets the number of decimals used by the aggregator. #### Returns | Name | Type | Description | | ---- | ----- | ------------------------------- | | [0] | uint8 | uint8 - The number of decimals. | ### description ```solidity function description() external pure returns (string) ``` Gets the description of the aggregator. #### Returns | Name | Type | Description | | ---- | ------ | -------------------------------------------------- | | [0] | string | string memory - The description of the aggregator. | ### getAnswer ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` Gets the answer for a specific round ID. #### Parameters | Name | Type | Description | | ------- | ------- | ------------------------------------- | | roundId | uint256 | - The round ID to get the answer for. | #### Returns | Name | Type | Description | | ---- | ------ | ------------------------------------------- | | [0] | int256 | int256 - The answer for the given round ID. | ### getRoundData ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the round data for a specific round ID. *This function should raise "No data present" if no data is available for the given round ID.* #### Parameters | Name | Type | Description | | --------- | ------ | ----------------------------------- | | _roundId | uint80 | - The round ID to get the data for. | #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------ | | roundId | uint80 | - The round ID. | | answer | int256 | - The answer for the round. | | startedAt | uint256 | - The timestamp when the round started. | | updatedAt | uint256 | - The timestamp when the round was updated. | | answeredInRound | uint80 | - The round ID in which the answer was computed. | ### getTimestamp ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` Gets the timestamp for a specific round ID. #### Parameters | Name | Type | Description | | ------- | ------- | ---------------------------------------- | | roundId | uint256 | - The round ID to get the timestamp for. | #### Returns | Name | Type | Description | | ---- | ------- | ----------------------------------------------- | | [0] | uint256 | uint256 - The timestamp for the given round ID. | ### latestAnswer ```solidity function latestAnswer() external view returns (int256) ``` Gets the latest answer from the aggregator. #### Returns | Name | Type | Description | | ---- | ------ | --------------------------- | | [0] | int256 | int256 - The latest answer. | ### latestRound ```solidity function latestRound() external view returns (uint256) ``` Gets the latest round ID from the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | ------------------------------ | | [0] | uint256 | uint256 - The latest round ID. | ### latestRoundData ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the latest round data. *This function should raise "No data present" if no data is available.* #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------------- | | roundId | uint80 | - The latest round ID. | | answer | int256 | - The latest answer. | | startedAt | uint256 | - The timestamp when the latest round started. | | updatedAt | uint256 | - The timestamp when the latest round was updated. | | answeredInRound | uint80 | - The round ID in which the latest answer was computed. | ### latestTimestamp ```solidity function latestTimestamp() external view returns (uint256) ``` Gets the timestamp of the latest answer from the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | --------------------------------------------- | | [0] | uint256 | uint256 - The timestamp of the latest answer. | ### proposeAggregator ```solidity function proposeAggregator(contract AggregatorV2V3Interface _aggregator) external ``` Proposes a new aggregator. #### Parameters | Name | Type | Description | | ------------ | -------------------------------- | ----------------------------------------- | | _aggregator | contract AggregatorV2V3Interface | - The address of the proposed aggregator. | ### updateAnswer ```solidity function updateAnswer(int256 _answer) public ``` Updates the answer in the mock aggregator. #### Parameters | Name | Type | Description | | -------- | ------ | --------------------------- | | _answer | int256 | - The new answer to be set. | ### updateRoundData ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` Updates the round data in the mock aggregator. #### Parameters | Name | Type | Description | | ----------- | ------- | --------------------------------------- | | _roundId | uint80 | - The round ID to be updated. | | _answer | int256 | - The new answer to be set. | | _timestamp | uint256 | - The timestamp to be set. | | _startedAt | uint256 | - The timestamp when the round started. | --- # MockVerifierProxy v0.2.8 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.8/mock-verifier-proxy > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.8 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.8 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.8 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.8/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockVerifierProxy Mock Data Streams verifier proxy. [MockVerifierProxy](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-streams/MockVerifierProxy.sol) ## Variables ### s_feeManager ```solidity contract IVerifierFeeManager s_feeManager ``` ### s_verifier ```solidity address s_verifier ``` ## Errors ### VerifierInvalid ```solidity error VerifierInvalid() ``` ### VerifierNotFound ```solidity error VerifierNotFound() ``` ### ZeroAddress ```solidity error ZeroAddress() ``` ## Events ### VerifierInitialized ```solidity event VerifierInitialized(address verifierAddress) ``` ## Functions ### _verify ```solidity function _verify(bytes payload) internal returns (bytes) ``` ### getVerifier ```solidity function getVerifier(bytes32) external view returns (address) ``` ### initializeVerifier ```solidity function initializeVerifier(address verifierAddress) external ``` ### setFeeManager ```solidity function setFeeManager(contract IVerifierFeeManager feeManager) external ``` ### verify ```solidity function verify(bytes payload, bytes parameterPayload) external payable returns (bytes) ``` ### verifyBulk ```solidity function verifyBulk(bytes[] payloads, bytes parameterPayload) external payable returns (bytes[] verifiedReports) ``` --- # MockVerifier v0.2.8 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.8/mock-verifier > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.8 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.8 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.8 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.8/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockVerifier Mock Data Streams verifier. [MockVerifier](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-streams/MockVerifier.sol) ## Variables ### i_verifierProxy ```solidity address i_verifierProxy ``` ### MOCK_DATA_STREAM_DON_ADDRESS ```solidity address MOCK_DATA_STREAM_DON_ADDRESS ``` ### N_2 ```solidity uint256 N_2 ``` ### s_inactiveDigests ```solidity mapping(bytes32 => mapping(bytes32 => bool)) s_inactiveDigests ``` ### s_inactiveFeeds ```solidity mapping(bytes32 => bool) s_inactiveFeeds ``` ### s_verifiedSignatures ```solidity mapping(bytes => bool) s_verifiedSignatures ``` ## Errors ### AccessForbidden ```solidity error AccessForbidden() ``` ### AlreadyUsedSignature ```solidity error AlreadyUsedSignature() ``` ### BadVerification ```solidity error BadVerification() ``` ### DigestInactive ```solidity error DigestInactive(bytes32 feedId, bytes32 configDigest) ``` ### InactiveFeed ```solidity error InactiveFeed(bytes32 feedId) ``` ### InvalidS ```solidity error InvalidS() ``` ### InvalidSignatureLength ```solidity error InvalidSignatureLength() ``` ### InvalidV ```solidity error InvalidV() ``` ## Events ### ReportVerified ```solidity event ReportVerified(bytes32 feedId, address sender) ``` ## Functions ### activateConfig ```solidity function activateConfig(bytes32 feedId, bytes32 configDigest) external ``` ### activateFeed ```solidity function activateFeed(bytes32 feedId) external ``` ### constructor ```solidity constructor(address verifierProxy) public ``` ### deactivateConfig ```solidity function deactivateConfig(bytes32 feedId, bytes32 configDigest) external ``` ### deactivateFeed ```solidity function deactivateFeed(bytes32 feedId) external ``` ### supportsInterface ```solidity function supportsInterface(bytes4 interfaceId) external pure returns (bool) ``` _Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding [https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP) section] to learn more about how these ids are created. This function call must use less than 30 000 gas._ ### verify ```solidity function verify(bytes signedReport, address sender) external returns (bytes verifierResponse) ``` --- # Register v0.2.8 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.8/register > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.8 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.8 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.8 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.8/src/ccip/CCIPLocalSimulator.sol"; > ``` ## Register CCIP network configuration registry. [Register](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/ccip/Register.sol) ## Structs ### NetworkDetails ```solidity struct NetworkDetails { uint64 chainSelector; address routerAddress; address linkAddress; address wrappedNativeAddress; address ccipBnMAddress; address ccipLnMAddress; address rmnProxyAddress; address registryModuleOwnerCustomAddress; address tokenAdminRegistryAddress; } ``` ## Variables ### s_networkDetails ```solidity mapping(uint256 => struct Register.NetworkDetails) s_networkDetails ``` Mapping to store network details based on chain ID. ## Functions ### constructor ```solidity constructor() public ``` Constructor to initialize the network details for various chains. ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails networkDetails) ``` Retrieves network details for a given chain ID. #### Parameters | Name | Type | Description | | ------- | ------- | --------------------------------------------- | | chainId | uint256 | - The ID of the chain to get the details for. | #### Returns | Name | Type | Description | | -------------- | ------------------------------ | ------------------------------------------------- | | networkDetails | struct Register.NetworkDetails | - The network details for the specified chain ID. | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external ``` Sets the network details for a given chain ID. #### Parameters | Name | Type | Description | | -------------- | ------------------------------ | -------------------------------------------------------- | | chainId | uint256 | - The ID of the chain to set the details for. | | networkDetails | struct Register.NetworkDetails | - The network details to set for the specified chain ID. | --- # ReportVersions v0.2.8 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.8/report-versions > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.8 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.8 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.8 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.8/src/ccip/CCIPLocalSimulator.sol"; > ``` ## ReportVersions Data Streams report schemas. [ReportVersions](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-streams/ReportVersions.sol) ## Structs ### ReportV2 *Represents a data report from a Data Streams stream for v2 schema (crypto streams). The `price` value is carried to either 8 or 18 decimal places, depending on the stream. For more information, see [https://docs.chain.link/data-streams/crypto-streams](https://docs.chain.link/data-streams/crypto-streams) and [https://docs.chain.link/data-streams/reference/report-schema](https://docs.chain.link/data-streams/reference/report-schema)* ```solidity struct ReportV2 { bytes32 feedId; uint32 validFromTimestamp; uint32 observationsTimestamp; uint192 nativeFee; uint192 linkFee; uint32 expiresAt; int192 benchmarkPrice; } ``` ### ReportV3 *Represents a data report from a Data Streams stream for v3 schema (crypto streams). The `price`, `bid`, and `ask` values are carried to either 8 or 18 decimal places, depending on the stream. For more information, see [https://docs.chain.link/data-streams/crypto-streams](https://docs.chain.link/data-streams/crypto-streams) and [https://docs.chain.link/data-streams/reference/report-schema](https://docs.chain.link/data-streams/reference/report-schema)* ```solidity struct ReportV3 { bytes32 feedId; uint32 validFromTimestamp; uint32 observationsTimestamp; uint192 nativeFee; uint192 linkFee; uint32 expiresAt; int192 price; int192 bid; int192 ask; } ``` ### ReportV4 *Represents a data report from a Data Streams stream for v4 schema (RWA stream). The `price` value is carried to either 8 or 18 decimal places, depending on the stream. The `marketStatus` indicates whether the market is currently open. Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). For more information, see [https://docs.chain.link/data-streams/rwa-streams](https://docs.chain.link/data-streams/rwa-streams) and [https://docs.chain.link/data-streams/reference/report-schema-v4](https://docs.chain.link/data-streams/reference/report-schema-v4)* ```solidity struct ReportV4 { bytes32 feedId; uint32 validFromTimestamp; uint32 observationsTimestamp; uint192 nativeFee; uint192 linkFee; uint32 expiresAt; int192 price; uint32 marketStatus; } ``` --- # WETH9 v0.2.8 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.8/weth9 > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.8 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.8 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.8 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.8/src/ccip/CCIPLocalSimulator.sol"; > ``` ## WETH9 Wrapped Ether implementation. [WETH9](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/shared/WETH9.sol) ## Variables ### allowance ```solidity mapping(address => mapping(address => uint256)) allowance ``` ### balanceOf ```solidity mapping(address => uint256) balanceOf ``` ### decimals ```solidity uint8 decimals ``` ### name ```solidity string name ``` ### symbol ```solidity string symbol ``` ## Events ### Approval ```solidity event Approval(address src, address guy, uint256 wad) ``` ### Deposit ```solidity event Deposit(address dst, uint256 wad) ``` ### Transfer ```solidity event Transfer(address src, address dst, uint256 wad) ``` ### Withdrawal ```solidity event Withdrawal(address src, uint256 wad) ``` ## Functions ### _deposit ```solidity function _deposit() internal ``` ### approve ```solidity function approve(address guy, uint256 wad) public returns (bool) ``` ### deposit ```solidity function deposit() external payable ``` ### receive ```solidity receive() external payable ``` ### totalSupply ```solidity function totalSupply() public view returns (uint256) ``` ### transfer ```solidity function transfer(address dst, uint256 wad) public returns (bool) ``` ### transferFrom ```solidity function transferFrom(address src, address dst, uint256 wad) public returns (bool) ``` ### withdraw ```solidity function withdraw(uint256 wad) external ``` --- # AggregatorInterface v0.2.9 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.9/aggregator-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.9 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.9 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.9/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorInterface Basic price feed interface. [AggregatorInterface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-feeds/interfaces/AggregatorInterface.sol) ## Events ### AnswerUpdated ```solidity event AnswerUpdated(int256 current, uint256 roundId, uint256 updatedAt) ``` Emitted when the answer is updated. #### Parameters | Name | Type | Description | | --------- | ------- | ------------------------------------------------ | | current | int256 | - The updated answer. | | roundId | uint256 | - The round ID for which the answer was updated. | | updatedAt | uint256 | - The timestamp when the answer was updated. | ### NewRound ```solidity event NewRound(uint256 roundId, address startedBy, uint256 startedAt) ``` Emitted when a new round is started. #### Parameters | Name | Type | Description | | --------- | ------- | ---------------------------------------------------- | | roundId | uint256 | - The round ID of the new round. | | startedBy | address | - The address of the account that started the round. | | startedAt | uint256 | - The timestamp when the round was started. | ## Functions ### getAnswer ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` Gets the answer for a specific round ID. #### Parameters | Name | Type | Description | | ------- | ------- | ------------------------------------- | | roundId | uint256 | - The round ID to get the answer for. | #### Returns | Name | Type | Description | | ---- | ------ | ------------------------------------------- | | [0] | int256 | int256 - The answer for the given round ID. | ### getTimestamp ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` Gets the timestamp for a specific round ID. #### Parameters | Name | Type | Description | | ------- | ------- | ---------------------------------------- | | roundId | uint256 | - The round ID to get the timestamp for. | #### Returns | Name | Type | Description | | ---- | ------- | ----------------------------------------------- | | [0] | uint256 | uint256 - The timestamp for the given round ID. | ### latestAnswer ```solidity function latestAnswer() external view returns (int256) ``` Gets the latest answer from the aggregator. #### Returns | Name | Type | Description | | ---- | ------ | --------------------------- | | [0] | int256 | int256 - The latest answer. | ### latestRound ```solidity function latestRound() external view returns (uint256) ``` Gets the latest round ID from the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | ------------------------------ | | [0] | uint256 | uint256 - The latest round ID. | ### latestTimestamp ```solidity function latestTimestamp() external view returns (uint256) ``` Gets the timestamp of the latest answer from the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | --------------------------------------------- | | [0] | uint256 | uint256 - The timestamp of the latest answer. | --- # AggregatorV2V3Interface v0.2.9 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.9/aggregator-v2-v3-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.9 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.9 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.9/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorV2V3Interface Combined V2/V3 price feed interface. [AggregatorV2V3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-feeds/interfaces/AggregatorV2V3Interface.sol) --- # AggregatorV3Interface v0.2.9 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.9/aggregator-v3-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.9 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.9 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.9/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorV3Interface Extended price feed interface. [AggregatorV3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-feeds/interfaces/AggregatorV3Interface.sol) ## Functions ### decimals ```solidity function decimals() external view returns (uint8) ``` Gets the number of decimals used by the aggregator. #### Returns | Name | Type | Description | | ---- | ----- | ------------------------------- | | [0] | uint8 | uint8 - The number of decimals. | ### description ```solidity function description() external view returns (string) ``` Gets the description of the aggregator. #### Returns | Name | Type | Description | | ---- | ------ | -------------------------------------------------- | | [0] | string | string memory - The description of the aggregator. | ### getRoundData ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the round data for a specific round ID. *This function should raise "No data present" if no data is available for the given round ID.* #### Parameters | Name | Type | Description | | --------- | ------ | ----------------------------------- | | _roundId | uint80 | - The round ID to get the data for. | #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------ | | roundId | uint80 | - The round ID. | | answer | int256 | - The answer for the round. | | startedAt | uint256 | - The timestamp when the round started. | | updatedAt | uint256 | - The timestamp when the round was updated. | | answeredInRound | uint80 | - The round ID in which the answer was computed. | ### latestRoundData ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the latest round data. *This function should raise "No data present" if no data is available.* #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------------- | | roundId | uint80 | - The latest round ID. | | answer | int256 | - The latest answer. | | startedAt | uint256 | - The timestamp when the latest round started. | | updatedAt | uint256 | - The timestamp when the latest round was updated. | | answeredInRound | uint80 | - The round ID in which the latest answer was computed. | ### version ```solidity function version() external view returns (uint256) ``` Gets the version of the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | ---------------------------------------- | | [0] | uint256 | uint256 - The version of the aggregator. | --- # BurnMintERC677Helper v0.2.9 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.9/burn-mint-erc677-helper > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.9 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.9 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.9/src/ccip/CCIPLocalSimulator.sol"; > ``` ## BurnMintERC677Helper Helper contract for ERC677 token operations. [BurnMintERC677Helper](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/ccip/BurnMintERC677Helper.sol) ## Functions ### constructor ```solidity constructor(string name, string symbol) public ``` Constructor to initialize the BurnMintERC677Helper contract with a name and symbol. *Calls the parent constructor of BurnMintERC677 with fixed decimals (18) and initial supply (0).* #### Parameters | Name | Type | Description | | ------ | ------ | -------------------------- | | name | string | - The name of the token. | | symbol | string | - The symbol of the token. | ### drip ```solidity function drip(address to) external ``` Mints one full token (1e18) to the specified address. *Calls the internal `_mint` function from the BurnMintERC677 contract.* #### Parameters | Name | Type | Description | | ---- | ------- | ------------------------------------------ | | to | address | - The address to receive the minted token. | --- # CCIPLocalSimulatorFork JS v0.2.9 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.9/ccip-local-simulator-fork-js > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.9 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.9 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.9/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulatorFork JS Hardhat 2 JavaScript helpers for fork routing. [CCIPLocalSimulatorFork JS](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/scripts/CCIPLocalSimulatorFork.js) ## Types ### Evm2EvmMessage : `Object` **Properties** | Name | Type | | ------------------- | ------------------------------------------ | | sourceChainSelector | `bigint` | | sender | `string` | | receiver | `string` | | sequenceNumber | `bigint` | | gasLimit | `bigint` | | strict | `boolean` | | nonce | `bigint` | | feeToken | `string` | | feeTokenAmount | `bigint` | | data | `string` | | tokenAmounts | `Array.<\{token: string, amount: bigint}>` | | sourceTokenData | `Array.` | | messageId | `string` | ## Functions ### requestLinkFromTheFaucet(linkAddress, to, amount) ⇒ `Promise.` Requests LINK tokens from the faucet and returns the transaction hash **Returns**: `Promise.` - Promise resolving to the transaction hash of the fund transfer | Param | Type | Description | | ----------- | -------- | ------------------------------------------------------- | | linkAddress | `string` | The address of the LINK contract on the current network | | to | `string` | The address to send LINK to | | amount | `bigint` | The amount of LINK to request | ### getEvm2EvmMessage(receipt) ⇒ `Evm2EvmMessage` | `null` Parses a transaction receipt to extract the sent message Scans through transaction logs to find a `CCIPSendRequested` event and then decodes it to an object **Returns**: `Evm2EvmMessage` | `null` - Returns either the sent message or null if provided receipt does not contain `CCIPSendRequested` log | Param | Type | Description | | ------- | -------- | ------------------------------------------------ | | receipt | `object` | The transaction receipt from the `ccipSend` call | ### getEvm2AnyRampMessage(receipt) ⇒ `object` | `null` Parses a transaction receipt to extract the sent message from CCIPMessageSent **Returns**: `object` | `null` - Returns \{ destChainSelector, sequenceNumber, EVM2AnyRampMessage message } or null | Param | Type | Description | | ------- | -------- | ------------------------------------------ | | receipt | `object` | – The tx receipt from the on-ramp contract | ### routeMessage(routerAddress, evm2EvmMessage) ⇒ `Promise.` Routes the sent message from the source network on the destination (current) network **Returns**: `Promise.` - Either resolves with no value if the message is successfully routed, or reverts\ **Throws**: - `Error` Fails if no off-ramp matches the message's source chain selector or if calling `router.getOffRamps()` | Param | Type | Description | | -------------- | ---------------- | --------------------------------- | | routerAddress | `string` | Address of the destination Router | | evm2EvmMessage | `Evm2EvmMessage` | Sent cross-chain message | --- # CCIPLocalSimulatorFork v0.2.9 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.9/ccip-local-simulator-fork > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.9 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.9 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.9/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulatorFork CCIP simulator for forked networks. [CCIPLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/ccip/CCIPLocalSimulatorFork.sol) ## Structs ### EVM2EVMMessage ```solidity struct EVM2EVMMessage { uint64 sourceChainSelector; address sender; address receiver; uint64 sequenceNumber; uint256 gasLimit; bool strict; uint64 nonce; address feeToken; uint256 feeTokenAmount; bytes data; struct Client.EVMTokenAmount[] tokenAmounts; bytes[] sourceTokenData; bytes32 messageId; } ``` ### OffRamp Structure representing an offRamp configuration #### Parameters | Name | Type | Description | | ---- | ---- | ----------- | ```solidity struct OffRamp { uint64 sourceChainSelector; address offRamp; } ``` ## Variables ### DEFAULT_GAS_LIMIT ```solidity uint32 DEFAULT_GAS_LIMIT ``` ### i_register ```solidity contract Register i_register ``` The immutable register instance ### LINK_FAUCET ```solidity address LINK_FAUCET ``` The address of the LINK faucet ### s_processedMessages ```solidity mapping(bytes32 => bool) s_processedMessages ``` Mapping to track processed messages ## Errors ### InvalidExtraArgsTag ```solidity error InvalidExtraArgsTag() ``` ## Events ### CCIPMessageSent ```solidity event CCIPMessageSent(uint64 destChainSelector, uint64 sequenceNumber, struct Internal.EVM2AnyRampMessage message) ``` ### CCIPSendRequested ```solidity event CCIPSendRequested(struct InternalPreV1dot6.EVM2EVMMessage message) ``` Events emitted when a CCIP send request is made ## Functions ### _fromBytes ```solidity function _fromBytes(bytes extraArgs) internal pure returns (struct Client.GenericExtraArgsV2) ``` Internal helper function to decode extraArgs bytes to GenericExtraArgsV2 struct. Supports decoding of both GenericExtraArgsV2 and EVMExtraArgsV1 structs. #### Parameters | Name | Type | Description | | --------- | ----- | --------------------------------------------- | | extraArgs | bytes | - The bytes representing the extra arguments. | #### Returns | Name | Type | Description | | ---- | -------------------------------- | --------------------------------------------------------- | | [0] | struct Client.GenericExtraArgsV2 | genericExtraArgs - The decoded GenericExtraArgsV2 struct. | ### _routeCapturedMessages ```solidity function _routeCapturedMessages(uint256[] forkIds, uint256 sourceForkId, address sourceRouterAddress) internal ``` Internal function to route captured messages to their respective destination forks. #### Parameters | Name | Type | Description | | ------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------- | | forkIds | uint256[] | - The IDs of the destination network forks. These are the returned values of `createFork()` or `createSelectFork()`, not chainIds. | | sourceForkId | uint256 | - The ID of the source network fork. This is the returned value of `createFork()` or `createSelectFork()`, not chainId. | | sourceRouterAddress | address | - The address of the Router on the source chain. | ### constructor ```solidity constructor() public ``` Constructor to initialize the contract ### executeSingleMessage ```solidity function executeSingleMessage(struct Internal.Any2EVMRampMessage message, bytes[] offchainTokenData, uint32[] tokenGasOverrides) external ``` Executes a single CCIP message on the offRamp #### Parameters | Name | Type | Description | | ----------------- | ---------------------------------- | --------------------------------- | | message | struct Internal.Any2EVMRampMessage | - The CCIP message to be executed | | offchainTokenData | bytes[] | - Additional offchain token data | | tokenGasOverrides | uint32[] | | ### executeSingleMessage ```solidity function executeSingleMessage(struct InternalPreV1dot6.EVM2EVMMessage message, bytes[] offchainTokenData, uint32[] tokenGasOverrides) external ``` Works with Foundry only ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) ``` Returns the default values for currently CCIP supported networks. If network is not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Name | Type | Description | | ------- | ------- | ------------------------------------------------------------------------------------------------------ | | chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | #### Returns | Name | Type | Description | | ---- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | ### getOffRamps ```solidity function getOffRamps() external view returns (struct IRouterFork.OffRamp[]) ``` Gets the list of offRamps #### Returns | Name | Type | Description | | ---- | ----------------------------- | ----------------------------------- | | [0] | struct IRouterFork.OffRamp[] | offRamps - Array of OffRamp structs | ### getOnRamp ```solidity function getOnRamp(uint64 destChainSelector) external view returns (address) ``` Return the configured onramp for specific a destination chain. @param destChainSelector The destination chain Id to get the onRamp for. #### Returns | Name | Type | Description | | ---- | ------- | -------------------------- | | [0] | address | The address of the onRamp. | ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------- | | to | address | - The address to which LINK tokens are to be sent. | | amount | uint256 | - The amount of LINK tokens to send. | #### Returns | Name | Type | Description | | ------- | ---- | ----------------------------------------------------------------------------- | | success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external ``` If network details are not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Name | Type | Description | | -------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | | networkDetails | struct Register.NetworkDetails | - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | ### switchChainAndRouteMessage ```solidity function switchChainAndRouteMessage(uint256 forkId) external ``` To be called after the sending of the cross-chain message (`ccipSend`). Goes through the list of past logs and looks for the `CCIPSendRequested` and `CCIPMessageSent` events. Switches to a destination network fork. Routes the sent cross-chain message on the destination network. If you sent more than one message, it will try to route all of them to `forkId`. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------------------------------------------------------------------- | | forkId | uint256 | - The ID of the destination network fork. This is the returned value of `createFork()` or `createSelectFork()` | ### switchChainAndRouteMessage ```solidity function switchChainAndRouteMessage(uint256[] forkIds) external ``` To be called after the sending of the cross-chain message (`ccipSend`). Override variant of the `switchChainAndRouteMessage(uint256 forkId)` function in case of multiple destination forks. Goes through the list of past logs and looks for the `CCIPSendRequested` and `CCIPMessageSent` events. Loops through provided `forkIds` and tries to route the message to correct destination. If you haven't provide correct `forkId`, the message will get lost. If you sent more than one message, it will try to route all of them to correct destinations. #### Parameters | Name | Type | Description | | ------- | ---------- | ------------------------------------------------------------------------------------------------------------------- | | forkIds | uint256[] | - The IDs of the destination network forks. These are the returned values of `createFork()` or `createSelectFork()` | --- # CCIPLocalSimulator v0.2.9 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.9/ccip-local-simulator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.9 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.9 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.9/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulator Local CCIP simulator (no-fork mode). [CCIPLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/ccip/CCIPLocalSimulator.sol) ## Variables ### CHAIN_SELECTOR ```solidity uint64 CHAIN_SELECTOR ``` The unique CCIP Chain Selector constant ### i_ccipBnM ```solidity contract BurnMintERC677Helper i_ccipBnM ``` The BurnMintERC677Helper instance for CCIP-BnM token ### i_ccipLnM ```solidity contract BurnMintERC677Helper i_ccipLnM ``` The BurnMintERC677Helper instance for CCIP-LnM token ### i_linkToken ```solidity contract LinkToken i_linkToken ``` The LINK token instance ### i_mockRouter ```solidity contract MockCCIPRouter i_mockRouter ``` The mock CCIP router instance ### i_wrappedNative ```solidity contract WETH9 i_wrappedNative ``` The wrapped native token instance ### s_supportedTokens ```solidity address[] s_supportedTokens ``` The list of supported token addresses ## Errors ### CCIPLocalSimulator__MsgSenderIsNotTokenOwner ```solidity error CCIPLocalSimulator__MsgSenderIsNotTokenOwner() ``` ### CCIPLocalSimulator__RequiredRoleNotFound ```solidity error CCIPLocalSimulator__RequiredRoleNotFound(address account, bytes32 role, address token) ``` ## Functions ### configuration ```solidity function configuration() public view returns (uint64 chainSelector_, contract IRouterClient sourceRouter_, contract IRouterClient destinationRouter_, contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract BurnMintERC677Helper ccipBnM_, contract BurnMintERC677Helper ccipLnM_) ``` Returns configuration details for pre-deployed contracts and services needed for local CCIP simulations. #### Returns | Name | Type | Description | | ------------------- | ----------------------------- | ----------------------------------------------------------- | | chainSelector_ | uint64 | - The unique CCIP Chain Selector. | | sourceRouter_ | contract IRouterClient | - The source chain Router contract. | | destinationRouter_ | contract IRouterClient | - The destination chain Router contract. | | wrappedNative_ | contract WETH9 | - The wrapped native token which can be used for CCIP fees. | | linkToken_ | contract LinkToken | - The LINK token. | | ccipBnM_ | contract BurnMintERC677Helper | - The ccipBnM token. | | ccipLnM_ | contract BurnMintERC677Helper | - The ccipLnM token. | ### constructor ```solidity constructor() public ``` Constructor to initialize the contract and pre-deployed token instances ### getSupportedTokens ```solidity function getSupportedTokens(uint64 chainSelector) external view returns (address[] tokens) ``` Gets a list of token addresses that are supported for cross-chain transfers by the simulator. #### Parameters | Name | Type | Description | | ------------- | ------ | --------------------------------- | | chainSelector | uint64 | - The unique CCIP Chain Selector. | #### Returns | Name | Type | Description | | ------ | ---------- | -------------------------------------------------------------------------------------------------- | | tokens | address[] | - Returns a list of token addresses that are supported for cross-chain transfers by the simulator. | ### isChainSupported ```solidity function isChainSupported(uint64 chainSelector) public pure returns (bool supported) ``` Checks whether the provided `chainSelector` is supported by the simulator. #### Parameters | Name | Type | Description | | ------------- | ------ | --------------------------------- | | chainSelector | uint64 | - The unique CCIP Chain Selector. | #### Returns | Name | Type | Description | | --------- | ---- | ---------------------------------------------------------------- | | supported | bool | - Returns true if `chainSelector` is supported by the simulator. | ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------- | | to | address | - The address to which LINK tokens are to be sent. | | amount | uint256 | - The amount of LINK tokens to send. | #### Returns | Name | Type | Description | | ------- | ---- | ----------------------------------------------------------------------------- | | success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | ### supportNewTokenViaAccessControlDefaultAdmin ```solidity function supportNewTokenViaAccessControlDefaultAdmin(address tokenAddress) external ``` Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. The caller must have the DEFAULT_ADMIN_ROLE as defined by the contract itself. Reverts if the caller is not the admin of the token using OZ's AccessControl DEFAULT_ADMIN_ROLE. #### Parameters | Name | Type | Description | | ------------ | ------- | ------------------------------------------------------------------ | | tokenAddress | address | - The address of the token to add to the list of supported tokens. | ### supportNewTokenViaGetCCIPAdmin ```solidity function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external ``` Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. Reverts if token does not implement getCCIPAdmin() function. Reverts if the caller is not the token CCIPAdmin. #### Parameters | Name | Type | Description | | ------------ | ------- | ------------------------------------------------------------------ | | tokenAddress | address | - The address of the token to add to the list of supported tokens. | ### supportNewTokenViaOwner ```solidity function supportNewTokenViaOwner(address tokenAddress) external ``` Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. Reverts if token does not implement owner() function. Reverts if the caller is not the token owner. #### Parameters | Name | Type | Description | | ------------ | ------- | ------------------------------------------------------------------ | | tokenAddress | address | - The address of the token to add to the list of supported tokens. | --- # DataStreamsLocalSimulatorFork v0.2.9 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.9/data-streams-local-simulator-fork > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.9 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.9 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.9/src/ccip/CCIPLocalSimulator.sol"; > ``` ## DataStreamsLocalSimulatorFork Data Streams simulator for forked networks. [DataStreamsLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-streams/DataStreamsLocalSimulatorFork.sol) ## Variables ### i_register ```solidity contract Register i_register ``` The immutable register instance ### LINK_FAUCET ```solidity address LINK_FAUCET ``` The address of the LINK faucet ## Functions ### constructor ```solidity constructor() public ``` Constructor to initialize the contract ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) ``` Returns the default values for currently Data Streams supported networks. If network is not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Name | Type | Description | | ------- | ------- | ----------------------------------------------------------------------------- | | chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | #### Returns | Name | Type | Description | | ---- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | | [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------- | | to | address | - The address to which LINK tokens are to be sent. | | amount | uint256 | - The amount of LINK tokens to send. | #### Returns | Name | Type | Description | | ------- | ---- | ----------------------------------------------------------------------------- | | success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | ### requestNativeFromFaucet ```solidity function requestNativeFromFaucet(address to, uint256 amount) external ``` Requests native coints from the faucet. #### Parameters | Name | Type | Description | | ------ | ------- | --------------------------------------------------- | | to | address | - The address to which native coins are to be sent. | | amount | uint256 | - The amount of native coins to send. | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external ``` If network details are not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. #### Parameters | Name | Type | Description | | -------------- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- | | chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | | networkDetails | struct Register.NetworkDetails | - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | --- # DataStreamsLocalSimulator v0.2.9 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.9/data-streams-local-simulator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.9 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.9 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.9/src/ccip/CCIPLocalSimulator.sol"; > ``` ## DataStreamsLocalSimulator Local Data Streams simulator (no-fork mode). [DataStreamsLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-streams/DataStreamsLocalSimulator.sol) ## Variables ### i_linkToken ```solidity contract LinkToken i_linkToken ``` The LINK token instance ### i_wrappedNative ```solidity contract WETH9 i_wrappedNative ``` The wrapped native token instance ### s_mockFeeManager ```solidity contract MockFeeManager s_mockFeeManager ``` ### s_mockRewardManager ```solidity contract MockRewardManager s_mockRewardManager ``` ### s_mockVerifier ```solidity contract MockVerifier s_mockVerifier ``` ### s_mockVerifierProxy ```solidity contract MockVerifierProxy s_mockVerifierProxy ``` ## Functions ### configuration ```solidity function configuration() public view returns (contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract MockVerifier mockVerifier_, contract MockVerifierProxy mockVerifierProxy_, contract MockFeeManager mockFeeManager_, contract MockRewardManager mockRewardManager_) ``` @notice Returns configuration details for pre-deployed contracts and services needed for local Data Streams simulations. #### Returns | Name | Type | Description | | ------------------- | -------------------------- | ----------------------------------- | | wrappedNative_ | contract WETH9 | - The wrapped native token. | | linkToken_ | contract LinkToken | - The LINK token. | | mockVerifier_ | contract MockVerifier | - The mock verifier contract. | | mockVerifierProxy_ | contract MockVerifierProxy | - The mock verifier proxy contract. | | mockFeeManager_ | contract MockFeeManager | - The mock fee manager contract. | | mockRewardManager_ | contract MockRewardManager | - The mock reward manager contract. | ### constructor ```solidity constructor() public ``` ### requestLinkFromFaucet ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Name | Type | Description | | ------ | ------- | -------------------------------------------------- | | to | address | - The address to which LINK tokens are to be sent. | | amount | uint256 | - The amount of LINK tokens to send. | #### Returns | Name | Type | Description | | ------- | ---- | ----------------------------------------------------------------------------- | | success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | --- # Register (Data Streams) v0.2.9 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.9/data-streams-register > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.9 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.9 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.9/src/ccip/CCIPLocalSimulator.sol"; > ``` ## Register (Data Streams) Data Streams network configuration registry. [Register (Data Streams)](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-streams/Register.sol) ## Structs ### NetworkDetails ```solidity struct NetworkDetails { address verifierProxyAddress; address linkAddress; } ``` ## Variables ### s_networkDetails ```solidity mapping(uint256 => struct Register.NetworkDetails) s_networkDetails ``` Mapping to store network details based on chain ID. ## Functions ### constructor ```solidity constructor() public ``` Constructor to initialize the network details for various chains. ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails networkDetails) ``` Retrieves network details for a given chain ID. #### Parameters | Name | Type | Description | | ------- | ------- | --------------------------------------------- | | chainId | uint256 | - The ID of the chain to get the details for. | #### Returns | Name | Type | Description | | -------------- | ------------------------------ | ------------------------------------------------- | | networkDetails | struct Register.NetworkDetails | - The network details for the specified chain ID. | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external ``` Sets the network details for a given chain ID. #### Parameters | Name | Type | Description | | -------------- | ------------------------------ | -------------------------------------------------------- | | chainId | uint256 | - The ID of the chain to set the details for. | | networkDetails | struct Register.NetworkDetails | - The network details to set for the specified chain ID. | --- # Chainlink Local v0.2.9 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.9 > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.9 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.9 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.9/src/ccip/CCIPLocalSimulator.sol"; > ``` Chainlink Local v0.2.9 fixes `CCIPLocalSimulatorFork.switchChainAndRouteMessage` to pair the destination OffRamp with the source OnRamp by reading `getSourceChainConfig` (v1.6+) and `getStaticConfig` (pre-v1.6), with a fallback to other OffRamps with the same `sourceChainSelector`. This is the last release of the `0.2.x` line and the one Hardhat 2 users stay on. ## CCIP These contracts provide Cross-Chain Interoperability Protocol (CCIP) functionality in a local testing environment: - [CCIPLocalSimulator](/chainlink-local/api-reference/v0.2.9/ccip-local-simulator) - Local CCIP simulator (no-fork mode) - [CCIPLocalSimulatorFork](/chainlink-local/api-reference/v0.2.9/ccip-local-simulator-fork) - CCIP simulator for forked networks - [CCIPLocalSimulatorFork JS](/chainlink-local/api-reference/v0.2.9/ccip-local-simulator-fork-js) - JavaScript helpers for fork routing - [Register](/chainlink-local/api-reference/v0.2.9/register) - CCIP network configuration registry ## Data Streams Contracts for simulating Chainlink Data Streams: - [DataStreamsLocalSimulator](/chainlink-local/api-reference/v0.2.9/data-streams-local-simulator) - Local Data Streams simulator (no-fork mode) - [DataStreamsLocalSimulatorFork](/chainlink-local/api-reference/v0.2.9/data-streams-local-simulator-fork) - Data Streams simulator for forked networks - [MockVerifier](/chainlink-local/api-reference/v0.2.9/mock-verifier) - Mock Data Streams verifier - [MockVerifierProxy](/chainlink-local/api-reference/v0.2.9/mock-verifier-proxy) - Mock Data Streams verifier proxy - [MockReportGenerator](/chainlink-local/api-reference/v0.2.9/mock-report-generator) - Signed report generator for every report schema - [MockFeeManager](/chainlink-local/api-reference/v0.2.9/mock-fee-manager) - Mock verifier fee manager - [MockRewardManager](/chainlink-local/api-reference/v0.2.9/mock-reward-manager) - Mock reward manager - [ReportVersions](/chainlink-local/api-reference/v0.2.9/report-versions) - Data Streams report schemas - [Register (Data Streams)](/chainlink-local/api-reference/v0.2.9/data-streams-register) - Data Streams network configuration registry ## Data Feeds Contracts for simulating Chainlink Data Feeds: - [AggregatorInterface](/chainlink-local/api-reference/v0.2.9/aggregator-interface) - Basic price feed interface - [AggregatorV2V3Interface](/chainlink-local/api-reference/v0.2.9/aggregator-v2-v3-interface) - Combined V2/V3 price feed interface - [AggregatorV3Interface](/chainlink-local/api-reference/v0.2.9/aggregator-v3-interface) - Extended price feed interface - [MockOffchainAggregator](/chainlink-local/api-reference/v0.2.9/mock-offchain-aggregator) - Mock implementation of off-chain aggregator - [MockV3Aggregator](/chainlink-local/api-reference/v0.2.9/mock-v3-aggregator) - Mock implementation of V3 aggregator ## Token Contracts Standard token implementations for testing: - [BurnMintERC677Helper](/chainlink-local/api-reference/v0.2.9/burn-mint-erc677-helper) - Helper contract for ERC677 token operations - [LinkToken](/chainlink-local/api-reference/v0.2.9/link-token) - LINK token implementation - [WETH9](/chainlink-local/api-reference/v0.2.9/weth9) - Wrapped Ether implementation --- # LinkToken v0.2.9 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.9/link-token > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.9 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.9 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.9/src/ccip/CCIPLocalSimulator.sol"; > ``` ## LinkToken LINK token implementation. [LinkToken](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/shared/LinkToken.sol) ## Functions ### _onCreate ```solidity function _onCreate() internal virtual ``` Hook that is called when this contract is created. *Useful to override constructor behaviour in child contracts (e.g., LINK bridge tokens). The default implementation mints 10\*\*27 tokens to the contract deployer.* ### constructor ```solidity constructor() public ``` Constructor to initialize the LinkToken contract with a fixed total supply, name, and symbol. *Calls the ERC677 constructor with the name and symbol, and then mints the total supply to the contract deployer.* --- # MockFeeManager v0.2.9 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.9/mock-fee-manager > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.9 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.9 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.9/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockFeeManager Mock verifier fee manager. [MockFeeManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-streams/MockFeeManager.sol) ## Structs ### Asset ```solidity struct Asset { address assetAddress; uint256 amount; } ``` ## Variables ### i_linkAddress ```solidity address i_linkAddress ``` ### i_nativeAddress ```solidity address i_nativeAddress ``` ### i_proxyAddress ```solidity address i_proxyAddress ``` ### i_rewardManager ```solidity contract IRewardManager i_rewardManager ``` ### s_mockDiscounts ```solidity mapping(address => uint256) s_mockDiscounts ``` ### s_nativeSurcharge ```solidity uint256 s_nativeSurcharge ``` ## Errors ### ExpiredReport ```solidity error ExpiredReport() ``` ### InvalidAddress ```solidity error InvalidAddress() ``` ### InvalidDeposit ```solidity error InvalidDeposit() ``` ### InvalidDiscount ```solidity error InvalidDiscount() ``` ### InvalidQuote ```solidity error InvalidQuote() ``` ### InvalidSurcharge ```solidity error InvalidSurcharge() ``` ### Unauthorized ```solidity error Unauthorized() ``` ## Functions ### _processFee ```solidity function _processFee(bytes payload, bytes parameterPayload, address subscriber) internal ``` ### constructor ```solidity constructor(address linkAddress, address nativeAddress, address proxyAddress, address rewardManager) public ``` ### getFeeAndReward ```solidity function getFeeAndReward(address subscriber, bytes report, address quoteAddress) public view returns (struct Common.Asset, struct Common.Asset, uint256) ``` ### getMockDiscount ```solidity function getMockDiscount(address subscriber) external view returns (uint256) ``` ### processFee ```solidity function processFee(bytes payload, bytes parameterPayload, address subscriber) external payable ``` ### processFeeBulk ```solidity function processFeeBulk(bytes[] payloads, bytes parameterPayload, address subscriber) external payable ``` ### setMockDiscount ```solidity function setMockDiscount(address subscriber, uint256 discount) external ``` ### setNativeSurcharge ```solidity function setNativeSurcharge(uint64 surcharge) external ``` ### supportsInterface ```solidity function supportsInterface(bytes4 interfaceId) external pure returns (bool) ``` _Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding [https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP) section] to learn more about how these ids are created. This function call must use less than 30 000 gas._ --- # MockOffchainAggregator v0.2.9 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.9/mock-offchain-aggregator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.9 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.9 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.9/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockOffchainAggregator Mock implementation of off-chain aggregator. [MockOffchainAggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-feeds/MockOffchainAggregator.sol) ## Variables ### decimals ```solidity uint8 decimals ``` The number of decimals used by the aggregator. ### getAnswer ```solidity mapping(uint256 => int256) getAnswer ``` Mapping to get the answer for a specific round ID. ### getTimestamp ```solidity mapping(uint256 => uint256) getTimestamp ``` Mapping to get the timestamp for a specific round ID. ### latestAnswer ```solidity int256 latestAnswer ``` The latest answer reported by the aggregator. ### latestRound ```solidity uint256 latestRound ``` The latest round ID. ### latestTimestamp ```solidity uint256 latestTimestamp ``` The timestamp of the latest answer. ### maxAnswer ```solidity int192 maxAnswer ``` The maximum answer the aggregator is allowed to report. ### minAnswer ```solidity int192 minAnswer ``` The minimum answer the aggregator is allowed to report. ## Functions ### constructor ```solidity constructor(uint8 _decimals, int256 _initialAnswer) public ``` Constructor to initialize the MockOffchainAggregator contract with initial parameters. #### Parameters | Name | Type | Description | | --------------- | ------ | ------------------------------------------------------ | | _decimals | uint8 | - The number of decimals for the aggregator. | | _initialAnswer | int256 | - The initial answer to be set in the mock aggregator. | ### getRoundData ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the round data for a specific round ID. #### Parameters | Name | Type | Description | | --------- | ------ | ----------------------------------- | | _roundId | uint80 | - The round ID to get the data for. | #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------ | | roundId | uint80 | - The round ID. | | answer | int256 | - The answer for the round. | | startedAt | uint256 | - The timestamp when the round started. | | updatedAt | uint256 | - The timestamp when the round was updated. | | answeredInRound | uint80 | - The round ID in which the answer was computed. | ### latestRoundData ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the latest round data. #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------------- | | roundId | uint80 | - The latest round ID. | | answer | int256 | - The latest answer. | | startedAt | uint256 | - The timestamp when the latest round started. | | updatedAt | uint256 | - The timestamp when the latest round was updated. | | answeredInRound | uint80 | - The round ID in which the latest answer was computed. | ### updateAnswer ```solidity function updateAnswer(int256 _answer) public ``` Updates the answer in the mock aggregator. #### Parameters | Name | Type | Description | | -------- | ------ | --------------------------- | | _answer | int256 | - The new answer to be set. | ### updateMinAndMaxAnswers ```solidity function updateMinAndMaxAnswers(int192 _minAnswer, int192 _maxAnswer) external ``` Updates the minimum and maximum answers the aggregator can report. #### Parameters | Name | Type | Description | | ----------- | ------ | ------------------------- | | _minAnswer | int192 | - The new minimum answer. | | _maxAnswer | int192 | - The new maximum answer. | ### updateRoundData ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` Updates the round data in the mock aggregator. #### Parameters | Name | Type | Description | | ----------- | ------- | --------------------------------------- | | _roundId | uint80 | - The round ID to be updated. | | _answer | int256 | - The new answer to be set. | | _timestamp | uint256 | - The timestamp to be set. | | _startedAt | uint256 | - The timestamp when the round started. | --- # MockReportGenerator v0.2.9 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.9/mock-report-generator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.9 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.9 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.9/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockReportGenerator Signed report generator for every report schema. [MockReportGenerator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-streams/MockReportGenerator.sol) ## Variables ### i_donAddress ```solidity address i_donAddress ``` ### i_donDigest ```solidity uint256 i_donDigest ``` ### i_reportV2MockFeedId ```solidity bytes32 i_reportV2MockFeedId ``` ### i_reportV3MockFeedId ```solidity bytes32 i_reportV3MockFeedId ``` ### i_reportV4MockFeedId ```solidity bytes32 i_reportV4MockFeedId ``` ### s_ask ```solidity int192 s_ask ``` ### s_bid ```solidity int192 s_bid ``` ### s_expiresPeriod ```solidity uint32 s_expiresPeriod ``` ### s_linkFee ```solidity uint192 s_linkFee ``` ### s_marketStatus ```solidity uint32 s_marketStatus ``` ### s_nativeFee ```solidity uint192 s_nativeFee ``` ### s_price ```solidity int192 s_price ``` ## Errors ### MockReportGenerator__CastOverflow ```solidity error MockReportGenerator__CastOverflow() ``` ### MockReportGenerator__InvalidAsk ```solidity error MockReportGenerator__InvalidAsk() ``` ### MockReportGenerator__InvalidBid ```solidity error MockReportGenerator__InvalidBid() ``` ## Functions ### constructor ```solidity constructor(int192 initialPrice) public ``` ### generateReport ```solidity function generateReport(struct ReportVersions.ReportV2 report) external returns (bytes signedReport) ``` ### generateReport ```solidity function generateReport(struct ReportVersions.ReportV3 report) external returns (bytes signedReport) ``` ### generateReport ```solidity function generateReport(struct ReportVersions.ReportV4 report) external returns (bytes signedReport) ``` ### generateReportV2 ```solidity function generateReportV2() external returns (bytes signedReport, struct ReportVersions.ReportV2 report) ``` ### generateReportV3 ```solidity function generateReportV3() external returns (bytes signedReport, struct ReportVersions.ReportV3 report) ``` ### generateReportV4 ```solidity function generateReportV4() external returns (bytes signedReport, struct ReportVersions.ReportV4 report) ``` ### getMockDonAddress ```solidity function getMockDonAddress() external view returns (address) ``` ### updateExpiresPeriod ```solidity function updateExpiresPeriod(uint32 period) external ``` ### updateFees ```solidity function updateFees(uint192 nativeFee, uint192 linkFee) external ``` ### updateMarketStatus ```solidity function updateMarketStatus(uint32 status) external ``` ### updatePrice ```solidity function updatePrice(int192 price) public ``` ### updatePriceBidAndAsk ```solidity function updatePriceBidAndAsk(int192 price, int192 bid, int192 ask) external ``` --- # MockRewardManager v0.2.9 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.9/mock-reward-manager > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.9 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.9 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.9/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockRewardManager Mock reward manager. [MockRewardManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-streams/MockRewardManager.sol) ## Variables ### i_linkAddress ```solidity address i_linkAddress ``` ### s_feeManagerAddress ```solidity address s_feeManagerAddress ``` ## Errors ### Unauthorized ```solidity error Unauthorized() ``` ## Events ### FeePaid ```solidity event FeePaid(struct IRewardManager.FeePayment[] payments, address payer) ``` ## Functions ### claimRewards ```solidity function claimRewards(bytes32[]) external pure ``` ### constructor ```solidity constructor(address linkAddress) public ``` ### onFeePaid ```solidity function onFeePaid(struct IRewardManager.FeePayment[] payments, address payer) external ``` ### setFeeManager ```solidity function setFeeManager(address newFeeManager) external ``` ### supportsInterface ```solidity function supportsInterface(bytes4 interfaceId) external pure returns (bool) ``` _Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding [https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP) section] to learn more about how these ids are created. This function call must use less than 30 000 gas._ --- # MockV3Aggregator v0.2.9 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.9/mock-v3-aggregator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.9 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.9 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.9/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockV3Aggregator Mock implementation of V3 aggregator. [MockV3Aggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-feeds/MockV3Aggregator.sol) ## Variables ### aggregator ```solidity address aggregator ``` The address of the current aggregator. ### proposedAggregator ```solidity address proposedAggregator ``` The address of the proposed aggregator. ### version ```solidity uint256 version ``` The version of the aggregator. ## Functions ### confirmAggregator ```solidity function confirmAggregator(address _aggregator) external ``` Confirms the proposed aggregator. #### Parameters | Name | Type | Description | | ------------ | ------- | ----------------------------------------- | | _aggregator | address | - The address of the proposed aggregator. | ### constructor ```solidity constructor(uint8 _decimals, int256 _initialAnswer) public ``` Constructor to initialize the MockV3Aggregator contract with initial parameters. #### Parameters | Name | Type | Description | | --------------- | ------ | ------------------------------------------------------ | | _decimals | uint8 | - The number of decimals for the aggregator. | | _initialAnswer | int256 | - The initial answer to be set in the mock aggregator. | ### decimals ```solidity function decimals() external view returns (uint8) ``` Gets the number of decimals used by the aggregator. #### Returns | Name | Type | Description | | ---- | ----- | ------------------------------- | | [0] | uint8 | uint8 - The number of decimals. | ### description ```solidity function description() external pure returns (string) ``` Gets the description of the aggregator. #### Returns | Name | Type | Description | | ---- | ------ | -------------------------------------------------- | | [0] | string | string memory - The description of the aggregator. | ### getAnswer ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` Gets the answer for a specific round ID. #### Parameters | Name | Type | Description | | ------- | ------- | ------------------------------------- | | roundId | uint256 | - The round ID to get the answer for. | #### Returns | Name | Type | Description | | ---- | ------ | ------------------------------------------- | | [0] | int256 | int256 - The answer for the given round ID. | ### getRoundData ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the round data for a specific round ID. *This function should raise "No data present" if no data is available for the given round ID.* #### Parameters | Name | Type | Description | | --------- | ------ | ----------------------------------- | | _roundId | uint80 | - The round ID to get the data for. | #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------ | | roundId | uint80 | - The round ID. | | answer | int256 | - The answer for the round. | | startedAt | uint256 | - The timestamp when the round started. | | updatedAt | uint256 | - The timestamp when the round was updated. | | answeredInRound | uint80 | - The round ID in which the answer was computed. | ### getTimestamp ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` Gets the timestamp for a specific round ID. #### Parameters | Name | Type | Description | | ------- | ------- | ---------------------------------------- | | roundId | uint256 | - The round ID to get the timestamp for. | #### Returns | Name | Type | Description | | ---- | ------- | ----------------------------------------------- | | [0] | uint256 | uint256 - The timestamp for the given round ID. | ### latestAnswer ```solidity function latestAnswer() external view returns (int256) ``` Gets the latest answer from the aggregator. #### Returns | Name | Type | Description | | ---- | ------ | --------------------------- | | [0] | int256 | int256 - The latest answer. | ### latestRound ```solidity function latestRound() external view returns (uint256) ``` Gets the latest round ID from the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | ------------------------------ | | [0] | uint256 | uint256 - The latest round ID. | ### latestRoundData ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` Gets the latest round data. *This function should raise "No data present" if no data is available.* #### Returns | Name | Type | Description | | --------------- | ------- | ------------------------------------------------------- | | roundId | uint80 | - The latest round ID. | | answer | int256 | - The latest answer. | | startedAt | uint256 | - The timestamp when the latest round started. | | updatedAt | uint256 | - The timestamp when the latest round was updated. | | answeredInRound | uint80 | - The round ID in which the latest answer was computed. | ### latestTimestamp ```solidity function latestTimestamp() external view returns (uint256) ``` Gets the timestamp of the latest answer from the aggregator. #### Returns | Name | Type | Description | | ---- | ------- | --------------------------------------------- | | [0] | uint256 | uint256 - The timestamp of the latest answer. | ### proposeAggregator ```solidity function proposeAggregator(contract AggregatorV2V3Interface _aggregator) external ``` Proposes a new aggregator. #### Parameters | Name | Type | Description | | ------------ | -------------------------------- | ----------------------------------------- | | _aggregator | contract AggregatorV2V3Interface | - The address of the proposed aggregator. | ### updateAnswer ```solidity function updateAnswer(int256 _answer) public ``` Updates the answer in the mock aggregator. #### Parameters | Name | Type | Description | | -------- | ------ | --------------------------- | | _answer | int256 | - The new answer to be set. | ### updateRoundData ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` Updates the round data in the mock aggregator. #### Parameters | Name | Type | Description | | ----------- | ------- | --------------------------------------- | | _roundId | uint80 | - The round ID to be updated. | | _answer | int256 | - The new answer to be set. | | _timestamp | uint256 | - The timestamp to be set. | | _startedAt | uint256 | - The timestamp when the round started. | --- # MockVerifierProxy v0.2.9 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.9/mock-verifier-proxy > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.9 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.9 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.9/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockVerifierProxy Mock Data Streams verifier proxy. [MockVerifierProxy](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-streams/MockVerifierProxy.sol) ## Variables ### s_feeManager ```solidity contract IVerifierFeeManager s_feeManager ``` ### s_verifier ```solidity address s_verifier ``` ## Errors ### VerifierInvalid ```solidity error VerifierInvalid() ``` ### VerifierNotFound ```solidity error VerifierNotFound() ``` ### ZeroAddress ```solidity error ZeroAddress() ``` ## Events ### VerifierInitialized ```solidity event VerifierInitialized(address verifierAddress) ``` ## Functions ### _verify ```solidity function _verify(bytes payload) internal returns (bytes) ``` ### getVerifier ```solidity function getVerifier(bytes32) external view returns (address) ``` ### initializeVerifier ```solidity function initializeVerifier(address verifierAddress) external ``` ### setFeeManager ```solidity function setFeeManager(contract IVerifierFeeManager feeManager) external ``` ### verify ```solidity function verify(bytes payload, bytes parameterPayload) external payable returns (bytes) ``` ### verifyBulk ```solidity function verifyBulk(bytes[] payloads, bytes parameterPayload) external payable returns (bytes[] verifiedReports) ``` --- # MockVerifier v0.2.9 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.9/mock-verifier > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.9 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.9 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.9/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockVerifier Mock Data Streams verifier. [MockVerifier](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-streams/MockVerifier.sol) ## Variables ### i_verifierProxy ```solidity address i_verifierProxy ``` ### MOCK_DATA_STREAM_DON_ADDRESS ```solidity address MOCK_DATA_STREAM_DON_ADDRESS ``` ### N_2 ```solidity uint256 N_2 ``` ### s_inactiveDigests ```solidity mapping(bytes32 => mapping(bytes32 => bool)) s_inactiveDigests ``` ### s_inactiveFeeds ```solidity mapping(bytes32 => bool) s_inactiveFeeds ``` ### s_verifiedSignatures ```solidity mapping(bytes => bool) s_verifiedSignatures ``` ## Errors ### AccessForbidden ```solidity error AccessForbidden() ``` ### AlreadyUsedSignature ```solidity error AlreadyUsedSignature() ``` ### BadVerification ```solidity error BadVerification() ``` ### DigestInactive ```solidity error DigestInactive(bytes32 feedId, bytes32 configDigest) ``` ### InactiveFeed ```solidity error InactiveFeed(bytes32 feedId) ``` ### InvalidS ```solidity error InvalidS() ``` ### InvalidSignatureLength ```solidity error InvalidSignatureLength() ``` ### InvalidV ```solidity error InvalidV() ``` ## Events ### ReportVerified ```solidity event ReportVerified(bytes32 feedId, address sender) ``` ## Functions ### activateConfig ```solidity function activateConfig(bytes32 feedId, bytes32 configDigest) external ``` ### activateFeed ```solidity function activateFeed(bytes32 feedId) external ``` ### constructor ```solidity constructor(address verifierProxy) public ``` ### deactivateConfig ```solidity function deactivateConfig(bytes32 feedId, bytes32 configDigest) external ``` ### deactivateFeed ```solidity function deactivateFeed(bytes32 feedId) external ``` ### supportsInterface ```solidity function supportsInterface(bytes4 interfaceId) external pure returns (bool) ``` _Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding [https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP) section] to learn more about how these ids are created. This function call must use less than 30 000 gas._ ### verify ```solidity function verify(bytes signedReport, address sender) external returns (bytes verifierResponse) ``` --- # Register v0.2.9 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.9/register > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.9 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.9 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.9/src/ccip/CCIPLocalSimulator.sol"; > ``` ## Register CCIP network configuration registry. [Register](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/ccip/Register.sol) ## Structs ### NetworkDetails ```solidity struct NetworkDetails { uint64 chainSelector; address routerAddress; address linkAddress; address wrappedNativeAddress; address ccipBnMAddress; address ccipLnMAddress; address rmnProxyAddress; address registryModuleOwnerCustomAddress; address tokenAdminRegistryAddress; } ``` ## Variables ### s_networkDetails ```solidity mapping(uint256 => struct Register.NetworkDetails) s_networkDetails ``` Mapping to store network details based on chain ID. ## Functions ### constructor ```solidity constructor() public ``` Constructor to initialize the network details for various chains. ### getNetworkDetails ```solidity function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails networkDetails) ``` Retrieves network details for a given chain ID. #### Parameters | Name | Type | Description | | ------- | ------- | --------------------------------------------- | | chainId | uint256 | - The ID of the chain to get the details for. | #### Returns | Name | Type | Description | | -------------- | ------------------------------ | ------------------------------------------------- | | networkDetails | struct Register.NetworkDetails | - The network details for the specified chain ID. | ### setNetworkDetails ```solidity function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external ``` Sets the network details for a given chain ID. #### Parameters | Name | Type | Description | | -------------- | ------------------------------ | -------------------------------------------------------- | | chainId | uint256 | - The ID of the chain to set the details for. | | networkDetails | struct Register.NetworkDetails | - The network details to set for the specified chain ID. | --- # ReportVersions v0.2.9 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.9/report-versions > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.9 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.9 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.9/src/ccip/CCIPLocalSimulator.sol"; > ``` ## ReportVersions Data Streams report schemas. [ReportVersions](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-streams/ReportVersions.sol) ## Structs ### ReportV2 *Represents a data report from a Data Streams stream for v2 schema (crypto streams). The `price` value is carried to either 8 or 18 decimal places, depending on the stream. For more information, see [https://docs.chain.link/data-streams/crypto-streams](https://docs.chain.link/data-streams/crypto-streams) and [https://docs.chain.link/data-streams/reference/report-schema](https://docs.chain.link/data-streams/reference/report-schema)* ```solidity struct ReportV2 { bytes32 feedId; uint32 validFromTimestamp; uint32 observationsTimestamp; uint192 nativeFee; uint192 linkFee; uint32 expiresAt; int192 benchmarkPrice; } ``` ### ReportV3 *Represents a data report from a Data Streams stream for v3 schema (crypto streams). The `price`, `bid`, and `ask` values are carried to either 8 or 18 decimal places, depending on the stream. For more information, see [https://docs.chain.link/data-streams/crypto-streams](https://docs.chain.link/data-streams/crypto-streams) and [https://docs.chain.link/data-streams/reference/report-schema](https://docs.chain.link/data-streams/reference/report-schema)* ```solidity struct ReportV3 { bytes32 feedId; uint32 validFromTimestamp; uint32 observationsTimestamp; uint192 nativeFee; uint192 linkFee; uint32 expiresAt; int192 price; int192 bid; int192 ask; } ``` ### ReportV4 *Represents a data report from a Data Streams stream for v4 schema (RWA stream). The `price` value is carried to either 8 or 18 decimal places, depending on the stream. The `marketStatus` indicates whether the market is currently open. Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). For more information, see [https://docs.chain.link/data-streams/rwa-streams](https://docs.chain.link/data-streams/rwa-streams) and [https://docs.chain.link/data-streams/reference/report-schema-v4](https://docs.chain.link/data-streams/reference/report-schema-v4)* ```solidity struct ReportV4 { bytes32 feedId; uint32 validFromTimestamp; uint32 observationsTimestamp; uint192 nativeFee; uint192 linkFee; uint32 expiresAt; int192 price; uint32 marketStatus; } ``` --- # WETH9 v0.2.9 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.9/weth9 > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.2.9 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.2.9 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.2.9 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.2.9/src/ccip/CCIPLocalSimulator.sol"; > ``` ## WETH9 Wrapped Ether implementation. [WETH9](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/shared/WETH9.sol) ## Variables ### allowance ```solidity mapping(address => mapping(address => uint256)) allowance ``` ### balanceOf ```solidity mapping(address => uint256) balanceOf ``` ### decimals ```solidity uint8 decimals ``` ### name ```solidity string name ``` ### symbol ```solidity string symbol ``` ## Events ### Approval ```solidity event Approval(address src, address guy, uint256 wad) ``` ### Deposit ```solidity event Deposit(address dst, uint256 wad) ``` ### Transfer ```solidity event Transfer(address src, address dst, uint256 wad) ``` ### Withdrawal ```solidity event Withdrawal(address src, uint256 wad) ``` ## Functions ### _deposit ```solidity function _deposit() internal ``` ### approve ```solidity function approve(address guy, uint256 wad) public returns (bool) ``` ### deposit ```solidity function deposit() external payable ``` ### receive ```solidity receive() external payable ``` ### totalSupply ```solidity function totalSupply() public view returns (uint256) ``` ### transfer ```solidity function transfer(address dst, uint256 wad) public returns (bool) ``` ### transferFrom ```solidity function transferFrom(address src, address dst, uint256 wad) public returns (bool) ``` ### withdraw ```solidity function withdraw(uint256 wad) external ``` --- # AggregatorInterface v0.3.0 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.0/aggregator-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.0 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.0 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.0 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.0/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorInterface Basic price feed interface. [AggregatorInterface](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-feeds/interfaces/AggregatorInterface.sol) ## Events ### AnswerUpdated Emitted when the answer is updated. ```solidity event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt); ``` **Parameters** | Name | Type | Description | | ----------- | --------- | ------------------------------------------------ | | `current` | `int256` | - The updated answer. | | `roundId` | `uint256` | - The round ID for which the answer was updated. | | `updatedAt` | `uint256` | - The timestamp when the answer was updated. | ### NewRound Emitted when a new round is started. ```solidity event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt); ``` **Parameters** | Name | Type | Description | | ----------- | --------- | ---------------------------------------------------- | | `roundId` | `uint256` | - The round ID of the new round. | | `startedBy` | `address` | - The address of the account that started the round. | | `startedAt` | `uint256` | - The timestamp when the round was started. | ## Functions ### getAnswer Gets the answer for a specific round ID. ```solidity function getAnswer(uint256 roundId) external view returns (int256); ``` **Parameters** | Name | Type | Description | | --------- | --------- | ------------------------------------- | | `roundId` | `uint256` | - The round ID to get the answer for. | **Returns** | Name | Type | Description | | -------- | -------- | ------------------------------------------- | | `` | `int256` | int256 - The answer for the given round ID. | ### getTimestamp Gets the timestamp for a specific round ID. ```solidity function getTimestamp(uint256 roundId) external view returns (uint256); ``` **Parameters** | Name | Type | Description | | --------- | --------- | ---------------------------------------- | | `roundId` | `uint256` | - The round ID to get the timestamp for. | **Returns** | Name | Type | Description | | -------- | --------- | ----------------------------------------------- | | `` | `uint256` | uint256 - The timestamp for the given round ID. | ### latestAnswer Gets the latest answer from the aggregator. ```solidity function latestAnswer() external view returns (int256); ``` **Returns** | Name | Type | Description | | -------- | -------- | --------------------------- | | `` | `int256` | int256 - The latest answer. | ### latestRound Gets the latest round ID from the aggregator. ```solidity function latestRound() external view returns (uint256); ``` **Returns** | Name | Type | Description | | -------- | --------- | ------------------------------ | | `` | `uint256` | uint256 - The latest round ID. | ### latestTimestamp Gets the timestamp of the latest answer from the aggregator. ```solidity function latestTimestamp() external view returns (uint256); ``` **Returns** | Name | Type | Description | | -------- | --------- | --------------------------------------------- | | `` | `uint256` | uint256 - The timestamp of the latest answer. | --- # AggregatorV2V3Interface v0.3.0 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.0/aggregator-v2-v3-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.0 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.0 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.0 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.0/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorV2V3Interface Combined V2/V3 price feed interface. [AggregatorV2V3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-feeds/interfaces/AggregatorV2V3Interface.sol) --- # AggregatorV3Interface v0.3.0 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.0/aggregator-v3-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.0 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.0 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.0 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.0/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorV3Interface Extended price feed interface. [AggregatorV3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-feeds/interfaces/AggregatorV3Interface.sol) ## Functions ### decimals Gets the number of decimals used by the aggregator. ```solidity function decimals() external view returns (uint8); ``` **Returns** | Name | Type | Description | | -------- | ------- | ------------------------------- | | `` | `uint8` | uint8 - The number of decimals. | ### description Gets the description of the aggregator. ```solidity function description() external view returns (string memory); ``` **Returns** | Name | Type | Description | | -------- | -------- | -------------------------------------------------- | | `` | `string` | string memory - The description of the aggregator. | ### getRoundData Gets the round data for a specific round ID. This function should raise "No data present" if no data is available for the given round ID. ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); ``` **Parameters** | Name | Type | Description | | ---------- | -------- | ----------------------------------- | | `_roundId` | `uint80` | - The round ID to get the data for. | **Returns** | Name | Type | Description | | ----------------- | --------- | ------------------------------------------------ | | `roundId` | `uint80` | - The round ID. | | `answer` | `int256` | - The answer for the round. | | `startedAt` | `uint256` | - The timestamp when the round started. | | `updatedAt` | `uint256` | - The timestamp when the round was updated. | | `answeredInRound` | `uint80` | - The round ID in which the answer was computed. | ### latestRoundData Gets the latest round data. This function should raise "No data present" if no data is available. ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); ``` **Returns** | Name | Type | Description | | ----------------- | --------- | ------------------------------------------------------- | | `roundId` | `uint80` | - The latest round ID. | | `answer` | `int256` | - The latest answer. | | `startedAt` | `uint256` | - The timestamp when the latest round started. | | `updatedAt` | `uint256` | - The timestamp when the latest round was updated. | | `answeredInRound` | `uint80` | - The round ID in which the latest answer was computed. | ### version Gets the version of the aggregator. ```solidity function version() external view returns (uint256); ``` **Returns** | Name | Type | Description | | -------- | --------- | ---------------------------------------- | | `` | `uint256` | uint256 - The version of the aggregator. | --- # BurnMintERC677Helper v0.3.0 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.0/burn-mint-erc677-helper > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.0 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.0 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.0 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.0/src/ccip/CCIPLocalSimulator.sol"; > ``` ## BurnMintERC677Helper Helper contract for ERC677 token operations. [BurnMintERC677Helper](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/ccip/BurnMintERC677Helper.sol) ## Functions ### constructor Constructor to initialize the BurnMintERC677Helper contract with a name and symbol. Calls the parent constructor of BurnMintERC677 with fixed decimals (18) and initial supply (0). ```solidity constructor(string memory name, string memory symbol) BurnMintERC677(name, symbol, 18, 0); ``` **Parameters** | Name | Type | Description | | -------- | -------- | -------------------------- | | `name` | `string` | - The name of the token. | | `symbol` | `string` | - The symbol of the token. | ### drip Mints one full token (1e18) to the specified address. Calls the internal `_mint` function from the BurnMintERC677 contract. ```solidity function drip(address to) external; ``` **Parameters** | Name | Type | Description | | ---- | --------- | ------------------------------------------ | | `to` | `address` | - The address to receive the minted token. | --- # CCIPLocalRouter v0.3.0 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.0/ccip-local-router > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.0 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.0 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.0 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.0/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalRouter The local-mode router with CCIP 2.0 message rules. [CCIPLocalRouter](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/ccip/CCIPLocalRouter.sol) ## Variables ### DEFAULT_GAS_LIMIT ```solidity uint32 public constant DEFAULT_GAS_LIMIT = 200_000 ``` ### GAS_FOR_CALL_EXACT_CHECK ```solidity uint16 public constant GAS_FOR_CALL_EXACT_CHECK = 5_000 ``` ### s_mockFeeTokenAmount ```solidity uint256 internal s_mockFeeTokenAmount ``` ### s_nonce Nonce used to guarantee a unique messageId per send, see `ccipSend`. ```solidity uint256 internal s_nonce ``` ### SOURCE_CHAIN_SELECTOR Source chain selector stamped on local messages (Ethereum Sepolia), as in `MockCCIPRouter`. ```solidity uint64 internal constant SOURCE_CHAIN_SELECTOR = 16015286601757825753 ``` ## Errors ### CannotSendZeroTokens Mirrors `OnRamp.CannotSendZeroTokens`. ```solidity error CannotSendZeroTokens(); ``` ### CanOnlySendOneTokenPerMessage Mirrors `OnRamp.CanOnlySendOneTokenPerMessage`. ```solidity error CanOnlySendOneTokenPerMessage(); ``` ### InvalidAddress ```solidity error InvalidAddress(bytes encodedAddress); ``` ### InvalidExtraArgsTag ```solidity error InvalidExtraArgsTag(); ``` ### InvalidOptionalThreshold Mirrors `OffRamp.InvalidOptionalThreshold`. ```solidity error InvalidOptionalThreshold(uint8 wanted, uint256 got); ``` ### MessageGasLimitTooHigh Mirrors `FeeQuoter.MessageGasLimitTooHigh`. ```solidity error MessageGasLimitTooHigh(); ``` ### ReceiverError ```solidity error ReceiverError(bytes err); ``` ### TokenReceiverNotAllowed Mirrors `OnRamp.TokenReceiverNotAllowed`: `GenericExtraArgsV3.tokenReceiver` is rejected on all EVM lanes (`DestChainConfig.tokenReceiverAllowed` is always false for EVM per its NatSpec). ```solidity error TokenReceiverNotAllowed(uint64 destChainSelector); ``` ## Events ### MessageExecuted ```solidity event MessageExecuted(bytes32 messageId, uint64 sourceChainSelector, address offRamp, bytes32 calldataHash); ``` ### MsgExecuted ```solidity event MsgExecuted(bool success, bytes retData, uint256 gasUsed); ``` ## Functions ### _ensureReceiverAllowsFinality Mirrors OffRamp 2.0 `_getCCVsFromReceiver`, which is called for every message that is not a token-only transfer regardless of requested finality (including fully finalized messages, not only Faster-Than- Finality ones). Token-only transfers skip it entirely, as the pool enforces finality for them in production (pools are not simulated in local mode). Local mode has no CCV verifiers to query for quorum, so this only reproduces the validation and finality parts of `_getCCVsFromReceiver`: duplicate required/optional CCVs and `optionalThreshold > optionalCCVs.length` are rejected the same way, and the receiver's allowed finality is enforced. If `getCCVsAndFinalityConfig` reverts, that revert is bubbled as-is (not wrapped in `ReceiverError`). In production the OffRamp does not distinguish this from any other revert during message execution: it simply records `ExecutionStateChanged(..., FAILURE, returnData)` with the getter's raw revert data. `ReceiverError` is reserved for the narrower case of the receiver's own `ccipReceive` call failing (see `_routeMessage`/`OffRamp._callReceiver`), so bubbling here (rather than wrapping) keeps that error meaning precise while still failing the local send, consistent with this contract's "fails in production" -> "ccipSend reverts locally" mapping. ```solidity function _ensureReceiverAllowsFinality( address receiver, Client.Any2EVMMessage memory message, uint256 gasLimit, bytes4 requestedFinality ) internal view; ``` ### _isTokenOnlyTransfer Same token-only rule as OffRamp 2.0 `_isTokenOnlyTransfer`, which also decides whether the receiver is called. ```solidity function _isTokenOnlyTransfer(uint256 dataLength, uint256 gasLimit, address receiver) internal view returns (bool); ``` ### _legacyGasLimit FeeQuoter compares the full uint256 V1/V2 gas limit against the lane's uint32 `maxPerMsgGasLimit` and reverts `MessageGasLimitTooHigh`, so a value above uint32 is rejected everywhere; the upstream mock truncated it. Local mode has no lane config, so lower lane caps are not enforced. ```solidity function _legacyGasLimit(uint256 gasLimit) internal pure returns (uint256); ``` ### _parseExtraArgs ```solidity function _parseExtraArgs(uint64 destinationChainSelector, bytes calldata extraArgs) internal pure returns (uint256 gasLimit, bytes4 requestedFinality); ``` **Parameters** | Name | Type | Description | | -------------------------- | -------- | ------------------------------------------------------------------------------ | | `destinationChainSelector` | `uint64` | Destination chain selector, used only for the `TokenReceiverNotAllowed` error. | | `extraArgs` | `bytes` | | **Returns** | Name | Type | Description | | ------------------- | --------- | ------------------------------------------------------------------------------------ | | `gasLimit` | `uint256` | Callback gas limit. | | `requestedFinality` | `bytes4` | `GenericExtraArgsV3.requestedFinalityConfig`, or WAIT_FOR_FINALITY for older tags. | ### _routeMessage ```solidity function _routeMessage( Client.Any2EVMMessage memory message, uint16 gasForCallExactCheck, uint256 gasLimit, address receiver ) internal returns (bool success, bytes memory retData, uint256 gasUsed); ``` ### ccipSend Sends the tx locally to the receiver instead of on the destination chain. Ignores destinationChainSelector Returns a mock message ID, which is not calculated from the message contents in the same way as the real message ID. ```solidity function ccipSend(uint64 destinationChainSelector, Client.EVM2AnyMessage calldata message) external payable returns (bytes32); ``` ### getFee Returns 0 as the fee is not supported in this mock contract. ```solidity function getFee(uint64, Client.EVM2AnyMessage memory) public view returns (uint256); ``` ### getOnRamp Always returns address(1234567890) ```solidity function getOnRamp( uint64 /* destChainSelector */ ) external pure returns (address onRampAddress); ``` ### getSupportedTokens Returns an empty array. ```solidity function getSupportedTokens(uint64) external pure returns (address[] memory tokens); ``` ### isChainSupported Always returns true to make sure this check can be performed on any chain. ```solidity function isChainSupported(uint64) external pure returns (bool supported); ``` ### isOffRamp Always returns true ```solidity function isOffRamp( uint64, /* sourceChainSelector */ address /* offRamp */ ) external pure returns (bool); ``` ### routeMessage ```solidity function routeMessage( Client.Any2EVMMessage calldata message, uint16 gasForCallExactCheck, uint256 gasLimit, address receiver ) external returns (bool success, bytes memory retData, uint256 gasUsed); ``` ### setFee Sets the fees returned by getFee but is only checked when using native fee tokens ```solidity function setFee(uint256 feeAmount) external; ``` --- # CCIPLocalSimulatorFork JS v0.3.0 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.0/ccip-local-simulator-fork-js > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.0 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.0 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.0 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.0/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulatorFork JS Hardhat 3 JavaScript helpers for fork routing. [CCIPLocalSimulatorFork JS](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/scripts/CCIPLocalSimulatorFork.js) ## Types ### CCIPSentMessage : `Object` **Properties** \| Name | Type | Description | \| ------------------- | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ---------------- | --------------------------------------------------------- | \| era | `"PRE_V1_6"` | `"V1_6"` | `"V2"` | CCIP protocol version of the lane the message was sent on | \| onRamp | `string` | Source OnRamp that emitted the message | \| messageId | `string` | | \| sourceChainSelector | `bigint` | | \| destChainSelector | `bigint` | | \| message | `object` | Era-specific payload: the pre-1.6 `EVM2EVMMessage`, the 1.6 `EVM2AnyRampMessage`, or for CCIP 2.0 `{ encodedMessage, receipts }` | ## Functions ### LINK_FAUCET_ADDRESS Hardhat 3 helpers for routing CCIP messages between forked networks (the JavaScript counterpart of the Solidity `CCIPLocalSimulatorFork`). Supports pre-1.6 (`EVM2EVMOnRamp`), 1.6 and CCIP 2.0 (CCV-based) lanes. Every function takes the `NetworkConnection` returned by `network.connect()` and requires the `@nomicfoundation/hardhat-ethers` plugin (it uses `connection.ethers`). Messages are sent on the source connection, then routed on the destination connection: const source = await network.connect(\{ network: "sepoliaFork" }); const destination = await network.connect(\{ network: "arbitrumSepoliaFork" }); const receipt = await (await router.ccipSend(destChainSelector, message, \{ value: fee })).wait(); const [sent] = getCCIPMessages(source, receipt); await routeMessage(destination, destinationRouterAddress, sent); **Kind**: global constant ### CCIP_V2_ROUTERS Dedicated CCIP 2.0 routers deployed next to the default router, keyed by chain id (verified on-chain, Sep 2026). **Kind**: global constant ### requestLinkFromTheFaucet(connection, linkAddress, to, amount) ⇒ `Promise.` Requests LINK tokens from the testnet faucet by impersonating it, and returns the transaction hash. **Returns**: `Promise.` - The transaction hash of the transfer | Param | Type | Description | | ----------- | -------- | --------------------------------------------------------- | | connection | `object` | Network connection from `network.connect()` | | linkAddress | `string` | The address of the LINK contract on the connected network | | to | `string` | The address to send LINK to | | amount | `bigint` | The amount of LINK to request | ### getCCIPMessages(connection, receipt) ⇒ `Array.` Extracts every CCIP message sent in a transaction, for all supported protocol versions. **Returns**: `Array.` - The sent messages, in log order (empty if none) | Param | Type | Description | | ---------- | -------- | ------------------------------------------ | | connection | `object` | Network connection of the source chain | | receipt | `object` | Transaction receipt of the `ccipSend` call | ### routeMessage(connection, routerAddresses, sent, [options]) ⇒ `Promise.` Routes a sent message on the destination (connected) network, as the destination OffRamp would execute it. - pre-1.6 and 1.6: impersonates the lane's OffRamp and calls `executeSingleMessage`. - CCIP 2.0: the OffRamp selects the CCVs (`getCCVsForMessage`), CCVs that are owner-configurable verifier resolvers are pointed at a synthetic no-op verifier, and the raw encoded message is executed through the permissionless `execute`. A message is only delivered if the OffRamp reports SUCCESS. **Returns**: `Promise.` - `{ offRamp, executed, reason }`: `executed` is false only for a CCIP 2.0 NO_EXECUTION message routed without `forceExecution` (`reason` is then `"NO_EXECUTION_ADDRESS"`)\ **Throws**: - `Error` If no OffRamp serves the lane, or if execution fails (receiver revert, finality or CCV rejection) \| Param | Type | Default | Description | \| ------------------------ | ----------------- | ---------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | \| connection | `object` | | Network connection of the destination chain | \| routerAddresses | `string` | `Array.` | | Destination router address(es) whose OffRamps are searched, e.g. the default router and `CCIP_V2_ROUTERS[chainId]` | \| sent | `CCIPSentMessage` | | A message returned by `getCCIPMessages` | \| [options] | `Object` | | | \| [options.forceExecution] | `boolean` | `false` | Execute CCIP 2.0 messages whose executor is `NO_EXECUTION_ADDRESS` (manual execution) | --- # CCIPLocalSimulatorFork v0.3.0 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.0/ccip-local-simulator-fork > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.0 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.0 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.0 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.0/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulatorFork CCIP simulator for forked networks. [CCIPLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/ccip/CCIPLocalSimulatorFork.sol) ## Enums ### CCIPEra ```solidity enum CCIPEra { UNKNOWN, PRE_V1_DOT_6, V1_DOT_6, V2 } ``` ### MessageStatus Outcome of a captured CCIP message (see `getMessageStatus`). NOT_FOUND: never captured by this simulator. QUEUED: a CCIP 2.0 `NO_EXECUTION_ADDRESS` message waiting for `executePendingV2Message`, or a 1.6 / 2.0 message whose destination fork was not passed to `switchChainAndRouteMessage` yet (a later call that includes it routes the message; the reason says so). FAILED: not routed, or execution did not succeed (the reason is recorded). ```solidity enum MessageStatus { NOT_FOUND, QUEUED, FAILED, SUCCESS } ``` ### V2ExecutionMode ```solidity enum V2ExecutionMode { AUTO, RESPECT_NO_EXEC, MANUAL_ONLY } ``` ### V2VerificationMode ```solidity enum V2VerificationMode { STRICT, HYBRID, SYNTHETIC_ONLY, /// @notice Derives the CCV selection from the destination OffRamp's /// `getCCVsForMessage(encodedMessage)` and executes the raw encoded message through /// the permissionless `execute` entrypoint, so routing does not depend on the local /// `MessageV1` codec. Fork-only. OFFRAMP_DERIVED } ``` ## Structs ### AwaitingDestinationMessage A captured 1.6 / 2.0 message whose destination fork was not in `forkIds`, kept for a later routing call. ```solidity struct AwaitingDestinationMessage { uint256 sourceForkId; uint64 sourceChainSelector; address emitter; bytes32[] topics; bytes data; } ``` ### MessageOutcome ```solidity struct MessageOutcome { MessageStatus status; bytes reason; } ``` ### PendingV2Message ```solidity struct PendingV2Message { bool exists; uint64 sourceChainSelector; address emitter; bytes32[] topics; bytes data; } ``` ## Variables ### i_messageV1Decoder Helper to decode MessageV1 from memory bytes. ```solidity MessageV1CodecDecoder immutable i_messageV1Decoder ``` ### i_register The immutable register instance ```solidity Register immutable i_register ``` ### INBOUND_IMPLEMENTATION_NOT_FOUND_SELECTOR ```solidity bytes4 private constant INBOUND_IMPLEMENTATION_NOT_FOUND_SELECTOR = bytes4(keccak256("InboundImplementationNotFound(address,bytes)")) ``` ### INVALID_VERIFIER_RESULTS_LENGTH_SELECTOR ```solidity bytes4 private constant INVALID_VERIFIER_RESULTS_LENGTH_SELECTOR = bytes4(keccak256("InvalidVerifierResultsLength()")) ``` ### INVALID_VERIFIER_RESULTS_SELECTOR ```solidity bytes4 private constant INVALID_VERIFIER_RESULTS_SELECTOR = bytes4(keccak256("InvalidVerifierResults()")) ``` ### LINK_FAUCET The address of the LINK faucet ```solidity address constant LINK_FAUCET = 0x4281eCF07378Ee595C564a59048801330f3084eE ``` ### NO_STATE_PROGRESS_MADE_SELECTOR OffRamp 2.0 `NoStateProgressMade(bytes32 messageId, bytes err)`: a retry of a FAILURE message reverts with it. ```solidity bytes4 private constant NO_STATE_PROGRESS_MADE_SELECTOR = bytes4(keccak256("NoStateProgressMade(bytes32,bytes)")) ``` ### s_awaitingDestination Captured messages waiting for their destination fork, in send order. ```solidity AwaitingDestinationMessage[] internal s_awaitingDestination ``` ### s_ccipV2Routers CCIP 2.0 routers deployed next to the Register router (which `getNetworkDetails` returns). Hand-maintained: `Register` is generated from the CCIP docs API and only carries one router per chain. ```solidity mapping(uint256 chainId => address router) internal s_ccipV2Routers ``` ### s_messageOutcomes Outcome of every captured message, see `getMessageStatus`. ```solidity mapping(bytes32 messageId => MessageOutcome outcome) internal s_messageOutcomes ``` ### s_pendingV2MessageIdsByScope ```solidity mapping(uint256 routeScope => bytes32[] messageIds) internal s_pendingV2MessageIdsByScope ``` ### s_pendingV2MessagesByScope ```solidity mapping(uint256 routeScope => mapping(bytes32 messageId => PendingV2Message pendingMessage)) internal s_pendingV2MessagesByScope ``` ### s_processedMessages Mapping to track processed messages ```solidity mapping(bytes32 messageId => bool isProcessed) internal s_processedMessages ``` ### s_strictRouting When true (the default), routing reverts on a message that is not routed or does not execute successfully. ```solidity bool internal s_strictRouting ``` ### s_syntheticV2VerifierByScope ```solidity mapping(uint256 routeScope => address verifier) internal s_syntheticV2VerifierByScope ``` ### s_v2ExecutionMode ```solidity V2ExecutionMode internal s_v2ExecutionMode ``` ### s_v2VerificationMode ```solidity V2VerificationMode internal s_v2VerificationMode ``` ### SYNTHETIC_V2_VERIFIER_VERSION ```solidity bytes4 private constant SYNTHETIC_V2_VERIFIER_VERSION = 0x464f524b ``` ### V2_EXECUTION_STATE_SUCCESS `Internal.MessageExecutionState.SUCCESS`. ```solidity uint256 private constant V2_EXECUTION_STATE_SUCCESS = 2 ``` ## Errors ### CCIPLocalSimulatorFork__MessageExecutionFailed Strict routing: a routed message did not execute successfully. `reason` is the revert data of the execution (for CCIP 2.0, the OffRamp's recorded failure). ```solidity error CCIPLocalSimulatorFork__MessageExecutionFailed(bytes32 messageId, bytes reason); ``` ### CCIPLocalSimulatorFork__MessageNotRouted Strict routing: a captured CCIP message was not routed to any destination fork. ```solidity error CCIPLocalSimulatorFork__MessageNotRouted(bytes32 messageId, string reason); ``` ## Functions ### _awaitDestination Not a failure, even in strict mode: routing one destination fork per call is the documented usage. ```solidity function _awaitDestination(bytes32 messageId, Vm.Log memory entry, uint256 sourceForkId, uint64 sourceChainSelector) internal; ``` ### _buildSyntheticV2VerificationInputs ```solidity function _buildSyntheticV2VerificationInputs( address offRamp, bytes memory encodedMessage, bytes[] memory existingVerifierResults ) internal returns (address[] memory ccvs, bytes[] memory verifierResults); ``` ### _configureResolverForSyntheticV2Verification ```solidity function _configureResolverForSyntheticV2Verification(address resolver, address syntheticVerifier) internal returns (bool configured); ``` ### _decodeAddressWord Decodes an ABI-encoded address word without reverting: `abi.decode(data, (address))` reverts in the calling frame (not catchable) when the word has non-zero high bits, e.g. a non-EVM OnRamp address. ```solidity function _decodeAddressWord(bytes memory data) internal pure returns (bool isAddress, address decoded); ``` ### _dequeuePendingV2Message ```solidity function _dequeuePendingV2Message(uint256 routeScope, bytes32 messageId) internal; ``` ### _deriveV2CCVSelection ```solidity function _deriveV2CCVSelection(address offRamp, bytes memory encodedMessage) internal view returns (address[] memory ccvs); ``` ### _deriveV2VerificationInputs ```solidity function _deriveV2VerificationInputs(address offRamp, CCIPForkAdapterV2.DecodedMessage memory decodedMessage) internal returns (address[] memory ccvs, bytes[] memory verifierResults, bool usedSyntheticInputs); ``` ### _detectEraFromLog ```solidity function _detectEraFromLog(Vm.Log memory entry) internal pure returns (CCIPEra era); ``` ### _detectOffRampEra ```solidity function _detectOffRampEra(address offRamp) internal view returns (bool isReadable, CCIPEra era); ``` **Returns** | Name | Type | Description | | ------------ | --------- | ---------------------------------------------------------------------- | | `isReadable` | `bool` | False when `typeAndVersion` is missing or does not decode to a string. | | `era` | `CCIPEra` | The OffRamp era, or UNKNOWN for an unrecognised type or version. | ### _enqueuePendingV2Message ```solidity function _enqueuePendingV2Message(bytes32 messageId, Vm.Log memory entry, uint64 sourceChainSelector) internal; ``` ### _findOffRampForOnRamp Returns the destination OffRamp whose lane is configured for `sourceOnRamp`, if discoverable. The router lists OffRamps of several protocol versions for the same source chain (e.g. 1.6 and 2.0 side by side during a lane migration). Their getters share selectors but not return shapes, and a mismatched return payload fails to decode in the calling frame, which Solidity `try/catch` cannot catch. So every candidate is probed with low-level calls and decoded through an external self-call, and a candidate of unknown shape is skipped instead of reverting the routing flow. ```solidity function _findOffRampForOnRamp( CCIPForkAdapterTypes.RouterOffRamp[] memory offRamps, uint64 sourceChainSelector, address sourceOnRamp ) internal view returns (address offRampAddress); ``` ### _findOffRampOnCurrentFork Returns the destination OffRamp for the lane of `sourceOnRamp`, searching the OffRamps of the Register router and then of the CCIP 2.0 router on the current fork. ```solidity function _findOffRampOnCurrentFork(uint64 sourceChainSelector, address sourceOnRamp) internal view returns (address offRampAddress); ``` ### _findSourceOnRamp Returns the OnRamp on the current (source) fork that emitted `emitter`'s log towards `destChainSelector`, checking the Register router and then the CCIP 2.0 router. address(0) if neither. ```solidity function _findSourceOnRamp(uint64 destChainSelector, address emitter) internal view returns (address onRamp); ``` ### _getOrCreateSyntheticV2Verifier ```solidity function _getOrCreateSyntheticV2Verifier() internal returns (address verifier); ``` ### _isNoExecV2Message ```solidity function _isNoExecV2Message(CCIPForkAdapterTypes.V2Receipt[] memory receipts) internal pure returns (bool); ``` ### _isRecoverableV2VerificationFailure ```solidity function _isRecoverableV2VerificationFailure(bytes memory returnData) internal pure returns (bool); ``` ### _isV2ExecutionSuccess Reads `getExecutionState(messageId)` from an OffRamp 2.0 without trusting the return shape. ```solidity function _isV2ExecutionSuccess(address offRamp, bytes32 messageId) internal view returns (bool); ``` ### _logDestinationChainSelector ```solidity function _logDestinationChainSelector(Vm.Log memory entry, CCIPEra logEra) internal pure returns (bool hasDestination, uint64 destinationChainSelector); ``` **Returns** | Name | Type | Description | | -------------------------- | -------- | ---------------------------------------------------------------------------- | | `hasDestination` | `bool` | Whether the log names its destination chain (1.6 and 2.0 `CCIPMessageSent`). | | `destinationChainSelector` | `uint64` | The destination chain selector (`topics[1]`). | ### _messageIdFromLog ```solidity function _messageIdFromLog(Vm.Log memory entry, CCIPEra logEra) internal view returns (bool isCCIPMessage, bytes32 messageId); ``` **Returns** | Name | Type | Description | | --------------- | --------- | ------------------------------------------------------------------------------------ | | `isCCIPMessage` | `bool` | False when the log has a CCIP event signature but does not decode as a CCIP message. | | `messageId` | `bytes32` | The CCIP message ID. | ### _offRampServesOnRamp ```solidity function _offRampServesOnRamp(address offRamp, uint64 sourceChainSelector, address sourceOnRamp) internal view returns (bool); ``` ### _pendingV2MessageToLog ```solidity function _pendingV2MessageToLog(PendingV2Message storage pending) internal view returns (Vm.Log memory entry); ``` ### _preV1dot6LaneMatches ```solidity function _preV1dot6LaneMatches(address offRamp, uint64 sourceChainSelector, address sourceOnRamp) internal view returns (bool); ``` ### _recordExecutionFailure ```solidity function _recordExecutionFailure(bytes32 messageId, bytes memory reason) internal; ``` ### _recordNotRouted ```solidity function _recordNotRouted(bytes32 messageId, string memory reason) internal; ``` ### _recordQueued ```solidity function _recordQueued(bytes32 messageId) internal; ``` ### _recordSuccess ```solidity function _recordSuccess(bytes32 messageId) internal; ``` ### _resolvesSyntheticVersionTo ```solidity function _resolvesSyntheticVersionTo(address resolver, address syntheticVerifier) internal view returns (bool); ``` ### _routeCapturedMessage ```solidity function _routeCapturedMessage( Vm.Log memory entry, uint256[] memory forkIds, uint256 sourceForkId, uint64 sourceChainSelector ) internal; ``` ### _routeCapturedMessages Internal function to route captured messages to their respective destination forks. ```solidity function _routeCapturedMessages(uint256[] memory forkIds, uint256 sourceForkId) internal; ``` **Parameters** | Name | Type | Description | | -------------- | ----------- | ----------------------- | | `forkIds` | `uint256[]` | - Destination fork IDs. | | `sourceForkId` | `uint256` | - Source fork ID. | ### _routeMessageForEra ```solidity function _routeMessageForEra( Vm.Log memory entry, CCIPEra routingEra, address sourceOnRamp, uint64 sourceChainSelector ) internal returns (bool attempted); ``` ### _routePreV1dot6Message ```solidity function _routePreV1dot6Message(Vm.Log memory entry, address sourceOnRamp) internal returns (bool attempted); ``` ### _routersOnCurrentChain ```solidity function _routersOnCurrentChain() internal view returns (address[2] memory routers); ``` **Returns** | Name | Type | Description | | --------- | ------------ | --------------------------------------------------------------------------------------------- | | `routers` | `address[2]` | The Register router and the CCIP 2.0 router (address(0) if unset or identical) of this chain. | ### _routeScope ```solidity function _routeScope() internal view returns (uint256 routeScope); ``` ### _routeV1dot6Message ```solidity function _routeV1dot6Message(Vm.Log memory entry, address sourceOnRamp) internal returns (bool attempted); ``` ### _routeV2Message Routes a CCIP 2.0 message on the current (destination) fork. ```solidity function _routeV2Message(Vm.Log memory entry, uint64 sourceChainSelector, bool forceExecution) internal returns (bool attempted); ``` **Parameters** | Name | Type | Description | | --------------------- | -------- | -------------------------------------------------------------- | | `entry` | `Vm.Log` | | | `sourceChainSelector` | `uint64` | Chain selector of the source chain the message was sent from. | | `forceExecution` | `bool` | Execute even if the V2 execution mode would queue the message. | ### _routeV2MessageOffRampDerived Routes a CCIP 2.0 message without decoding it locally: the destination OffRamp's `getCCVsForMessage` selects the CCVs and the permissionless `execute` entrypoint consumes the raw encoded message, so routing keeps working when the on-chain `MessageV1` wire format moves ahead of the pinned codec. `execute` does not revert when the inner execution fails on a first attempt (it records `FAILURE`), so the message is marked processed only when the OffRamp reports `SUCCESS`. ```solidity function _routeV2MessageOffRampDerived(Vm.Log memory entry, uint64 sourceChainSelector, bool forceExecution) internal returns (bool attempted); ``` ### _routeV2MessageWithLocalCodec ```solidity function _routeV2MessageWithLocalCodec(Vm.Log memory entry, bool forceExecution) internal returns (bool attempted); ``` ### _setLaneDefaultCCVs ```solidity function _setLaneDefaultCCVs(address offRamp, uint64 sourceChainSelector, address ccv) internal; ``` ### _shouldQueueV2Message ```solidity function _shouldQueueV2Message(CCIPForkAdapterTypes.V2Receipt[] memory receipts) internal view returns (bool); ``` ### _stampedV2OffRamp Reads `offRampAddress` from a MessageV1 wire encoding: a 69-byte fixed header, then `onRampAddress` and `offRampAddress`, each prefixed with a 1-byte length (see `MessageV1Codec`). address(0) when malformed or not a 20-byte EVM address. ```solidity function _stampedV2OffRamp(bytes memory encodedMessage) internal pure returns (address offRamp); ``` ### _startsWith ```solidity function _startsWith(bytes memory value, bytes memory prefix) internal pure returns (bool); ``` ### _v1dot6LaneMatches ```solidity function _v1dot6LaneMatches(address offRamp, uint64 sourceChainSelector, address sourceOnRamp) internal view returns (bool); ``` ### _v2FailureReason OffRamp 2.0 `execute` records FAILURE without reverting, and does not return the reason. A second attempt of a FAILURE message reverts `NoStateProgressMade(messageId, err)` with the original failure, and a reverted call leaves no state behind, so the retry recovers the reason without side effects. ```solidity function _v2FailureReason( address offRamp, bytes memory encodedMessage, address[] memory ccvs, bytes[] memory verifierResults ) internal returns (bytes memory reason); ``` ### _v2LaneMatches ```solidity function _v2LaneMatches(address offRamp, uint64 sourceChainSelector, address sourceOnRamp) internal view returns (bool); ``` ### constructor Constructor to initialize the contract ```solidity constructor() ; ``` ### decodeCCVsForMessage External decode helper for `getCCVsForMessage` return data. Do not call directly. ```solidity function decodeCCVsForMessage(bytes calldata data) external pure returns (address[] memory requiredCCVs, address[] memory optionalCCVs, uint8 threshold); ``` ### decodeMessageId External decode helper for pre-1.6 and 1.6 message IDs. Do not call directly. Decoding runs in an external self-call so a mis-shaped log fails inside `try/catch`. ```solidity function decodeMessageId(uint8 logEra, bytes calldata data) external pure returns (bytes32); ``` ### decodeNoStateProgressMade External decode helper for `NoStateProgressMade(bytes32,bytes)` revert data. Do not call directly. ```solidity function decodeNoStateProgressMade(bytes calldata revertData) external pure returns (bytes memory innerErr); ``` ### decodeRouterOffRamps External decode helper for router `getOffRamps` return data. Do not call directly. ```solidity function decodeRouterOffRamps(bytes calldata data) external pure returns (CCIPForkAdapterTypes.RouterOffRamp[] memory); ``` ### decodeSourceChainConfigV1dot6 External decode helper for the OffRamp lookup. Do not call directly. ```solidity function decodeSourceChainConfigV1dot6(bytes calldata data) external pure returns (IOffRampSourceConfigFork.SourceChainConfig memory); ``` ### decodeSourceChainConfigV2 External decode helper for the OffRamp lookup. Do not call directly. ```solidity function decodeSourceChainConfigV2(bytes calldata data) external pure returns (IOffRampSourceConfigV2Fork.SourceChainConfig memory); ``` ### decodeStaticConfigPreV1dot6 External decode helper for the OffRamp lookup. Do not call directly. ```solidity function decodeStaticConfigPreV1dot6(bytes calldata data) external pure returns (IEVM2EVMOffRampStaticConfigFork.StaticConfig memory); ``` ### decodeTypeAndVersion External decode helper for the OffRamp lookup. Do not call directly. Decoding runs in an external self-call so a mismatched payload fails inside `try/catch`. ```solidity function decodeTypeAndVersion(bytes calldata data) external pure returns (string memory); ``` ### deriveV2VerificationInputs ```solidity function deriveV2VerificationInputs(address offRamp, CCIPForkAdapterV2.DecodedMessage calldata decodedMessage) external view returns (address[] memory ccvs, bytes[] memory verifierResults); ``` ### executePendingV2Message ```solidity function executePendingV2Message(bytes32 messageId) external returns (bool attempted); ``` ### getCCIPV2RouterAddress Returns the CCIP 2.0 router deployed next to the Register router on `chainId`, or address(0) if none is known. Send through this router (and point receivers at it) to use its CCIP 2.0 lanes; messages sent through either router are routed by `switchChainAndRouteMessage`. ```solidity function getCCIPV2RouterAddress(uint256 chainId) external view returns (address); ``` ### getMessageStatus Returns the outcome of a captured CCIP message. ```solidity function getMessageStatus(bytes32 messageId) external view returns (MessageStatus status, bytes memory reason); ``` **Parameters** | Name | Type | Description | | ----------- | --------- | ---------------------- | | `messageId` | `bytes32` | - The CCIP message ID. | **Returns** | Name | Type | Description | | -------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------- | | `status` | `MessageStatus` | - NOT_FOUND, QUEUED, FAILED or SUCCESS. | | `reason` | `bytes` | - For FAILED: the revert data of the execution, or an `Error(string)` explaining why the message was not routed. Empty otherwise. | ### getNetworkDetails Returns the default values for currently CCIP supported networks. ```solidity function getNetworkDetails(uint256 chainId) external view returns (Register.NetworkDetails memory); ``` ### getOffRampForLane Returns the destination OffRamp configured for `sourceOnRamp` on the given fork, if discoverable. Useful to configure CCIP 2.0 lane CCVs before routing a message. ```solidity function getOffRampForLane(uint256 forkId, uint64 sourceChainSelector, address sourceOnRamp) external returns (address offRamp); ``` **Parameters** | Name | Type | Description | | --------------------- | --------- | ------------------------------------------------ | | `forkId` | `uint256` | - The ID of the destination network fork. | | `sourceChainSelector` | `uint64` | - The chain selector of the source chain. | | `sourceOnRamp` | `address` | - The address of the OnRamp on the source chain. | **Returns** | Name | Type | Description | | --------- | --------- | ------------------------------------------------------------- | | `offRamp` | `address` | - The matching OffRamp address, or address(0) when not found. | ### getPendingV2MessageIds ```solidity function getPendingV2MessageIds() external view returns (bytes32[] memory messageIds); ``` ### getStrictRouting ```solidity function getStrictRouting() external view returns (bool strict); ``` ### getV2ExecutionMode ```solidity function getV2ExecutionMode() external view returns (V2ExecutionMode mode); ``` ### getV2VerificationMode ```solidity function getV2VerificationMode() external view returns (V2VerificationMode mode); ``` ### isPendingV2Message ```solidity function isPendingV2Message(bytes32 messageId) external view returns (bool isPending); ``` ### requestLinkFromFaucet Requests LINK tokens from the faucet. ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success); ``` ### setCCIPV2RouterAddress Manually sets the CCIP 2.0 router for `chainId`. Use address(0) to route through the Register router only. ```solidity function setCCIPV2RouterAddress(uint256 chainId, address router) external; ``` ### setLaneDefaultCCVs Points a destination lane's default CCVs at `ccv` by impersonating the OffRamp owner. Fork-only testing helper for CCIP 2.0 lanes: the mocked CCV must be configured on the destination lane before a captured message can be routed through the permissionless execution path. Router, enabled flag, OnRamp bindings and lane-mandated CCVs are preserved. ```solidity function setLaneDefaultCCVs(uint256 forkId, address offRamp, uint64 sourceChainSelector, address ccv) external; ``` **Parameters** | Name | Type | Description | | --------------------- | --------- | ----------------------------------------------------- | | `forkId` | `uint256` | - The ID of the destination network fork. | | `offRamp` | `address` | - The destination OffRamp that holds the lane config. | | `sourceChainSelector` | `uint64` | - The chain selector of the source chain. | | `ccv` | `address` | - The CCV address to set as the lane default. | ### setNetworkDetails Manually sets network details. ```solidity function setNetworkDetails(uint256 chainId, Register.NetworkDetails memory networkDetails) external; ``` ### setStrictRouting Enables or disables strict routing (enabled by default). When enabled, `switchChainAndRouteMessage` and `executePendingV2Message` revert with `CCIPLocalSimulatorFork__MessageNotRouted` when a captured CCIP message cannot be routed to any of the given forks, and with `CCIPLocalSimulatorFork__MessageExecutionFailed` when a routed message does not execute successfully. When disabled, failures are logged and recorded (see `getMessageStatus`) and routing continues. ```solidity function setStrictRouting(bool strict) external; ``` ### setV2ExecutionMode ```solidity function setV2ExecutionMode(V2ExecutionMode mode) external; ``` ### setV2VerificationMode ```solidity function setV2VerificationMode(V2VerificationMode mode) external; ``` ### switchChainAndRouteMessage To be called after the sending of the cross-chain message (`ccipSend`). Goes through the list of past logs and looks for the supported CCIP send events. Switches to a destination network fork. Routes the sent cross-chain message on the destination network. If you sent more than one message, it will try to route all of them to `forkId`. A 1.6 or 2.0 message to another chain is kept (status QUEUED) and routed by a later call that includes its destination fork. `forkId` is the active fork when the call returns. ```solidity function switchChainAndRouteMessage(uint256 forkId) external; ``` **Parameters** | Name | Type | Description | | -------- | --------- | -------------------------------------------------------------------------------------------------------------- | | `forkId` | `uint256` | - The ID of the destination network fork. This is the returned value of `createFork()` or `createSelectFork()` | ### switchChainAndRouteMessage To be called after the sending of the cross-chain message (`ccipSend`). Override variant of the `switchChainAndRouteMessage(uint256 forkId)` function in case of multiple destination forks. Goes through provided `forkIds` and tries to route messages to the matching destination. A 1.6 or 2.0 message to a chain that is not in `forkIds` is kept (status QUEUED) for a later call. ```solidity function switchChainAndRouteMessage(uint256[] memory forkIds) external; ``` **Parameters** | Name | Type | Description | | --------- | ----------- | ------------------------------------------------------------------------------------------------------------------- | | `forkIds` | `uint256[]` | - The IDs of the destination network forks. These are the returned values of `createFork()` or `createSelectFork()` | --- # CCIPLocalSimulator v0.3.0 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.0/ccip-local-simulator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.0 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.0 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.0 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.0/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulator Local CCIP simulator (no-fork mode). [CCIPLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/ccip/CCIPLocalSimulator.sol) ## Variables ### CHAIN_SELECTOR The unique CCIP Chain Selector constant ```solidity uint64 constant CHAIN_SELECTOR = 16015286601757825753 ``` ### i_ccipBnM The BurnMintERC677Helper instance for CCIP-BnM token ```solidity BurnMintERC677Helper internal immutable i_ccipBnM ``` ### i_ccipLnM The BurnMintERC677Helper instance for CCIP-LnM token ```solidity BurnMintERC677Helper internal immutable i_ccipLnM ``` ### i_linkToken The LINK token instance ```solidity LinkToken internal immutable i_linkToken ``` ### i_mockRouter The mock CCIP router instance ```solidity CCIPLocalRouter internal immutable i_mockRouter ``` ### i_wrappedNative The wrapped native token instance ```solidity WETH9 internal immutable i_wrappedNative ``` ### s_supportedTokens The list of supported token addresses ```solidity address[] internal s_supportedTokens ``` ## Errors ### CCIPLocalSimulator__MsgSenderIsNotTokenOwner ```solidity error CCIPLocalSimulator__MsgSenderIsNotTokenOwner(); ``` ### CCIPLocalSimulator__RequiredRoleNotFound ```solidity error CCIPLocalSimulator__RequiredRoleNotFound(address account, bytes32 role, address token); ``` ## Functions ### configuration Returns configuration details for pre-deployed contracts and services needed for local CCIP simulations. ```solidity function configuration() public view returns ( uint64 chainSelector_, IRouterClient sourceRouter_, IRouterClient destinationRouter_, WETH9 wrappedNative_, LinkToken linkToken_, BurnMintERC677Helper ccipBnM_, BurnMintERC677Helper ccipLnM_ ); ``` **Returns** | Name | Type | Description | | -------------------- | ---------------------- | ----------------------------------------------------------- | | `chainSelector_` | `uint64` | - The unique CCIP Chain Selector. | | `sourceRouter_` | `IRouterClient` | - The source chain Router contract. | | `destinationRouter_` | `IRouterClient` | - The destination chain Router contract. | | `wrappedNative_` | `WETH9` | - The wrapped native token which can be used for CCIP fees. | | `linkToken_` | `LinkToken` | - The LINK token. | | `ccipBnM_` | `BurnMintERC677Helper` | - The ccipBnM token. | | `ccipLnM_` | `BurnMintERC677Helper` | - The ccipLnM token. | ### constructor Constructor to initialize the contract and pre-deployed token instances ```solidity constructor() ; ``` ### getSupportedTokens Gets a list of token addresses that are supported for cross-chain transfers by the simulator. ```solidity function getSupportedTokens(uint64 chainSelector) external view returns (address[] memory tokens); ``` **Parameters** | Name | Type | Description | | --------------- | -------- | --------------------------------- | | `chainSelector` | `uint64` | - The unique CCIP Chain Selector. | **Returns** | Name | Type | Description | | -------- | ----------- | -------------------------------------------------------------------------------------------------- | | `tokens` | `address[]` | - Returns a list of token addresses that are supported for cross-chain transfers by the simulator. | ### isChainSupported Checks whether the provided `chainSelector` is supported by the simulator. ```solidity function isChainSupported(uint64 chainSelector) public pure returns (bool supported); ``` **Parameters** | Name | Type | Description | | --------------- | -------- | --------------------------------- | | `chainSelector` | `uint64` | - The unique CCIP Chain Selector. | **Returns** | Name | Type | Description | | ----------- | ------ | ---------------------------------------------------------------- | | `supported` | `bool` | - Returns true if `chainSelector` is supported by the simulator. | ### requestLinkFromFaucet Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success); ``` **Parameters** | Name | Type | Description | | -------- | --------- | -------------------------------------------------- | | `to` | `address` | - The address to which LINK tokens are to be sent. | | `amount` | `uint256` | - The amount of LINK tokens to send. | **Returns** | Name | Type | Description | | --------- | ------ | ----------------------------------------------------------------------------- | | `success` | `bool` | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | ### supportNewTokenViaAccessControlDefaultAdmin Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. The caller must have the DEFAULT_ADMIN_ROLE as defined by the contract itself. Reverts if the caller is not the admin of the token using OZ's AccessControl DEFAULT_ADMIN_ROLE. ```solidity function supportNewTokenViaAccessControlDefaultAdmin(address tokenAddress) external; ``` **Parameters** | Name | Type | Description | | -------------- | --------- | ------------------------------------------------------------------ | | `tokenAddress` | `address` | - The address of the token to add to the list of supported tokens. | ### supportNewTokenViaGetCCIPAdmin Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. Reverts if token does not implement getCCIPAdmin() function. Reverts if the caller is not the token CCIPAdmin. ```solidity function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external; ``` **Parameters** | Name | Type | Description | | -------------- | --------- | ------------------------------------------------------------------ | | `tokenAddress` | `address` | - The address of the token to add to the list of supported tokens. | ### supportNewTokenViaOwner Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. Reverts if token does not implement owner() function. Reverts if the caller is not the token owner. ```solidity function supportNewTokenViaOwner(address tokenAddress) external; ``` **Parameters** | Name | Type | Description | | -------------- | --------- | ------------------------------------------------------------------ | | `tokenAddress` | `address` | - The address of the token to add to the list of supported tokens. | --- # DataStreamsLocalSimulatorFork v0.3.0 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.0/data-streams-local-simulator-fork > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.0 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.0 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.0 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.0/src/ccip/CCIPLocalSimulator.sol"; > ``` ## DataStreamsLocalSimulatorFork Data Streams simulator for forked networks. [DataStreamsLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-streams/DataStreamsLocalSimulatorFork.sol) ## Variables ### i_register The immutable register instance ```solidity Register immutable i_register ``` ### LINK_FAUCET The address of the LINK faucet ```solidity address constant LINK_FAUCET = 0x4281eCF07378Ee595C564a59048801330f3084eE ``` ## Functions ### constructor Constructor to initialize the contract ```solidity constructor() ; ``` ### getNetworkDetails Returns the default values for currently Data Streams supported networks. If network is not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. ```solidity function getNetworkDetails(uint256 chainId) external view returns (Register.NetworkDetails memory); ``` **Parameters** | Name | Type | Description | | --------- | --------- | ----------------------------------------------------------------------------- | | `chainId` | `uint256` | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | **Returns** | Name | Type | Description | | -------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `` | `Register.NetworkDetails` | networkDetails - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | ### requestLinkFromFaucet Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success); ``` **Parameters** | Name | Type | Description | | -------- | --------- | -------------------------------------------------- | | `to` | `address` | - The address to which LINK tokens are to be sent. | | `amount` | `uint256` | - The amount of LINK tokens to send. | **Returns** | Name | Type | Description | | --------- | ------ | ----------------------------------------------------------------------------- | | `success` | `bool` | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | ### requestNativeFromFaucet Requests native coints from the faucet. ```solidity function requestNativeFromFaucet(address to, uint256 amount) external; ``` **Parameters** | Name | Type | Description | | -------- | --------- | --------------------------------------------------- | | `to` | `address` | - The address to which native coins are to be sent. | | `amount` | `uint256` | - The amount of native coins to send. | ### setNetworkDetails If network details are not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function. ```solidity function setNetworkDetails(uint256 chainId, Register.NetworkDetails memory networkDetails) external; ``` **Parameters** | Name | Type | Description | | ---------------- | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | | `chainId` | `uint256` | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | | `networkDetails` | `Register.NetworkDetails` | - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | --- # DataStreamsLocalSimulator v0.3.0 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.0/data-streams-local-simulator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.0 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.0 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.0 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.0/src/ccip/CCIPLocalSimulator.sol"; > ``` ## DataStreamsLocalSimulator Local Data Streams simulator (no-fork mode). [DataStreamsLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-streams/DataStreamsLocalSimulator.sol) ## Variables ### feeManagerEnabled Whether fee manager is enabled (can be toggled after deployment) ```solidity bool public feeManagerEnabled ``` ### i_linkToken The LINK token instance ```solidity LinkToken internal immutable i_linkToken ``` ### i_wrappedNative The wrapped native token instance ```solidity WETH9 internal immutable i_wrappedNative ``` ### s_mockFeeManager ```solidity MockFeeManager internal s_mockFeeManager ``` ### s_mockRewardManager ```solidity MockRewardManager internal s_mockRewardManager ``` ### s_mockVerifier ```solidity MockVerifier internal s_mockVerifier ``` ### s_mockVerifierProxy ```solidity MockVerifierProxy internal s_mockVerifierProxy ``` ## Functions ### _deployFeeManager Internal function to deploy fee manager and reward manager ```solidity function _deployFeeManager() private; ``` ### configuration Returns configuration details for pre-deployed contracts and services needed for local Data Streams simulations. ```solidity function configuration() public view returns ( WETH9 wrappedNative_, LinkToken linkToken_, MockVerifier mockVerifier_, MockVerifierProxy mockVerifierProxy_, MockFeeManager mockFeeManager_, MockRewardManager mockRewardManager_ ); ``` **Returns** | Name | Type | Description | | -------------------- | ------------------- | --------------------------------------------------------------------------------- | | `wrappedNative_` | `WETH9` | - The wrapped native token. | | `linkToken_` | `LinkToken` | - The LINK token. | | `mockVerifier_` | `MockVerifier` | - The mock verifier contract. | | `mockVerifierProxy_` | `MockVerifierProxy` | - The mock verifier proxy contract. | | `mockFeeManager_` | `MockFeeManager` | - The mock fee manager contract (returns what's currently set on verifier proxy). | | `mockRewardManager_` | `MockRewardManager` | - The mock reward manager contract (address(0) if fee manager is disabled). | ### constructor ```solidity constructor() ; ``` ### enableOffChainBilling Enables off-chain billing mechanism by removing fee manager This simulates chains that don't have FeeManager contracts deployed ```solidity function enableOffChainBilling() external; ``` ### enableOnChainBilling Enables on-chain billing mechanism by deploying/setting fee manager This simulates chains that have FeeManager contracts deployed ```solidity function enableOnChainBilling() external; ``` ### getBillingMechanism Returns the current billing mechanism type ```solidity function getBillingMechanism() external view returns (string memory billingType); ``` **Returns** | Name | Type | Description | | ------------- | -------- | ------------------------------------------------------------- | | `billingType` | `string` | "on-chain" if fee manager is enabled, "off-chain" if disabled | ### requestLinkFromFaucet Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success); ``` **Parameters** | Name | Type | Description | | -------- | --------- | -------------------------------------------------- | | `to` | `address` | - The address to which LINK tokens are to be sent. | | `amount` | `uint256` | - The amount of LINK tokens to send. | **Returns** | Name | Type | Description | | --------- | ------ | ----------------------------------------------------------------------------- | | `success` | `bool` | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | --- # Register (Data Streams) v0.3.0 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.0/data-streams-register > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.0 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.0 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.0 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.0/src/ccip/CCIPLocalSimulator.sol"; > ``` ## Register (Data Streams) Data Streams network configuration registry. [Register (Data Streams)](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-streams/Register.sol) ## Structs ### NetworkDetails ```solidity struct NetworkDetails { address verifierProxyAddress; address linkAddress; } ``` ## Variables ### s_networkDetails Mapping to store network details based on chain ID. ```solidity mapping(uint256 chainId => NetworkDetails) internal s_networkDetails ``` ## Functions ### constructor Constructor to initialize the network details for various chains. ```solidity constructor() ; ``` ### getNetworkDetails Retrieves network details for a given chain ID. ```solidity function getNetworkDetails(uint256 chainId) external view returns (NetworkDetails memory networkDetails); ``` **Parameters** | Name | Type | Description | | --------- | --------- | --------------------------------------------- | | `chainId` | `uint256` | - The ID of the chain to get the details for. | **Returns** | Name | Type | Description | | ---------------- | ---------------- | ------------------------------------------------- | | `networkDetails` | `NetworkDetails` | - The network details for the specified chain ID. | ### setNetworkDetails Sets the network details for a given chain ID. ```solidity function setNetworkDetails(uint256 chainId, NetworkDetails memory networkDetails) external; ``` **Parameters** | Name | Type | Description | | ---------------- | ---------------- | -------------------------------------------------------- | | `chainId` | `uint256` | - The ID of the chain to set the details for. | | `networkDetails` | `NetworkDetails` | - The network details to set for the specified chain ID. | --- # Chainlink Local v0.3.0 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.0 > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.0 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.0 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.0 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.0/src/ccip/CCIPLocalSimulator.sol"; > ``` Chainlink Local v0.3.0 (V3) targets CCIP 2.0: `CCIPLocalSimulatorFork` and the Hardhat 3 JavaScript fork helper support CCIP 2.0 (CCV-based) lanes, the local router applies the CCIP 2.0 message rules, and the built-in `Register` network details are split into generated data shards so every generated contract stays under the EIP-170 runtime limit. This is a **breaking** release; Hardhat 2 is not supported in `0.3.x` (see [the release notes](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/CHANGELOG.md)). ## CCIP These contracts provide Cross-Chain Interoperability Protocol (CCIP) functionality in a local testing environment: - [CCIPLocalSimulator](/chainlink-local/api-reference/v0.3.0/ccip-local-simulator) - Local CCIP simulator (no-fork mode) - [CCIPLocalSimulatorFork](/chainlink-local/api-reference/v0.3.0/ccip-local-simulator-fork) - CCIP simulator for forked networks - [CCIPLocalSimulatorFork JS](/chainlink-local/api-reference/v0.3.0/ccip-local-simulator-fork-js) - JavaScript helpers for fork routing - [Register](/chainlink-local/api-reference/v0.3.0/register) - CCIP network configuration registry - [CCIPLocalRouter](/chainlink-local/api-reference/v0.3.0/ccip-local-router) - The local-mode router with CCIP 2.0 message rules ## Data Streams Contracts for simulating Chainlink Data Streams: - [DataStreamsLocalSimulator](/chainlink-local/api-reference/v0.3.0/data-streams-local-simulator) - Local Data Streams simulator (no-fork mode) - [DataStreamsLocalSimulatorFork](/chainlink-local/api-reference/v0.3.0/data-streams-local-simulator-fork) - Data Streams simulator for forked networks - [MockVerifier](/chainlink-local/api-reference/v0.3.0/mock-verifier) - Mock Data Streams verifier - [MockVerifierProxy](/chainlink-local/api-reference/v0.3.0/mock-verifier-proxy) - Mock Data Streams verifier proxy - [MockReportGenerator](/chainlink-local/api-reference/v0.3.0/mock-report-generator) - Signed report generator for every report schema - [MockFeeManager](/chainlink-local/api-reference/v0.3.0/mock-fee-manager) - Mock verifier fee manager - [MockRewardManager](/chainlink-local/api-reference/v0.3.0/mock-reward-manager) - Mock reward manager - [ReportVersions](/chainlink-local/api-reference/v0.3.0/report-versions) - Data Streams report schemas - [Register (Data Streams)](/chainlink-local/api-reference/v0.3.0/data-streams-register) - Data Streams network configuration registry ## Data Feeds Contracts for simulating Chainlink Data Feeds: - [AggregatorInterface](/chainlink-local/api-reference/v0.3.0/aggregator-interface) - Basic price feed interface - [AggregatorV2V3Interface](/chainlink-local/api-reference/v0.3.0/aggregator-v2-v3-interface) - Combined V2/V3 price feed interface - [AggregatorV3Interface](/chainlink-local/api-reference/v0.3.0/aggregator-v3-interface) - Extended price feed interface - [MockOffchainAggregator](/chainlink-local/api-reference/v0.3.0/mock-offchain-aggregator) - Mock implementation of off-chain aggregator - [MockV3Aggregator](/chainlink-local/api-reference/v0.3.0/mock-v3-aggregator) - Mock implementation of V3 aggregator ## Token Contracts Standard token implementations for testing: - [BurnMintERC677Helper](/chainlink-local/api-reference/v0.3.0/burn-mint-erc677-helper) - Helper contract for ERC677 token operations - [LinkToken](/chainlink-local/api-reference/v0.3.0/link-token) - LINK token implementation - [WETH9](/chainlink-local/api-reference/v0.3.0/weth9) - Wrapped Ether implementation --- # LinkToken v0.3.0 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.0/link-token > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.0 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.0 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.0 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.0/src/ccip/CCIPLocalSimulator.sol"; > ``` ## LinkToken LINK token implementation. [LinkToken](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/shared/LinkToken.sol) ## Variables ### NAME The name of the LINK token. ```solidity string private constant NAME = "ChainLink Token" ``` ### SYMBOL The symbol of the LINK token. ```solidity string private constant SYMBOL = "LINK" ``` ### TOTAL_SUPPLY The total supply of LINK tokens. ```solidity uint256 private constant TOTAL_SUPPLY = 10 ** 27 ``` ## Functions ### _onCreate Hook that is called when this contract is created. Useful to override constructor behaviour in child contracts (e.g., LINK bridge tokens). The default implementation mints 10\*\*27 tokens to the contract deployer. ```solidity function _onCreate() internal virtual; ``` ### constructor Constructor to initialize the LinkToken contract with a fixed total supply, name, and symbol. Calls the ERC677 constructor with the name and symbol, and then mints the total supply to the contract deployer. ```solidity constructor() ERC677(NAME, SYMBOL); ``` --- # MockFeeManager v0.3.0 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.0/mock-fee-manager > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.0 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.0 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.0 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.0/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockFeeManager Mock verifier fee manager. [MockFeeManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-streams/MockFeeManager.sol) ## Variables ### i_linkAddress ```solidity address public immutable i_linkAddress ``` ### i_nativeAddress ```solidity address public immutable i_nativeAddress ``` ### i_proxyAddress ```solidity address public immutable i_proxyAddress ``` ### i_rewardManager ```solidity IRewardManager public immutable i_rewardManager ``` ### PERCENTAGE_SCALAR the total discount that can be applied to a fee, 1e18 = 100% discount ```solidity uint64 private constant PERCENTAGE_SCALAR = 1e18 ``` ### s_mockDiscounts ```solidity mapping(address => uint256) public s_mockDiscounts ``` ### s_nativeSurcharge ```solidity uint256 public s_nativeSurcharge ``` ## Errors ### ExpiredReport ```solidity error ExpiredReport(); ``` ### InvalidAddress ```solidity error InvalidAddress(); ``` ### InvalidDeposit ```solidity error InvalidDeposit(); ``` ### InvalidDiscount ```solidity error InvalidDiscount(); ``` ### InvalidQuote ```solidity error InvalidQuote(); ``` ### InvalidSurcharge ```solidity error InvalidSurcharge(); ``` ### Unauthorized ```solidity error Unauthorized(); ``` ## Functions ### _processFee ```solidity function _processFee(bytes calldata payload, bytes calldata parameterPayload, address subscriber) internal; ``` ### constructor ```solidity constructor(address linkAddress, address nativeAddress, address proxyAddress, address rewardManager) ; ``` ### getFeeAndReward ```solidity function getFeeAndReward(address subscriber, bytes memory report, address quoteAddress) public view returns (Common.Asset memory, Common.Asset memory, uint256); ``` ### getMockDiscount ```solidity function getMockDiscount(address subscriber) external view returns (uint256); ``` ### processFee ```solidity function processFee(bytes calldata payload, bytes calldata parameterPayload, address subscriber) external payable override onlyProxy; ``` ### processFeeBulk ```solidity function processFeeBulk(bytes[] calldata payloads, bytes calldata parameterPayload, address subscriber) external payable override onlyProxy; ``` ### setMockDiscount ```solidity function setMockDiscount(address subscriber, uint256 discount) external; ``` ### setNativeSurcharge ```solidity function setNativeSurcharge(uint64 surcharge) external; ``` ### supportsInterface ```solidity function supportsInterface(bytes4 interfaceId) external pure override returns (bool); ``` --- # MockOffchainAggregator v0.3.0 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.0/mock-offchain-aggregator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.0 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.0 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.0 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.0/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockOffchainAggregator Mock implementation of off-chain aggregator. [MockOffchainAggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-feeds/MockOffchainAggregator.sol) ## Variables ### decimals The number of decimals used by the aggregator. ```solidity uint8 public decimals ``` ### getAnswer Mapping to get the answer for a specific round ID. ```solidity mapping(uint256 => int256) public getAnswer ``` ### getStartedAt Mapping to get the start time for a specific round ID. ```solidity mapping(uint256 => uint256) private getStartedAt ``` ### getTimestamp Mapping to get the timestamp for a specific round ID. ```solidity mapping(uint256 => uint256) public getTimestamp ``` ### latestAnswer The latest answer reported by the aggregator. ```solidity int256 public latestAnswer ``` ### latestRound The latest round ID. ```solidity uint256 public latestRound ``` ### latestTimestamp The timestamp of the latest answer. ```solidity uint256 public latestTimestamp ``` ### MAX_ANSWER_POSSIBLE The maximum possible answer the aggregator can report. ```solidity int192 private constant MAX_ANSWER_POSSIBLE = 95780971304118053647396689196894323976171195136475135 ``` ### maxAnswer The maximum answer the aggregator is allowed to report. ```solidity int192 public maxAnswer ``` ### MIN_ANSWER_POSSIBLE The minimum possible answer the aggregator can report. ```solidity int192 private constant MIN_ANSWER_POSSIBLE = 1 ``` ### minAnswer The minimum answer the aggregator is allowed to report. ```solidity int192 public minAnswer ``` ## Functions ### constructor Constructor to initialize the MockOffchainAggregator contract with initial parameters. ```solidity constructor(uint8 _decimals, int256 _initialAnswer) ; ``` **Parameters** | Name | Type | Description | | ---------------- | -------- | ------------------------------------------------------ | | `_decimals` | `uint8` | - The number of decimals for the aggregator. | | `_initialAnswer` | `int256` | - The initial answer to be set in the mock aggregator. | ### getRoundData Gets the round data for a specific round ID. ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); ``` **Parameters** | Name | Type | Description | | ---------- | -------- | ----------------------------------- | | `_roundId` | `uint80` | - The round ID to get the data for. | **Returns** | Name | Type | Description | | ----------------- | --------- | ------------------------------------------------ | | `roundId` | `uint80` | - The round ID. | | `answer` | `int256` | - The answer for the round. | | `startedAt` | `uint256` | - The timestamp when the round started. | | `updatedAt` | `uint256` | - The timestamp when the round was updated. | | `answeredInRound` | `uint80` | - The round ID in which the answer was computed. | ### latestRoundData Gets the latest round data. ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); ``` **Returns** | Name | Type | Description | | ----------------- | --------- | ------------------------------------------------------- | | `roundId` | `uint80` | - The latest round ID. | | `answer` | `int256` | - The latest answer. | | `startedAt` | `uint256` | - The timestamp when the latest round started. | | `updatedAt` | `uint256` | - The timestamp when the latest round was updated. | | `answeredInRound` | `uint80` | - The round ID in which the latest answer was computed. | ### updateAnswer Updates the answer in the mock aggregator. ```solidity function updateAnswer(int256 _answer) public; ``` **Parameters** | Name | Type | Description | | --------- | -------- | --------------------------- | | `_answer` | `int256` | - The new answer to be set. | ### updateMinAndMaxAnswers Updates the minimum and maximum answers the aggregator can report. ```solidity function updateMinAndMaxAnswers(int192 _minAnswer, int192 _maxAnswer) external; ``` **Parameters** | Name | Type | Description | | ------------ | -------- | ------------------------- | | `_minAnswer` | `int192` | - The new minimum answer. | | `_maxAnswer` | `int192` | - The new maximum answer. | ### updateRoundData Updates the round data in the mock aggregator. ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public; ``` **Parameters** | Name | Type | Description | | ------------ | --------- | --------------------------------------- | | `_roundId` | `uint80` | - The round ID to be updated. | | `_answer` | `int256` | - The new answer to be set. | | `_timestamp` | `uint256` | - The timestamp to be set. | | `_startedAt` | `uint256` | - The timestamp when the round started. | --- # MockReportGenerator v0.3.0 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.0/mock-report-generator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.0 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.0 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.0 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.0/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockReportGenerator Signed report generator for every report schema. [MockReportGenerator](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-streams/MockReportGenerator.sol) ## Variables ### i_donAddress ```solidity address internal immutable i_donAddress ``` ### i_donDigest ```solidity uint256 internal immutable i_donDigest ``` ### i_reportV10MockFeedId ```solidity bytes32 internal immutable i_reportV10MockFeedId = hex"000a777777777777777777777777777777777777777777777777777777777777" ``` ### i_reportV11MockFeedId ```solidity bytes32 internal immutable i_reportV11MockFeedId = hex"000b777777777777777777777777777777777777777777777777777777777777" ``` ### i_reportV12MockFeedId ```solidity bytes32 internal immutable i_reportV12MockFeedId = hex"000c777777777777777777777777777777777777777777777777777777777777" ``` ### i_reportV13MockFeedId ```solidity bytes32 internal immutable i_reportV13MockFeedId = hex"000d777777777777777777777777777777777777777777777777777777777777" ``` ### i_reportV1MockFeedId ```solidity bytes32 internal immutable i_reportV1MockFeedId = hex"0001777777777777777777777777777777777777777777777777777777777777" ``` ### i_reportV2MockFeedId ```solidity bytes32 internal immutable i_reportV2MockFeedId = hex"0002777777777777777777777777777777777777777777777777777777777777" ``` ### i_reportV3MockFeedId ```solidity bytes32 internal immutable i_reportV3MockFeedId = hex"0003777777777777777777777777777777777777777777777777777777777777" ``` ### i_reportV4MockFeedId ```solidity bytes32 internal immutable i_reportV4MockFeedId = hex"0004777777777777777777777777777777777777777777777777777777777777" ``` ### i_reportV5MockFeedId ```solidity bytes32 internal immutable i_reportV5MockFeedId = hex"0005777777777777777777777777777777777777777777777777777777777777" ``` ### i_reportV6MockFeedId ```solidity bytes32 internal immutable i_reportV6MockFeedId = hex"0006777777777777777777777777777777777777777777777777777777777777" ``` ### i_reportV7MockFeedId ```solidity bytes32 internal immutable i_reportV7MockFeedId = hex"0007777777777777777777777777777777777777777777777777777777777777" ``` ### i_reportV8MockFeedId ```solidity bytes32 internal immutable i_reportV8MockFeedId = hex"0008777777777777777777777777777777777777777777777777777777777777" ``` ### i_reportV9MockFeedId ```solidity bytes32 internal immutable i_reportV9MockFeedId = hex"0009777777777777777777777777777777777777777777777777777777777777" ``` ### s_ask ```solidity int192 internal s_ask ``` ### s_bid ```solidity int192 internal s_bid ``` ### s_expiresPeriod ```solidity uint32 internal s_expiresPeriod ``` ### s_linkFee ```solidity uint192 internal s_linkFee ``` ### s_marketStatus ```solidity uint32 internal s_marketStatus ``` ### s_nativeFee ```solidity uint192 internal s_nativeFee ``` ### s_price ```solidity int192 internal s_price ``` ## Errors ### MockReportGenerator__CastOverflow ```solidity error MockReportGenerator__CastOverflow(); ``` ### MockReportGenerator__InvalidAsk ```solidity error MockReportGenerator__InvalidAsk(); ``` ### MockReportGenerator__InvalidBid ```solidity error MockReportGenerator__InvalidBid(); ``` ## Functions ### constructor ```solidity constructor(int192 initialPrice) ; ``` ### generateReport ```solidity function generateReport(ReportV1 calldata report) external returns (bytes memory signedReport); ``` ### generateReport ```solidity function generateReport(ReportV3 calldata report) external returns (bytes memory signedReport); ``` ### generateReport ```solidity function generateReport(ReportV4 calldata report) external returns (bytes memory signedReport); ``` ### generateReport ```solidity function generateReport(ReportV5 calldata report) external returns (bytes memory signedReport); ``` ### generateReport ```solidity function generateReport(ReportV6 calldata report) external returns (bytes memory signedReport); ``` ### generateReport ```solidity function generateReport(ReportV7 calldata report) external returns (bytes memory signedReport); ``` ### generateReport ```solidity function generateReport(ReportV8 calldata report) external returns (bytes memory signedReport); ``` ### generateReport ```solidity function generateReport(ReportV9 calldata report) external returns (bytes memory signedReport); ``` ### generateReport ```solidity function generateReport(ReportV10 calldata report) external returns (bytes memory signedReport); ``` ### generateReport ```solidity function generateReport(ReportV11 calldata report) external returns (bytes memory signedReport); ``` ### generateReport ```solidity function generateReport(ReportV12 calldata report) external returns (bytes memory signedReport); ``` ### generateReport ```solidity function generateReport(ReportV13 calldata report) external returns (bytes memory signedReport); ``` ### generateReportV1 ```solidity function generateReportV1() external returns (bytes memory signedReport, ReportV1 memory report); ``` ### generateReportV10 ```solidity function generateReportV10() external returns (bytes memory signedReport, ReportV10 memory report); ``` ### generateReportV11 ```solidity function generateReportV11() external returns (bytes memory signedReport, ReportV11 memory report); ``` ### generateReportV12 ```solidity function generateReportV12() external returns (bytes memory signedReport, ReportV12 memory report); ``` ### generateReportV13 ```solidity function generateReportV13() external returns (bytes memory signedReport, ReportV13 memory report); ``` ### generateReportV2 ```solidity function generateReportV2(ReportV2 calldata report) external returns (bytes memory signedReport); ``` ### generateReportV2 ```solidity function generateReportV2() external returns (bytes memory signedReport, ReportV2 memory report); ``` ### generateReportV3 ```solidity function generateReportV3() external returns (bytes memory signedReport, ReportV3 memory report); ``` ### generateReportV4 ```solidity function generateReportV4() external returns (bytes memory signedReport, ReportV4 memory report); ``` ### generateReportV5 ```solidity function generateReportV5() external returns (bytes memory signedReport, ReportV5 memory report); ``` ### generateReportV6 ```solidity function generateReportV6() external returns (bytes memory signedReport, ReportV6 memory report); ``` ### generateReportV7 ```solidity function generateReportV7() external returns (bytes memory signedReport, ReportV7 memory report); ``` ### generateReportV8 ```solidity function generateReportV8() external returns (bytes memory signedReport, ReportV8 memory report); ``` ### generateReportV9 ```solidity function generateReportV9() external returns (bytes memory signedReport, ReportV9 memory report); ``` ### getMockDonAddress ```solidity function getMockDonAddress() external view returns (address); ``` ### signReport ```solidity function signReport(bytes memory reportData) private returns (bytes memory signedReport); ``` ### toUint32 ```solidity function toUint32(uint256 timestamp) private pure returns (uint32); ``` ### toUint64 ```solidity function toUint64(uint256 value) private pure returns (uint64); ``` ### updateExpiresPeriod ```solidity function updateExpiresPeriod(uint32 period) external; ``` ### updateFees ```solidity function updateFees(uint192 nativeFee, uint192 linkFee) external; ``` ### updateMarketStatus ```solidity function updateMarketStatus(uint32 status) external; ``` ### updatePrice ```solidity function updatePrice(int192 price) public; ``` ### updatePriceBidAndAsk ```solidity function updatePriceBidAndAsk(int192 price, int192 bid, int192 ask) external; ``` --- # MockRewardManager v0.3.0 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.0/mock-reward-manager > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.0 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.0 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.0 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.0/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockRewardManager Mock reward manager. [MockRewardManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-streams/MockRewardManager.sol) ## Variables ### i_linkAddress ```solidity address public immutable i_linkAddress ``` ### s_feeManagerAddress ```solidity address public s_feeManagerAddress ``` ## Errors ### Unauthorized ```solidity error Unauthorized(); ``` ## Events ### FeePaid ```solidity event FeePaid(IRewardManager.FeePayment[] payments, address payer); ``` ## Functions ### claimRewards ```solidity function claimRewards( bytes32[] memory /*poolIds*/ ) external pure override; ``` ### constructor ```solidity constructor(address linkAddress) ; ``` ### onFeePaid ```solidity function onFeePaid(FeePayment[] calldata payments, address payer) external override onlyFeeManager; ``` ### setFeeManager ```solidity function setFeeManager(address newFeeManager) external override; ``` ### supportsInterface ```solidity function supportsInterface(bytes4 interfaceId) external pure override returns (bool); ``` --- # MockV3Aggregator v0.3.0 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.0/mock-v3-aggregator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.0 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.0 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.0 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.0/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockV3Aggregator Mock implementation of V3 aggregator. [MockV3Aggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-feeds/MockV3Aggregator.sol) ## Variables ### aggregator The address of the current aggregator. ```solidity address public aggregator ``` ### proposedAggregator The address of the proposed aggregator. ```solidity address public proposedAggregator ``` ### version The version of the aggregator. ```solidity uint256 public constant override version = 0 ``` ## Functions ### confirmAggregator Confirms the proposed aggregator. ```solidity function confirmAggregator(address _aggregator) external; ``` **Parameters** | Name | Type | Description | | ------------- | --------- | ----------------------------------------- | | `_aggregator` | `address` | - The address of the proposed aggregator. | ### constructor Constructor to initialize the MockV3Aggregator contract with initial parameters. ```solidity constructor(uint8 _decimals, int256 _initialAnswer) ; ``` **Parameters** | Name | Type | Description | | ---------------- | -------- | ------------------------------------------------------ | | `_decimals` | `uint8` | - The number of decimals for the aggregator. | | `_initialAnswer` | `int256` | - The initial answer to be set in the mock aggregator. | ### decimals Gets the number of decimals used by the aggregator. ```solidity function decimals() external view override returns (uint8); ``` **Returns** | Name | Type | Description | | -------- | ------- | ------------------------------- | | `` | `uint8` | uint8 - The number of decimals. | ### description Gets the description of the aggregator. ```solidity function description() external pure override returns (string memory); ``` **Returns** | Name | Type | Description | | -------- | -------- | -------------------------------------------------- | | `` | `string` | string memory - The description of the aggregator. | ### getAnswer Gets the answer for a specific round ID. ```solidity function getAnswer(uint256 roundId) external view override returns (int256); ``` **Parameters** | Name | Type | Description | | --------- | --------- | ------------------------------------- | | `roundId` | `uint256` | - The round ID to get the answer for. | **Returns** | Name | Type | Description | | -------- | -------- | ------------------------------------------- | | `` | `int256` | int256 - The answer for the given round ID. | ### getRoundData Gets the round data for a specific round ID. This function should raise "No data present" if no data is available for the given round ID. ```solidity function getRoundData(uint80 _roundId) external view override returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); ``` **Parameters** | Name | Type | Description | | ---------- | -------- | ----------------------------------- | | `_roundId` | `uint80` | - The round ID to get the data for. | **Returns** | Name | Type | Description | | ----------------- | --------- | ------------------------------------------------ | | `roundId` | `uint80` | - The round ID. | | `answer` | `int256` | - The answer for the round. | | `startedAt` | `uint256` | - The timestamp when the round started. | | `updatedAt` | `uint256` | - The timestamp when the round was updated. | | `answeredInRound` | `uint80` | - The round ID in which the answer was computed. | ### getTimestamp Gets the timestamp for a specific round ID. ```solidity function getTimestamp(uint256 roundId) external view override returns (uint256); ``` **Parameters** | Name | Type | Description | | --------- | --------- | ---------------------------------------- | | `roundId` | `uint256` | - The round ID to get the timestamp for. | **Returns** | Name | Type | Description | | -------- | --------- | ----------------------------------------------- | | `` | `uint256` | uint256 - The timestamp for the given round ID. | ### latestAnswer Gets the latest answer from the aggregator. ```solidity function latestAnswer() external view override returns (int256); ``` **Returns** | Name | Type | Description | | -------- | -------- | --------------------------- | | `` | `int256` | int256 - The latest answer. | ### latestRound Gets the latest round ID from the aggregator. ```solidity function latestRound() external view override returns (uint256); ``` **Returns** | Name | Type | Description | | -------- | --------- | ------------------------------ | | `` | `uint256` | uint256 - The latest round ID. | ### latestRoundData Gets the latest round data. This function should raise "No data present" if no data is available. ```solidity function latestRoundData() external view override returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); ``` **Returns** | Name | Type | Description | | ----------------- | --------- | ------------------------------------------------------- | | `roundId` | `uint80` | - The latest round ID. | | `answer` | `int256` | - The latest answer. | | `startedAt` | `uint256` | - The timestamp when the latest round started. | | `updatedAt` | `uint256` | - The timestamp when the latest round was updated. | | `answeredInRound` | `uint80` | - The round ID in which the latest answer was computed. | ### latestTimestamp Gets the timestamp of the latest answer from the aggregator. ```solidity function latestTimestamp() external view override returns (uint256); ``` **Returns** | Name | Type | Description | | -------- | --------- | --------------------------------------------- | | `` | `uint256` | uint256 - The timestamp of the latest answer. | ### proposeAggregator Proposes a new aggregator. ```solidity function proposeAggregator(AggregatorV2V3Interface _aggregator) external; ``` **Parameters** | Name | Type | Description | | ------------- | ------------------------- | ----------------------------------------- | | `_aggregator` | `AggregatorV2V3Interface` | - The address of the proposed aggregator. | ### updateAnswer Updates the answer in the mock aggregator. ```solidity function updateAnswer(int256 _answer) public; ``` **Parameters** | Name | Type | Description | | --------- | -------- | --------------------------- | | `_answer` | `int256` | - The new answer to be set. | ### updateRoundData Updates the round data in the mock aggregator. ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public; ``` **Parameters** | Name | Type | Description | | ------------ | --------- | --------------------------------------- | | `_roundId` | `uint80` | - The round ID to be updated. | | `_answer` | `int256` | - The new answer to be set. | | `_timestamp` | `uint256` | - The timestamp to be set. | | `_startedAt` | `uint256` | - The timestamp when the round started. | --- # MockVerifierProxy v0.3.0 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.0/mock-verifier-proxy > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.0 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.0 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.0 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.0/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockVerifierProxy Mock Data Streams verifier proxy. [MockVerifierProxy](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-streams/MockVerifierProxy.sol) ## Variables ### s_feeManager ```solidity IVerifierFeeManager public s_feeManager ``` ### s_verifier ```solidity address internal s_verifier ``` ## Errors ### FeeManagerNotExpected ```solidity error FeeManagerNotExpected(string message); ``` ### FeeManagerRequired ```solidity error FeeManagerRequired(string message); ``` ### VerifierInvalid ```solidity error VerifierInvalid(); ``` ### VerifierNotFound ```solidity error VerifierNotFound(); ``` ### ZeroAddress ```solidity error ZeroAddress(); ``` ## Events ### VerifierInitialized ```solidity event VerifierInitialized(address indexed verifierAddress); ``` ## Functions ### _validateBillingMechanism Validates billing mechanism configuration and provides helpful error messages This validation helps developers catch billing mechanism mismatches early in development ```solidity function _validateBillingMechanism(address feeManagerAddress, bytes calldata parameterPayload) internal pure; ``` **Parameters** | Name | Type | Description | | ------------------- | --------- | ------------------------------------------------------------- | | `feeManagerAddress` | `address` | Current fee manager address (address(0) if off-chain billing) | | `parameterPayload` | `bytes` | The parameter payload from the consumer contract | ### _verify ```solidity function _verify(bytes calldata payload) internal returns (bytes memory); ``` ### getVerifier ```solidity function getVerifier( bytes32 /*configDigest*/ ) external view returns (address); ``` ### initializeVerifier ```solidity function initializeVerifier(address verifierAddress) external onlyOwner onlyValidVerifier(verifierAddress); ``` ### setFeeManager ```solidity function setFeeManager(IVerifierFeeManager feeManager) external; ``` ### verify ```solidity function verify(bytes calldata payload, bytes calldata parameterPayload) external payable returns (bytes memory); ``` ### verifyBulk ```solidity function verifyBulk(bytes[] calldata payloads, bytes calldata parameterPayload) external payable returns (bytes[] memory verifiedReports); ``` --- # MockVerifier v0.3.0 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.0/mock-verifier > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.0 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.0 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.0 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.0/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockVerifier Mock Data Streams verifier. [MockVerifier](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-streams/MockVerifier.sol) ## Variables ### i_verifierProxy ```solidity address internal immutable i_verifierProxy ``` ### MOCK_DATA_STREAM_DON_ADDRESS ```solidity address constant MOCK_DATA_STREAM_DON_ADDRESS = 0x143f40b47ab222503b787e98940023c59fc29984 ``` ### N_2 ```solidity uint256 constant N_2 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0 ``` ### s_inactiveDigests ```solidity mapping(bytes32 => mapping(bytes32 => bool)) internal s_inactiveDigests ``` ### s_inactiveFeeds ```solidity mapping(bytes32 => bool) internal s_inactiveFeeds ``` ### s_verifiedSignatures ```solidity mapping(bytes => bool) internal s_verifiedSignatures ``` ## Errors ### AccessForbidden ```solidity error AccessForbidden(); ``` ### AlreadyUsedSignature ```solidity error AlreadyUsedSignature(); ``` ### BadVerification ```solidity error BadVerification(); ``` ### DigestInactive ```solidity error DigestInactive(bytes32 feedId, bytes32 configDigest); ``` ### InactiveFeed ```solidity error InactiveFeed(bytes32 feedId); ``` ### InvalidS ```solidity error InvalidS(); ``` ### InvalidSignatureLength ```solidity error InvalidSignatureLength(); ``` ### InvalidV ```solidity error InvalidV(); ``` ## Events ### ReportVerified ```solidity event ReportVerified(bytes32 indexed feedId, address indexed sender); ``` ## Functions ### activateConfig ```solidity function activateConfig(bytes32 feedId, bytes32 configDigest) external; ``` ### activateFeed ```solidity function activateFeed(bytes32 feedId) external; ``` ### constructor ```solidity constructor(address verifierProxy) ; ``` ### deactivateConfig ```solidity function deactivateConfig(bytes32 feedId, bytes32 configDigest) external; ``` ### deactivateFeed ```solidity function deactivateFeed(bytes32 feedId) external; ``` ### supportsInterface ```solidity function supportsInterface(bytes4 interfaceId) external pure override returns (bool); ``` ### verify ```solidity function verify(bytes calldata signedReport, address sender) external returns (bytes memory verifierResponse); ``` --- # Register v0.3.0 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.0/register > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.0 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.0 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.0 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.0/src/ccip/CCIPLocalSimulator.sol"; > ``` ## Register CCIP network configuration registry. [Register](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/ccip/Register.sol) ## Structs ### NetworkDetails ```solidity struct NetworkDetails { uint64 chainSelector; address routerAddress; address linkAddress; address wrappedNativeAddress; address ccipBnMAddress; address ccipLnMAddress; address rmnProxyAddress; address registryModuleOwnerCustomAddress; address tokenAdminRegistryAddress; } ``` ## Variables ### _SHARD_COUNT Number of generated data shards in RegisterData.sol. ```solidity uint256 internal constant _SHARD_COUNT = 4 ``` ### s_isOverridden Whether `setNetworkDetails` was called for a chain ID. ```solidity mapping(uint256 chainId => bool isOverridden) internal s_isOverridden ``` ### s_networkDetails Network details set with `setNetworkDetails`, overriding the built-in ones. ```solidity mapping(uint256 chainId => NetworkDetails) internal s_networkDetails ``` ## Functions ### _defaultNetworkDetails Built-in network details for `chainId`, or an all-zero struct for an unknown chain. Decodes the generated data shards; shard addresses without code are skipped, so a bare `new Register()` (no shards placed) only serves `setNetworkDetails` overrides. ```solidity function _defaultNetworkDetails(uint256 chainId) internal view returns (NetworkDetails memory); ``` ### getNetworkDetails Retrieves network details for a given chain ID. ```solidity function getNetworkDetails(uint256 chainId) external view returns (NetworkDetails memory networkDetails); ``` **Parameters** | Name | Type | Description | | --------- | --------- | --------------------------------------------- | | `chainId` | `uint256` | - The ID of the chain to get the details for. | **Returns** | Name | Type | Description | | ---------------- | ---------------- | ------------------------------------------------- | | `networkDetails` | `NetworkDetails` | - The network details for the specified chain ID. | ### setNetworkDetails Sets the network details for a given chain ID. ```solidity function setNetworkDetails(uint256 chainId, NetworkDetails memory networkDetails) external; ``` **Parameters** | Name | Type | Description | | ---------------- | ---------------- | -------------------------------------------------------- | | `chainId` | `uint256` | - The ID of the chain to set the details for. | | `networkDetails` | `NetworkDetails` | - The network details to set for the specified chain ID. | ### shardAddress Deterministic address of built-in data shard `index`; the simulator places each shard there. ```solidity function shardAddress(uint256 index) public view returns (address); ``` --- # ReportVersions v0.3.0 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.0/report-versions > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.0 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.0 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.0 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.0/src/ccip/CCIPLocalSimulator.sol"; > ``` ## ReportVersions Data Streams report schemas. [ReportVersions](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-streams/ReportVersions.sol) ## Structs ### ReportV1 Represents a data report from a Data Streams stream for v1 schema (early crypto report with block metadata). DEPRECATED: v1 schema is deprecated; only included here for historical reference and backwards compatibility with legacy streams. For schema overview, see [https://docs.chain.link/data-streams/reference/report-schema-overview](https://docs.chain.link/data-streams/reference/report-schema-overview) ```solidity struct ReportV1 { bytes32 feedId; // The stream ID the report has data for. uint32 observationsTimestamp; // Observation timestamp in seconds. int192 benchmarkPrice; // DON consensus median benchmark price. int192 bid; // Bid-side price estimate. int192 ask; // Ask-side price estimate. uint64 currentBlockNum; // Current block number used by the report. bytes32 currentBlockHash; // Current block hash used by the report. uint64 validFromBlockNum; // Earliest block number from which the report is valid. uint64 currentBlockTimestamp; // Current block timestamp in seconds. } ``` ### ReportV10 Represents a data report from a Data Streams stream for v10 schema (tokenized-asset stream). The `marketStatus` indicates whether the market is currently open. Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). For more information, see [https://docs.chain.link/data-streams/reference/report-schema-v10](https://docs.chain.link/data-streams/reference/report-schema-v10) ```solidity struct ReportV10 { bytes32 feedId; // The stream ID the report has data for. uint32 validFromTimestamp; // Earliest timestamp for which the report is applicable. uint32 observationsTimestamp; // Latest timestamp for which the report is applicable. uint192 nativeFee; // Base cost to validate a transaction using the report, denominated in the chain's native token (e.g., WETH/ETH). uint192 linkFee; // Base cost to validate a transaction using the report, denominated in LINK. uint32 expiresAt; // Latest timestamp where the report can be verified onchain. uint64 lastUpdateTimestamp; // Timestamp of the last source-side update. int192 price; // Underlying asset price (8 or 18 decimals). uint32 marketStatus; // The DON's consensus on whether the market is currently open. int192 currentMultiplier; // Current underlying-share multiplier. int192 newMultiplier; // Future multiplier applied after a corporate action. uint32 activationDateTime; // Corporate-action activation timestamp. int192 tokenizedPrice; // Tokenized-asset price when available. } ``` ### ReportV11 Represents a data report from a Data Streams stream for v11 schema (RWA Advanced stream). The `marketStatus` indicates whether the market is currently open. Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). For more information, see [https://docs.chain.link/data-streams/reference/report-schema-v11](https://docs.chain.link/data-streams/reference/report-schema-v11) ```solidity struct ReportV11 { bytes32 feedId; // The stream ID the report has data for. uint32 validFromTimestamp; // Earliest timestamp for which the report is applicable. uint32 observationsTimestamp; // Latest timestamp for which the report is applicable. uint192 nativeFee; // Base cost to validate a transaction using the report, denominated in the chain's native token (e.g., WETH/ETH). uint192 linkFee; // Base cost to validate a transaction using the report, denominated in LINK. uint32 expiresAt; // Latest timestamp where the report can be verified onchain. int192 mid; // Liquidity-weighted mid price (8 or 18 decimals). uint64 lastSeenTimestampNs; // Last-seen timestamp from the source, in nanoseconds. int192 bid; // Consensus bid price (8 or 18 decimals). int192 bidVolume; // Resting bid-side volume / depth. int192 ask; // Consensus ask price (8 or 18 decimals). int192 askVolume; // Resting ask-side volume / depth. int192 lastTradedPrice; // Most recent traded price (8 or 18 decimals). uint32 marketStatus; // The DON's consensus on whether the market is currently open. } ``` ### ReportV12 Represents a data report from a Data Streams stream for v12 schema (NAV report with next NAV). For schema overview, see [https://docs.chain.link/data-streams/reference/report-schema-overview](https://docs.chain.link/data-streams/reference/report-schema-overview) ```solidity struct ReportV12 { bytes32 feedId; // The stream ID the report has data for. uint32 validFromTimestamp; // Earliest timestamp for which the report is applicable. uint32 observationsTimestamp; // Latest timestamp for which the report is applicable. uint192 nativeFee; // Base cost to validate a transaction using the report, denominated in the chain's native token (e.g., WETH/ETH). uint192 linkFee; // Base cost to validate a transaction using the report, denominated in LINK. uint32 expiresAt; // Latest timestamp where the report can be verified onchain. int192 navPerShare; // Current NAV per share. int192 nextNavPerShare; // Next NAV per share. uint64 navDate; // NAV date / timestamp. uint32 ripcord; // Issuer / source risk flag. } ``` ### ReportV13 Represents a data report from a Data Streams stream for v13 schema (best bid / best ask market data report). For schema overview, see [https://docs.chain.link/data-streams/reference/report-schema-overview](https://docs.chain.link/data-streams/reference/report-schema-overview) ```solidity struct ReportV13 { bytes32 feedId; // The stream ID the report has data for. uint32 validFromTimestamp; // Earliest timestamp for which the report is applicable. uint32 observationsTimestamp; // Latest timestamp for which the report is applicable. uint192 nativeFee; // Base cost to validate a transaction using the report, denominated in the chain's native token (e.g., WETH/ETH). uint192 linkFee; // Base cost to validate a transaction using the report, denominated in LINK. uint32 expiresAt; // Latest timestamp where the report can be verified onchain. int192 bestAsk; // Best ask price. int192 bestBid; // Best bid price. uint64 askVolume; // Best ask volume. uint64 bidVolume; // Best bid volume. int192 lastTradedPrice; // Most recent traded price. } ``` ### ReportV2 Represents a data report from a Data Streams stream for v2 schema (crypto streams). The `price` value is carried to either 8 or 18 decimal places, depending on the stream. For more information, see [https://docs.chain.link/data-streams/crypto-streams](https://docs.chain.link/data-streams/crypto-streams) and [https://docs.chain.link/data-streams/reference/report-schema](https://docs.chain.link/data-streams/reference/report-schema) ```solidity struct ReportV2 { bytes32 feedId; // The feed ID the report has data for uint32 validFromTimestamp; // Earliest timestamp for which price is applicable uint32 observationsTimestamp; // Latest timestamp for which price is applicable uint192 nativeFee; // Base cost to validate a transaction using the report, denominated in the chain’s native token (WETH/ETH) uint192 linkFee; // Base cost to validate a transaction using the report, denominated in LINK uint32 expiresAt; // Latest timestamp where the report can be verified on-chain int192 benchmarkPrice; // DON consensus median price, carried to 8 decimal places } ``` ### ReportV3 Represents a data report from a Data Streams stream for v3 schema (crypto streams). The `price`, `bid`, and `ask` values are carried to either 8 or 18 decimal places, depending on the stream. For more information, see [https://docs.chain.link/data-streams/crypto-streams](https://docs.chain.link/data-streams/crypto-streams) and [https://docs.chain.link/data-streams/reference/report-schema](https://docs.chain.link/data-streams/reference/report-schema) ```solidity struct ReportV3 { bytes32 feedId; // The stream ID the report has data for. uint32 validFromTimestamp; // Earliest timestamp for which price is applicable. uint32 observationsTimestamp; // Latest timestamp for which price is applicable. uint192 nativeFee; // Base cost to validate a transaction using the report, denominated in the chain’s native token (e.g., WETH/ETH). uint192 linkFee; // Base cost to validate a transaction using the report, denominated in LINK. uint32 expiresAt; // Latest timestamp where the report can be verified onchain. int192 price; // DON consensus median price (8 or 18 decimals). int192 bid; // Simulated price impact of a buy order up to the X% depth of liquidity utilisation (8 or 18 decimals). int192 ask; // Simulated price impact of a sell order up to the X% depth of liquidity utilisation (8 or 18 decimals). } ``` ### ReportV4 Represents a data report from a Data Streams stream for v4 schema (RWA stream). The `price` value is carried to either 8 or 18 decimal places, depending on the stream. The `marketStatus` indicates whether the market is currently open. Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). For more information, see [https://docs.chain.link/data-streams/rwa-streams](https://docs.chain.link/data-streams/rwa-streams) and [https://docs.chain.link/data-streams/reference/report-schema-v4](https://docs.chain.link/data-streams/reference/report-schema-v4) ```solidity struct ReportV4 { bytes32 feedId; // The stream ID the report has data for. uint32 validFromTimestamp; // Earliest timestamp for which price is applicable. uint32 observationsTimestamp; // Latest timestamp for which price is applicable. uint192 nativeFee; // Base cost to validate a transaction using the report, denominated in the chain’s native token (e.g., WETH/ETH). uint192 linkFee; // Base cost to validate a transaction using the report, denominated in LINK. uint32 expiresAt; // Latest timestamp where the report can be verified onchain. int192 price; // DON consensus median benchmark price (8 or 18 decimals). uint32 marketStatus; // The DON's consensus on whether the market is currently open. } ``` ### ReportV5 Represents a data report from a Data Streams stream for v5 schema (rate report). For schema overview, see [https://docs.chain.link/data-streams/reference/report-schema-overview](https://docs.chain.link/data-streams/reference/report-schema-overview) ```solidity struct ReportV5 { bytes32 feedId; // The stream ID the report has data for. uint32 validFromTimestamp; // Earliest timestamp for which the report is applicable. uint32 observationsTimestamp; // Latest timestamp for which the report is applicable. uint192 nativeFee; // Base cost to validate a transaction using the report, denominated in the chain's native token (e.g., WETH/ETH). uint192 linkFee; // Base cost to validate a transaction using the report, denominated in LINK. uint32 expiresAt; // Latest timestamp where the report can be verified onchain. int192 rate; // Reported rate value. uint32 timestamp; // Rate timestamp in seconds. uint32 duration; // Duration window in seconds. } ``` ### ReportV6 Represents a data report from a Data Streams stream for v6 schema (multi-price report). For schema overview, see [https://docs.chain.link/data-streams/reference/report-schema-overview](https://docs.chain.link/data-streams/reference/report-schema-overview) ```solidity struct ReportV6 { bytes32 feedId; // The stream ID the report has data for. uint32 validFromTimestamp; // Earliest timestamp for which the report is applicable. uint32 observationsTimestamp; // Latest timestamp for which the report is applicable. uint192 nativeFee; // Base cost to validate a transaction using the report, denominated in the chain's native token (e.g., WETH/ETH). uint192 linkFee; // Base cost to validate a transaction using the report, denominated in LINK. uint32 expiresAt; // Latest timestamp where the report can be verified onchain. int192 price; // Primary price value. int192 price2; // Secondary price value. int192 price3; // Third price value. int192 price4; // Fourth price value. int192 price5; // Fifth price value. } ``` ### ReportV7 Represents a data report from a Data Streams stream for v7 schema (redemption-rate stream). The `exchangeRate` value is carried to either 8 or 18 decimal places, depending on the stream. For more information, see [https://docs.chain.link/data-streams/reference/report-schema-v7](https://docs.chain.link/data-streams/reference/report-schema-v7) ```solidity struct ReportV7 { bytes32 feedId; // The stream ID the report has data for. uint32 validFromTimestamp; // Earliest timestamp for which the report is applicable. uint32 observationsTimestamp; // Latest timestamp for which the report is applicable. uint192 nativeFee; // Base cost to validate a transaction using the report, denominated in the chain's native token (e.g., WETH/ETH). uint192 linkFee; // Base cost to validate a transaction using the report, denominated in LINK. uint32 expiresAt; // Latest timestamp where the report can be verified onchain. int192 exchangeRate; // Redemption / exchange-rate value (8 or 18 decimals). } ``` ### ReportV8 Represents a data report from a Data Streams stream for v8 schema (RWA Standard stream). The `marketStatus` indicates whether the market is currently open. Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). For more information, see [https://docs.chain.link/data-streams/reference/report-schema-v8](https://docs.chain.link/data-streams/reference/report-schema-v8) ```solidity struct ReportV8 { bytes32 feedId; // The stream ID the report has data for. uint32 validFromTimestamp; // Earliest timestamp for which the report is applicable. uint32 observationsTimestamp; // Latest timestamp for which the report is applicable. uint192 nativeFee; // Base cost to validate a transaction using the report, denominated in the chain's native token (e.g., WETH/ETH). uint192 linkFee; // Base cost to validate a transaction using the report, denominated in LINK. uint32 expiresAt; // Latest timestamp where the report can be verified onchain. uint64 lastUpdateTimestamp; // Timestamp of the last source-side update. int192 midPrice; // DON consensus mid price (8 or 18 decimals). uint32 marketStatus; // The DON's consensus on whether the market is currently open. } ``` ### ReportV9 Represents a data report from a Data Streams stream for v9 schema (SmartData / NAV / Proof of Reserve). For more information, see [https://docs.chain.link/data-streams/reference/report-schema-v9](https://docs.chain.link/data-streams/reference/report-schema-v9) ```solidity struct ReportV9 { bytes32 feedId; // The stream ID the report has data for. uint32 validFromTimestamp; // Earliest timestamp for which the report is applicable. uint32 observationsTimestamp; // Latest timestamp for which the report is applicable. uint192 nativeFee; // Base cost to validate a transaction using the report, denominated in the chain's native token (e.g., WETH/ETH). uint192 linkFee; // Base cost to validate a transaction using the report, denominated in LINK. uint32 expiresAt; // Latest timestamp where the report can be verified onchain. int192 navPerShare; // Net asset value per share. uint64 navDate; // NAV date / timestamp. int192 aum; // Assets under management value. uint32 ripcord; // Issuer / source risk flag; non-zero indicates the value should not be treated as normal market data. } ``` --- # WETH9 v0.3.0 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.0/weth9 > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.0 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.0 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.0 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.0/src/ccip/CCIPLocalSimulator.sol"; > ``` ## WETH9 Wrapped Ether implementation. [WETH9](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/shared/WETH9.sol) ## Variables ### allowance ```solidity mapping(address => mapping(address => uint256)) public allowance ``` ### balanceOf ```solidity mapping(address => uint256) public balanceOf ``` ### decimals ```solidity uint8 public decimals = 18 ``` ### name ```solidity string public name = "Wrapped Ether" ``` ### symbol ```solidity string public symbol = "WETH" ``` ## Events ### Approval ```solidity event Approval(address indexed src, address indexed guy, uint256 wad); ``` ### Deposit ```solidity event Deposit(address indexed dst, uint256 wad); ``` ### Transfer ```solidity event Transfer(address indexed src, address indexed dst, uint256 wad); ``` ### Withdrawal ```solidity event Withdrawal(address indexed src, uint256 wad); ``` ## Functions ### _deposit ```solidity function _deposit() internal; ``` ### approve ```solidity function approve(address guy, uint256 wad) public returns (bool); ``` ### deposit ```solidity function deposit() external payable; ``` ### receive ```solidity receive() external payable; ``` ### totalSupply ```solidity function totalSupply() public view returns (uint256); ``` ### transfer ```solidity function transfer(address dst, uint256 wad) public returns (bool); ``` ### transferFrom ```solidity function transferFrom(address src, address dst, uint256 wad) public returns (bool); ``` ### withdraw ```solidity function withdraw(uint256 wad) external; ``` --- # AggregatorInterface v0.3.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1/aggregator-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorInterface Interface for accessing price feed data from an aggregator contract. [`AggregatorInterface`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-feeds/interfaces/AggregatorInterface.sol) > **NOTE** > > Provides methods to get the latest and historical price data for specific rounds. ## Events ### AnswerUpdated ```solidity event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt) ``` > **NOTE** > > Emitted when the answer is updated. #### Parameters | Parameter | Type | Description | | --------- | --------- | --------------------------------------------- | | current | `int256` | The updated answer | | roundId | `uint256` | The round ID for which the answer was updated | | updatedAt | `uint256` | The timestamp when the answer was updated | ### NewRound ```solidity event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt) ``` > **NOTE** > > Emitted when a new round is started. #### Parameters | Parameter | Type | Description | | --------- | --------- | ------------------------------------------------- | | roundId | `uint256` | The round ID of the new round | | startedBy | `address` | The address of the account that started the round | | startedAt | `uint256` | The timestamp when the round was started | ## Functions ### getAnswer Gets the answer for a specific round ID. ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` > **NOTE** > > Gets the answer for a specific round ID. #### Parameters | Parameter | Type | Description | | --------- | --------- | ---------------------------------- | | roundId | `uint256` | The round ID to get the answer for | #### Returns | Parameter | Type | Description | | --------- | -------- | --------------------------------- | | (unnamed) | `int256` | The answer for the given round ID | ### getTimestamp Gets the timestamp for a specific round ID. ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` > **NOTE** > > Gets the timestamp for a specific round ID. #### Parameters | Parameter | Type | Description | | --------- | --------- | ------------------------------------- | | roundId | `uint256` | The round ID to get the timestamp for | #### Returns | Parameter | Type | Description | | --------- | --------- | ------------------------------------ | | (unnamed) | `uint256` | The timestamp for the given round ID | ### latestAnswer Gets the latest answer from the aggregator. ```solidity function latestAnswer() external view returns (int256) ``` > **NOTE** > > Gets the latest answer from the aggregator. #### Returns | Parameter | Type | Description | | --------- | -------- | ----------------- | | (unnamed) | `int256` | The latest answer | ### latestRound Gets the latest round ID from the aggregator. ```solidity function latestRound() external view returns (uint256) ``` > **NOTE** > > Gets the latest round ID from the aggregator. #### Returns | Parameter | Type | Description | | --------- | --------- | ------------------- | | (unnamed) | `uint256` | The latest round ID | ### latestTimestamp Gets the timestamp of the latest answer from the aggregator. ```solidity function latestTimestamp() external view returns (uint256) ``` > **NOTE** > > Gets the timestamp of the latest answer from the aggregator. #### Returns | Parameter | Type | Description | | --------- | --------- | ---------------------------------- | | (unnamed) | `uint256` | The timestamp of the latest answer | --- # AggregatorV2V3Interface v0.3.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1/aggregator-v2-v3-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorV2V3Interface Interface that combines functionality from both AggregatorInterface and AggregatorV3Interface. [`AggregatorV2V3Interface`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-feeds/interfaces/AggregatorV2V3Interface.sol) > **NOTE** > > This interface inherits from: > > - [AggregatorInterface](/chainlink-local/api-reference/v0.3.1/aggregator-interface) > - [AggregatorV3Interface](/chainlink-local/api-reference/v0.3.1/aggregator-v3-interface) --- # AggregatorV3Interface v0.3.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1/aggregator-v3-interface > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## AggregatorV3Interface Interface for accessing detailed data from an aggregator contract, including round data and metadata. [`AggregatorV3Interface`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-feeds/interfaces/AggregatorV3Interface.sol) > **NOTE** > > Provides methods to get the latest data, historical data for specific rounds, and metadata such as decimals and > description. ## Functions ### decimals Gets the number of decimals used by the aggregator. ```solidity function decimals() external view returns (uint8) ``` > **NOTE** > > Gets the number of decimals used by the aggregator. #### Returns | Parameter | Type | Description | | --------- | ------- | ---------------------- | | (unnamed) | `uint8` | The number of decimals | ### description Gets the description of the aggregator. ```solidity function description() external view returns (string memory) ``` > **NOTE** > > Gets the description of the aggregator. #### Returns | Parameter | Type | Description | | --------- | -------- | --------------------------------- | | (unnamed) | `string` | The description of the aggregator | ### getRoundData Gets the round data for a specific round ID. ```solidity function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` > **NOTE** > > Gets the round data for a specific round ID. Reverts with "No data present" if no data is available for the given > round ID. #### Parameters | Parameter | Type | Description | | --------- | -------- | -------------------------------- | | _roundId | `uint80` | The round ID to get the data for | #### Returns | Parameter | Type | Description | | --------------- | --------- | --------------------------------------------- | | roundId | `uint80` | The round ID | | answer | `int256` | The answer for the round | | startedAt | `uint256` | The timestamp when the round started | | updatedAt | `uint256` | The timestamp when the round was updated | | answeredInRound | `uint80` | The round ID in which the answer was computed | ### latestRoundData Gets the latest round data. ```solidity function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` > **NOTE** > > Gets the latest round data. Reverts with "No data present" if no data is available. #### Returns | Parameter | Type | Description | | --------------- | --------- | ---------------------------------------------------- | | roundId | `uint80` | The latest round ID | | answer | `int256` | The latest answer | | startedAt | `uint256` | The timestamp when the latest round started | | updatedAt | `uint256` | The timestamp when the latest round was updated | | answeredInRound | `uint80` | The round ID in which the latest answer was computed | ### version Gets the version of the aggregator. ```solidity function version() external view returns (uint256) ``` > **NOTE** > > Gets the version of the aggregator. #### Returns | Parameter | Type | Description | | --------- | --------- | ----------------------------- | | (unnamed) | `uint256` | The version of the aggregator | --- # BurnMintERC677Helper v0.3.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1/burn-mint-erc677-helper > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## BurnMintERC677Helper A helper contract that extends the BurnMintERC677 token contract to provide additional minting functionality. [`BurnMintERC677Helper`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/ccip/BurnMintERC677Helper.sol) > **NOTE** > > This contract extends the functionality of the BurnMintERC677 token contract to include a `drip` function that mints one full token to a specified address. > > Inherits from the BurnMintERC677 contract and sets the token name, symbol, decimals, and initial supply in the constructor. ## Functions ### constructor Initializes the token with a name and symbol, setting fixed decimals and initial supply. ```solidity constructor(string memory name, string memory symbol) ``` > **NOTE** > > Constructor to initialize the BurnMintERC677Helper contract with a name and symbol. > > Calls the parent constructor of BurnMintERC677 with fixed decimals (18) and initial supply (0). #### Parameters | Parameter | Type | Description | | --------- | -------- | ----------------------- | | name | `string` | The name of the token | | symbol | `string` | The symbol of the token | ### drip Mints exactly one token (1e18 units) to a specified address. ```solidity function drip(address to) external ``` > **NOTE** > > Mints one full token (1e18) to the specified address. > > Calls the internal `_mint` function from the BurnMintERC677 contract. #### Parameters | Parameter | Type | Description | | --------- | --------- | --------------------------------------- | | to | `address` | The address to receive the minted token | --- # CCIPLocalRouter v0.3.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1/ccip-local-router > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalRouter The local-mode router used by [`CCIPLocalSimulator`](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator). It mirrors `MockCCIPRouter` from `@chainlink/contracts-ccip` 2.0.0 (same ABI, events and behaviour) and additionally applies the CCIP 2.0 finality rules of the OnRamp and OffRamp, so a test that passes locally does not fail on a fork or in production. [`CCIPLocalRouter`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/ccip/CCIPLocalRouter.sol) > **NOTE** > > `ccipSend` delivers the message synchronously to the receiver instead of routing it to a destination chain. The CCIP > 2.0 rules it enforces: the requested finality of `GenericExtraArgsV3` must use a single mode (OnRamp check at send > time), and a Faster-Than-Finality message that is not a token-only transfer is only delivered to a receiver whose > `getCCVsAndFinalityConfig` allows the requested finality (OffRamp check). Receivers without > `IAny2EVMMessageReceiverV2` accept finalized messages only. See [CCIP 2.0 behavior in local > mode](/chainlink-local/learn/ccip-v2-local). ## Errors ### CanOnlySendOneTokenPerMessage ```solidity error CanOnlySendOneTokenPerMessage() ``` > **NOTE** > > Mirrors `OnRamp.CanOnlySendOneTokenPerMessage`: more than one token per message is rejected at send time. ### CannotSendZeroTokens ```solidity error CannotSendZeroTokens() ``` > **NOTE** > > Mirrors `OnRamp.CannotSendZeroTokens`: a zero-amount token is rejected at send time. ### InvalidAddress ```solidity error InvalidAddress(bytes encodedAddress) ``` ### InvalidExtraArgsTag ```solidity error InvalidExtraArgsTag() ``` ### InvalidOptionalThreshold ```solidity error InvalidOptionalThreshold(uint8 wanted, uint256 got) ``` > **NOTE** > > Mirrors `OffRamp.InvalidOptionalThreshold`: the receiver's optional CCV threshold exceeds its optional CCV list > length. ### MessageGasLimitTooHigh ```solidity error MessageGasLimitTooHigh() ``` > **NOTE** > > Mirrors `FeeQuoter.MessageGasLimitTooHigh`: a V1/V2 extraArgs gas limit above `uint32` is rejected. ### ReceiverError ```solidity error ReceiverError(bytes err) ``` > **NOTE** > > The receiver's own `ccipReceive` call failed; `err` is its revert data. ### TokenReceiverNotAllowed ```solidity error TokenReceiverNotAllowed(uint64 destChainSelector) ``` > **NOTE** > > Mirrors `OnRamp.TokenReceiverNotAllowed`: `GenericExtraArgsV3.tokenReceiver` is rejected on all EVM lanes. ## Events ### MessageExecuted ```solidity event MessageExecuted(bytes32 messageId, uint64 sourceChainSelector, address offRamp, bytes32 calldataHash) ``` > **NOTE** > > The real router event, emitted after the receiver call. ### MsgExecuted ```solidity event MsgExecuted(bool success, bytes retData, uint256 gasUsed) ``` > **NOTE** > > Test-assistance event that does not exist on real deployments. ## Constants ### GAS_FOR_CALL_EXACT_CHECK ```solidity uint16 public constant GAS_FOR_CALL_EXACT_CHECK = 5_000 ``` ### DEFAULT_GAS_LIMIT ```solidity uint32 public constant DEFAULT_GAS_LIMIT = 200_000 ``` > **NOTE** > > Gas limit applied when `extraArgs` is shorter than 4 bytes (treated as unset). ## Functions ### ccipSend Sends the message locally to the receiver instead of on the destination chain. ```solidity function ccipSend(uint64 destinationChainSelector, Client.EVM2AnyMessage calldata message) external payable returns (bytes32) ``` > **NOTE** > > Validates the receiver address, collects the fee (see `setFee`), parses `extraArgs` (V1, V2 and V3 tags are accepted; > V3 `tokenReceiver` is rejected on EVM lanes), enforces the CCIP 2.0 send-time rules (one token per message, no zero > amounts, single finality mode), checks the receiver's finality config for non-token-only transfers, transfers the > tokens directly to the receiver, and calls `ccipReceive` with the exact gas limit. Returns a mock message ID that is > not calculated from the message contents in the same way as the real message ID. ### getFee Returns the fee set with `setFee`. ```solidity function getFee(uint64, Client.EVM2AnyMessage memory) public view returns (uint256) ``` > **NOTE** > > Returns the fee amount set by `setFee` (default 0). The destination chain selector and message are ignored. ### setFee Sets the fees returned by `getFee`. ```solidity function setFee(uint256 feeAmount) external ``` > **NOTE** > > The fee is charged in the fee token: native value when `feeToken` is `address(0)`, or a transfer of the fee token > otherwise. ### getOnRamp ```solidity function getOnRamp(uint64) external pure returns (address onRampAddress) ``` > **NOTE** > > Always returns `address(1234567890)`. ### getSupportedTokens ```solidity function getSupportedTokens(uint64) external pure returns (address[] memory tokens) ``` > **NOTE** > > Always returns an empty array. ### isChainSupported ```solidity function isChainSupported(uint64) external pure returns (bool supported) ``` > **NOTE** > > Always returns true, so the check can be performed on any chain. ### isOffRamp ```solidity function isOffRamp(uint64, address) external pure returns (bool) ``` > **NOTE** > > Always returns true. ### routeMessage Routes a message to a receiver directly, bypassing `ccipSend` validation. ```solidity function routeMessage(Client.Any2EVMMessage calldata message, uint16 gasForCallExactCheck, uint256 gasLimit, address receiver) external returns (bool success, bytes memory retData, uint256 gasUsed) ``` > **NOTE** > > Calls the receiver's `ccipReceive` with the exact gas limit. Token-only transfers (no data, gas limit 0, or a receiver > without `IAny2EVMMessageReceiver`) return success without calling the receiver. --- # CCIPLocalSimulatorFork JS v0.3.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork-js > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulatorFork JS Hardhat 3 helpers for routing CCIP messages between forked networks: the JavaScript counterpart of the Solidity [`CCIPLocalSimulatorFork`](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork). Supports pre-1.6 (`EVM2EVMOnRamp`), 1.6 and CCIP 2.0 (CCV-based) lanes. [`CCIPLocalSimulatorFork.js`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/scripts/CCIPLocalSimulatorFork.js) > **NOTE** > > Every function takes the `NetworkConnection` returned by `network.connect()` and requires the > `@nomicfoundation/hardhat-ethers` plugin (it uses `connection.ethers`). TypeScript declarations ship next to the > script (`CCIPLocalSimulatorFork.d.ts`). Hardhat 2 is not supported; Hardhat 2 users stay on Chainlink Local `0.2.x`. ## Constants ### CCIP_V2_ROUTERS ```javascript export const CCIP_V2_ROUTERS = Object.freeze({ 11155111: "0x784d49a71BB4C48eB7dA4cD7e6Ecb424f9b5EAB1", // Ethereum Sepolia 43113: "0x7C9B8B4e8024e5Ee8A630F6FCe9015e470dA5763", // Avalanche Fuji }) ``` > **NOTE** > > Dedicated CCIP 2.0 routers deployed next to the default router, keyed by chain ID. Pass them (together with the > default router) to `routeMessage` so both routers' OffRamps are searched. ## Types ### CCIPSentMessage Represents a CCIP message sent in a transaction, for any supported protocol version. | Property | Type | Description | | ------------------- | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- | | era | `"PRE_V1_6" \| "V1_6" \| "V2"` | CCIP protocol version of the lane the message was sent on | | onRamp | `string` | Source OnRamp that emitted the message | | messageId | `string` | The message ID | | sourceChainSelector | `bigint` | The source chain selector | | destChainSelector | `bigint` | The destination chain selector (`undefined` for pre-1.6) | | message | `object` | Era-specific payload: the pre-1.6 `EVM2EVMMessage`, the 1.6 `EVM2AnyRampMessage`, or for CCIP 2.0 `{ encodedMessage, receipts }` | ## Functions ### getCCIPMessages Extracts every CCIP message sent in a transaction, for all supported protocol versions. ```javascript function getCCIPMessages(connection, receipt) => CCIPSentMessage[] ``` > **NOTE** > > Parses the pre-1.6 `CCIPSendRequested` and the 1.6 / 2.0 `CCIPMessageSent` events from the receipt logs. For CCIP 2.0, > the source and destination chain selectors are read from the `MessageV1` wire format without a full decode. #### Parameters | Parameter | Type | Description | | ---------- | -------- | ------------------------------------------ | | connection | `object` | Network connection of the source chain | | receipt | `object` | Transaction receipt of the `ccipSend` call | #### Returns | Type | Description | | ------------------- | ----------------------------------------------- | | `CCIPSentMessage[]` | The sent messages, in log order (empty if none) | ### requestLinkFromTheFaucet Requests LINK tokens from the testnet faucet by impersonating it. ```javascript async function requestLinkFromTheFaucet(connection, linkAddress, to, amount) => Promise ``` #### Parameters | Parameter | Type | Description | | ----------- | -------- | --------------------------------------------------------- | | connection | `object` | Network connection from `network.connect()` | | linkAddress | `string` | The address of the LINK contract on the connected network | | to | `string` | The address to send LINK to | | amount | `bigint` | The amount of LINK to request | #### Returns | Type | Description | | ----------------- | -------------------------------------------------------------- | | `Promise` | Promise resolving to the transaction hash of the fund transfer | ### routeMessage Routes a sent message on the destination (connected) network, as the destination OffRamp would execute it. ```javascript async function routeMessage(connection, routerAddresses, sent, options = {}) => Promise ``` > **NOTE** > > - pre-1.6 and 1.6: impersonates the lane's OffRamp and calls `executeSingleMessage`. - CCIP 2.0: the OffRamp selects > the CCVs (`getCCVsForMessage`), CCVs that are owner-configurable verifier resolvers are pointed at a synthetic no-op > verifier, and the raw encoded message is executed through the permissionless `execute`. A message is only delivered if > the OffRamp reports `SUCCESS`. #### Parameters | Parameter | Type | Description | | --------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | | connection | `object` | Network connection of the destination chain | | routerAddresses | `string \| string[]` | Destination router address(es) whose OffRamps are searched, e.g. the default router and `CCIP_V2_ROUTERS[chainId]` | | sent | `CCIPSentMessage` | A message returned by `getCCIPMessages` | | options | `Object` | Optional: `forceExecution` (default `false`) executes CCIP 2.0 messages whose executor is `NO_EXECUTION_ADDRESS` (manual execution) | #### Returns | Type | Description | | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Object` | `{ offRamp, executed, reason }`: `executed` is `false` only for a CCIP 2.0 `NO_EXECUTION` message routed without `forceExecution` (`reason` is then `"NO_EXECUTION_ADDRESS"`) | > **CAUTION** > > **Possible Errors** > > - Throws if no OffRamp serves the lane (no OffRamp found for the message's source chain and OnRamp on the given routers) > - Throws if execution fails (receiver revert, finality or CCV rejection) --- # CCIPLocalSimulatorFork v0.3.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulatorFork A contract that simulates CCIP (Cross-Chain Interoperability Protocol) message routing in a Foundry test environment, for every CCIP era: pre-1.6 (`EVM2EVMOnRamp`), 1.6 and CCIP 2.0 (CCV-based lanes, which live testnet lanes run today). [`CCIPLocalSimulatorFork`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/ccip/CCIPLocalSimulatorFork.sol) > **NOTE** > > This contract provides utilities for testing cross-chain message routing by simulating message sending and receiving between different blockchain networks in a Foundry test environment. Works with Foundry only. Fork tests need `evm_version = "cancun"` or later (deployed CCIP 2.0 contracts use Cancun opcodes) and Foundry >= 1.5.1. ## Enums ### CCIPEra ```solidity enum CCIPEra { UNKNOWN, PRE_V1_DOT_6, V1_DOT_6, V2 } ``` > **NOTE** > > The CCIP protocol version of a lane, detected from the OnRamp's `typeAndVersion()`. ### V2VerificationMode ```solidity enum V2VerificationMode { STRICT, HYBRID, SYNTHETIC_ONLY, OFFRAMP_DERIVED } ``` > **NOTE** > > How CCIP 2.0 messages are verified when routed. The default is `OFFRAMP_DERIVED`: the CCV selection is derived from > the destination OffRamp's `getCCVsForMessage(encodedMessage)` and the raw encoded message is executed through the > permissionless `execute` entrypoint, so routing does not depend on the local `MessageV1` codec. CCV attestations are > simulated with a synthetic no-op verifier. ### V2ExecutionMode ```solidity enum V2ExecutionMode { AUTO, RESPECT_NO_EXEC, MANUAL_ONLY } ``` > **NOTE** > > How `NO_EXECUTION_ADDRESS` (manual execution) messages are handled. The default is `RESPECT_NO_EXEC`: they are queued > for `executePendingV2Message` instead of executed. ### MessageStatus ```solidity enum MessageStatus { NOT_FOUND, QUEUED, FAILED, SUCCESS } ``` > **NOTE** > > Outcome of a captured CCIP message (see `getMessageStatus`). `NOT_FOUND`: never captured by this simulator. `QUEUED`: > a CCIP 2.0 `NO_EXECUTION_ADDRESS` message waiting for `executePendingV2Message`, or a 1.6 / 2.0 message whose > destination fork was not passed to `switchChainAndRouteMessage` yet (a later call that includes it routes the > message). `FAILED`: not routed, or execution did not succeed (the reason is recorded). ## Structs ### MessageOutcome ```solidity struct MessageOutcome { MessageStatus status; bytes reason; } ``` | Field | Type | Description | | ------ | --------------- | ---------------------------------------------------------------------------------------------------------------- | | status | `MessageStatus` | The outcome of the message | | reason | `bytes` | For `FAILED`: the revert data, or an `Error(string)` explaining why the message was not routed. Empty otherwise. | ## Errors ### CCIPLocalSimulatorFork__MessageNotRouted ```solidity error CCIPLocalSimulatorFork__MessageNotRouted(bytes32 messageId, string reason) ``` > **NOTE** > > Strict routing: a captured CCIP message was not routed to any destination fork. ### CCIPLocalSimulatorFork__MessageExecutionFailed ```solidity error CCIPLocalSimulatorFork__MessageExecutionFailed(bytes32 messageId, bytes reason) ``` > **NOTE** > > Strict routing: a routed message did not execute successfully. `reason` is the revert data of the execution (for CCIP > 2.0, the OffRamp's recorded failure). ## Variables ### i_register ```solidity Register immutable i_register ``` > **NOTE** > > The immutable Register contract instance used to store network configuration details. Placed with `vm.etch` rather > than deployed, together with the `RegisterData` shards, so deploying the simulator does not cost the size of the > Register code in gas. ### LINK_FAUCET ```solidity address constant LINK_FAUCET = 0x4281eCF07378Ee595C564a59048801330f3084eE ``` > **NOTE** > > The address of the LINK token faucet contract, impersonated by `requestLinkFromFaucet`. ### s_processedMessages ```solidity mapping(bytes32 messageId => bool isProcessed) internal s_processedMessages ``` > **NOTE** > > Internal mapping to track which messages have been processed to prevent duplicate processing. ### s_messageOutcomes ```solidity mapping(bytes32 messageId => MessageOutcome outcome) internal s_messageOutcomes ``` > **NOTE** > > Outcome of every captured message, read with `getMessageStatus`. ### s_strictRouting ```solidity bool internal s_strictRouting ``` > **NOTE** > > When true (the default), routing reverts on a message that is not routed or does not execute successfully. Toggle with > `setStrictRouting`. ### s_ccipV2Routers ```solidity mapping(uint256 chainId => address router) internal s_ccipV2Routers ``` > **NOTE** > > CCIP 2.0 routers deployed next to the Register router (which `getNetworkDetails` returns). Hand-maintained: `Register` > is generated from the CCIP docs API and only carries one router per chain. Read and override with > `getCCIPV2RouterAddress` / `setCCIPV2RouterAddress`. ## Functions ### constructor Initializes the contract and sets up logging and persistence. ```solidity constructor() ``` > **NOTE** > > Initializes the contract by: > > - Starting log recording (`vm.recordLogs`) > - Placing the Register and its `RegisterData` shards with `vm.etch` at deterministic addresses, and making them persistent > - Setting the default `V2VerificationMode` to `OFFRAMP_DERIVED`, strict routing to enabled, and `V2ExecutionMode` to `RESPECT_NO_EXEC` > - Pre-registering the verified CCIP 2.0 routers for Ethereum Sepolia (`0x784d49a71BB4C48eB7dA4cD7e6Ecb424f9b5EAB1`) and Avalanche Fuji (`0x7C9B8B4e8024e5Ee8A630F6FCe9015e470dA5763`) ### switchChainAndRouteMessage Routes a cross-chain message on the destination network after switching to the specified fork. ```solidity function switchChainAndRouteMessage(uint256 forkId) external ``` > **NOTE** > > To be called after sending a cross-chain message (`ccipSend`). The function: > > - Searches past logs for the supported CCIP send events (all eras) > - Switches to the destination network fork > - Routes the sent message on the destination network > - If you sent more than one message, it tries to route all of them to `forkId`. A 1.6 or 2.0 message to another chain is kept (status `QUEUED`) and routed by a later call that includes its destination fork. > > `forkId` is the active fork when the call returns. #### Parameters | Parameter | Type | Description | | --------- | --------- | ------------------------------------------------------------------------------------------- | | forkId | `uint256` | The ID of the destination network fork (returned by `createFork()` or `createSelectFork()`) | > **CAUTION** > > **Possible Reverts** > > With strict routing enabled (the default), reverts with `CCIPLocalSimulatorFork__MessageNotRouted(messageId, reason)` when a captured message cannot be routed to any of the given forks, and with `CCIPLocalSimulatorFork__MessageExecutionFailed(messageId, reason)` when a routed message does not execute successfully. Call `setStrictRouting(false)` to record failures instead and read them with `getMessageStatus`. ### switchChainAndRouteMessage (multiple forks) Override variant of `switchChainAndRouteMessage(uint256 forkId)` for multiple destination forks. ```solidity function switchChainAndRouteMessage(uint256[] memory forkIds) external ``` > **NOTE** > > Goes through the provided `forkIds` and routes messages to the matching destination. A 1.6 or 2.0 message to a chain > that is not in `forkIds` is kept (status `QUEUED`) for a later call. With several destinations, either pass every > destination fork at once with this overload, or call `switchChainAndRouteMessage` once per destination fork. #### Parameters | Parameter | Type | Description | | --------- | ----------- | ---------------------------------------- | | forkIds | `uint256[]` | The IDs of the destination network forks | ### getNetworkDetails Returns the network configuration details for a specified chain ID. ```solidity function getNetworkDetails(uint256 chainId) external view returns (Register.NetworkDetails memory) ``` > **NOTE** > > Returns the default values for currently CCIP supported networks. If a network is not present or values have changed, > new network details can be added using `setNetworkDetails`. #### Parameters | Parameter | Type | Description | | --------- | --------- | --------------------------------------------------------------------- | | chainId | `uint256` | The blockchain network chain ID (e.g., 11155111 for Ethereum Sepolia) | #### Returns | Parameter | Type | Description | | --------- | ---------------- | --------------------------------------------------------- | | (unnamed) | `NetworkDetails` | The network configuration details for the specified chain | ### setNetworkDetails Updates or adds new network configuration details for a specified chain ID. ```solidity function setNetworkDetails(uint256 chainId, Register.NetworkDetails memory networkDetails) external ``` > **NOTE** > > Used to add or update network details when they are not present or have changed from default values. > `getNetworkDetails` returns an all-zero struct for a chain ID that is not in `Register`. #### Parameters | Parameter | Type | Description | | -------------- | ---------------- | --------------------------------------------------------------------- | | chainId | `uint256` | The blockchain network chain ID (e.g., 11155111 for Ethereum Sepolia) | | networkDetails | `NetworkDetails` | The network configuration details to be stored | ### getCCIPV2RouterAddress Returns the CCIP 2.0 router for a chain, or `address(0)` if none is known. ```solidity function getCCIPV2RouterAddress(uint256 chainId) external view returns (address) ``` > **NOTE** > > Returns the CCIP 2.0 router deployed next to the Register router on `chainId`, or `address(0)` if none is known. Send > through this router (and point receivers at it) to use its CCIP 2.0 lanes; messages sent through either router are > routed by `switchChainAndRouteMessage`. #### Parameters | Parameter | Type | Description | | --------- | --------- | ------------------------------- | | chainId | `uint256` | The blockchain network chain ID | ### setCCIPV2RouterAddress Manually sets the CCIP 2.0 router for a chain. ```solidity function setCCIPV2RouterAddress(uint256 chainId, address router) external ``` > **NOTE** > > Use `address(0)` to route through the Register router only. #### Parameters | Parameter | Type | Description | | --------- | --------- | ---------------------------------- | | chainId | `uint256` | The blockchain network chain ID | | router | `address` | The CCIP 2.0 router address to set | ### getOffRampForLane Returns the destination OffRamp configured for a source OnRamp on the given fork. ```solidity function getOffRampForLane(uint256 forkId, uint64 sourceChainSelector, address sourceOnRamp) external returns (address offRamp) ``` > **NOTE** > > Useful to configure CCIP 2.0 lane CCVs (see `setLaneDefaultCCVs`) before routing a message. Returns `address(0)` when > not found. #### Parameters | Parameter | Type | Description | | ------------------- | --------- | --------------------------------------------- | | forkId | `uint256` | The ID of the destination network fork | | sourceChainSelector | `uint64` | The chain selector of the source chain | | sourceOnRamp | `address` | The address of the OnRamp on the source chain | #### Returns | Parameter | Type | Description | | --------- | --------- | ------------------------------------------------------------ | | offRamp | `address` | The matching OffRamp address, or `address(0)` when not found | ### setLaneDefaultCCVs Points a destination lane's default CCVs at a CCV address by impersonating the OffRamp owner. ```solidity function setLaneDefaultCCVs(uint256 forkId, address offRamp, uint64 sourceChainSelector, address ccv) external ``` > **NOTE** > > Fork-only testing helper for CCIP 2.0 lanes: the mocked CCV must be configured on the destination lane before a > captured message can be routed through the permissionless execution path. Router, enabled flag, OnRamp bindings and > lane-mandated CCVs are preserved, so the fork lane is never less strict than production. #### Parameters | Parameter | Type | Description | | ------------------- | --------- | -------------------------------------------------- | | forkId | `uint256` | The ID of the destination network fork | | offRamp | `address` | The destination OffRamp that holds the lane config | | sourceChainSelector | `uint64` | The chain selector of the source chain | | ccv | `address` | The CCV address to set as the lane default | ### requestLinkFromFaucet Requests LINK tokens from the faucet for a specified address. ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` > **NOTE** > > Transfers the specified amount of LINK tokens from the faucet (impersonated) to the provided destination address, on > the active fork. #### Parameters | Parameter | Type | Description | | --------- | --------- | -------------------------------------- | | to | `address` | The address to receive the LINK tokens | | amount | `uint256` | The amount of LINK tokens to transfer | #### Returns | Parameter | Type | Description | | --------- | ------ | ------------------------------------------------- | | success | `bool` | Returns true if the token transfer was successful | ### setStrictRouting Enables or disables strict routing (enabled by default). ```solidity function setStrictRouting(bool strict) external ``` > **NOTE** > > When enabled, `switchChainAndRouteMessage` and `executePendingV2Message` revert with > `CCIPLocalSimulatorFork__MessageNotRouted` when a captured CCIP message cannot be routed to any of the given forks, > and with `CCIPLocalSimulatorFork__MessageExecutionFailed` when a routed message does not execute successfully. When > disabled, failures are logged and recorded (see `getMessageStatus`) and routing continues. #### Parameters | Parameter | Type | Description | | --------- | ------ | ---------------------------------------------------------- | | strict | `bool` | Whether to enable (true) or disable (false) strict routing | ### getStrictRouting Returns whether strict routing is enabled. ```solidity function getStrictRouting() external view returns (bool strict) ``` ### getMessageStatus Returns the outcome of a captured CCIP message. ```solidity function getMessageStatus(bytes32 messageId) external view returns (MessageStatus status, bytes memory reason) ``` #### Parameters | Parameter | Type | Description | | --------- | --------- | ------------------- | | messageId | `bytes32` | The CCIP message ID | #### Returns | Parameter | Type | Description | | --------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------- | | status | `MessageStatus` | `NOT_FOUND`, `QUEUED`, `FAILED` or `SUCCESS` | | reason | `bytes` | For `FAILED`: the revert data of the execution, or an `Error(string)` explaining why the message was not routed. Empty otherwise. | ### setV2VerificationMode Sets how CCIP 2.0 messages are verified when routed. ```solidity function setV2VerificationMode(V2VerificationMode mode) external ``` > **NOTE** > > The default is `OFFRAMP_DERIVED`. See the `V2VerificationMode` enum for the available modes. #### Parameters | Parameter | Type | Description | | --------- | -------------------- | ---------------------------- | | mode | `V2VerificationMode` | The verification mode to set | ### getV2VerificationMode Returns the current CCIP 2.0 verification mode. ```solidity function getV2VerificationMode() external view returns (V2VerificationMode mode) ``` ### setV2ExecutionMode Sets how `NO_EXECUTION_ADDRESS` (manual execution) CCIP 2.0 messages are handled. ```solidity function setV2ExecutionMode(V2ExecutionMode mode) external ``` > **NOTE** > > The default is `RESPECT_NO_EXEC`: such messages are queued for `executePendingV2Message` instead of executed. #### Parameters | Parameter | Type | Description | | --------- | ----------------- | ------------------------- | | mode | `V2ExecutionMode` | The execution mode to set | ### getV2ExecutionMode Returns the current CCIP 2.0 execution mode. ```solidity function getV2ExecutionMode() external view returns (V2ExecutionMode mode) ``` ### getPendingV2MessageIds Returns the message IDs of pending CCIP 2.0 `NO_EXECUTION_ADDRESS` messages on the current route scope. ```solidity function getPendingV2MessageIds() external view returns (bytes32[] memory messageIds) ``` ### isPendingV2Message Checks whether a CCIP 2.0 message is pending manual execution. ```solidity function isPendingV2Message(bytes32 messageId) external view returns (bool isPending) ``` ### executePendingV2Message Executes a pending CCIP 2.0 `NO_EXECUTION_ADDRESS` message on the current fork. ```solidity function executePendingV2Message(bytes32 messageId) external returns (bool attempted) ``` > **NOTE** > > Routes the pending message through the destination OffRamp's permissionless `execute` entrypoint. Returns `false` (and > records a `FAILED` outcome) when no OffRamp on the current fork serves the message's lane. The message is dequeued > once processed. #### Parameters | Parameter | Type | Description | | --------- | --------- | ------------------------------ | | messageId | `bytes32` | The CCIP message ID to execute | #### Returns | Parameter | Type | Description | | --------- | ------ | ------------------------------------------------------ | | attempted | `bool` | Whether an execution was attempted on the current fork | --- # CCIPLocalSimulator v0.3.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1/ccip-local-simulator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## CCIPLocalSimulator A contract that simulates local CCIP (Cross-Chain Interoperability Protocol) operations for testing and development purposes. [`CCIPLocalSimulator`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/ccip/CCIPLocalSimulator.sol) > **NOTE** > > This contract deploys the pre-funded tokens, the > [`CCIPLocalRouter`](/chainlink-local/api-reference/v0.3.1/ccip-local-router) and the CCIP-BnM / CCIP-LnM test tokens, > and includes methods to manage supported tokens and configurations for local simulations. Messages are delivered > synchronously inside `ccipSend`, applying the CCIP 2.0 OnRamp and OffRamp message rules. See [CCIP 2.0 behavior in > local mode](/chainlink-local/learn/ccip-v2-local) for what is and is not enforced. ## Variables ### CHAIN_SELECTOR ```solidity uint64 constant CHAIN_SELECTOR = 16015286601757825753 ``` > **NOTE** > > The unique CCIP Chain Selector constant (Ethereum Sepolia) ### i_ccipBnM ```solidity BurnMintERC677Helper internal immutable i_ccipBnM ``` > **NOTE** > > The BurnMintERC677Helper instance for CCIP-BnM token ### i_ccipLnM ```solidity BurnMintERC677Helper internal immutable i_ccipLnM ``` > **NOTE** > > The BurnMintERC677Helper instance for CCIP-LnM token ### i_linkToken ```solidity LinkToken internal immutable i_linkToken ``` > **NOTE** > > The LINK token instance ### i_mockRouter ```solidity CCIPLocalRouter internal immutable i_mockRouter ``` > **NOTE** > > The local CCIP router instance ([`CCIPLocalRouter`](/chainlink-local/api-reference/v0.3.1/ccip-local-router)) ### i_wrappedNative ```solidity WETH9 internal immutable i_wrappedNative ``` > **NOTE** > > The wrapped native token instance ### s_supportedTokens ```solidity address[] internal s_supportedTokens ``` > **NOTE** > > The list of supported token addresses ## Errors ### CCIPLocalSimulator__MsgSenderIsNotTokenOwner ```solidity error CCIPLocalSimulator__MsgSenderIsNotTokenOwner() ``` ### CCIPLocalSimulator__RequiredRoleNotFound ```solidity error CCIPLocalSimulator__RequiredRoleNotFound(address account, bytes32 role, address token) ``` ## Functions ### configuration Returns the configuration details for pre-deployed contracts and services needed for local CCIP simulations. ```solidity function configuration() public view returns (uint64 chainSelector_, IRouterClient sourceRouter_, IRouterClient destinationRouter_, WETH9 wrappedNative_, LinkToken linkToken_, BurnMintERC677Helper ccipBnM_, BurnMintERC677Helper ccipLnM_) ``` > **NOTE** > > Returns configuration details for pre-deployed contracts and services needed for local CCIP simulations. #### Returns | Parameter | Type | Description | | ------------------- | ---------------------- | -------------------------------------------------------- | | chainSelector_ | `uint64` | The unique CCIP Chain Selector | | sourceRouter_ | `IRouterClient` | The source chain Router contract | | destinationRouter_ | `IRouterClient` | The destination chain Router contract | | wrappedNative_ | `WETH9` | The wrapped native token which can be used for CCIP fees | | linkToken_ | `LinkToken` | The LINK token | | ccipBnM_ | `BurnMintERC677Helper` | The ccipBnM token | | ccipLnM_ | `BurnMintERC677Helper` | The ccipLnM token | ### constructor Initializes the contract with pre-deployed token instances. ```solidity constructor() ``` > **NOTE** > > Constructor to initialize the contract and pre-deployed token instances. Deploys WETH9, LinkToken, CCIP-BnM, CCIP-LnM > and the [`CCIPLocalRouter`](/chainlink-local/api-reference/v0.3.1/ccip-local-router). ### getSupportedTokens Gets the list of supported token addresses for a given chain selector. ```solidity function getSupportedTokens(uint64 chainSelector) external view returns (address[] memory tokens) ``` > **NOTE** > > Gets a list of token addresses that are supported for cross-chain transfers by the simulator. Local mode does not > enforce the supported-token list; it is informational. #### Parameters | Parameter | Type | Description | | ------------- | -------- | ------------------------------ | | chainSelector | `uint64` | The unique CCIP Chain Selector | #### Returns | Parameter | Type | Description | | --------- | ----------- | ------------------------------------------------------------------------------ | | tokens | `address[]` | Returns a list of token addresses that are supported for cross-chain transfers | ### isChainSupported Checks if a given chain selector is supported. ```solidity function isChainSupported(uint64 chainSelector) public pure returns (bool supported) ``` > **NOTE** > > Checks whether the provided `chainSelector` is supported by the simulator. #### Parameters | Parameter | Type | Description | | ------------- | -------- | ------------------------------ | | chainSelector | `uint64` | The unique CCIP Chain Selector | #### Returns | Parameter | Type | Description | | --------- | ------ | ------------------------------------------------------------- | | supported | `bool` | Returns true if `chainSelector` is supported by the simulator | ### requestLinkFromFaucet Transfers LINK tokens from the faucet to a specified address. ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` > **NOTE** > > Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address. #### Parameters | Parameter | Type | Description | | --------- | --------- | ----------------------------------------------- | | to | `address` | The address to which LINK tokens are to be sent | | amount | `uint256` | The amount of LINK tokens to send | #### Returns | Parameter | Type | Description | | --------- | ------ | ------------------------------------------------------- | | success | `bool` | Returns `true` if the transfer of tokens was successful | ### supportNewTokenViaAccessControlDefaultAdmin Adds a new token to supported tokens list via AccessControl's DEFAULT_ADMIN_ROLE. ```solidity function supportNewTokenViaAccessControlDefaultAdmin(address tokenAddress) external ``` > **NOTE** > > Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. The caller must have > the DEFAULT_ADMIN_ROLE as defined by the contract itself. #### Parameters | Parameter | Type | Description | | ------------ | --------- | --------------------------------------------------------------- | | tokenAddress | `address` | The address of the token to add to the list of supported tokens | > **CAUTION** > > **Possible Reverts** > > - Reverts if the caller is not the admin of the token using OZ's AccessControl DEFAULT_ADMIN_ROLE ### supportNewTokenViaGetCCIPAdmin Adds a new token to supported tokens list via CCIP admin role. ```solidity function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external ``` > **NOTE** > > Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. #### Parameters | Parameter | Type | Description | | ------------ | --------- | --------------------------------------------------------------- | | tokenAddress | `address` | The address of the token to add to the list of supported tokens | > **CAUTION** > > **Possible Reverts** > > - Reverts if token does not implement getCCIPAdmin() function > - Reverts if the caller is not the token CCIPAdmin ### supportNewTokenViaOwner Adds a new token to supported tokens list via token owner. ```solidity function supportNewTokenViaOwner(address tokenAddress) external ``` > **NOTE** > > Allows user to support any new token, besides CCIP BnM and CCIP LnM, for cross-chain transfers. #### Parameters | Parameter | Type | Description | | ------------ | --------- | --------------------------------------------------------------- | | tokenAddress | `address` | The address of the token to add to the list of supported tokens | > **CAUTION** > > **Possible Reverts** > > - Reverts if token does not implement owner() function > - Reverts if the caller is not the token owner --- # DataStreamsLocalSimulatorFork v0.3.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1/data-streams-local-simulator-fork > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## DataStreamsLocalSimulatorFork A contract that simulates Data Streams operations on forked networks in a Foundry test environment. [`DataStreamsLocalSimulatorFork`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-streams/DataStreamsLocalSimulatorFork.sol) > **NOTE** > > Works with Foundry only. Use this simulator when your consumer contract needs the real `VerifierProxy` deployed on a > live network; use [`DataStreamsLocalSimulator`](/chainlink-local/api-reference/v0.3.1/data-streams-local-simulator) > for local mode. ## Variables ### i_register ```solidity Register immutable i_register ``` > **NOTE** > > The immutable Register contract instance used to store Data Streams network configuration details. ### LINK_FAUCET ```solidity address constant LINK_FAUCET = 0x4281eCF07378Ee595C564a59048801330f3084eE ``` > **NOTE** > > The address of the LINK token faucet contract, impersonated by `requestLinkFromFaucet`. ## Functions ### constructor Initializes the contract. ```solidity constructor() ``` > **NOTE** > > Deploys the Data Streams `Register` with the built-in network details. ### getNetworkDetails Returns the default values for currently Data Streams supported networks. ```solidity function getNetworkDetails(uint256 chainId) external view returns (Register.NetworkDetails memory) ``` > **NOTE** > > If a network is not present or some of the values have changed, add new network details with `setNetworkDetails`. #### Parameters | Parameter | Type | Description | | --------- | --------- | ------------------------------------------------------------------- | | chainId | `uint256` | The blockchain network chain ID (e.g., 421614 for Arbitrum Sepolia) | #### Returns | Parameter | Type | Description | | -------------- | ---------------- | ---------------------------------------------------------------- | | networkDetails | `NetworkDetails` | `verifierProxyAddress` and `linkAddress` for the specified chain | ### setNetworkDetails Sets the network details for a given chain ID. ```solidity function setNetworkDetails(uint256 chainId, Register.NetworkDetails memory networkDetails) external ``` #### Parameters | Parameter | Type | Description | | -------------- | ---------------- | ----------------------------------------------------- | | chainId | `uint256` | The blockchain network chain ID | | networkDetails | `NetworkDetails` | The network details to set for the specified chain ID | ### requestLinkFromFaucet Requests LINK tokens from the faucet. ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` > **NOTE** > > Impersonates the LINK faucet and transfers LINK (at the address from the current chain's network details) to the > destination address, on the active fork. #### Parameters | Parameter | Type | Description | | --------- | --------- | -------------------------------------- | | to | `address` | The address to receive the LINK tokens | | amount | `uint256` | The amount of LINK tokens to transfer | #### Returns | Parameter | Type | Description | | --------- | ------ | ------------------------------------------------- | | success | `bool` | Returns true if the token transfer was successful | ### requestNativeFromFaucet Requests native coins from the faucet. ```solidity function requestNativeFromFaucet(address to, uint256 amount) external ``` > **NOTE** > > Deals the amount of native coins to the destination address with `vm.deal`. #### Parameters | Parameter | Type | Description | | --------- | --------- | --------------------------------------- | | to | `address` | The address to receive the native coins | | amount | `uint256` | The amount of native coins to send | --- # DataStreamsLocalSimulator v0.3.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1/data-streams-local-simulator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## DataStreamsLocalSimulator A contract that simulates local Data Streams operations for testing and development purposes. [`DataStreamsLocalSimulator`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-streams/DataStreamsLocalSimulator.sol) > **NOTE** > > This contract deploys the mock verifier, verifier proxy, fee manager and reward manager, plus the LINK and wrapped > native tokens, and lets you switch between on-chain and off-chain billing mechanisms. Reports are generated with > [`MockReportGenerator`](/chainlink-local/api-reference/v0.3.1/mock-report-generator) and verified through the > [`MockVerifierProxy`](/chainlink-local/api-reference/v0.3.1/mock-verifier-proxy). ## Variables ### feeManagerEnabled ```solidity bool public feeManagerEnabled ``` > **NOTE** > > Whether the on-chain billing mechanism (fee manager) is enabled. On-chain billing is enabled by default. ## Functions ### configuration Returns the configuration details for pre-deployed contracts and services needed for local Data Streams simulations. ```solidity function configuration() public view returns (WETH9 wrappedNative_, LinkToken linkToken_, MockVerifier mockVerifier_, MockVerifierProxy mockVerifierProxy_, MockFeeManager mockFeeManager_, MockRewardManager mockRewardManager_) ``` > **NOTE** > > The returned fee manager reflects the current billing state: it is the fee manager currently set on the verifier > proxy, and the reward manager is `address(0)` when off-chain billing is enabled. #### Returns | Parameter | Type | Description | | ------------------- | ------------------- | --------------------------------------------------------------------------- | | wrappedNative_ | `WETH9` | The wrapped native token | | linkToken_ | `LinkToken` | The LINK token | | mockVerifier_ | `MockVerifier` | The mock verifier contract | | mockVerifierProxy_ | `MockVerifierProxy` | The mock verifier proxy contract | | mockFeeManager_ | `MockFeeManager` | The mock fee manager contract (what is currently set on the verifier proxy) | | mockRewardManager_ | `MockRewardManager` | The mock reward manager contract (`address(0)` if fee manager is disabled) | ### constructor Initializes the contract with pre-deployed instances. ```solidity constructor() ``` > **NOTE** > > Deploys WETH9, LinkToken, the mock verifier proxy and mock verifier, and (by default) the fee manager and reward > manager for on-chain billing. ### enableOffChainBilling Enables the off-chain billing mechanism by removing the fee manager. ```solidity function enableOffChainBilling() external ``` > **NOTE** > > Simulates chains that don't have FeeManager contracts deployed. After this call, `verify` and `verifyBulk` expect an > empty `parameterPayload`. ### enableOnChainBilling Enables the on-chain billing mechanism by deploying/setting the fee manager. ```solidity function enableOnChainBilling() external ``` > **NOTE** > > Simulates chains that have FeeManager contracts deployed. After this call, `verify` and `verifyBulk` expect a fee > token address in `parameterPayload`. ### getBillingMechanism Returns the current billing mechanism type. ```solidity function getBillingMechanism() external view returns (string memory billingType) ``` > **NOTE** > > Returns `"on-chain"` if the fee manager is enabled, `"off-chain"` if disabled. ### requestLinkFromFaucet Requests LINK tokens from the faucet. ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` > **NOTE** > > The provided amount of tokens is transferred to the provided destination address. #### Parameters | Parameter | Type | Description | | --------- | --------- | ----------------------------------------------- | | to | `address` | The address to which LINK tokens are to be sent | | amount | `uint256` | The amount of LINK tokens to send | #### Returns | Parameter | Type | Description | | --------- | ------ | ------------------------------------------------------- | | success | `bool` | Returns `true` if the transfer of tokens was successful | --- # Register (Data Streams) v0.3.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1/data-streams-register > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## Register (Data Streams) A contract that stores and retrieves Data Streams network details for various chains. [`Register`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-streams/Register.sol) > **NOTE** > > This contract is separate from the CCIP [`Register`](/chainlink-local/api-reference/v0.3.1/register): it stores the > Data Streams verifier proxy and LINK addresses per chain. Used by > [`DataStreamsLocalSimulatorFork`](/chainlink-local/api-reference/v0.3.1/data-streams-local-simulator-fork). ## Structs ### NetworkDetails Contains Data Streams configuration details for a specific network/chain. | Field | Type | Description | | -------------------- | --------- | ------------------------------------------ | | verifierProxyAddress | `address` | The address of the Verifier Proxy contract | | linkAddress | `address` | The address of the LINK token contract | ## Functions ### constructor Initializes the contract with predefined network details. ```solidity constructor() ``` > **NOTE** > > Built-in details cover Arbitrum Sepolia, Avalanche Fuji, Base Sepolia, opBNB Testnet and Soneium Minato Testnet. ### getNetworkDetails Retrieves network details for a given chain ID. ```solidity function getNetworkDetails(uint256 chainId) external view returns (NetworkDetails memory networkDetails) ``` #### Parameters | Parameter | Type | Description | | --------- | --------- | ------------------------------------------ | | chainId | `uint256` | The ID of the chain to get the details for | #### Returns | Parameter | Type | Description | | -------------- | ---------------- | ---------------------------------------------- | | networkDetails | `NetworkDetails` | The network details for the specified chain ID | ### setNetworkDetails Sets the network details for a given chain ID. ```solidity function setNetworkDetails(uint256 chainId, NetworkDetails memory networkDetails) external ``` > **NOTE** > > Used to add or update network details when they are not present or have changed from default values. #### Parameters | Parameter | Type | Description | | -------------- | ---------------- | ----------------------------------------------------- | | chainId | `uint256` | The ID of the chain to set the details for | | networkDetails | `NetworkDetails` | The network details to set for the specified chain ID | --- # Chainlink Local v0.3.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1 > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` Chainlink Local v0.3.1 (V3) targets CCIP 2.0: it pins `@chainlink/contracts-ccip` 2.0.0 and `@chainlink/contracts` 1.5.0, and the local router applies the CCIP 2.0 OnRamp and OffRamp message rules. Fork routing supports every CCIP era (pre-1.6, 1.6 and CCIP 2.0). Hardhat 2 is not supported in `0.3.x`; Hardhat 2 users stay on `0.2.x` (see [the release notes](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/CHANGELOG.md)). ## CCIP These contracts provide Cross-Chain Interoperability Protocol (CCIP) functionality in a local testing environment: - [CCIPLocalSimulator](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator) - Local CCIP simulator (no-fork mode) - [CCIPLocalRouter](/chainlink-local/api-reference/v0.3.1/ccip-local-router) - The local-mode router with CCIP 2.0 message rules - [CCIPLocalSimulatorFork](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork) - CCIP simulator for forked networks (all CCIP eras) - [CCIPLocalSimulatorFork JS](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork-js) - Hardhat 3 JavaScript helpers for fork routing - [Register](/chainlink-local/api-reference/v0.3.1/register) - CCIP network configuration registry ## Data Streams Contracts for simulating Chainlink Data Streams: - [DataStreamsLocalSimulator](/chainlink-local/api-reference/v0.3.1/data-streams-local-simulator) - Local Data Streams simulator (no-fork mode) - [DataStreamsLocalSimulatorFork](/chainlink-local/api-reference/v0.3.1/data-streams-local-simulator-fork) - Data Streams simulator for forked networks - [MockVerifier](/chainlink-local/api-reference/v0.3.1/mock-verifier) - Mock Data Streams verifier - [MockVerifierProxy](/chainlink-local/api-reference/v0.3.1/mock-verifier-proxy) - Mock Data Streams verifier proxy - [MockReportGenerator](/chainlink-local/api-reference/v0.3.1/mock-report-generator) - Signed report generator for every report schema - [MockFeeManager](/chainlink-local/api-reference/v0.3.1/mock-fee-manager) - Mock verifier fee manager - [MockRewardManager](/chainlink-local/api-reference/v0.3.1/mock-reward-manager) - Mock reward manager - [ReportVersions](/chainlink-local/api-reference/v0.3.1/report-versions) - Data Streams report schemas (`ReportV1`-`ReportV13`) - [Register (Data Streams)](/chainlink-local/api-reference/v0.3.1/data-streams-register) - Data Streams network configuration registry ## Data Feeds Contracts for simulating Chainlink Data Feeds: - [AggregatorInterface](/chainlink-local/api-reference/v0.3.1/aggregator-interface) - Basic price feed interface - [AggregatorV2V3Interface](/chainlink-local/api-reference/v0.3.1/aggregator-v2-v3-interface) - Combined V2/V3 price feed interface - [AggregatorV3Interface](/chainlink-local/api-reference/v0.3.1/aggregator-v3-interface) - Extended price feed interface - [MockOffchainAggregator](/chainlink-local/api-reference/v0.3.1/mock-offchain-aggregator) - Mock implementation of off-chain aggregator - [MockV3Aggregator](/chainlink-local/api-reference/v0.3.1/mock-v3-aggregator) - Mock implementation of V3 aggregator ## Token Contracts Standard token implementations for testing: - [BurnMintERC677Helper](/chainlink-local/api-reference/v0.3.1/burn-mint-erc677-helper) - Helper contract for ERC677 token operations - [LinkToken](/chainlink-local/api-reference/v0.3.1/link-token) - LINK token implementation - [WETH9](/chainlink-local/api-reference/v0.3.1/weth9) - Wrapped Ether implementation --- # LinkToken v0.3.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1/link-token > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## LinkToken A contract that implements the ChainLink Token (LINK) using the ERC677 standard. [`LinkToken`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/shared/LinkToken.sol) > **NOTE** > > This contract inherits from ERC677 token contract and initializes with a fixed total supply and standard token > details. ## Functions ### constructor Initializes the contract with fixed token details. ```solidity constructor() ``` > **NOTE** > > Constructor to initialize the LinkToken contract with a fixed total supply, name, and symbol. Calls the ERC677 > constructor with the name "ChainLink Token" and symbol "LINK", then mints the total supply (10^27 tokens) to the > contract deployer. ### _onCreate Internal hook called during contract creation. ```solidity function _onCreate() internal virtual ``` > **NOTE** > > Hook that is called when this contract is created. Useful to override constructor behaviour in child contracts (e.g., > LINK bridge tokens). The default implementation mints 10^27 tokens to the contract deployer. --- # MockFeeManager v0.3.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1/mock-fee-manager > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockFeeManager A mock implementation of the Data Streams verifier fee manager for local testing. [`MockFeeManager`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-streams/MockFeeManager.sol) > **NOTE** > > This contract processes report verification fees in LINK or native token, applies per-subscriber discounts and a > native surcharge, and forwards LINK rewards to the > [`MockRewardManager`](/chainlink-local/api-reference/v0.3.1/mock-reward-manager). Only the verifier proxy may call its > functions. ## Errors ### Unauthorized ```solidity error Unauthorized() ``` > **NOTE** > > Reverts when called by anyone other than the verifier proxy. ### InvalidAddress ```solidity error InvalidAddress() ``` ### InvalidQuote ```solidity error InvalidQuote() ``` > **NOTE** > > Reverts when the quote token is neither the LINK nor the wrapped native token. ### ExpiredReport ```solidity error ExpiredReport() ``` ### InvalidDiscount ```solidity error InvalidDiscount() ``` ### InvalidSurcharge ```solidity error InvalidSurcharge() ``` ### InvalidDeposit ```solidity error InvalidDeposit() ``` ## Functions ### constructor Initializes the contract. ```solidity constructor(address linkAddress, address nativeAddress, address proxyAddress, address rewardManager) ``` > **NOTE** > > Approves the reward manager to pull the LINK it receives. #### Parameters | Parameter | Type | Description | | ------------- | --------- | ---------------------------------------- | | linkAddress | `address` | The LINK token address | | nativeAddress | `address` | The wrapped native token address | | proxyAddress | `address` | The verifier proxy address (only caller) | | rewardManager | `address` | The reward manager address | ### processFee Processes the fee for a single report verification. ```solidity function processFee(bytes calldata payload, bytes calldata parameterPayload, address subscriber) external payable override onlyProxy ``` > **NOTE** > > Decodes the fee from the report, applies the subscriber discount and (for native quotes) the surcharge, then pulls the > fee from the subscriber and forwards the LINK reward to the reward manager. ### processFeeBulk Processes fees for multiple report verifications. ```solidity function processFeeBulk(bytes[] calldata payloads, bytes calldata parameterPayload, address subscriber) external payable override onlyProxy ``` ### getFeeAndReward Returns the fee and reward for a report and quote token. ```solidity function getFeeAndReward(address subscriber, bytes memory report, address quoteAddress) public view returns (Common.Asset memory, Common.Asset memory, uint256) ``` > **NOTE** > > Reverts with `ExpiredReport` when the report's `expiresAt` is in the past. #### Parameters | Parameter | Type | Description | | ------------ | --------- | ------------------------------------------------ | | subscriber | `address` | The subscriber address (for the discount lookup) | | report | `bytes` | The report data | | quoteAddress | `address` | The fee token to quote (LINK or wrapped native) | #### Returns | Parameter | Type | Description | | --------- | -------------- | ----------------------------------------- | | (unnamed) | `Common.Asset` | The fee asset and amount | | (unnamed) | `Common.Asset` | The reward asset and amount (always LINK) | | (unnamed) | `uint256` | The discount applied | ### setNativeSurcharge Sets the surcharge applied to native token fees. ```solidity function setNativeSurcharge(uint256 surcharge) external onlyOwner ``` ### setMockDiscount Sets a per-subscriber discount. ```solidity function setMockDiscount(address subscriber, uint256 discount) external onlyOwner ``` > **NOTE** > > `1e18` is a 100% discount. ### withdrawMockFee Withdraws accumulated fees. ```solidity function withdrawMockFee(address to, address coin) external onlyOwner ``` ### withdrawLink Withdraws accumulated LINK. ```solidity function withdrawLink(address to) external onlyOwner ``` --- # MockOffchainAggregator v0.3.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1/mock-offchain-aggregator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockOffchainAggregator A mock implementation of an offchain aggregator for testing purposes. [`MockOffchainAggregator`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-feeds/MockOffchainAggregator.sol) > **NOTE** > > Simulates the behavior of an offchain aggregator and allows for updating answers and round data. ## Variables ### decimals ```solidity uint8 public decimals ``` > **NOTE** > > The number of decimals used by the aggregator. ### getAnswer ```solidity mapping(uint256 => int256) public getAnswer ``` > **NOTE** > > Mapping to get the answer for a specific round ID. ### getTimestamp ```solidity mapping(uint256 => uint256) public getTimestamp ``` > **NOTE** > > Mapping to get the timestamp for a specific round ID. ### latestAnswer ```solidity int256 public latestAnswer ``` > **NOTE** > > The latest answer reported by the aggregator. ### latestRound ```solidity uint256 public latestRound ``` > **NOTE** > > The latest round ID. ### latestTimestamp ```solidity uint256 public latestTimestamp ``` > **NOTE** > > The timestamp of the latest answer. ### maxAnswer ```solidity int192 public maxAnswer ``` > **NOTE** > > The maximum answer the aggregator is allowed to report. ### minAnswer ```solidity int192 public minAnswer ``` > **NOTE** > > The minimum answer the aggregator is allowed to report. ## Functions ### constructor Initializes the contract with decimals and initial answer. ```solidity constructor(uint8 _decimals, int256 _initialAnswer) ``` > **NOTE** > > Constructor to initialize the MockOffchainAggregator contract with initial parameters. #### Parameters | Parameter | Type | Description | | --------------- | -------- | ----------------------------------------- | | _decimals | `uint8` | The number of decimals for the aggregator | | _initialAnswer | `int256` | The initial answer to be set | ### getRoundData Gets the round data for a specific round ID. ```solidity function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` > **NOTE** > > Gets the round data for a specific round ID. #### Parameters | Parameter | Type | Description | | --------- | -------- | -------------------------------- | | _roundId | `uint80` | The round ID to get the data for | #### Returns | Parameter | Type | Description | | --------------- | --------- | --------------------------------------------- | | roundId | `uint80` | The round ID | | answer | `int256` | The answer for the round | | startedAt | `uint256` | The timestamp when the round started | | updatedAt | `uint256` | The timestamp when the round was updated | | answeredInRound | `uint80` | The round ID in which the answer was computed | ### latestRoundData Gets the latest round data. ```solidity function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` > **NOTE** > > Gets the latest round data. #### Returns | Parameter | Type | Description | | --------------- | --------- | ---------------------------------------------------- | | roundId | `uint80` | The latest round ID | | answer | `int256` | The latest answer | | startedAt | `uint256` | The timestamp when the latest round started | | updatedAt | `uint256` | The timestamp when the latest round was updated | | answeredInRound | `uint80` | The round ID in which the latest answer was computed | ### updateAnswer Updates the answer in the mock aggregator. ```solidity function updateAnswer(int256 _answer) public ``` > **NOTE** > > Updates the answer in the mock aggregator. #### Parameters | Parameter | Type | Description | | --------- | -------- | ------------------------ | | _answer | `int256` | The new answer to be set | ### updateMinAndMaxAnswers Updates the minimum and maximum answers the aggregator can report. ```solidity function updateMinAndMaxAnswers(int192 _minAnswer, int192 _maxAnswer) external ``` > **NOTE** > > Updates the minimum and maximum answers the aggregator can report. #### Parameters | Parameter | Type | Description | | ----------- | -------- | ---------------------- | | _minAnswer | `int192` | The new minimum answer | | _maxAnswer | `int192` | The new maximum answer | #### Possible Reverts - Reverts if minAnswer is not less than maxAnswer with "minAnswer must be less than maxAnswer" - Reverts if minAnswer is too low with "minAnswer is too low" - Reverts if maxAnswer is too high with "maxAnswer is too high" ### updateRoundData Updates the round data in the mock aggregator. ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` > **NOTE** > > Updates the round data in the mock aggregator. #### Parameters | Parameter | Type | Description | | ----------- | --------- | ------------------------------------ | | _roundId | `uint80` | The round ID to be updated | | _answer | `int256` | The new answer to be set | | _timestamp | `uint256` | The timestamp to be set | | _startedAt | `uint256` | The timestamp when the round started | --- # MockReportGenerator v0.3.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1/mock-report-generator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockReportGenerator A contract that generates signed Data Streams reports for local testing. [`MockReportGenerator`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-streams/MockReportGenerator.sol) > **NOTE** > > This contract generates reports for every report schema (`ReportV1` through `ReportV13`), signs them with a generated > mock DON key, and returns the ABI-encoded signed report that a consumer passes to > [`MockVerifierProxy.verify`](/chainlink-local/api-reference/v0.3.1/mock-verifier-proxy#verify). The report contents > (price, bid/ask, fees, expiry, market status) are set with the `update*` functions. ## Errors ### MockReportGenerator__InvalidBid ```solidity error MockReportGenerator__InvalidBid() ``` ### MockReportGenerator__InvalidAsk ```solidity error MockReportGenerator__InvalidAsk() ``` ### MockReportGenerator__CastOverflow ```solidity error MockReportGenerator__CastOverflow() ``` ## Functions ### constructor Initializes the generator with an initial price. ```solidity constructor(int192 initialPrice) ``` > **NOTE** > > Sets the price, bid and ask to `initialPrice`, the expiry period to 1 day, and the market status to `2` (Open). The > DON address and key are generated with `makeAddrAndKey("Mock Data Streams DON")`. #### Parameters | Parameter | Type | Description | | ------------ | -------- | ------------------------ | | initialPrice | `int192` | The initial report price | ### generateReportV1..V13 Generates a signed report for a specific schema version. ```solidity function generateReportV3() external returns (bytes memory signedReport, ReportV3 memory report) ``` > **NOTE** > > One `generateReportVn()` function exists per schema version (`generateReportV1` through `generateReportV13`), > returning the signed report and the decoded report struct. Each version uses its own mock feed ID (for example > `0x00037777…` for V3). Overloads that take a calldata report struct (`generateReport(ReportV3 calldata report)`) are > also available. #### Returns | Parameter | Type | Description | | ------------ | ---------- | ----------------------------- | | signedReport | `bytes` | The ABI-encoded signed report | | report | `ReportVn` | The generated report struct | ### updatePrice Updates the price used in generated reports. ```solidity function updatePrice(int192 price) public ``` ### updatePriceBidAndAsk Updates the price, bid and ask used in generated reports. ```solidity function updatePriceBidAndAsk(int192 price, int192 bid, int192 ask) external ``` ### updateExpiresPeriod Updates the report expiry period. ```solidity function updateExpiresPeriod(uint32 period) external ``` > **NOTE** > > The report `expiresAt` is `block.timestamp + period` at generation time. ### updateMarketStatus Updates the market status used in generated reports. ```solidity function updateMarketStatus(uint32 status) external ``` > **NOTE** > > `0` (Unknown), `1` (Closed) or `2` (Open). ### updateFees Updates the native and LINK fees carried in generated reports. ```solidity function updateFees(uint192 nativeFee, uint192 linkFee) external ``` > **NOTE** > > Both default to 0. The fees are charged by the > [`MockFeeManager`](/chainlink-local/api-reference/v0.3.1/mock-fee-manager) when on-chain billing is enabled. --- # MockRewardManager v0.3.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1/mock-reward-manager > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockRewardManager A mock implementation of the Data Streams reward manager for local testing. [`MockRewardManager`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-streams/MockRewardManager.sol) > **NOTE** > > This contract receives the LINK rewards collected by the > [`MockFeeManager`](/chainlink-local/api-reference/v0.3.1/mock-fee-manager). Only the fee manager may call `onFeePaid`. ## Errors ### Unauthorized ```solidity error Unauthorized() ``` > **NOTE** > > Reverts when `onFeePaid` is called by anyone other than the fee manager. ## Events ### FeePaid ```solidity event FeePaid(IRewardManager.FeePayment[] payments, address payer) ``` ## Functions ### constructor Initializes the contract with the LINK token address. ```solidity constructor(address linkAddress) ``` #### Parameters | Parameter | Type | Description | | ----------- | --------- | ---------------------- | | linkAddress | `address` | The LINK token address | ### onFeePaid Records a fee payment and pulls the LINK from the payer. ```solidity function onFeePaid(FeePayment[] calldata payments, address payer) external override onlyFeeManager ``` > **NOTE** > > Tallies the total payable fees and transfers the LINK from the payer to this contract. #### Parameters | Parameter | Type | Description | | --------- | -------------- | ------------------------------------------ | | payments | `FeePayment[]` | The fee payments (pool ID and amount each) | | payer | `address` | The address that paid the fees | ### claimRewards Not implemented. ```solidity function claimRewards(bytes32[] memory) external pure override ``` > **NOTE** > > Always reverts with "Not implemented". ### setFeeManager Sets the fee manager address. ```solidity function setFeeManager(address newFeeManager) external override ``` ### supportsInterface ```solidity function supportsInterface(bytes4 interfaceId) external pure override returns (bool) ``` > **NOTE** > > Returns true only for the `onFeePaid` selector. --- # MockV3Aggregator v0.3.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1/mock-v3-aggregator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockV3Aggregator A mock implementation of the AggregatorV2V3Interface for testing purposes. [`MockV3Aggregator`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-feeds/MockV3Aggregator.sol) > **NOTE** > > This contract inherits from AggregatorV2V3Interface and interacts with a MockOffchainAggregator to simulate price > feeds. ## Variables ### aggregator ```solidity address public aggregator ``` > **NOTE** > > The address of the current aggregator. ### proposedAggregator ```solidity address public proposedAggregator ``` > **NOTE** > > The address of the proposed aggregator. ### version ```solidity uint256 public constant override version = 0 ``` > **NOTE** > > The version of the aggregator. ## Functions ### confirmAggregator Confirms the proposed aggregator. ```solidity function confirmAggregator(address _aggregator) external ``` > **NOTE** > > Confirms the proposed aggregator. #### Parameters | Parameter | Type | Description | | ------------ | --------- | -------------------------------------- | | _aggregator | `address` | The address of the proposed aggregator | #### Possible Reverts - Reverts if the provided aggregator address does not match the proposed aggregator with "Invalid proposed aggregator" ### constructor Initializes the contract with decimals and initial answer. ```solidity constructor(uint8 _decimals, int256 _initialAnswer) ``` > **NOTE** > > Constructor to initialize the MockV3Aggregator contract with initial parameters. #### Parameters | Parameter | Type | Description | | --------------- | -------- | ----------------------------------------- | | _decimals | `uint8` | The number of decimals for the aggregator | | _initialAnswer | `int256` | The initial answer to be set | ### decimals Gets the number of decimals used by the aggregator. ```solidity function decimals() external view returns (uint8) ``` > **NOTE** > > Gets the number of decimals from the underlying aggregator. #### Returns | Parameter | Type | Description | | --------- | ------- | ---------------------- | | (unnamed) | `uint8` | The number of decimals | ### description Gets the description of the aggregator. ```solidity function description() external pure returns (string memory) ``` > **NOTE** > > Gets the description of the aggregator. #### Returns | Parameter | Type | Description | | --------- | -------- | ------------------------------------ | | (unnamed) | `string` | The contract path as the description | ### getAnswer Gets the answer for a specific round ID. ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` > **NOTE** > > Gets the answer for a specific round ID from the underlying aggregator. #### Parameters | Parameter | Type | Description | | --------- | --------- | ------------------------------ | | roundId | `uint256` | The round ID to get answer for | #### Returns | Parameter | Type | Description | | --------- | -------- | --------------------------------- | | (unnamed) | `int256` | The answer for the given round ID | ### getRoundData Gets the round data for a specific round ID. ```solidity function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` > **NOTE** > > Gets the round data for a specific round ID from the underlying aggregator. #### Parameters | Parameter | Type | Description | | --------- | -------- | -------------------------------- | | _roundId | `uint80` | The round ID to get the data for | #### Returns | Parameter | Type | Description | | --------------- | --------- | --------------------------------------------- | | roundId | `uint80` | The round ID | | answer | `int256` | The answer for the round | | startedAt | `uint256` | The timestamp when the round started | | updatedAt | `uint256` | The timestamp when the round was updated | | answeredInRound | `uint80` | The round ID in which the answer was computed | ### getTimestamp Gets the timestamp for a specific round ID. ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` > **NOTE** > > Gets the timestamp for a specific round ID from the underlying aggregator. #### Parameters | Parameter | Type | Description | | --------- | --------- | --------------------------------- | | roundId | `uint256` | The round ID to get timestamp for | #### Returns | Parameter | Type | Description | | --------- | --------- | ------------------------------------ | | (unnamed) | `uint256` | The timestamp for the given round ID | ### latestAnswer Gets the latest answer from the aggregator. ```solidity function latestAnswer() external view returns (int256) ``` > **NOTE** > > Gets the latest answer from the underlying aggregator. #### Returns | Parameter | Type | Description | | --------- | -------- | ----------------- | | (unnamed) | `int256` | The latest answer | ### latestRound Gets the latest round ID from the aggregator. ```solidity function latestRound() external view returns (uint256) ``` > **NOTE** > > Gets the latest round ID from the underlying aggregator. #### Returns | Parameter | Type | Description | | --------- | --------- | ------------------- | | (unnamed) | `uint256` | The latest round ID | ### latestRoundData Gets the latest round data. ```solidity function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` > **NOTE** > > Gets the latest round data from the underlying aggregator. #### Returns | Parameter | Type | Description | | --------------- | --------- | ---------------------------------------------------- | | roundId | `uint80` | The latest round ID | | answer | `int256` | The latest answer | | startedAt | `uint256` | The timestamp when the latest round started | | updatedAt | `uint256` | The timestamp when the latest round was updated | | answeredInRound | `uint80` | The round ID in which the latest answer was computed | ### latestTimestamp Gets the timestamp of the latest answer. ```solidity function latestTimestamp() external view returns (uint256) ``` > **NOTE** > > Gets the timestamp of the latest answer from the underlying aggregator. #### Returns | Parameter | Type | Description | | --------- | --------- | ---------------------------------- | | (unnamed) | `uint256` | The timestamp of the latest answer | ### proposeAggregator Proposes a new aggregator. ```solidity function proposeAggregator(AggregatorV2V3Interface _aggregator) external ``` > **NOTE** > > Proposes a new aggregator. #### Parameters | Parameter | Type | Description | | ------------ | ------------------------- | -------------------------------------- | | _aggregator | `AggregatorV2V3Interface` | The address of the proposed aggregator | #### Possible Reverts - Reverts if the proposed aggregator is the zero address with "Proposed aggregator cannot be zero address" - Reverts if the proposed aggregator is the current aggregator with "Proposed aggregator cannot be current aggregator" ### updateAnswer Updates the answer in the mock aggregator. ```solidity function updateAnswer(int256 _answer) public ``` > **NOTE** > > Updates the answer in the underlying mock aggregator. #### Parameters | Parameter | Type | Description | | --------- | -------- | ------------------------ | | _answer | `int256` | The new answer to be set | ### updateRoundData Updates the round data in the mock aggregator. ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` > **NOTE** > > Updates the round data in the underlying mock aggregator. #### Parameters | Parameter | Type | Description | | ----------- | --------- | ------------------------------------ | | _roundId | `uint80` | The round ID to be updated | | _answer | `int256` | The new answer to be set | | _timestamp | `uint256` | The timestamp to be set | | _startedAt | `uint256` | The timestamp when the round started | --- # MockVerifierProxy v0.3.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1/mock-verifier-proxy > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockVerifierProxy A mock implementation of the Data Streams verifier proxy for local testing. [`MockVerifierProxy`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-streams/MockVerifierProxy.sol) > **NOTE** > > This contract forwards reports to the [`MockVerifier`](/chainlink-local/api-reference/v0.3.1/mock-verifier) and > optionally bills the caller through a fee manager. It validates that the billing mechanism (on-chain or off-chain) > matches what the consumer contract is using, with error messages that point to the fix. ## Errors ### ZeroAddress ```solidity error ZeroAddress() ``` ### VerifierInvalid ```solidity error VerifierInvalid() ``` > **NOTE** > > Reverts when the verifier does not support the `IVerifier.verify` interface. ### VerifierNotFound ```solidity error VerifierNotFound() ``` ### FeeManagerRequired ```solidity error FeeManagerRequired(string message) ``` > **NOTE** > > On-chain billing is active but the consumer is using the off-chain mechanism: either call > `simulator.enableOffChainBilling()` or provide the fee token address in `parameterPayload`. ### FeeManagerNotExpected ```solidity error FeeManagerNotExpected(string message) ``` > **NOTE** > > Off-chain billing is active but the consumer is providing `parameterPayload` for on-chain billing: either call > `simulator.enableOnChainBilling()` or pass empty bytes as `parameterPayload`. ## Events ### VerifierInitialized ```solidity event VerifierInitialized(address indexed verifierAddress) ``` ## Functions ### verify Verifies a report payload, billing the caller first when a fee manager is set. ```solidity function verify(bytes calldata payload, bytes calldata parameterPayload) external payable returns (bytes memory) ``` > **NOTE** > > When a fee manager is set (on-chain billing), `parameterPayload` must carry the fee token address and `msg.value` the > fee. With off-chain billing, pass empty bytes and no value. #### Parameters | Parameter | Type | Description | | ---------------- | ------- | ---------------------------------------------------------------------------------------- | | payload | `bytes` | The signed report payload | | parameterPayload | `bytes` | The fee payment parameters (fee token address for on-chain billing, empty for off-chain) | ### verifyBulk Verifies multiple report payloads in one call. ```solidity function verifyBulk(bytes[] calldata payloads, bytes calldata parameterPayload) external payable returns (bytes[] memory verifiedReports) ``` ### initializeVerifier Initializes the verifier address. ```solidity function initializeVerifier(address verifierAddress) external onlyOwner ``` > **NOTE** > > The verifier must support the `IVerifier.verify` interface. #### Parameters | Parameter | Type | Description | | --------------- | --------- | ------------------------------------ | | verifierAddress | `address` | The address of the verifier contract | ### getVerifier Returns the verifier address. ```solidity function getVerifier(bytes32) external view returns (address) ``` ### setFeeManager Sets the fee manager. ```solidity function setFeeManager(IVerifierFeeManager feeManager) external ``` > **NOTE** > > Pass `MockFeeManager(address(0))` to switch to off-chain billing. #### Parameters | Parameter | Type | Description | | ---------- | --------------------- | ------------------------------- | | feeManager | `IVerifierFeeManager` | The fee manager contract to set | --- # MockVerifier v0.3.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1/mock-verifier > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## MockVerifier A mock implementation of the Data Streams verifier for local testing. [`MockVerifier`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-streams/MockVerifier.sol) > **NOTE** > > This contract verifies reports signed by the mock DON address (generated from `keccak256("Mock Data Streams DON")`). > Only the [`MockVerifierProxy`](/chainlink-local/api-reference/v0.3.1/mock-verifier-proxy) may call `verify`. Reports > are generated with [`MockReportGenerator`](/chainlink-local/api-reference/v0.3.1/mock-report-generator). ## Errors ### AccessForbidden ```solidity error AccessForbidden() ``` > **NOTE** > > Reverts when `verify` is called by anyone other than the verifier proxy. ### InactiveFeed ```solidity error InactiveFeed(bytes32 feedId) ``` ### DigestInactive ```solidity error DigestInactive(bytes32 feedId, bytes32 configDigest) ``` ### BadVerification ```solidity error BadVerification() ``` > **NOTE** > > Reverts when the report signature does not recover to the mock DON address. ### InvalidV ```solidity error InvalidV() ``` ### AlreadyUsedSignature ```solidity error AlreadyUsedSignature() ``` > **NOTE** > > Reverts on a replayed report signature. ### InvalidSignatureLength ```solidity error InvalidSignatureLength() ``` ### InvalidS ```solidity error InvalidS() ``` > **NOTE** > > Reverts when `s` exceeds half the secp256k1 curve order (EIP-2 signature malleability check). ## Events ### ReportVerified ```solidity event ReportVerified(bytes32 indexed feedId, address indexed sender) ``` ## Functions ### constructor Initializes the contract with the verifier proxy address. ```solidity constructor(address verifierProxy) ``` #### Parameters | Parameter | Type | Description | | ------------- | --------- | ------------------------------------------ | | verifierProxy | `address` | The address of the verifier proxy contract | ### verify Verifies a signed report and returns the report data. ```solidity function verify(bytes calldata signedReport, address sender) external returns (bytes memory verifierResponse) ``` > **NOTE** > > Only callable by the verifier proxy. Decodes the signed report, checks the feed and config digest are active, recovers > the signer with `ecrecover` and marks the signature as used. Returns the report data. #### Parameters | Parameter | Type | Description | | ------------ | --------- | ------------------------------------- | | signedReport | `bytes` | The ABI-encoded signed report | | sender | `address` | The address that submitted the report | #### Returns | Parameter | Type | Description | | ---------------- | ------- | ----------------------- | | verifierResponse | `bytes` | The decoded report data | ### deactivateConfig Deactivates a config digest for a feed. ```solidity function deactivateConfig(bytes32 feedId, bytes32 configDigest) external ``` ### activateConfig Activates a config digest for a feed. ```solidity function activateConfig(bytes32 feedId, bytes32 configDigest) external ``` ### deactivateFeed Deactivates a feed. ```solidity function deactivateFeed(bytes32 feedId) external ``` ### activateFeed Activates a feed. ```solidity function activateFeed(bytes32 feedId) external ``` ### supportsInterface ```solidity function supportsInterface(bytes4 interfaceId) external pure override returns (bool) ``` > **NOTE** > > Returns true only for the `verify` selector. --- # Register v0.3.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1/register > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## Register A contract that stores and retrieves network details for various chains. [`Register`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/ccip/Register.sol) > **NOTE** > > This contract maintains a registry of network-specific details including chain selectors, router addresses, and token > addresses for various supported networks. Built-in network details live in the generated data shards of > `RegisterData.sol`, which the simulator places with `vm.etch`, instead of being written to storage in the constructor: > storing \~150 chains cost \~24M gas, which made `CCIPLocalSimulatorFork` too expensive to deploy on 30M-gas-limit forks. > Sharding keeps every generated contract runtime under the EIP-170 limit. `setNetworkDetails` overrides are stored. ## Structs ### NetworkDetails Contains configuration details for a specific network/chain. | Field | Type | Description | | -------------------------------- | --------- | -------------------------------------------- | | chainSelector | `uint64` | Unique identifier for the chain in CCIP | | routerAddress | `address` | Address of the CCIP Router contract | | linkAddress | `address` | Address of the LINK token contract | | wrappedNativeAddress | `address` | Address of the wrapped native token contract | | ccipBnMAddress | `address` | Address of the CCIP BnM token contract | | ccipLnMAddress | `address` | Address of the CCIP LnM token contract | | rmnProxyAddress | `address` | Address of the RMN proxy contract | | registryModuleOwnerCustomAddress | `address` | Address of the registry module owner | | tokenAdminRegistryAddress | `address` | Address of the token admin registry contract | ## Variables ### s_networkDetails ```solidity mapping(uint256 chainId => NetworkDetails) internal s_networkDetails ``` > **NOTE** > > Internal mapping that stores network details set with `setNetworkDetails`, overriding the built-in ones. ### s_isOverridden ```solidity mapping(uint256 chainId => bool isOverridden) internal s_isOverridden ``` > **NOTE** > > Internal mapping that records whether `setNetworkDetails` was called for a chain ID. ## Functions ### constructor Initializes the contract. ```solidity constructor() ``` > **NOTE** > > Built-in network details are not stored here; they live in the generated `RegisterData` shards. A bare `new > Register()` only serves `setNetworkDetails` overrides. ### getNetworkDetails Retrieves network details for a given chain ID. ```solidity function getNetworkDetails(uint256 chainId) external view returns (NetworkDetails memory networkDetails) ``` > **NOTE** > > Returns the `setNetworkDetails` override for the chain ID when one was set, otherwise the built-in details from the > data shards. An unknown chain returns an all-zero struct. #### Parameters | Parameter | Type | Description | | --------- | --------- | ------------------------------------------ | | chainId | `uint256` | The ID of the chain to get the details for | #### Returns | Parameter | Type | Description | | -------------- | ---------------- | ---------------------------------------------- | | networkDetails | `NetworkDetails` | The network details for the specified chain ID | ### setNetworkDetails Sets the network details for a given chain ID. ```solidity function setNetworkDetails(uint256 chainId, NetworkDetails memory networkDetails) external ``` > **NOTE** > > Used to add or update network details when they are not present or have changed from default values. > `getNetworkDetails` returns an all-zero struct for a chain ID that is not in `Register`. #### Parameters | Parameter | Type | Description | | -------------- | ---------------- | ----------------------------------------------------- | | chainId | `uint256` | The ID of the chain to set the details for | | networkDetails | `NetworkDetails` | The network details to set for the specified chain ID | ### shardAddress Returns the deterministic address of built-in data shard `index`. ```solidity function shardAddress(uint256 index) public view returns (address) ``` > **NOTE** > > The simulator places each generated `RegisterDataN` shard at this address with `vm.etch`. #### Parameters | Parameter | Type | Description | | --------- | --------- | ----------------------------------------- | | index | `uint256` | The shard index (0 to `_SHARD_COUNT - 1`) | --- # ReportVersions v0.3.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1/report-versions > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## ReportVersions An abstract contract that defines the Data Streams report schemas (`ReportV1` through `ReportV13`). [`ReportVersions`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-streams/ReportVersions.sol) > **NOTE** > > These structs mirror the Data Streams report schemas. For the schema reference, see the [Data Streams report > schemas](https://docs.chain.link/data-streams/reference/report-schema-overview). > [`MockReportGenerator`](/chainlink-local/api-reference/v0.3.1/mock-report-generator) inherits from this contract and > generates signed reports for each version. ## Structs ### ReportV1 > **CAUTION: Deprecated** > > The v1 schema (early crypto report with block metadata) is deprecated; it is included for historical reference and > backwards compatibility with legacy streams. | Field | Type | Description | | --------------------- | --------- | ---------------------------------------------------- | | feedId | `bytes32` | The stream ID the report has data for | | observationsTimestamp | `uint32` | Observation timestamp in seconds | | benchmarkPrice | `int192` | DON consensus median benchmark price | | bid | `int192` | Bid-side price estimate | | ask | `int192` | Ask-side price estimate | | currentBlockNum | `uint64` | Current block number used by the report | | currentBlockHash | `bytes32` | Current block hash used by the report | | validFromBlockNum | `uint64` | Earliest block number from which the report is valid | | currentBlockTimestamp | `uint64` | Current block timestamp in seconds | ### ReportV2 > **NOTE** > > Crypto streams schema. The `benchmarkPrice` value is carried to either 8 or 18 decimal places, depending on the > stream. | Field | Type | Description | | --------------------- | --------- | ---------------------------------------------------------- | | feedId | `bytes32` | The feed ID the report has data for | | validFromTimestamp | `uint32` | Earliest timestamp for which price is applicable | | observationsTimestamp | `uint32` | Latest timestamp for which price is applicable | | nativeFee | `uint192` | Base cost to validate a transaction, in the native token | | linkFee | `uint192` | Base cost to validate a transaction, in LINK | | expiresAt | `uint32` | Latest timestamp where the report can be verified on-chain | | benchmarkPrice | `int192` | DON consensus median price | ### ReportV3 > **NOTE** > > Crypto streams schema with bid/ask. The `price`, `bid`, and `ask` values are carried to either 8 or 18 decimal places, > depending on the stream. | Field | Type | Description | | --------------------- | --------- | ---------------------------------------------------------------------------------- | | feedId | `bytes32` | The stream ID the report has data for | | validFromTimestamp | `uint32` | Earliest timestamp for which price is applicable | | observationsTimestamp | `uint32` | Latest timestamp for which price is applicable | | nativeFee | `uint192` | Base cost to validate a transaction, in the native token | | linkFee | `uint192` | Base cost to validate a transaction, in LINK | | expiresAt | `uint32` | Latest timestamp where the report can be verified on-chain | | price | `int192` | DON consensus median price | | bid | `int192` | Simulated price impact of a buy order up to the X% depth of liquidity utilisation | | ask | `int192` | Simulated price impact of a sell order up to the X% depth of liquidity utilisation | ### ReportV4 > **NOTE** > > RWA stream schema. The `price` value is carried to either 8 or 18 decimal places. `marketStatus` indicates whether the > market is currently open: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). | Field | Type | Description | | --------------------- | --------- | ----------------------------------------------------------- | | feedId | `bytes32` | The stream ID the report has data for | | validFromTimestamp | `uint32` | Earliest timestamp for which price is applicable | | observationsTimestamp | `uint32` | Latest timestamp for which price is applicable | | nativeFee | `uint192` | Base cost to validate a transaction, in the native token | | linkFee | `uint192` | Base cost to validate a transaction, in LINK | | expiresAt | `uint32` | Latest timestamp where the report can be verified on-chain | | price | `int192` | DON consensus median benchmark price | | marketStatus | `uint32` | The DON's consensus on whether the market is currently open | ### ReportV5 > **NOTE** > > Rate report schema. | Field | Type | Description | | --------------------- | --------- | ---------------------------------------------------------- | | feedId | `bytes32` | The stream ID the report has data for | | validFromTimestamp | `uint32` | Earliest timestamp for which the report is applicable | | observationsTimestamp | `uint32` | Latest timestamp for which the report is applicable | | nativeFee | `uint192` | Base cost to validate a transaction, in the native token | | linkFee | `uint192` | Base cost to validate a transaction, in LINK | | expiresAt | `uint32` | Latest timestamp where the report can be verified on-chain | | rate | `int192` | Reported rate value | | timestamp | `uint32` | Rate timestamp in seconds | | duration | `uint32` | Duration window in seconds | ### ReportV6 > **NOTE** > > Multi-price report schema. | Field | Type | Description | | --------------------- | --------- | ---------------------------------------------------------- | | feedId | `bytes32` | The stream ID the report has data for | | validFromTimestamp | `uint32` | Earliest timestamp for which the report is applicable | | observationsTimestamp | `uint32` | Latest timestamp for which the report is applicable | | nativeFee | `uint192` | Base cost to validate a transaction, in the native token | | linkFee | `uint192` | Base cost to validate a transaction, in LINK | | expiresAt | `uint32` | Latest timestamp where the report can be verified on-chain | | price | `int192` | Primary price value | | price2 | `int192` | Secondary price value | | price3 | `int192` | Third price value | | price4 | `int192` | Fourth price value | | price5 | `int192` | Fifth price value | ### ReportV7 through ReportV13 > **NOTE** > > `ReportV7` through `ReportV13` follow the same base layout (feed ID, validity timestamps, native and LINK fees, > expiry) with schema-specific payload fields. See the [Data Streams report schema > overview](https://docs.chain.link/data-streams/reference/report-schema-overview) for each schema's fields. --- # WETH9 v0.3.1 API Reference Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1/weth9 > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` ## WETH9 A contract that implements Wrapped Ether (WETH), allowing users to wrap and unwrap ETH. [`WETH9`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/shared/WETH9.sol) > **NOTE** > > This contract provides functionality to wrap ETH into WETH and unwrap WETH back to ETH, along with standard ERC20 > operations. ## Variables ### allowance ```solidity mapping(address => mapping(address => uint256)) public allowance ``` > **NOTE** > > Mapping of owner addresses to spender addresses to approved amounts. ### balanceOf ```solidity mapping(address => uint256) public balanceOf ``` > **NOTE** > > Mapping of addresses to their WETH balances. ### decimals ```solidity uint8 public decimals = 18 ``` > **NOTE** > > The number of decimals used for WETH token amounts. ### name ```solidity string public name = "Wrapped Ether" ``` > **NOTE** > > The name of the token. ### symbol ```solidity string public symbol = "WETH" ``` > **NOTE** > > The symbol of the token. ## Events ### Approval ```solidity event Approval(address indexed src, address indexed guy, uint256 wad) ``` > **NOTE** > > Emitted when an approval is set. #### Parameters | Parameter | Type | Description | | --------- | --------- | ----------------------------------- | | src | `address` | The address giving the approval | | guy | `address` | The address receiving the approval | | wad | `uint256` | The amount of tokens being approved | ### Deposit ```solidity event Deposit(address indexed dst, uint256 wad) ``` > **NOTE** > > Emitted when ETH is wrapped to WETH. #### Parameters | Parameter | Type | Description | | --------- | --------- | ------------------------------- | | dst | `address` | The address receiving the WETH | | wad | `uint256` | The amount of ETH being wrapped | ### Transfer ```solidity event Transfer(address indexed src, address indexed dst, uint256 wad) ``` > **NOTE** > > Emitted when tokens are transferred. #### Parameters | Parameter | Type | Description | | --------- | --------- | -------------------------------------- | | src | `address` | The address sending the tokens | | dst | `address` | The address receiving the tokens | | wad | `uint256` | The amount of tokens being transferred | ### Withdrawal ```solidity event Withdrawal(address indexed src, uint256 wad) ``` > **NOTE** > > Emitted when WETH is unwrapped to ETH. #### Parameters | Parameter | Type | Description | | --------- | --------- | ---------------------------------- | | src | `address` | The address unwrapping the WETH | | wad | `uint256` | The amount of WETH being unwrapped | ## Functions ### approve Approves another address to spend tokens. ```solidity function approve(address guy, uint256 wad) public returns (bool) ``` > **NOTE** > > Sets the allowance that a spender has to access the caller's tokens. #### Parameters | Parameter | Type | Description | | --------- | --------- | ------------------------------- | | guy | `address` | The address to approve | | wad | `uint256` | The amount of tokens to approve | #### Returns | Parameter | Type | Description | | --------- | ------ | ------------------- | | (unnamed) | `bool` | Always returns true | ### deposit Deposits ETH to receive WETH. ```solidity function deposit() external payable ``` > **NOTE** > > Allows users to deposit ETH and receive WETH tokens. ### totalSupply Gets the total supply of WETH. ```solidity function totalSupply() public view returns (uint256) ``` > **NOTE** > > Returns the total amount of ETH held by this contract. #### Returns | Parameter | Type | Description | | --------- | --------- | ------------------------ | | (unnamed) | `uint256` | The total supply of WETH | ### transfer Transfers tokens to another address. ```solidity function transfer(address dst, uint256 wad) public returns (bool) ``` > **NOTE** > > Transfers tokens from the caller to another address. #### Parameters | Parameter | Type | Description | | --------- | --------- | -------------------------------- | | dst | `address` | The recipient address | | wad | `uint256` | The amount of tokens to transfer | #### Returns | Parameter | Type | Description | | --------- | ------ | ------------------------------------- | | (unnamed) | `bool` | Returns true if the transfer succeeds | ### transferFrom Transfers tokens from one address to another. ```solidity function transferFrom(address src, address dst, uint256 wad) public returns (bool) ``` > **NOTE** > > Transfers tokens between addresses, respecting allowances. #### Parameters | Parameter | Type | Description | | --------- | --------- | -------------------------------- | | src | `address` | The source address | | dst | `address` | The destination address | | wad | `uint256` | The amount of tokens to transfer | #### Returns | Parameter | Type | Description | | --------- | ------ | ------------------------------------- | | (unnamed) | `bool` | Returns true if the transfer succeeds | #### Possible Reverts - Reverts if the source address has insufficient balance - Reverts if the caller has insufficient allowance (unless caller is source or has maximum allowance) ### withdraw Withdraws ETH by unwrapping WETH. ```solidity function withdraw(uint256 wad) external ``` > **NOTE** > > Allows users to withdraw ETH by burning WETH tokens. #### Parameters | Parameter | Type | Description | | --------- | --------- | ---------------------------- | | wad | `uint256` | The amount of WETH to unwrap | #### Possible Reverts - Reverts if the caller has insufficient WETH balance --- # CCT - getCCIPAdmin() token with Burn and Mint Pool in forked environments Source: https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` This tutorial walks you through testing the procedure of enabling your own tokens in CCIP 2.0, using the [CCIP Foundry Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-foundry)'s Example 06 (CCT 01). You will deploy a `CrossChainToken` (a CCT-compatible ERC-20 that exposes `getCCIPAdmin()`) with a Burn & Mint pool on forks of *Ethereum Sepolia* and *Polygon Amoy*, register it in the live TokenAdminRegistry, link the pools, opt them into Fast Transfers, and send a transfer across the CCIP 2.0 lane with `CCIPLocalSimulatorFork` routing the message. The kit runs this exact flow as a fork test (`test/fork/Example06.fork.t.sol`), so every step below is verified against pinned forks of the live testnets. ## Prerequisites > **NOTE: Prerequisites** > > Familiarize yourself with the [CCT standard](/ccip/concepts/cross-chain-token/overview) and [CCIP > architecture](/ccip/concepts/architecture/overview) before proceeding with this tutorial. Complete the [Foundry forked environments guide](/chainlink-local/build/ccip/foundry/local-simulator-fork) first: it covers the fork profile, `evm_version = "cancun"`, Foundry >= 1.5.1 and the RPC setup. Before we start with this guide, let's recap parts of the CCT standard that we will need for it. ### Requirements for Cross-Chain Tokens Before enabling an ERC20-compatible token in CCIP, it's important to understand the requirements it must fulfill to integrate with CCIP. - **Recommended permissionless token administrator address registration methods**: A token can use either of these supported function signatures to register permissionlessly: - `owner()`: This function returns the token contract owner's address. - `getCCIPAdmin()`: This function returns the token administrator's address and is recommended for new tokens, as it allows for abstraction of the CCIP Token Administrator role from other common roles, like `owner()`. > **NOTE** > > In the event that these functions are not available, registration can be performed by submitting a form > [here](https://chain.link/ccip-contact). - **Requirements for CCIP token transfers**: The token's smart contract must meet minimum requirements to integrate with CCIP. - **Burn & Mint Requirements**: - The token smart contract must have the following functions: - `mint(address account, uint256 amount)`: This function is used to mint the `amount` of tokens to a given `account` on the destination blockchain. - `burn(uint256 amount)`: This function is used to burn the `amount` of tokens on the source blockchain. - `decimals()`: Returns the token's number of decimals. - `balanceOf(address account)`: Returns the current token balance of the specified `account`. - `burnFrom(address account, uint256 amount)`: This function burns a specified number of tokens from the provided account on the source blockchain. **Note**: This is an optional function. We generally recommend using the `burn` function, but if you use a tokenPool that calls `burnFrom`, your token contract will need to implement this function. - On the source and destination blockchains, the token contract must support granting mint and burn permissions. The token developers or another role (such as the token administrator) will grant these permissions to the token pool. If you don't have an existing token, the kit deploys a `CrossChainToken` for you: a `BaseERC20` with `getCCIPAdmin()`, mint and burn roles, and a pre-mint, configured in one constructor call. ### Understanding the Procedure It is also important first to understand the overall procedure for enabling your tokens in CCIP. This procedure involves deploying tokens and token pools, registering administrative roles, and configuring token pools to enable secure token transfers using CCIP. The steps in the diagram below highlight the flow of actions needed to enable a token for cross-chain transfers. Whether you're working with an Externally Owned Account (EOA) or a **Smart Account** (such as one using a multisig scheme), the overall logic remains the same. You'll follow the same process to enable cross-chain token transfers, configure pools, and register administrative roles. The diagram below outlines the entire process: ![Process for enabling a token in CCIP.](/images/ccip/CCIP_enabled_tokens_flowchart.jpg) ## Before You Begin 1. **Install Foundry >= 1.5.1**: If you haven't already, follow the instructions in the [Foundry documentation](https://book.getfoundry.sh/getting-started/installation). 2. **Clone the starter kit** and initialize the submodules one level deep: ```bash git clone https://github.com/smartcontractkit/ccip-starter-kit-foundry cd ccip-starter-kit-foundry git submodule update --init ``` 3. **Set up your environment**: Copy `.env.example` to `.env` and fill in archive-capable RPC endpoints for both chains: ```bash ETHEREUM_SEPOLIA_RPC_URL= POLYGON_AMOY_RPC_URL= ``` 4. **Import a keystore account** for script execution: ```bash cast wallet import myAccount --interactive ``` This tutorial assumes `--account myAccount`. > **NOTE: Optimizer is required for CCT pool deployment** > > `BurnMintTokenPool` can exceed the EVM max code size if compiled without the optimizer. The kit includes a dedicated > CCT profile in `foundry.toml` (`[profile.cct]` with `optimizer = true, optimizer_runs = 200`). Use > `FOUNDRY_PROFILE=cct` in all deployment commands of this tutorial. ## Step 1: Deploy the token and pool on Ethereum Sepolia (source) Run the `DeployCCTBurnMintTokenAndPool` script. It deploys the `CrossChainToken` (name `TestToken`, symbol `TEST`, 18 decimals, `1_000_000e18` pre-mint to the broadcaster, `100_000_000e18` max supply), the BurnMint pool, grants the pool mint and burn roles on the token, registers the token admin via `getCCIPAdmin()`, accepts the admin role, and sets the pool in the TokenAdminRegistry: ```bash FOUNDRY_PROFILE=cct forge script script/examples/Example06.s.sol:DeployCCTBurnMintTokenAndPool \ --rpc-url ethereumSepolia \ --account myAccount \ --broadcast \ --sig "run(address,address,address,address)" \ \ \ \ ``` Read the four addresses from the [CCIP Directory](/ccip/directory/testnet) (or from `Register.getNetworkDetails(11155111)`). Save from the logs: - `` - `` ## Step 2: Deploy the token and pool on Polygon Amoy (destination) Repeat the same script on Amoy: ```bash FOUNDRY_PROFILE=cct forge script script/examples/Example06.s.sol:DeployCCTBurnMintTokenAndPool \ --rpc-url polygonAmoy \ --account myAccount \ --broadcast \ --sig "run(address,address,address,address)" \ \ \ \ ``` Save `` and ``. ## Step 3: Configure the Sepolia pool with the Amoy remote The `Example06` script links a pool to its remote chain: it sets the remote token, the remote pool, and (in this example) a disabled rate limiter. Re-running it for the same remote chain selector replaces the existing config: ```bash FOUNDRY_PROFILE=cct forge script script/examples/Example06.s.sol:Example06 \ --rpc-url ethereumSepolia \ --account myAccount \ --broadcast \ --sig "run(address,uint64,address,address)" \ \ \ \ ``` ## Step 4: Configure the Amoy pool with the Sepolia remote ```bash FOUNDRY_PROFILE=cct forge script script/examples/Example06.s.sol:Example06 \ --rpc-url polygonAmoy \ --account myAccount \ --broadcast \ --sig "run(address,uint64,address,address)" \ \ \ \ ``` ## Step 5: (Optional) Enable Fast Transfers on both pools New pools allow full finality only (`0x00000000`): every transfer waits for full finality. To opt a pool into Faster Than Finality, set its allowed finality config to a minimum block depth: ```bash FOUNDRY_PROFILE=cct forge script script/examples/Example06.s.sol:Example06SetPoolAllowedFinalityConfig \ --rpc-url ethereumSepolia \ --account myAccount \ --broadcast \ --sig "run(address,bytes4)" \ \ ``` Repeat on Amoy with `--rpc-url polygonAmoy` and ``. `0x00000000` disables Faster Than Finality; values `0x00000001`-`0x0000ffff` set the minimum block depth. Read each pool back with the `Example06GetPoolAllowedFinalityConfig` script. Before an FTF send, check the lane's finality gates (pool, executor and CCV settings) with the read-only `Example06CheckFinalityGates` script. A `getFee` quote alone does not prove `ccipSend` will succeed for a non-`IPoolV2` pool. ## Step 6: Send the transfer across the lane Send with default finality (`blockConfirmations = 0`): ```bash FOUNDRY_PROFILE=cct forge script script/examples/Example06.s.sol:SendCCTTokenWithExtraArgsV3DefaultFinality \ --rpc-url ethereumSepolia \ --account myAccount \ --broadcast \ --sig "run(address,uint64,address,address,uint256,uint32,address)" \ \ \ \ \ \ \ ``` Parameter notes: - `` uses token decimals (`1e18` is 1 token for an 18-decimal token). - ``: set to `0` for a token-only transfer to an EOA receiver. - ``: the LINK token address on Sepolia to pay in LINK, or `0x0000000000000000000000000000000000000000` to pay in native. For the Faster Than Finality version (after Step 5), use `SendCCTTokenWithExtraArgsV3CustomFinality` with the same signature plus ``. The script logs the message ID. Monitor the message on [CCIP Explorer](https://ccip.chain.link). ## Run the same flow as a fork test The kit's `test/fork/Example06.fork.t.sol` runs this entire procedure against pinned forks of the live testnets, with `CCIPLocalSimulatorFork` routing each message to the Amoy OffRamp. The core of the test: ```solidity // Deploy on both forks through the real script (sepoliaToken, sepoliaPool) = _deploy(sepoliaFork, sepolia); (amoyToken, amoyPool) = _deploy(amoyFork, amoy); // Link the pools through the real script vm.selectFork(sepoliaFork); configureLaneScript.run(sepoliaPool, amoy.chainSelector, amoyToken, amoyPool); vm.selectFork(amoyFork); configureLaneScript.run(amoyPool, sepolia.chainSelector, sepoliaToken, sepoliaPool); // Send on Sepolia and route to the Amoy OffRamp vm.selectFork(sepoliaFork); sendDefaultFinality.run( sepolia.routerAddress, amoy.chainSelector, receiver, sepoliaToken, TRANSFER_AMOUNT, EOA_RECEIVER_GAS_LIMIT, address(0) ); simulator.switchChainAndRouteMessage(amoyFork); // Burn & Mint: supply shrinks on the source and grows on the destination assertEq(_balanceOnFork(amoyFork, amoyToken, receiver), TRANSFER_AMOUNT); assertEq(_supplyOnFork(amoyFork, amoyToken), destinationSupplyBefore + TRANSFER_AMOUNT); ``` Run it with: ```bash FOUNDRY_PROFILE=fork forge test --match-contract Example06ForkTest -j 1 ``` The fork test also covers the Faster Than Finality gates: it asserts the pool rejects block-depth requests until `setAllowedFinalityConfig` opts it in, then finds the smallest depth the live lane accepts and delivers the transfer at that depth. ## Verify the result on the live testnets After the transfer finalizes, verify the registration and the lane mapping: ```bash cast call "getPool(address)(address)" --rpc-url ethereumSepolia cast call "getRemoteToken(uint64)(bytes)" --rpc-url ethereumSepolia cast call "getRemotePools(uint64)(bytes[])" --rpc-url ethereumSepolia ``` Verify the Burn & Mint behavior (burn on source, mint on destination): ```bash cast call "balanceOf(address)(uint256)" --rpc-url ethereumSepolia cast call "balanceOf(address)(uint256)" --rpc-url polygonAmoy cast call "totalSupply()(uint256)" --rpc-url ethereumSepolia cast call "totalSupply()(uint256)" --rpc-url polygonAmoy ``` ## Next steps - For the Lock & Release flow (with a lock box and liquidity funding), read the [CCT lock and release tutorial](/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork). - For the full CCT registration procedure against live testnets (not forks), read [Register a new Burn and Mint token from an EOA](/ccip/evm/tutorials/cross-chain-tokens/register-from-eoa-burn-mint-foundry). --- # CCT - getCCIPAdmin() token with Lock and Release Pool in forked environments Source: https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` This tutorial walks you through testing the Lock & Release flow for enabling your own tokens in CCIP 2.0, using the [CCIP Foundry Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-foundry)'s Example 07 (CCT 02). You will deploy a `CrossChainToken` (a CCT-compatible ERC-20 that exposes `getCCIPAdmin()`) with an `ERC20LockBox` and a Lock & Release pool on forks of *Ethereum Sepolia* and *Polygon Amoy*, fund the destination lock box with liquidity, and send a transfer across the CCIP 2.0 lane with `CCIPLocalSimulatorFork` routing the message. The kit runs this exact flow as a fork test (`test/fork/Example07.fork.t.sol`), so every step below is verified against pinned forks of the live testnets. ## Prerequisites > **NOTE: Prerequisites** > > Familiarize yourself with the [CCT standard](/ccip/concepts/cross-chain-token/overview) and [CCIP > architecture](/ccip/concepts/architecture/overview) before proceeding with this tutorial. Complete the [CCT burn and > mint tutorial](/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork) first: it covers the kit setup, the > keystore, the CCT profile and the deployment scripts shared by this tutorial. Before we start with this guide, let's recap parts of the CCT standard that we will need for it. ### Requirements for Cross-Chain Tokens Before enabling an ERC20-compatible token in CCIP, it's important to understand the requirements it must fulfill to integrate with CCIP. - **Recommended permissionless token administrator address registration methods**: A token can use either of these supported function signatures to register permissionlessly: - `owner()`: This function returns the token contract owner's address. - `getCCIPAdmin()`: This function returns the token administrator's address and is recommended for new tokens, as it allows for abstraction of the CCIP Token Administrator role from other common roles, like `owner()`. > **NOTE** > > In the event that these functions are not available, registration can be performed by submitting a form > [here](https://chain.link/ccip-contact). - **Requirements for CCIP token transfers**: The token's smart contract must meet minimum requirements to integrate with CCIP. - **Lock & Release Requirements**: - The token smart contract must have the following functions: - `decimals()`: Returns the token's number of decimals. - `balanceOf(address account)`: Returns the current token balance of the specified `account`. - On the destination blockchain, the token contract must support granting mint and burn permissions. The token developers or another role (such as the token administrator) will grant these permissions to the token pool. In the Lock & Release flow, the source pool locks the tokens in its lock box and the destination pool releases tokens from its own lock box liquidity. Nothing is burned or minted: the total supply stays constant on every chain, and the destination lock box must hold enough liquidity before a transfer can execute. ### Understanding the Procedure It is also important first to understand the overall procedure for enabling your tokens in CCIP. This procedure involves deploying tokens and token pools, registering administrative roles, and configuring token pools to enable secure token transfers using CCIP. The steps in the diagram below highlight the flow of actions needed to enable a token for cross-chain transfers. Whether you're working with an Externally Owned Account (EOA) or a **Smart Account** (such as one using a multisig scheme), the overall logic remains the same. You'll follow the same process to enable cross-chain token transfers, configure pools, and register administrative roles. The diagram below outlines the entire process: ![Process for enabling a token in CCIP.](/images/ccip/CCIP_enabled_tokens_flowchart.jpg) ## Before You Begin Complete the [CCT burn and mint tutorial](/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork) prerequisites: clone the kit, initialize the submodules, set `ETHEREUM_SEPOLIA_RPC_URL` and `POLYGON_AMOY_RPC_URL` in `.env`, and import a keystore account (`cast wallet import myAccount --interactive`). This tutorial assumes `--account myAccount` and `FOUNDRY_PROFILE=cct` for the deployment commands. ## Step 1: Deploy the token, lock box and pool on Ethereum Sepolia (source) Run the `DeployCCTLockReleaseTokenAndPool` script. It deploys the `CrossChainToken` (name `TestToken`, symbol `TEST`, 18 decimals, `1_000_000e18` pre-mint to the broadcaster, `100_000_000e18` max supply), the `ERC20LockBox`, and the Lock & Release pool (wired to the lock box), authorizes the pool as a lock box caller, registers the token admin via `getCCIPAdmin()`, accepts the admin role, and sets the pool in the TokenAdminRegistry: ```bash FOUNDRY_PROFILE=cct forge script script/examples/Example07.s.sol:DeployCCTLockReleaseTokenAndPool \ --rpc-url ethereumSepolia \ --account myAccount \ --broadcast \ --sig "run(address,address,address,address)" \ \ \ \ ``` Read the four addresses from the [CCIP Directory](/ccip/directory/testnet). Save from the logs: - `` - `` - `` ## Step 2: Deploy the token, lock box and pool on Polygon Amoy (destination) ```bash FOUNDRY_PROFILE=cct forge script script/examples/Example07.s.sol:DeployCCTLockReleaseTokenAndPool \ --rpc-url polygonAmoy \ --account myAccount \ --broadcast \ --sig "run(address,address,address,address)" \ \ \ \ ``` Save ``, `` and ``. ## Step 3: Configure each pool with the other chain as its remote The `Example07` script links a pool to its remote chain (remote token, remote pool, disabled rate limiter in this example). Run it on both chains: ```bash FOUNDRY_PROFILE=cct forge script script/examples/Example07.s.sol:Example07 \ --rpc-url ethereumSepolia \ --account myAccount \ --broadcast \ --sig "run(address,uint64,address,address)" \ \ \ \ ``` ```bash FOUNDRY_PROFILE=cct forge script script/examples/Example07.s.sol:Example07 \ --rpc-url polygonAmoy \ --account myAccount \ --broadcast \ --sig "run(address,uint64,address,address)" \ \ \ \ ``` ## Step 4: Fund the destination lock box with liquidity Before a Sepolia → Amoy transfer can execute, the Amoy lock box must hold tokens to release. Fund it with the `FundCCTLockBoxLiquidity` script: ```bash FOUNDRY_PROFILE=cct forge script script/examples/Example07.s.sol:FundCCTLockBoxLiquidity \ --rpc-url polygonAmoy \ --account myAccount \ --broadcast \ --sig "run(address,address,uint256)" \ \ \ ``` > **CAUTION: Fund the destination lock box first** > > Without liquidity the destination OffRamp cannot release the tokens and the message fails on the destination chain. > The kit's fork test asserts exactly this failure path: without lock box funding, `switchChainAndRouteMessage` reverts > with `CCIPLocalSimulatorFork__MessageExecutionFailed`. ## Step 5: Send the transfer across the lane Send with default finality using the shared CCT sender script: ```bash FOUNDRY_PROFILE=cct forge script script/examples/Example06.s.sol:SendCCTTokenWithExtraArgsV3DefaultFinality \ --rpc-url ethereumSepolia \ --account myAccount \ --broadcast \ --sig "run(address,uint64,address,address,uint256,uint32,address)" \ \ \ \ \ \ \ ``` - ``: set to `0` for a token-only transfer to an EOA receiver. - ``: the LINK token address on Sepolia to pay in LINK, or `0x0000000000000000000000000000000000000000` to pay in native. The script logs the message ID. Monitor the message on [CCIP Explorer](https://ccip.chain.link). ## Run the same flow as a fork test The kit's `test/fork/Example07.fork.t.sol` runs this entire procedure against pinned forks of the live testnets. The core of the test: ```solidity // Deploy on both forks through the real script (sepoliaToken, sepoliaLockBox, sepoliaPool) = _deploy(sepoliaFork, sepolia); (amoyToken, amoyLockBox, amoyPool) = _deploy(amoyFork, amoy); // Link the pools through the real script vm.selectFork(sepoliaFork); configureLaneScript.run(sepoliaPool, amoy.chainSelector, amoyToken, amoyPool); vm.selectFork(amoyFork); configureLaneScript.run(amoyPool, sepolia.chainSelector, sepoliaToken, sepoliaPool); // Fund the destination lock box first vm.selectFork(amoyFork); fundLockBoxScript.run(amoyToken, amoyLockBox, DESTINATION_LIQUIDITY); // Send on Sepolia and route to the Amoy OffRamp _sendDefaultFinalityAndRoute(sepoliaToken, TRANSFER_AMOUNT); // Lock & Release: supply is unchanged on both chains assertEq(_balanceOnFork(sepoliaFork, sepoliaToken, sepoliaLockBox), TRANSFER_AMOUNT); assertEq(_supplyOnFork(sepoliaFork, sepoliaToken), PREMINT); assertEq(_balanceOnFork(amoyFork, amoyToken, receiver), TRANSFER_AMOUNT); assertEq(_balanceOnFork(amoyFork, amoyToken, amoyLockBox), DESTINATION_LIQUIDITY - TRANSFER_AMOUNT); assertEq(_supplyOnFork(amoyFork, amoyToken), PREMINT); ``` Run it with: ```bash FOUNDRY_PROFILE=fork forge test --match-contract Example07ForkTest -j 1 ``` The fork test also asserts the empty-lock-box failure: it sends without funding the Amoy lock box and expects the routing call to revert with `CCIPLocalSimulatorFork__MessageExecutionFailed`, which is the strict-routing surface of the destination OffRamp's recorded failure. ## Verify the result on the live testnets After the transfer finalizes, verify the registration, the lane mapping and the Lock & Release behavior: ```bash cast call "getPool(address)(address)" --rpc-url ethereumSepolia cast call "getRemoteToken(uint64)(bytes)" --rpc-url ethereumSepolia cast call "balanceOf(address)(uint256)" --rpc-url ethereumSepolia cast call "balanceOf(address)(uint256)" --rpc-url polygonAmoy cast call "balanceOf(address)(uint256)" --rpc-url polygonAmoy ``` The total supply on each chain is unchanged: nothing was burned or minted. ## Next steps - For the Burn & Mint flow, read the [CCT burn and mint tutorial](/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork). - For pool hooks, pool-based CCVs and policy engines, see the kit's Examples 08-10 (`AdvancedPoolHooks`). - For the full CCT registration procedure against live testnets (not forks), read [Register a new Lock and Mint token from an EOA](/ccip/evm/tutorials/cross-chain-tokens/register-from-eoa-lock-mint-foundry). --- # Sending data to a receiver with CCV config in your Foundry project Source: https://docs.chain.link/chainlink-local/build/ccip/foundry/data-messages-receiver-ccv-config > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` This guide walks you through the CCIP 2.0 receiver-side finality rules in local mode, using the [CCIP Foundry Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-foundry)'s Example 02. You will send a data-only message to a `BasicMessageReceiverWithCCVs` contract with Fast Transfers, and see the local router reject it when the requested block confirmations fall below the receiver's minimum block depth. The Example 01 guide covers a token-only transfer to an EOA, which is exactly the case that skips the receiver finality check. This guide covers the opposite case: a message with data and a receiver contract, where the local router reads the receiver's `getCCVsAndFinalityConfig` and enforces its allowed finality, reproducing the CCIP 2.0 OffRamp check. Read [CCIP 2.0 behavior in local mode](/chainlink-local/learn/ccip-v2-local) for the full rule list. ## Prerequisites Complete the [Foundry local simulator guide](/chainlink-local/build/ccip/foundry/local-simulator) first: it covers cloning the kit, initializing the submodules, and the `LocalSimulatorTest` setup this guide builds on. ## Test data messages to a receiver with CCV config The test file `Example02.t.sol` is located in the `./test` directory. It runs the real Example 02 scripts (`script/examples/Example02.s.sol`) against the Chainlink Local simulator. The file contains eight test cases: 1. **Deploy**: The deploy script wires the receiver to the router and the broadcaster owns it. 2. **Deliver above the minimum depth**: A Fast Transfer with confirmations above the receiver's `minBlockDepth` is delivered. 3. **Deliver at the minimum depth**: Confirmations equal to `minBlockDepth` are also delivered. 4. **Deliver with a CCV config applied**: A receiver with required and optional CCVs still gates on `minBlockDepth`. 5. **Revert below the minimum depth**: Confirmations below `minBlockDepth` revert with `FinalityCodec.InvalidRequestedFinality`. 6. **Revert when the minimum depth is unset**: Without a configured depth, the receiver accepts finalized messages only. 7. **Argument validation**: The `SetBasicMessageReceiverWithCCVsMinBlockDepth` script rejects a zero source chain selector. 8. **Send-time validation**: The send script requires `blockConfirmations > 0`, so every send in this file is a Fast Transfer. In your terminal, run the following command to execute the test: ```shell forge test --match-contract Example02Test ``` Example output: ```text $ forge test --match-contract Example02Test [⠊] Compiling... No files changed, compilation skipped Ran 8 tests for test/Example02.t.sol:Example02Test [PASS] test_deliversMessageWhenConfirmationsAreAtLeastMinBlockDepth() (gas: 2033236) [PASS] test_deliversMessageWhenConfirmationsEqualMinBlockDepth() (gas: 1993766) [PASS] test_deliversMessageWhenReceiverHasCCVConfigApplied() (gas: 3418578) [PASS] test_deployScriptWiresReceiverToRouterAndBroadcasterOwnsIt() (gas: 17951) [PASS] test_revertsWhenConfirmationsAreBelowMinBlockDepth() (gas: 1835829) [PASS] test_revertsWhenMinBlockDepthIsUnsetSoOnlyFullFinalityIsAccepted() (gas: 1233516) [PASS] test_sendScriptRequiresNonZeroBlockConfirmations() (gas: 41304) [PASS] test_setMinBlockDepthScriptRejectsZeroSourceChainSelector() (gas: 572902) Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 3.21ms (3.83ms CPU time) Ran 1 test suite in 6.65ms (3.21ms CPU time): 8 tests passed, 0 failed, 0 skipped (8 total tests) ``` ## Examine the code ### The receiver contract `src/BasicMessageReceiverWithCCVs.sol` extends `BasicMessageReceiver` with a per-source-chain CCV and finality policy. Two settings matter for this guide: - `setMinBlockDepth(sourceChainSelector, minBlockDepth)`: the minimum block depth the receiver accepts for Fast Transfers from that chain. `0` means the receiver requires default finality (fully finalized messages only). - `getCCVsAndFinalityConfig(sourceChainSelector, sender)`: the CCIP 2.0 receiver interface the OffRamp calls for every message that is not a token-only transfer. The kit's receiver returns its stored CCV config and encodes `minBlockDepth` as the allowed finality with `FinalityCodec._encodeBlockDepth`. ### Setup The `setUp()` function deploys the receiver through the kit's deploy script, so the test exercises the same deployment path the book's live-testnet flow uses: ```solidity function setUp() public override { super.setUp(); example = new Example02(); receiver = BasicMessageReceiverWithCCVs(new DeployBasicMessageReceiverWithCCVs().run(address(router))); } ``` The helper functions wrap the two scripts the test drives: ```solidity function _setMinBlockDepth(uint16 minBlockDepth) internal { new SetBasicMessageReceiverWithCCVsMinBlockDepth().run(address(receiver), chainSelector, minBlockDepth); } function _send(uint16 blockConfirmations) internal returns (bytes32) { return example.run( address(router), chainSelector, address(receiver), MESSAGE_TEXT, GAS_LIMIT, blockConfirmations, address(0) ); } ``` The constants used: ```solidity string internal constant MESSAGE_TEXT = "Hello CCIP 2.0"; uint32 internal constant GAS_LIMIT = 200_000; ``` `GAS_LIMIT` must be `> 0`: the receiver has a `ccipReceive` callback to execute, unlike the EOA receiver of Example 01. ### Deliver when confirmations meet the minimum depth `test_deliversMessageWhenConfirmationsAreAtLeastMinBlockDepth` sets the receiver's minimum depth to `3` and sends with `5` confirmations: ```solidity _setMinBlockDepth(3); bytes32 messageId = _send(5); assertEq(receiver.latestMessageId(), messageId); assertEq(receiver.latestSourceChainSelector(), chainSelector); assertEq(receiver.latestSender(), broadcaster); assertEq(receiver.latestMessage(), abi.encode(MESSAGE_TEXT)); ``` Inside the send, the local router parses the `ExtraArgsV3` requested finality, sees the message has data (not a token-only transfer), and calls the receiver's `getCCVsAndFinalityConfig`. The receiver's allowed finality is `FinalityCodec._encodeBlockDepth(3)`; the requested `5` is at least that, so the message is delivered synchronously and the assertions read the receiver's stored state directly. `test_deliversMessageWhenConfirmationsEqualMinBlockDepth` sends with exactly `3` confirmations and passes: the check is inclusive. ### Revert when confirmations fall below the minimum depth `test_revertsWhenConfirmationsAreBelowMinBlockDepth` sends with `2` confirmations against a minimum depth of `3`. The local router rejects the send with the same error the production OffRamp records, and no tokens or data move: ```solidity _setMinBlockDepth(3); vm.expectRevert( abi.encodeWithSelector( FinalityCodec.InvalidRequestedFinality.selector, FinalityCodec._encodeBlockDepth(2), FinalityCodec._encodeBlockDepth(3) ) ); _send(2); ``` The error carries both sides of the comparison: the requested finality (`2` block confirmations) and the allowed finality (the receiver's minimum depth `3`). `test_revertsWhenMinBlockDepthIsUnsetSoOnlyFullFinalityIsAccepted` shows the default: with no depth configured, the receiver's allowed finality is `FinalityCodec.WAIT_FOR_FINALITY_FLAG`, so any Fast Transfer request reverts: ```solidity vm.expectRevert( abi.encodeWithSelector( FinalityCodec.InvalidRequestedFinality.selector, FinalityCodec._encodeBlockDepth(1), FinalityCodec.WAIT_FOR_FINALITY_FLAG ) ); _send(1); ``` A message with `blockConfirmations = 0` (default finality) would still be delivered in this state, but the send script requires `> 0`, so this file always sends Fast Transfers. ### Deliver with a CCV config applied `test_deliversMessageWhenReceiverHasCCVConfigApplied` configures the receiver with required and optional CCVs through `applyCCVConfigUpdates`, then verifies the finality gate still applies on top: ```solidity address[] memory required = new address[](1); required[0] = makeAddr("requiredCCV"); address[] memory optional = new address[](2); optional[0] = makeAddr("optionalCCV1"); optional[1] = makeAddr("optionalCCV2"); BasicMessageReceiverWithCCVs.CCVConfigArgs[] memory configs = new BasicMessageReceiverWithCCVs.CCVConfigArgs[](1); configs[0] = BasicMessageReceiverWithCCVs.CCVConfigArgs({ requiredCCVs: required, optionalCCVs: optional, sourceChainSelector: chainSelector, optionalThreshold: 1 }); vm.prank(broadcaster); receiver.applyCCVConfigUpdates(configs); _setMinBlockDepth(3); ``` Local mode has no CCV verifiers, so it cannot check quorum. It does validate the config itself (duplicate CCVs, `optionalThreshold` beyond the optional list length) the same way the OffRamp does, so a receiver configured this way is accepted by the router-side validation and keeps gating on the minimum block depth. The test then asserts the same `InvalidRequestedFinality` revert for a `2`-confirmation send. ## Run the same flow on a live testnet The kit's book chapter lists the script commands for the live-testnet flow: deploy the receiver on the destination chain, set its minimum block depth for your source chain, then send the data message from the source chain. See the [Example 02 chapter](https://smartcontractkit.github.io/ccip-starter-kit-foundry/examples/example02-hello-world-to-basic-message-receiver.html) of the kit's book. ## Next steps - `Example03.t.sol` combines this receiver-side gating with a token transfer (data + tokens in one message). - To see the receiver finality rules enforced by the real OffRamp instead of the local router, read the [forked environments guide](/chainlink-local/build/ccip/foundry/local-simulator-fork). - For an index of every kit example and where its topic is documented, read the [CCIP starter kit examples map](/chainlink-local/learn/starter-kit-examples). --- # Using the Chainlink Local Simulator to fork mainnets Source: https://docs.chain.link/chainlink-local/build/ccip/foundry/forking-mainnets > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` This guide explains how to use the Chainlink Local Simulator to test cross-chain transactions in forked mainnet environments using Foundry. You'll use the `Register.sol` contract to read the network details of the chains you fork, and `setNetworkDetails` to add or override details when a chain is not in `Register` or its values have changed. Fork routing supports every CCIP era: pre-1.6, 1.6 and CCIP 2.0 (CCV-based) lanes. If the mainnet lane you fork runs CCIP 2.0 through a dedicated router, read it with [`getCCIPV2RouterAddress`](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork#getccipv2routeraddress) or set it with [`setCCIPV2RouterAddress`](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork#setccipv2routeraddress), and send through that router. Messages sent through either router are routed by `switchChainAndRouteMessage`. ## Understanding Network Registration The `Register.sol` smart contract contains pre-configured details for 134 chains, mainnets included, to accelerate cross-chain transaction simulations in Foundry. `getNetworkDetails` returns an all-zero struct for a chain ID that is not in `Register`; use `setNetworkDetails` to add it. > **NOTE: Best Practice** > > Always verify contract addresses from `Register.sol` against the official [CCIP Directory](/ccip/directory/mainnet) to > ensure you're using the correct network details. Here's an example of how to verify network details for a test network such as Sepolia: ```solidity pragma solidity ^0.8.0; import { Test, console } from "forge-std/Test.sol"; import { CCIPLocalSimulatorFork, Register } from "@chainlink/local/src/ccip/CCIPLocalSimulatorFork.sol" contract ExampleTest is Test { CCIPLocalSimulatorFork public ccipLocalSimulatorFork; uint256 public ethSepoliaFork; Register.NetworkDetails public ethSepoliaNetworkDetails; function setUp() public { // Create a fork of the Sepolia network string memory SEPOLIA_RPC_URL = vm.envString("SEPOLIA_RPC_URL"); ethSepoliaFork = vm.createFork(SEPOLIA_RPC_URL); // Initialize the CCIP simulator ccipLocalSimulatorFork = new CCIPLocalSimulatorFork(); vm.makePersistent(address(ccipLocalSimulatorFork)); // Select and verify the fork vm.selectFork(ethSepoliaFork); assertEq(block.chainid, 11155111); // Verify network details match the CCIP Directory ethSepoliaNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); assertEq(ethSepoliaNetworkDetails.chainSelector, 16015286601757825753); assertEq(ethSepoliaNetworkDetails.routerAddress, 0x0BF3dE8c5D3e8A2B34D2BEeB17ABfCeBaf363A59); } } ``` ## Working with Mainnet Forks The Chainlink Local Simulator supports any forked environment where CCIP contracts exist. Mainnet details are in `Register`, so forking a mainnet lane needs no extra configuration. Chainlink Local runs this exact flow as an e2e test: [`CCIPv2MainnetEthereumArbitrumFork.t.sol`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/test/e2e/ccip/CCIPv2MainnetEthereumArbitrumFork.t.sol) sends a data-only message across the *Ethereum* → *Arbitrum One* mainnet lane, a CCIP 2.0 lane, and needs only `ETHEREUM_MAINNET_RPC_URL` and `ARBITRUM_MAINNET_RPC_URL`. The core of the test: ```solidity function setUp() public { s_ethereumFork = vm.createSelectFork(vm.envString("ETHEREUM_MAINNET_RPC_URL")); s_arbitrumFork = vm.createFork(vm.envString("ARBITRUM_MAINNET_RPC_URL")); s_forkSimulator = new CCIPLocalSimulatorFork(); vm.makePersistent(address(s_forkSimulator)); s_encoder = new EncodeExtraArgsOffchain(); vm.makePersistent(address(s_encoder)); // Read the network details of both chains from Register vm.selectFork(s_arbitrumFork); s_arbitrum = s_forkSimulator.getNetworkDetails(block.chainid); vm.selectFork(s_ethereumFork); s_ethereum = s_forkSimulator.getNetworkDetails(block.chainid); // Fail fast if the lane is not CCIP 2.0 at the forked block address onRamp = IRouterOnRamp(s_ethereum.routerAddress).getOnRamp(s_arbitrum.chainSelector); assertEq(ITypeAndVersion(onRamp).typeAndVersion(), "OnRamp 2.0.0", "Ethereum -> Arbitrum is not CCIP 2.0"); s_alice = makeAddr("alice"); vm.deal(s_alice, 10 ether); } function test_mainnet_message_ethereumToArbitrum_fork() external { // Deploy a receiver on the destination chain vm.selectFork(s_arbitrumFork); BasicMessageReceiver receiver = new BasicMessageReceiver(s_arbitrum.routerAddress); // Send an ExtraArgsV3 message with default finality through the Ethereum router, paying in native bytes memory payload = bytes("Hello mainnet CCIP 2.0"); bytes32 messageId = _send( address(receiver), payload, new Client.EVMTokenAmount[](0), s_encoder.encodeV3Basic(200_000, FinalityCodec.WAIT_FOR_FINALITY_FLAG) ); // Route the message to the Arbitrum OffRamp s_forkSimulator.switchChainAndRouteMessage(s_arbitrumFork); // Verify the message arrived vm.selectFork(s_arbitrumFork); assertEq(receiver.latestMessageId(), messageId); assertEq(receiver.latestSourceChainSelector(), s_ethereum.chainSelector); assertEq(receiver.latestSender(), s_alice); assertEq(receiver.latestMessage(), payload); } ``` The `_send` helper builds the `Client.EVM2AnyMessage` with the given extraArgs, quotes the fee, and calls `ccipSend` as `alice` paying in native. The test's receiver and encoder are chainlink-local test contracts (`src/test/ccip/`, not shipped in the npm package); for your own project, the [CCIP Foundry Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-foundry) ships a receiver (`src/BasicMessageReceiver.sol`) and an extraArgs encoder (`script/EncodeExtraArgsOffchain.s.sol`). **Code explanation**: - **Network Setup**: The `setUp()` function creates forks of both Ethereum and Arbitrum One mainnets, initializes the CCIP simulator, and reads both chains' details from `Register` with no manual configuration. - **Lane check**: The `OnRamp 2.0.0` assertion fails the test early if the lane is not CCIP 2.0 at the forked block, for example after a chain upgrade. - **Message Transfer**: The test deploys the receiver on the destination fork, sends an `ExtraArgsV3` message with default finality (`FinalityCodec.WAIT_FOR_FINALITY_FLAG`) through the source router, and routes it with [`switchChainAndRouteMessage()`](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork#switchchainandroutemessage), which executes it on the destination OffRamp. Contracts created in a fork test are per-fork: make them persistent with `vm.makePersistent` before using them on another fork. ## Add or override network details with setNetworkDetails Use [`setNetworkDetails()`](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork#setnetworkdetails) when a chain is not in `Register` (it returns an all-zero struct) or when a value has changed from the built-in one, for example after a router upgrade. The details are keyed by the **chain ID**, not the fork ID: ```solidity ccipLocalSimulatorFork.setNetworkDetails( 137, // Polygon mainnet chain ID Register.NetworkDetails({ chainSelector: 4051577828743386545, routerAddress: 0x849c5ED5a80F5B408Dd4969b78c2C8fdf0565Bfe, linkAddress: 0xb0897686c545045aFc77CF20eC7A532E3120E0F1, wrappedNativeAddress: 0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270, ccipBnMAddress: address(0), // not needed for this test ccipLnMAddress: address(0), // not needed for this test rmnProxyAddress: 0xf1ceAa46D8d13Cac9fC38aaEF3d3d14754C5A9c2, registryModuleOwnerCustomAddress: 0xc751E86208F0F8aF2d5CD0e29716cA7AD98B5eF5, tokenAdminRegistryAddress: 0x00F027eA6D0fb03256A15E9182B2B9227A4931d8 }) ); ``` The values above are the built-in `Register` entry for Polygon mainnet, shown as an example of the full struct. Check the [CCIP Directory](/ccip/directory/mainnet) for the current values of the chain you are configuring. Parameters not needed for messaging can be set to `address(0)`. After this configuration, you can simulate cross-chain messages between any forks, enabling thorough testing of your cross-chain applications in a local environment. --- # Using Chainlink Local to Test CCIP in Your Foundry Project Source: https://docs.chain.link/chainlink-local/build/ccip/foundry > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` There are four guides to help you test Chainlink CCIP 2.0 in your Foundry project using Chainlink Local - two for each mode (with and without forking), plus the CCT tutorials. The guides use the [CCIP Foundry Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-foundry), whose CCIP 2.0 examples (`Example01`-`Example10`) cover token transfers, Fast Transfers, programmable token transfers, and Cross-Chain Token (CCT) setup on the Ethereum Sepolia → Polygon Amoy lane. Read [CCIP 2.0 behavior in Chainlink Local](/chainlink-local/learn/ccip-v2-local) to understand what the simulator enforces in each mode, or the [CCIP starter kit examples map](/chainlink-local/learn/starter-kit-examples) for an index of every kit example. ## Guides ### Using the Chainlink Local Simulator in your Foundry project This [guide](/chainlink-local/build/ccip/foundry/local-simulator) helps you set up and run CCIP 2.0 in a localhost environment within your Foundry project. It provides step-by-step instructions on: - Cloning the [CCIP Foundry Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-foundry) - Installing necessary dependencies - Running tests for token transfers between two accounts using `ExtraArgsV3` with Fast Transfers Using the local simulator without forking is ideal for initial development and testing in an isolated environment. ### Sending data to a receiver with CCV config This [guide](/chainlink-local/build/ccip/foundry/data-messages-receiver-ccv-config) covers the receiver-side finality rules in local mode: a data-only message to a `BasicMessageReceiverWithCCVs` contract, where the local router enforces the receiver's minimum block depth for Fast Transfers. ### Using the Chainlink Local Simulator in your Foundry project with forked environments This [guide](/chainlink-local/build/ccip/foundry/local-simulator-fork) extends your testing capabilities by demonstrating how to use the Chainlink Local Simulator in a forked environment. It includes instructions on: - Setting up forks of real blockchain networks (Ethereum Sepolia and Polygon Amoy, a live CCIP 2.0 lane) - Routing messages across forks with `CCIPLocalSimulatorFork` for every CCIP era - Running the CCT fork tests (token and pool deployment, registration, Faster Than Finality gates) Using the local simulator with forked environments is ideal for testing in a more realistic yet controlled setting. ### Forking mainnets This [guide](/chainlink-local/build/ccip/foundry/forking-mainnets) covers forking mainnet lanes: reading mainnet network details from `Register`, adding or overriding chains with `setNetworkDetails`, and routing messages across mainnet forks, following Chainlink Local's own Ethereum → Arbitrum One e2e test. ### CCT tutorials Three tutorials cover the fork-mode CCT examples: [CCT burn and mint](/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork), [CCT lock and release](/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork), and [pool-based CCVs on `AdvancedPoolHooks`](/chainlink-local/build/ccip/foundry/pool-based-ccvs-fork). --- # Using the Chainlink Local Simulator in your Foundry project with forked environments Source: https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator-fork > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` You can use Chainlink Local to run CCIP 2.0 in forked environments within your Foundry project. To get started quickly, you will use the [CCIP Foundry Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-foundry). The kit's `test/fork` directory contains fork tests for the CCT examples (`Example06`-`Example10`), which run the real example scripts against pinned forks of *Ethereum Sepolia* and *Polygon Amoy* (a live CCIP 2.0 lane) and route each message to the destination OffRamp with `CCIPLocalSimulatorFork`. `CCIPLocalSimulatorFork` routes messages on forked networks for every CCIP era: pre-1.6 (`EVM2EVMOnRamp`), 1.6 and CCIP 2.0 (CCV-based lanes, which live testnet lanes run today). On CCIP 2.0 lanes the destination OffRamp selects the CCVs and executes the message (`V2VerificationMode.OFFRAMP_DERIVED`, the default); CCV attestations are simulated with a synthetic no-op verifier. ## Prerequisites This guide assumes that you are familiar with the guide [Using the Chainlink Local Simulator in your Foundry project](/chainlink-local/build/ccip/foundry/local-simulator). If not, please get familiar with it and run all the prerequisites. Fork tests have two requirements beyond the no-fork setup: 1. **Foundry >= 1.5.1.** 2. **`evm_version = "cancun"` or later for the fork tests.** Deployed CCIP 2.0 contracts use Cancun opcodes; compiling with `paris` fails with `EvmError: NotActivated`. Use a fork-only profile so your deployed bytecode is not affected. The kit's `foundry.toml` does exactly this: ```toml [profile.fork] optimizer = true optimizer_runs = 200 no_match_path = 'test/none/**' match_path = 'test/fork/**' ``` `evm_version = 'cancun'` is set at the top level of the kit's `foundry.toml`. Set up an `.env` file (or export the variables) with the fork RPC URLs. The kit needs archive-capable endpoints for both chains: - `ETHEREUM_SEPOLIA_RPC_URL`: The RPC URL for the Ethereum Sepolia testnet. You can sign up for a personal endpoint from [Alchemy](https://www.alchemy.com/), [Infura](https://www.infura.io/), or another node provider service. - `POLYGON_AMOY_RPC_URL`: The RPC URL for the Polygon Amoy testnet, from the same providers. ## Test a CCT transfer across a CCIP 2.0 lane You will run the fork test for Example 06 (CCT 01: `CrossChainToken` + BurnMint pool). The test file `Example06.fork.t.sol` is located in the `./test/fork` directory. It deploys a custom token and pool on both forks, registers them in the live TokenAdminRegistry, links the pools, and sends token transfers across the Sepolia → Amoy CCIP 2.0 lane. The file contains seven test cases, including: 1. **Deploy**: Creates the token and pool on both chains and registers them. 2. **Configure lane**: Sets the remote token and pool on each pool. 3. **Send with default finality**: Burns on the source and mints on the destination. 4. **Send with Faster Than Finality**: Reverts until both pools opt in, then delivers after the pools opt in. In your terminal, run the following command to execute the test: ```shell FOUNDRY_PROFILE=fork forge test --match-contract Example06ForkTest -j 1 ``` Example output: ```text $ FOUNDRY_PROFILE=fork forge test --match-contract Example06ForkTest -j 1 Ran 7 tests for test/fork/Example06.fork.t.sol:Example06ForkTest [PASS] test_checkFinalityGates_findsRegisteredPool() (gas: 3066525) [PASS] test_configureLane_rerunReplacesExistingConfig() (gas: 942262) [PASS] test_configureLane_setsRemoteTokenAndPool() (gas: 747587) [PASS] test_deploy_createsTokenAndPoolAndRegistersThem() (gas: 240027) [PASS] test_send_defaultFinalityBurnsOnSourceAndMintsOnDestination() (gas: 2510920) [PASS] test_send_fasterThanFinalityDeliversAfterPoolsOptIn() (gas: 3481610) [PASS] test_send_fasterThanFinalityRevertsUntilPoolOptsIn() (gas: 1444822) Suite result: ok. 7 passed; 0 failed; 0 skipped; finished in 2.42s (15.51ms CPU time) Ran 1 test suite in 2.42s (2.42s CPU time): 7 tests passed, 0 failed, 0 skipped (7 total tests) ``` ## Examine the code ### Setup The shared base contract `test/fork/utils/CCTForkTest.sol` sets up both forks and the simulator. To route messages across forks, the test needs: - A fork of the source chain (Ethereum Sepolia) and the destination chain (Polygon Amoy) - The network details (router, registry, RMN proxy addresses) for both chains - The fork simulator, made persistent so it can route across forks - A sender account (the broadcaster) and a receiver account The `setUp()` function is invoked before each test case: 1. Create the forks. Both are pinned to a committed block (`DEFAULT_SEPOLIA_FORK_BLOCK`, `DEFAULT_AMOY_FORK_BLOCK`) so a fresh clone runs the same chain state. Override the pins per run with the `ETHEREUM_SEPOLIA_FORK_BLOCK` / `POLYGON_AMOY_FORK_BLOCK` environment variables: ```solidity sepoliaFork = vm.createSelectFork("ethereumSepolia", vm.envOr("ETHEREUM_SEPOLIA_FORK_BLOCK", DEFAULT_SEPOLIA_FORK_BLOCK)); amoyFork = vm.createFork("polygonAmoy", vm.envOr("POLYGON_AMOY_FORK_BLOCK", DEFAULT_AMOY_FORK_BLOCK)); ``` 2. Initialize the [fork Chainlink Local simulator](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork#cciplocalsimulatorfork) and make it persistent. The simulator must be created on a fork and be persistent so it can route across forks: ```solidity simulator = new CCIPLocalSimulatorFork(); vm.makePersistent(address(simulator)); ``` 3. Read the network details for both chains with [`getNetworkDetails`](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork#getnetworkdetails). [`Register.NetworkDetails`](/chainlink-local/api-reference/v0.3.1/register#networkdetails) stores the chain selector, router address, LINK address, wrapped native address, CCIP test tokens, RMN proxy, registry module and token admin registry addresses: ```solidity sepolia = simulator.getNetworkDetails(block.chainid); vm.selectFork(amoyFork); amoy = simulator.getNetworkDetails(block.chainid); ``` 4. Fund the broadcaster on both forks and verify the lane is the CCIP 2.0 lane the test expects. The test fails with a clear message if the pinned block or the lane is not what it describes: ```solidity vm.selectFork(sepoliaFork); vm.deal(broadcaster, 100 ether); vm.selectFork(amoyFork); vm.deal(broadcaster, 100 ether); vm.selectFork(sepoliaFork); address onRamp = IRouterOnRampView(sepolia.routerAddress).getOnRamp(amoy.chainSelector); assertTrue(onRamp != address(0), "Sepolia router has no OnRamp for Amoy at the pinned block"); assertEq(ITypeAndVersionView(onRamp).typeAndVersion(), "OnRamp 2.0.0", "Sepolia -> Amoy is not a CCIP 2.0 lane"); ``` 5. Contracts or scripts created in a fork test are per-fork: make them persistent before using them on another fork: ```solidity sendDefaultFinality = SendCCTTokenWithExtraArgsV3DefaultFinality( _persistent(address(new SendCCTTokenWithExtraArgsV3DefaultFinality())) ); ``` ### Send and route the message The `_sendDefaultFinalityAndRoute` helper shows the two-step flow used by every fork test: 1. On the source fork, run the send script. It builds an `ExtraArgsV3` message with `blockConfirmations = 0` (default finality) and calls `ccipSend` through the Sepolia router: ```solidity vm.selectFork(sepoliaFork); sendDefaultFinality.run( sepolia.routerAddress, amoy.chainSelector, receiver, token, amount, EOA_RECEIVER_GAS_LIMIT, address(0) ); ``` 2. Call [`switchChainAndRouteMessage`](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork#switchchainandroutemessage) to switch to the destination fork and route the message. The simulator reads the recorded logs, finds the `CCIPMessageSent` event, and executes the message on the Amoy OffRamp. The active fork is Amoy when the call returns: ```solidity simulator.switchChainAndRouteMessage(amoyFork); ``` Routing is strict by default: `switchChainAndRouteMessage` reverts with `CCIPLocalSimulatorFork__MessageNotRouted(messageId, reason)` when a captured message cannot be routed to any of the given forks, and with `CCIPLocalSimulatorFork__MessageExecutionFailed(messageId, reason)` (the decoded revert data) when it does not execute successfully. Call [`setStrictRouting(false)`](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork#setstrictrouting) to record failures instead and read them with [`getMessageStatus`](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork#getmessagestatus). The Example 07 fork test (`test_send_failsToExecuteWhenDestinationLockBoxIsEmpty`) shows the strict-routing failure path: it sends a Lock & Release transfer without funding the destination lock box, so the OffRamp cannot release the tokens, and expects the routing call to revert: ```solidity vm.expectPartialRevert(CCIPLocalSimulatorFork.CCIPLocalSimulatorFork__MessageExecutionFailed.selector); simulator.switchChainAndRouteMessage(amoyFork); ``` ### Faster Than Finality across the lane The `test_send_fasterThanFinalityDeliversAfterPoolsOptIn` test case shows the CCIP 2.0 finality gates on a real lane: 1. New pools allow full finality only, so any block-depth request is rejected by the pool. The test first asserts the pool's default and expects the send to revert: ```solidity assertEq(TokenPool(sepoliaPool).getAllowedFinalityConfig(), FinalityCodec.WAIT_FOR_FINALITY_FLAG); vm.expectPartialRevert(FinalityCodec.InvalidRequestedFinality.selector); ``` 2. Opt both pools in with `setAllowedFinalityConfig` (through the kit's `Example06SetPoolAllowedFinalityConfig` script), then find the smallest depth the live lane accepts by quoting `getFee` for candidate depths: ```solidity vm.selectFork(sepoliaFork); _setPoolMinBlockDepth(sepoliaPool, 1); uint16 depth = _findLaneFtfDepth(sepoliaToken); _setPoolMinBlockDepth(sepoliaPool, depth); vm.selectFork(amoyFork); _setPoolMinBlockDepth(amoyPool, depth); ``` 3. Send with the custom finality (`blockConfirmations = depth`) and route. The transfer burns on the source and mints on the destination, same as the default-finality case, but delivered before full finality. ## What the fork simulator does not model Not modelled by the simulator (and not asserted in the kit's fork tests): real CCV attestations, RMN and executor fees. CCVs on the lane are replaced by a synthetic verifier, and `executePendingV2Message` executes without charging the executor fee a real manual execution costs. Pinned state never sees testnet upgrades, so green tests only prove the examples against that snapshot; re-pin the fork blocks when the lane's behavior changes or on every `@chainlink/contracts-ccip` or `@chainlink/local` bump. ## Next steps - The other fork tests cover Lock & Release pools with a lock box (`Example07.fork.t.sol`), `AdvancedPoolHooks` (`Example08`-`Example10`). For pool-required CCVs on `AdvancedPoolHooks`, read the [pool-based CCVs tutorial](/chainlink-local/build/ccip/foundry/pool-based-ccvs-fork). - To fork mainnets, read [Using the Chainlink Local Simulator to fork mainnets](/chainlink-local/build/ccip/foundry/forking-mainnets). - For the full CCT enabling procedure on the Sepolia → Amoy lane, read the [CCT burn and mint tutorial](/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork) and the [CCT lock and release tutorial](/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork). - For an index of every kit example and where its topic is documented, read the [CCIP starter kit examples map](/chainlink-local/learn/starter-kit-examples). --- # Using Chainlink Local simulator in your Foundry project Source: https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` You can use Chainlink Local to run CCIP 2.0 in a localhost environment within your Foundry project. To get started quickly, you will use the [CCIP Foundry Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-foundry). This project is a Foundry boilerplate that includes the Chainlink Local package (V3, `v0.3.1`) and CCIP 2.0 examples (`Example01`-`Example10`) covering token transfers, Fast Transfers, programmable token transfers, and Cross-Chain Token (CCT) setup. In local mode, the simulator delivers messages synchronously inside `ccipSend` and applies the CCIP 2.0 OnRamp and OffRamp message rules: finality, one token per message, no zero amounts, and receiver CCV config validation. Read [CCIP 2.0 behavior in local mode](/chainlink-local/learn/ccip-v2-local) for the full list of what is and is not enforced. ## Prerequisites 1. In a terminal, clone the [CCIP Foundry Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-foundry) repository and change directories. Clone without `--recursive` and initialize the submodules one level deep: ```shell git clone https://github.com/smartcontractkit/ccip-starter-kit-foundry.git && \ cd ./ccip-starter-kit-foundry/ && \ git submodule update --init ``` 2. Run `forge build` to compile the contracts: ```shell forge build ``` The kit pins `solc 0.8.26` with `evm_version = cancun` in `foundry.toml`. CCIP 2.0 contracts need Cancun opcodes, so keep that setting in your own project. ## Test token transfers You will run a test that transfers tokens between two accounts using `ExtraArgsV3` with Fast Transfers (non-zero block confirmations). The test file `Example01.t.sol` is located in the `./test` directory. It runs the real `Example01` script (`script/examples/Example01.s.sol`) against the Chainlink Local simulator, so a regression in the script fails the test. The file contains four test cases: 1. **Transfer with native fees**: Transfers CCIP-BnM from the sender to a receiver EOA, paying the fee in native gas, and verifies the receiver was credited and the router collected the fee. 2. **Transfer with LINK fees**: Same transfer, paying the fee in LINK. 3. **Revert on zero block confirmations**: `blockConfirmations == 0` means default finality; the script requires `> 0` for Faster Than Finality. 4. **Revert on zero amount**: The CCIP 2.0 rules reject zero-amount token transfers. For a detailed explanation of the test file, refer to the [Examine the code](#examine-the-code) section. In your terminal, run the following command to execute the test: ```shell forge test --match-contract Example01Test ``` Example output: ```text $ forge test --match-contract Example01Test [⠊] Compiling... No files changed, compilation skipped Ran 4 tests for test/Example01.t.sol:Example01Test [PASS] test_revertsWhenAmountIsZero() (gas: 41283) [PASS] test_revertsWhenBlockConfirmationsIsZero() (gas: 41309) [PASS] test_transfersTokenToEoaPayingLinkFee() (gas: 1430441) [PASS] test_transfersTokenToEoaPayingNativeFee() (gas: 1350710) Suite result: ok. 4 passed; 0 failed; 0 skipped; finished in 2.54ms (1.81ms CPU time) Ran 1 test suite in 6.09ms (2.54ms CPU time): 4 tests passed, 0 failed, 0 skipped (4 total tests) ``` No RPC URLs are needed: `forge test` runs only the no-fork Chainlink Local tests. ## Examine the code ### Setup To transfer tokens using CCIP, the test needs: - The local chain selector - The local CCIP router - A test token contract (CCIP-BnM) - A sender account (the broadcaster) - A receiver account The shared base contract `test/utils/LocalSimulatorTest.sol` deploys the simulator and exposes the router, LINK and BnM. The `setUp()` function is invoked before each test case to reinitialize all the variables, ensuring a clean state for each: 1. Initialize the [Chainlink Local simulator](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator#cciplocalsimulator) contract and read its [`configuration`](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator#configuration): ```solidity simulator = new CCIPLocalSimulator(); (uint64 selector, IRouterClient sourceRouter,,, LinkToken linkToken, BurnMintERC677Helper bnm,) = simulator.configuration(); ``` **Note**: The [`configuration`](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator#configuration) function also returns the destination router, WETH9 and CCIP-LnM contracts, which these tests do not use. Hence, there are commas in the return values. 2. The example scripts wrap their calls in `vm.startBroadcast()` with no argument, so inside a test the transaction sender is `DEFAULT_SENDER`. That account is exposed as `broadcaster` and must hold the tokens and ETH the script spends: ```solidity address internal broadcaster = DEFAULT_SENDER; ``` 3. `Example01Test.setUp()` funds the broadcaster with CCIP-BnM and creates the receiver: ```solidity function setUp() public override { super.setUp(); example = new Example01(); receiver = makeAddr("receiver"); ccipBnM.drip(broadcaster); } ``` ### Test case 1: Transfer with native fees The `test_transfersTokenToEoaPayingNativeFee` function tests the transfer of tokens to an EOA while paying the fee in native gas. Here are the steps involved: 1. Set the fee the local router charges and fund the broadcaster with native gas. The local router charges only what `router.setFee(...)` sets (default 0) and uses a mock message ID: ```solidity uint256 fee = 0.01 ether; router.setFee(fee); deal(broadcaster, 1 ether); ``` 2. Record the sender's initial token balance, then run the `Example01` script with the router, chain selector, receiver, token, amount, gas limit, block confirmations and fee token: ```solidity uint256 senderBefore = ccipBnM.balanceOf(broadcaster); bytes32 messageId = example.run( address(router), chainSelector, receiver, address(ccipBnM), AMOUNT, EOA_GAS_LIMIT, BLOCK_CONFIRMATIONS, address(0) ); ``` The constants used: ```solidity uint256 internal constant AMOUNT = 1e17; uint32 internal constant EOA_GAS_LIMIT = 0; uint16 internal constant BLOCK_CONFIRMATIONS = 5; ``` - `EOA_GAS_LIMIT` is `0` because the receiver is an EOA: there is no `ccipReceive` logic to execute. The sender is billed for the specified gas limit, not actual usage, so do not set a gas limit for token-only transfers. - `BLOCK_CONFIRMATIONS` is `5` (any value `> 0`): this requests a Fast Transfer, delivered before full chain finality. `0` would mean default finality. 3. Inside the script, the `ExtraArgsV3` are encoded with the `EncodeExtraArgsOffchain` helper, and the [Client.EVM2AnyMessage](/ccip/evm/api-reference/v2.0.0/client#evm2anymessage) is built with the receiver, token amounts, extraArgs and fee token: ```solidity EncodeExtraArgsOffchain extraArgsEncoder = new EncodeExtraArgsOffchain(); bytes memory extraArgs = extraArgsEncoder.encodeV3Basic(gasLimit, blockConfirmations); Client.EVMTokenAmount[] memory tokenAmounts = new Client.EVMTokenAmount[](1); tokenAmounts[0] = Client.EVMTokenAmount({token: tokenToSend, amount: amount}); Client.EVM2AnyMessage memory ccipMessage = Client.EVM2AnyMessage({ receiver: abi.encode(receiver), data: "", tokenAmounts: tokenAmounts, extraArgs: extraArgs, feeToken: feeTokenAddress }); ``` `encodeV3Basic` maps `blockConfirmations` to the `requestedFinalityConfig` with `FinalityCodec._encodeBlockDepth`. Read more about `extraArgs` formats in the [CCIP best practices](/ccip/evm/concepts/best-practices#using-extraargs). 4. The script quotes the fee, approves the router to spend the token, and sends. With `feeTokenAddress == address(0)` the fee is paid in native gas: ```solidity uint256 fee = IRouterClient(sourceRouter).getFee(destinationChainSelector, ccipMessage); vm.startBroadcast(); IERC20(tokenToSend).approve(sourceRouter, amount); messageId = IRouterClient(sourceRouter).ccipSend{value: fee}(destinationChainSelector, ccipMessage); vm.stopBroadcast(); ``` 5. The test verifies the transfer: the receiver was credited, the sender was debited, and the router collected the fee. Because local mode delivers synchronously inside `ccipSend`, the assertions run immediately after the script: ```solidity assertTrue(messageId != bytes32(0)); assertEq(ccipBnM.balanceOf(receiver), AMOUNT); assertEq(ccipBnM.balanceOf(broadcaster), senderBefore - AMOUNT); assertEq(address(router).balance, fee); ``` ### Test case 2: Transfer with LINK fees The `test_transfersTokenToEoaPayingLinkFee` function tests the same transfer paying the fee in LINK. The differences from the previous test case: 1. Fund the broadcaster with LINK from the simulator faucet instead of native gas: ```solidity simulator.requestLinkFromFaucet(broadcaster, 1 ether); ``` 2. Pass the LINK token address as the fee token, so the script approves and pays in LINK: ```solidity bytes32 messageId = example.run( address(router), chainSelector, receiver, address(ccipBnM), AMOUNT, EOA_GAS_LIMIT, BLOCK_CONFIRMATIONS, address(link) ); ``` 3. Verify the router collected the fee in LINK: ```solidity assertEq(link.balanceOf(address(router)), fee); ``` ### Revert test cases The remaining two test cases verify the CCIP 2.0 send-time rules the local router enforces: 1. `test_revertsWhenBlockConfirmationsIsZero` expects the script's own require message, because `0` means default finality, not a Fast Transfer: ```solidity vm.expectRevert("blockConfirmations == 0 means default finality; use > 0 for Faster Than Finality"); example.run(address(router), chainSelector, receiver, address(ccipBnM), AMOUNT, EOA_GAS_LIMIT, 0, address(0)); ``` 2. `test_revertsWhenAmountIsZero` expects the zero-amount rejection: ```solidity vm.expectRevert("amount must be > 0"); ``` ## Next steps - Send a data-only message to a receiver contract and see the local router enforce its CCV config and minimum block depth in the [receiver CCV config guide](/chainlink-local/build/ccip/foundry/data-messages-receiver-ccv-config). - For the other test files in the `./test` directory (`Example03.t.sol` programmable token transfers, `Example04.t.sol` sender contract, `Example05.t.sol` manual execution path), see the [CCIP starter kit examples map](/chainlink-local/learn/starter-kit-examples). - To learn how to use Chainlink Local in forked environments, refer to the guide on [Using the Chainlink Local Simulator in your Foundry project with forked environments](/chainlink-local/build/ccip/foundry/local-simulator-fork). --- # Pool-based CCV requirements on AdvancedPoolHooks in forked environments Source: https://docs.chain.link/chainlink-local/build/ccip/foundry/pool-based-ccvs-fork > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` This tutorial walks you through testing pool-based Cross-Chain Verifier (CCV) requirements on `AdvancedPoolHooks`, using the [CCIP Foundry Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-foundry)'s Example 09 (CCT 04). You will deploy a `CrossChainToken` with an `AdvancedPoolHooks` hook and a BurnMint pool on forks of *Ethereum Sepolia* and *Polygon Amoy*, configure the hook to require a CCV for transfers, and observe the source OnRamp consult it outbound and the destination OffRamp verify with it inbound. Pool-required CCVs are the one CCIP 2.0 feature that local mode cannot exercise at all: local mode has no token pools, so pool-required CCVs are not enforced. Only the fork tests run them against the real OnRamp and OffRamp. ## How pool-based CCVs work A token pool can require specific CCVs for its transfers. When a pool requires CCVs: - the source OnRamp consults the pool's `getRequiredCCVs(...)` outbound and calls each CCV's `getOutboundImplementation` and `forwardToVerifier` on the source chain - the destination OffRamp resolves the same CCV addresses on the destination chain and calls `getInboundImplementation` and `verifyMessage` before releasing or minting tokens Because the destination OffRamp resolves the same address, **a pool-required CCV must exist at the same address on both chains**. Real CCVs are CREATE2-deployed to matching addresses on each chain. `AdvancedPoolHooks` exposes this through per-remote-chain CCV configs: - `outboundCCVs` / `inboundCCVs`: base CCVs, always required for transfers to/from that chain - `thresholdOutboundCCVs` / `thresholdInboundCCVs`: additional CCVs, required only when the transfer amount is at or above `thresholdAmountForAdditionalCCVs` - `address(0)` in a base list means "use the lane defaults alongside the other listed CCVs" Threshold CCV lists require non-empty base lists (use `address(0)` in the base list if you want defaults below the threshold). Duplicates within and across lists are rejected. ## Prerequisites > **NOTE: Prerequisites** > > Complete the [CCT burn and mint tutorial](/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork) first: it covers > the kit setup, the keystore, the fork profile, and the Example 06 deployment and lane-linking scripts this tutorial > reuses. Example 09 continues the setup from Example 08 (token + hook + pool with `AdvancedPoolHooks`). ## Run the fork test The kit's `test/fork/Example09.fork.t.sol` runs this flow against pinned forks of the live testnets. The file contains five test cases: 1. **Config storage**: `applyCCVConfigUpdates` stores the CCV config on both hooks. 2. **Both-sides consultation**: A transfer succeeds end to end while the source OnRamp consults the CCV outbound and the destination OffRamp verifies with it inbound. 3. **Threshold CCVs**: Threshold CCVs are required only at or above the threshold amount. 4. **Clearing**: Re-running the config script with empty lists removes the config. 5. **Validation**: Threshold CCVs without base CCVs revert with `MustSpecifyUnderThresholdCCVsForThresholdCCVs`. In your terminal, run the following command to execute the test: ```shell FOUNDRY_PROFILE=fork forge test --match-contract Example09ForkTest -j 1 ``` Example output: ```text $ FOUNDRY_PROFILE=fork forge test --match-contract Example09ForkTest -j 1 Ran 5 tests for test/fork/Example09.fork.t.sol:Example09ForkTest [PASS] test_send_poolRequiredCCVIsConsultedOnBothSides() (gas: 2304798) [PASS] test_send_thresholdCCVsAreRequiredAboveThresholdAmount() (gas: 4369395) [PASS] test_setPoolCCVConfig_clearingWithEmptyListsRemovesConfig() (gas: 380961) [PASS] test_setPoolCCVConfig_revertsWhenThresholdCCVsHaveNoBaseCCVs() (gas: 64126) [PASS] test_setPoolCCVConfig_storesConfigOnBothHooks() (gas: 528563) Suite result: ok. 5 passed; 0 failed; 0 skipped; finished in 2.19s (13.67ms CPU time) Ran 1 test suite in 2.20s (2.19s CPU time): 5 tests passed, 0 failed, 0 skipped (5 total tests) ``` ## Examine the code ### Setup The shared base contract `test/fork/utils/AdvancedPoolHooksForkTest.sol` extends the CCT fork setup: it deploys a `CrossChainToken`, an `AdvancedPoolHooks` hook and a BurnMint pool on both forks, and links the lanes, so each Example 08-10 test file only adds the hook feature it covers. The hook is deployed with `thresholdAmountForAdditionalCCVs = 1`, so threshold CCVs are effectively always required until you raise the threshold. `Example09ForkTest.setUp()` adds the CCV. The test deploys a `CountingCCV` (a no-op CCV that counts consultations and verifications) once and makes it persistent, so it exists at the same address on both chains: ```solidity vm.selectFork(sepoliaFork); ccv = CountingCCV(_persistent(address(new CountingCCV()))); thresholdCCV = CountingCCV(_persistent(address(new CountingCCV()))); ``` Real CCVs are CREATE2-deployed to matching addresses on each chain; the persistent test contract achieves the same property. Like the simulator's own CCVs, it performs no real verification. ### Configure the CCV on both hooks The `Example09SetPoolCCVConfig` script wraps `AdvancedPoolHooks.applyCCVConfigUpdates`. The test requires the CCV for both outbound and inbound traffic on each side of the lane: ```solidity _setCCVConfig(sepoliaFork, sepoliaHook, amoy.chainSelector, address(ccv)); _setCCVConfig(amoyFork, amoyHook, sepolia.chainSelector, address(ccv)); ``` `test_setPoolCCVConfig_storesConfigOnBothHooks` then reads the config back from both hooks and asserts the CCV appears in the outbound and inbound lists. ### Observe the CCV consulted on both sides `test_send_poolRequiredCCVIsConsultedOnBothSides` sends a default-finality transfer Sepolia → Amoy and routes it with `switchChainAndRouteMessage`, then asserts three things: ```solidity _sendDefaultFinalityAndRoute(sepoliaToken, TRANSFER_AMOUNT); // The transfer still succeeds end to end. assertEq(_balanceOnFork(amoyFork, amoyToken, receiver), TRANSFER_AMOUNT); assertEq(_supplyOnFork(amoyFork, amoyToken), destinationSupplyBefore + TRANSFER_AMOUNT); // The source OnRamp consulted the CCV outbound (getOutboundImplementation + forwardToVerifier). vm.selectFork(sepoliaFork); assertEq(ccv.outboundConsultations(), 1, "source OnRamp did not consult the pool-required CCV"); // The destination OffRamp verified the message inbound (getInboundImplementation + verifyMessage). vm.selectFork(amoyFork); assertEq(ccv.inboundVerifications(), 1, "destination OffRamp did not verify with the pool-required CCV"); ``` The counters prove the pool-required CCV participated on both chains: one outbound consultation on the source, one inbound verification on the destination. ### Threshold CCVs `test_send_thresholdCCVsAreRequiredAboveThresholdAmount` configures base CCVs plus threshold CCVs, then moves the threshold around the transfer amount: ```solidity // Raise the threshold above the transfer amount: only the base CCV is required. _setThreshold(sepoliaFork, sepoliaHook, TRANSFER_AMOUNT + 1); _setThreshold(amoyFork, amoyHook, TRANSFER_AMOUNT + 1); _setCCVConfigWithThreshold(sepoliaFork, sepoliaHook, amoy.chainSelector, address(ccv), address(thresholdCCV)); _setCCVConfigWithThreshold(amoyFork, amoyHook, sepolia.chainSelector, address(ccv), address(thresholdCCV)); _sendDefaultFinalityAndRoute(sepoliaToken, TRANSFER_AMOUNT); vm.selectFork(sepoliaFork); assertEq(thresholdCCV.outboundConsultations(), 0, "threshold CCV consulted below threshold"); // Now lower the threshold to 1 wei: the same transfer amount requires the threshold CCV too. _setThreshold(sepoliaFork, sepoliaHook, 1); _setThreshold(amoyFork, amoyHook, 1); _sendDefaultFinalityAndRoute(sepoliaToken, TRANSFER_AMOUNT); vm.selectFork(sepoliaFork); assertEq(thresholdCCV.outboundConsultations(), 1, "threshold CCV not consulted at/above threshold"); ``` The same transfer amount flips between requiring and not requiring the threshold CCV as the threshold moves, on both the outbound and inbound side. ## Run the same flow on a live testnet The kit's book chapter lists the script commands for the live-testnet flow: deploy the token, hook and pool on both chains (Example 08 steps), set the pool CCV config on both hooks with `Example09SetPoolCCVConfig`, send with the Example 06 sender, adjust the threshold with `Example09SetThresholdAmount`, and clear the config by re-running the config script with empty lists. See the [Example 09 chapter](https://smartcontractkit.github.io/ccip-starter-kit-foundry/examples/example09-cct04-pool-based-ccvs-on-advanced-pool-hooks.html) of the kit's book. > **NOTE: Real CCVs** > > The starter kit does not deploy a real CCV; its tests use a counting no-op CCV. To try pool-based CCVs end to end on > the live testnets, deploy your own CCV with the [CCV starter kit](https://docs.chain.link/ccip/ccv-starter-kit) and > use its resolver address as the CCV address. Use the resolver address, not the committee verifier implementation: a > pool that lists the implementation address reverts during the fee quote. ## Next steps - Example 10 attaches an ACE policy engine to the same hook (`Example10.fork.t.sol`); see [Enforce ACE policies](/ccip/evm/tutorials/cross-chain-tokens/enforce-ace-policies-foundry) for the live-testnet flow. - Example 08 covers the sender allowlist on the same hook; see [Configure a sender allowlist](/ccip/evm/tutorials/cross-chain-tokens/configure-sender-allowlist-advanced-pool-hooks-foundry). - For an index of every kit example and where its topic is documented, read the [CCIP starter kit examples map](/chainlink-local/learn/starter-kit-examples). --- # Sending data to a receiver with CCV config in your Hardhat project Source: https://docs.chain.link/chainlink-local/build/ccip/hardhat/data-messages-receiver-ccv-config > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` This guide walks you through the CCIP 2.0 receiver-side finality rules in local mode, using the [CCIP Hardhat Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-hardhat)'s Example 02. You will send a data-only message to a `BasicMessageReceiverWithCCVs` contract with Fast Transfers, and see the local router reject it when the requested block confirmations fall below the receiver's minimum block depth. The Example 01 guide covers a token-only transfer to an EOA, which is exactly the case that skips the receiver finality check. This guide covers the opposite case: a message with data and a receiver contract, where the local router reads the receiver's `getCCVsAndFinalityConfig` and enforces its allowed finality, reproducing the CCIP 2.0 OffRamp check. Read [CCIP 2.0 behavior in local mode](/chainlink-local/learn/ccip-v2-local) for the full rule list. > **NOTE: Hardhat 3 required** > > Chainlink Local `0.3.x` does not compile under Hardhat 2. Hardhat 2 users stay on the `0.2.x` line (`npm install > @chainlink/local@0.2.9`). ## Prerequisites Complete the [Hardhat local simulator guide](/chainlink-local/build/ccip/hardhat/local-simulator) first: it covers cloning the kit, `npm install`, and the `setupLocalSimulator` helper this guide builds on. ## Test data messages to a receiver with CCV config The test file `Example02.test.ts` is located in the `./test` directory. It calls the real Example 02 task actions (`tasks/Example02.ts` and `tasks/helpers/SetBasicMessageReceiverWithCCVsMinBlockDepth.ts`) against the Chainlink Local simulator. The file contains nine test cases: 1. **Deploy**: The receiver is wired to the router and owned by the deployer. 2. **Deliver above the minimum depth**: A Fast Transfer with confirmations above the receiver's `minBlockDepth` is delivered. 3. **Deliver at the minimum depth**: Confirmations equal to `minBlockDepth` are also delivered. 4. **Deliver with default finality**: A message with `blockConfirmations = 0` is delivered even when no `minBlockDepth` is set. 5. **Deliver with a CCV config applied**: A receiver with required and optional CCVs still gates on `minBlockDepth`. 6. **Revert below the minimum depth**: Confirmations below `minBlockDepth` revert with `InvalidRequestedFinality`. 7. **Revert when the minimum depth is unset**: Without a configured depth, the receiver accepts finalized messages only. 8. **Argument validation**: The tasks reject a zero source chain selector and a zero receiver. In your terminal, run the following command to execute the test: ```shell npx hardhat test nodejs ``` Example output: ```text $ npx hardhat test nodejs Example02 ✔ deploys the receiver wired to the router and owned by the deployer (644ms) ✔ delivers the message when confirmations are above the min block depth (285ms) ✔ delivers the message when confirmations equal the min block depth (347ms) ✔ delivers a message with default finality (0 confirmations) even when no min block depth is set (165ms) ✔ delivers the message when the receiver has a CCV config applied (223ms) ✔ reverts when confirmations are below the min block depth (141ms) ✔ reverts when the min block depth is unset, so only full finality is accepted (137ms) ✔ set-min-block-depth task rejects a zero source chain selector ✔ rejects a zero receiver ... ``` ## Examine the code ### The receiver contract `contracts/BasicMessageReceiverWithCCVs.sol` extends `BasicMessageReceiver` with a per-source-chain CCV and finality policy. Two settings matter for this guide: - `setMinBlockDepth(sourceChainSelector, minBlockDepth)`: the minimum block depth the receiver accepts for Fast Transfers from that chain. `0` means the receiver requires default finality (fully finalized messages only). - `getCCVsAndFinalityConfig(sourceChainSelector, sender)`: the CCIP 2.0 receiver interface the OffRamp calls for every message that is not a token-only transfer. The kit's receiver returns its stored CCV config and encodes `minBlockDepth` as the allowed finality with `FinalityCodec._encodeBlockDepth`. ### Setup The `beforeEach` hook deploys the receiver through the same Ignition module the kit's book uses for live-testnet deployments, so the test exercises the real deployment path: ```typescript s = await setupLocalSimulator() const { basicMessageReceiverWithCCVs } = await s.connection.ignition.deploy(BasicMessageReceiverWithCCVsModule, { parameters: { BasicMessageReceiverWithCCVsModule: { routerAddress: s.router.address } }, }) receiver = await s.viem.getContractAt("BasicMessageReceiverWithCCVs", basicMessageReceiverWithCCVs.address) ``` The helper functions wrap the two task actions the test drives: ```typescript const setMinBlockDepth = (minBlockDepth: number, sourceChainSelector = s.chainSelector) => quietly(() => setMinBlockDepthAction({ receiver: receiver.address, sourceChainSelector, minBlockDepth }, s.taskHre)) const send = (blockConfirmations: number, overrides: { receiver?: string } = {}) => quietly(() => example02Action( { sourceRouter: s.router.address, destinationChainSelector: s.chainSelector, receiver: overrides.receiver ?? receiver.address, messageText: MESSAGE_TEXT, gasLimit: GAS_LIMIT, blockConfirmations, feeTokenAddress: ZERO_ADDRESS, }, s.taskHre ) ) ``` The constants used: ```typescript const MESSAGE_TEXT = "Hello CCIP 2.0" const GAS_LIMIT = 200_000 ``` `GAS_LIMIT` must be `> 0`: the receiver has a `ccipReceive` callback to execute, unlike the EOA receiver of Example 01. ### Deliver when confirmations meet the minimum depth The `delivers the message when confirmations are above the min block depth` test case sets the receiver's minimum depth to `3` and sends with `5` confirmations: ```typescript await setMinBlockDepth(3) await send(5) assert.notEqual(await receiver.read.latestMessageId(), `0x${"00".repeat(32)}`) assert.equal(await receiver.read.latestSourceChainSelector(), s.chainSelector) assert.equal((await receiver.read.latestSender()).toLowerCase(), s.broadcaster.account.address.toLowerCase()) assert.equal(await receiver.read.latestMessage(), encodeAbiParameters([{ type: "string" }], [MESSAGE_TEXT])) ``` Inside the send, the local router parses the `ExtraArgsV3` requested finality, sees the message has data (not a token-only transfer), and calls the receiver's `getCCVsAndFinalityConfig`. The receiver's allowed finality is `FinalityCodec._encodeBlockDepth(3)`; the requested `5` is at least that, so the message is delivered synchronously and the assertions read the receiver's stored state directly. The `delivers the message when confirmations equal the min block depth` test case sends with exactly `3` confirmations and passes: the check is inclusive. ### Revert when confirmations fall below the minimum depth The `reverts when confirmations are below the min block depth` test case sends with `2` confirmations against a minimum depth of `3`. The local router rejects the send with the same error the production OffRamp records: ```typescript await setMinBlockDepth(3) await expectInvalidFinality(send(2), blockDepth(2), blockDepth(3)) ``` `expectRevertWithError` decodes the revert data and asserts the exact custom error and arguments. `blockDepth(n)` is the finality encoding of a block-depth request, `bytes4(uint32(n))`: ```typescript const blockDepth = (n: number) => `0x${n.toString(16).padStart(8, "0")}` ``` The error carries both sides of the comparison: the requested finality (`0x00000002`) and the allowed finality (the receiver's minimum depth, `0x00000003`). The `reverts when the min block depth is unset, so only full finality is accepted` test case shows the default: with no depth configured, the receiver's allowed finality is `WAIT_FOR_FINALITY` (`0x00000000`), so any Fast Transfer request reverts: ```typescript await expectInvalidFinality(send(1), blockDepth(1), WAIT_FOR_FINALITY) ``` A message with `blockConfirmations = 0` (default finality) is still delivered in this state, which the `delivers a message with default finality` test case verifies. ### Deliver with a CCV config applied The `delivers the message when the receiver has a CCV config applied` test case configures the receiver with required and optional CCVs through `applyCCVConfigUpdates`, then verifies the finality gate still applies on top: ```typescript await receiver.write.applyCCVConfigUpdates([ [ { requiredCCVs: ["0x00000000000000000000000000000000000000a1"], optionalCCVs: ["0x00000000000000000000000000000000000000b1", "0x00000000000000000000000000000000000000b2"], sourceChainSelector: s.chainSelector, optionalThreshold: 1, }, ], ]) await setMinBlockDepth(3) await send(3) assert.notEqual(await receiver.read.latestMessageId(), `0x${"00".repeat(32)}`) await expectInvalidFinality(send(2), blockDepth(2), blockDepth(3)) ``` Local mode has no CCV verifiers, so it cannot check quorum. It does validate the config itself (duplicate CCVs, `optionalThreshold` beyond the optional list length) the same way the OffRamp does, so a receiver configured this way is accepted by the router-side validation and keeps gating on the minimum block depth. ## Run the same flow on a live testnet The kit's book chapter lists the task commands for the live-testnet flow: deploy the receiver with Ignition on the destination chain, set its minimum block depth with the `set-basic-message-receiver-with-ccvs-min-block-depth` task, then send the data message with the `example02` task. See the [Example 02 chapter](https://smartcontractkit.github.io/ccip-starter-kit-hardhat/examples/example02-hello-world-to-basic-message-receiver.html) of the kit's book. ## Next steps - `Example03.test.ts` combines this receiver-side gating with a token transfer (data + tokens in one message). - To see the receiver finality rules enforced by the real OffRamp instead of the local router, read the [forked environments guide](/chainlink-local/build/ccip/hardhat/local-simulator-fork). - For an index of every kit example and where its topic is documented, read the [CCIP starter kit examples map](/chainlink-local/learn/starter-kit-examples). --- # Using Chainlink Local to Test CCIP in Your Hardhat Project Source: https://docs.chain.link/chainlink-local/build/ccip/hardhat > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` There are three guides to help you test Chainlink CCIP 2.0 in your Hardhat project using Chainlink Local - two for local mode and one for forked environments. The guides use the [CCIP Hardhat Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-hardhat) (Hardhat 3), whose CCIP 2.0 examples (`Example01`-`Example10`) run as Hardhat tasks and Ignition modules on the Ethereum Sepolia → Polygon Amoy lane. Read [CCIP 2.0 behavior in Chainlink Local](/chainlink-local/learn/ccip-v2-local) to understand what the simulator enforces in each mode, or the [CCIP starter kit examples map](/chainlink-local/learn/starter-kit-examples) for an index of every kit example. ## Guides ### Using Chainlink Local Simulator in your Hardhat project This [guide](/chainlink-local/build/ccip/hardhat/local-simulator) helps you set up and run CCIP 2.0 in a localhost environment within your Hardhat project. It provides step-by-step instructions on : - Cloning the [CCIP Hardhat Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-hardhat) - Installing necessary dependencies - Running tests for token transfers between two accounts using `ExtraArgsV3` with Fast Transfers Using the local simulator without forking is ideal for initial development and testing in an isolated environment. ### Sending data to a receiver with CCV config This [guide](/chainlink-local/build/ccip/hardhat/data-messages-receiver-ccv-config) covers the receiver-side finality rules in local mode: a data-only message to a `BasicMessageReceiverWithCCVs` contract, where the local router enforces the receiver's minimum block depth for Fast Transfers. ### Using Chainlink Local Simulator in your Hardhat project with forked environments This [guide](/chainlink-local/build/ccip/hardhat/local-simulator-fork) extends your testing capabilities by demonstrating how to use the Chainlink Local Simulator in a forked environment. It includes instructions on: - Setting up forks of real blockchain networks (Ethereum Sepolia and Polygon Amoy, a live CCIP 2.0 lane) - Routing messages across forks with the Hardhat 3 JavaScript fork helper for every CCIP era - Running the CCT fork tests (token and pool deployment, registration, Faster Than Finality gates) Using the local simulator with forked environments is ideal for testing in a more realistic yet controlled setting. --- # Using Chainlink Local Simulator in Your Hardhat Project - Forked Environments Source: https://docs.chain.link/chainlink-local/build/ccip/hardhat/local-simulator-fork > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` You can use Chainlink Local to run CCIP 2.0 in forked environments within your Hardhat 3 project. To get started quickly, you will use the [CCIP Hardhat Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-hardhat). The kit's `test-fork` directory contains fork tests for the CCT examples (`Example06`-`Example10`), which run the real Ignition modules and tasks against pinned forks of *Ethereum Sepolia* and *Polygon Amoy* (a live CCIP 2.0 lane) and route each message to the destination OffRamp with the Chainlink Local JavaScript fork helper (`@chainlink/local/scripts/CCIPLocalSimulatorFork.js`). The helper routes messages for every CCIP era: pre-1.6 (`EVM2EVMOnRamp`), 1.6 and CCIP 2.0 (CCV-based lanes, which live testnet lanes run today). On CCIP 2.0 lanes the destination OffRamp selects the CCVs and executes the message through the permissionless `execute` entrypoint; CCV attestations are simulated with a synthetic no-op verifier. ## Prerequisites This guide assumes that you are familiar with the guide [Using Chainlink Local Simulator in Your Hardhat Project](/chainlink-local/build/ccip/hardhat/local-simulator). If not, please get familiar with it and run all the prerequisites. Fork tests have three requirements beyond the no-fork setup: 1. **Node.js 22 and the `@nomicfoundation/hardhat-ethers` plugin**, which the JavaScript fork helper uses (`connection.ethers`). The kit already registers the plugin in `hardhat.config.ts`. 2. **Archive-capable RPC URLs for both chains.** A free-tier Alchemy or Infura endpoint works; public non-archive endpoints fail with "historical state is not available". Provide them as environment variables or in the Hardhat keystore: ```shell npx hardhat keystore set ETHEREUM_SEPOLIA_RPC_URL npx hardhat keystore set POLYGON_AMOY_RPC_URL ``` 3. **The `production` build profile**: the token pools exceed the 24 KB contract size limit without the optimizer. The kit's `test:fork` script sets it. The fork networks are defined in `hardhat.config.ts` with pinned blocks, so a fresh clone runs the same chain state: ```ts sepoliaFork: { type: "edr-simulated", chainType: "generic", chainId: 11155111, forking: { url: configVariable("ETHEREUM_SEPOLIA_RPC_URL"), blockNumber: Number(process.env.ETHEREUM_SEPOLIA_FORK_BLOCK ?? 11_920_292), }, }, ``` Override the pins for a run with `ETHEREUM_SEPOLIA_FORK_BLOCK` / `POLYGON_AMOY_FORK_BLOCK`, for example to check whether the live lane has drifted. ## Test a CCT transfer across a CCIP 2.0 lane You will run the fork test for Example 06 (CCT 01: `CrossChainToken` + BurnMint pool). The test file `Example06.fork.test.ts` is located in the `./test-fork` directory. It deploys a custom token and pool on both forks through the kit's Ignition module, registers them in the live TokenAdminRegistry, links the pools, and sends token transfers across the Sepolia → Amoy CCIP 2.0 lane. The file contains seven test cases, including: 1. **Deploy**: Creates the token and pool and registers them on both chains. 2. **Configure lane**: Sets the remote token and pool. 3. **Send with default finality**: Burns on the source and mints on the destination. 4. **Send with Faster Than Finality**: Reverts until the pool opts in, then delivers after both pools opt in. In your terminal, run the following command to execute the test: ```shell npm run test:fork ``` Example output: ```text $ npm run test:fork Example06 (fork) ✔ deploy creates the token and pool and registers them (1962ms) ✔ configureLane sets the remote token and pool (1200ms) ✔ configureLane rerun replaces the existing config (1167ms) ✔ send at default finality burns on the source and mints on the destination (1338ms) ✔ send with Faster Than Finality reverts until the pool opts in (1328ms) ✔ send with Faster Than Finality delivers after both pools opt in (1441ms) ✔ check-finality-gates finds the registered pool (1105ms) ... 27 passing (36481ms) ``` ## Examine the code ### Setup The shared setup lives in `test-fork/utils/cctFork.ts`. To route messages across forks, the test needs: - A fork connection for the source chain (Ethereum Sepolia) and the destination chain (Polygon Amoy) - The chain details (routers, RMN proxy, registries) for both chains - A sender account (the broadcaster, Hardhat wallet 0) and a receiver account The `setupForks()` function: 1. Connects to both fork networks and wraps each connection in a `Fork` object with the chain details, the public client, the broadcaster, and a `taskHre` whose `connect()` returns that fork (for running the example tasks against it): ```typescript const sepolia = await connectFork("sepoliaFork", SEPOLIA) const amoy = await connectFork("amoyFork", AMOY) ``` The chain details (routers, RMN proxy, registries) are copied from `@chainlink/local`'s `RegisterData.sol`: ```typescript export const SEPOLIA = { chainSelector: 16015286601757825753n, routerAddress: "0x0BF3dE8c5D3e8A2B34D2BEeB17ABfCeBaf363A59", rmnProxyAddress: "0xba3f6251de62dED61Ff98590cB2fDf6871FbB991", registryModuleOwnerCustomAddress: "0xa3c796d480638d7476792230da1E2ADa86e031b0", tokenAdminRegistryAddress: "0x95F29FEE11c5C55d26cCcf1DB6772DE953B37B82", } as const ``` 2. Verifies the lane is the CCIP 2.0 lane the test expects. The test fails with a clear message if the pinned block or the lane is not what it describes: ```typescript const onRamp = await sepolia.publicClient.readContract({ address: SEPOLIA.routerAddress, abi: routerOnRampAbi, functionName: "getOnRamp", args: [AMOY.chainSelector], }) assert.notEqual(onRamp, ZERO_ADDRESS, "Sepolia router has no OnRamp for Amoy at the pinned block") assert.equal( await sepolia.publicClient.readContract({ address: onRamp, abi: typeAndVersionAbi, functionName: "typeAndVersion", }), "OnRamp 2.0.0", "Sepolia -> Amoy is not a CCIP 2.0 lane" ) ``` 3. Deploys the kit's Ignition module on each fork with the per-chain parameters (router, RMN proxy, registries): ```typescript return (await fork.connection.ignition.deploy(module, { parameters: { $global: { routerAddress: fork.details.routerAddress, armProxy: fork.details.rmnProxyAddress, registryModuleOwnerCustom: fork.details.registryModuleOwnerCustomAddress, tokenAdminRegistry: fork.details.tokenAdminRegistryAddress, thresholdAmountForAdditionalCCVs: THRESHOLD, }, }, })) as Record ``` ### Send and route the message The `sendAndRoute()` helper shows the two-step flow used by every fork test: 1. On the source fork, run the book's send task. It builds an `ExtraArgsV3` message and calls `ccipSend` through the Sepolia router: ```typescript await quietly(() => sendAction( { sourceRouter: SEPOLIA.routerAddress, destinationChainSelector: AMOY.chainSelector, receiver: forks.receiver, tokenToSend: token, amount, gasLimit: EOA_RECEIVER_GAS_LIMIT, blockConfirmations, feeTokenAddress: ZERO_ADDRESS, }, forks.sepolia.taskHre ) ) ``` 2. Fetch the `ccipSend` transaction receipt and extract the CCIP message with [`getCCIPMessages`](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork-js#getccipmessages), then route it on the destination connection with [`routeMessage`](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork-js#routemessage): ```typescript const receipt = await sepolia.connection.ethers.provider.getTransactionReceipt(sendTx.hash) const [sent] = getCCIPMessages(sepolia.connection, receipt) return routeMessage(amoy.connection, AMOY.routerAddress, sent) ``` `getCCIPMessages` parses the send event for every CCIP era and returns a `CCIPSentMessage` (for CCIP 2.0, the raw `encodedMessage` and the receipts). `routeMessage` finds the destination OffRamp that serves the lane, points owner-configurable CCV resolvers at a synthetic no-op verifier, and executes the message through the OffRamp's permissionless `execute`. It returns `{ offRamp, executed, reason }` and throws if no OffRamp serves the lane or the execution fails (receiver revert, finality or CCV rejection). When the destination chain has a dedicated CCIP 2.0 router, pass both routers so both routers' OffRamps are searched. For example, when the destination is Ethereum Sepolia, which has a dedicated CCIP 2.0 router: ```typescript routeMessage(sepolia.connection, [SEPOLIA.routerAddress, CCIP_V2_ROUTERS[11155111]], sent) ``` ### Faster Than Finality across the lane The `send with Faster Than Finality delivers after both pools opt in` test case shows the CCIP 2.0 finality gates on a real lane: 1. New pools allow full finality only, so any block-depth request is rejected by the pool. The test first asserts the pool's default and expects the send to revert. 2. Opt both pools in by setting their allowed finality config (through the kit's `Example06-SetPoolFinality` task), then find the smallest depth the live lane accepts by quoting `getFee` for candidate depths: ```typescript export async function findLaneFtfDepth(forks: Forks, token: Address): Promise { for (const depth of [1, 2, 3, 5, 10, 20, 50, 100]) { /* quote getFee with blockConfirmations: depth; return the first depth that does not revert */ } } ``` 3. Send with the custom finality (`blockConfirmations = depth`) and route. The transfer burns on the source and mints on the destination, same as the default-finality case, but delivered before full finality. ## What the fork helper does not model Not modelled by the helper (and not asserted in the kit's fork tests): real CCV attestations, RMN and executor fees. CCVs on the lane are replaced by a synthetic verifier, and a manual execution does not charge the executor fee a real one costs. Pinned state never sees testnet upgrades, so green tests only prove the examples against that snapshot; re-pin the fork blocks when the lane's behavior changes or on every `@chainlink/contracts-ccip` or `@chainlink/local` bump. ## Next steps - The other fork tests cover Lock & Release pools with a lock box (`Example07.fork.test.ts`), `AdvancedPoolHooks` (`Example08`-`Example10`). For pool-required CCVs on `AdvancedPoolHooks` in Foundry fork tests, read the [pool-based CCVs tutorial](/chainlink-local/build/ccip/foundry/pool-based-ccvs-fork). - For the full CCT enabling procedure with the kit's tasks and Ignition modules, read the [CCT burn and mint tutorial](/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork) (the flow is the same in Hardhat; the kit's book chapters list the Hardhat task commands). - For an index of every kit example and where its topic is documented, read the [CCIP starter kit examples map](/chainlink-local/learn/starter-kit-examples). --- # Using Chainlink Local simulator in your Hardhat project Source: https://docs.chain.link/chainlink-local/build/ccip/hardhat/local-simulator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` You can use Chainlink Local to run CCIP 2.0 in a localhost environment within your Hardhat project. To get started quickly, you will use the [CCIP Hardhat Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-hardhat). This project is a Hardhat 3 boilerplate that includes the Chainlink Local package (V3, `v0.3.1`) and CCIP 2.0 examples (`Example01`-`Example10`) as Hardhat tasks and Ignition modules. In local mode, the simulator delivers messages synchronously inside `ccipSend` and applies the CCIP 2.0 OnRamp and OffRamp message rules: finality, one token per message, no zero amounts, and receiver CCV config validation. Read [CCIP 2.0 behavior in local mode](/chainlink-local/learn/ccip-v2-local) for the full list of what is and is not enforced. > **NOTE: Hardhat 3 required** > > Chainlink Local `0.3.x` does not compile under Hardhat 2 (the contracts use `@openzeppelin/contracts@4.8.3`-style > imports that Hardhat 2 cannot resolve, `HH411`). Hardhat 2 users stay on the `0.2.x` line (`npm install > @chainlink/local@0.2.9`). ## Prerequisites 1. In a terminal, clone the [CCIP Hardhat Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-hardhat) repository and change directories: ```shell git clone https://github.com/smartcontractkit/ccip-starter-kit-hardhat.git && \ cd ./ccip-starter-kit-hardhat/ ``` 2. Install the dependencies, including the [Chainlink Local](https://github.com/smartcontractkit/chainlink-local) package: ```shell npm install ``` 3. Compile the contracts: ```shell npx hardhat build ``` The kit pins `solc 0.8.26` with `evmVersion: "cancun"` in `hardhat.config.ts`. CCIP 2.0 contracts need Cancun opcodes, so keep that setting in your own project. Contracts from npm packages (including the Chainlink Local simulator) are only compiled if listed in `solidity.npmFilesToBuild`. ## Test token transfers You will run a test that transfers tokens between two accounts using `ExtraArgsV3` with Fast Transfers (non-zero block confirmations). The test file `Example01.test.ts` is located in the `./test` directory. It calls the real `example01` task action (`tasks/Example01.ts`) against the Chainlink Local simulator, so a regression in the task fails the test. The file contains four test cases: 1. **Transfer with native fees**: Transfers CCIP-BnM from the sender to a receiver EOA, paying the fee in native gas, and verifies the receiver was credited and the router collected the fee. 2. **Transfer with LINK fees**: Same transfer, paying the fee in LINK. 3. **Revert on zero amount**: The task rejects a zero amount before sending anything. 4. **Revert on zero receiver**: The task rejects a zero receiver. For a detailed explanation of the test file, refer to the [Examine the code](#examine-the-code) section. In your terminal, run the following command to execute the test: ```shell npx hardhat test nodejs ``` Example output: ```text $ npx hardhat test nodejs Example01 ✔ transfers token to an EOA paying the fee in native (1048ms) ✔ transfers token to an EOA paying the fee in LINK (166ms) ✔ rejects a zero amount before sending anything (105ms) ✔ rejects a zero receiver (96ms) ... 51 passing (3392ms) ``` No RPC URLs or keys are needed: the tests in `test/` run against the in-process Chainlink Local simulator. ## Examine the code ### Setup The shared setup lives in `test/utils/localSimulator.ts`. Each call to `setupLocalSimulator()` returns an isolated in-process chain with the simulator deployed: 1. Connect to the in-process network and deploy the [Chainlink Local simulator](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator#cciplocalsimulator) contract: ```typescript const connection = await hre.network.connect() const { viem } = connection const simulator = await viem.deployContract("CCIPLocalSimulator") ``` 2. Read the simulator's [`configuration`](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator#configuration) and connect to the router, LINK and CCIP-BnM contracts: ```typescript const [chainSelector, routerAddress, , , linkAddress, bnmAddress] = await simulator.read.configuration() const router = await viem.getContractAt("CCIPLocalRouter", routerAddress) const link = await viem.getContractAt("LinkToken", linkAddress) const ccipBnM = await viem.getContractAt("BurnMintERC677Helper", bnmAddress) ``` **Note**: The [`configuration`](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator#configuration) call also returns the destination router, WETH9 and CCIP-LnM contracts, which these tests do not use. Hence, there are empty slots in the destructured array. 3. The example tasks open their own connection with `hre.network.connect()`, which would be a fresh chain. The setup hands them an hre whose `connect()` returns the test's connection instead, and exposes the first Hardhat wallet as `broadcaster` (the account every example task sends from): ```typescript const taskHre = Object.create(hre, { network: { value: { connect: async () => connection } } }) as typeof hre ``` 4. `Example01`'s `beforeEach` funds the broadcaster with CCIP-BnM and picks the receiver: ```typescript s = await setupLocalSimulator() receiver = s.other.account.address await s.ccipBnM.write.drip([s.broadcaster.account.address]) ``` ### Test case 1: Transfer with native fees The `transfers token to an EOA paying the fee in native` test case: 1. Set the fee the local router charges. The local router charges only what `router.write.setFee(...)` sets (default 0) and uses a mock message ID: ```typescript const fee = 10n ** 16n await s.router.write.setFee([fee]) const senderBefore = await s.ccipBnM.read.balanceOf([s.broadcaster.account.address]) ``` 2. Run the task with the router, chain selector, receiver, token, amount, gas limit, block confirmations and fee token. The constants used: ```typescript const AMOUNT = 10n ** 17n const EOA_GAS_LIMIT = 0 const BLOCK_CONFIRMATIONS = 5 ``` - `EOA_GAS_LIMIT` is `0` because the receiver is an EOA: there is no `ccipReceive` logic to execute. The sender is billed for the specified gas limit, not actual usage, so do not set a gas limit for token-only transfers. - `BLOCK_CONFIRMATIONS` is `5` (any value `> 0`): this requests a Fast Transfer, delivered before full chain finality. `0` would mean default finality. ```typescript await run() ``` where `run()` calls the task action with `feeTokenAddress: ZERO_ADDRESS` and the test's `taskHre`. 3. Inside the task, the `ExtraArgsV3` are encoded with the `encodeV3Basic` helper (`scripts/CallEncodeExtraArgsOffchain.ts`), and the [Client.EVM2AnyMessage](/ccip/evm/api-reference/v2.0.0/client#evm2anymessage) is built with the receiver, token amounts, extraArgs and fee token: ```typescript const params: EncodeV3Params = { gasLimit, blockConfirmations } const extraArgs = await encodeV3Basic(params) const ccipMessage = { receiver: receiverEncoded, data: "0x" as `0x${string}`, tokenAmounts, extraArgs, feeToken: feeTokenAddress, } ``` `encodeV3Basic` maps `blockConfirmations` to the `requestedFinalityConfig` with `FinalityCodec._encodeBlockDepth`. Read more about `extraArgs` formats in the [CCIP best practices](/ccip/evm/concepts/best-practices#using-extraargs). 4. The task quotes the fee, approves the router to spend the token, and sends. With `feeTokenAddress` set to the zero address the fee is paid in native gas: ```typescript const fee = await publicClient.readContract({ address: sourceRouter, abi: routerArtifact.abi, functionName: "getFee", args: [destinationChainSelector, ccipMessage], }) ``` 5. The test verifies the transfer: the receiver was credited, the sender was debited, and the router collected the fee. Because local mode delivers synchronously inside `ccipSend`, the assertions run immediately after the task: ```typescript assert.equal(await s.ccipBnM.read.balanceOf([receiver]), AMOUNT) assert.equal(await s.ccipBnM.read.balanceOf([s.broadcaster.account.address]), senderBefore - AMOUNT) assert.equal(await s.publicClient.getBalance({ address: s.router.address }), fee) ``` ### Test case 2: Transfer with LINK fees The `transfers token to an EOA paying the fee in LINK` test case runs the same task with two differences: 1. Fund the broadcaster with LINK from the simulator faucet instead of relying on native gas: ```typescript await s.simulator.write.requestLinkFromFaucet([s.broadcaster.account.address, 10n ** 18n]) ``` 2. Pass the LINK token address as the fee token (`run({ feeTokenAddress: s.link.address })`), and verify the router collected the fee in LINK: ```typescript assert.equal(await s.link.read.balanceOf([s.router.address]), fee) ``` ### Revert test cases The remaining two test cases verify the task's argument validation, which mirrors the CCIP 2.0 send-time rules: 1. A zero amount is rejected before anything is sent, and no tokens move: ```typescript await assert.rejects(run({ amount: 0n }), /Required args must be non-zero/) assert.equal(await s.ccipBnM.read.balanceOf([receiver]), 0n) ``` 2. A zero receiver is rejected the same way: ```typescript await assert.rejects(run({ receiver: ZERO_ADDRESS }), /Required args must be non-zero/) ``` ## Next steps - Send a data-only message to a receiver contract and see the local router enforce its CCV config and minimum block depth in the [receiver CCV config guide](/chainlink-local/build/ccip/hardhat/data-messages-receiver-ccv-config). - For the other test files in the `./test` directory (`Example03.test.ts` programmable token transfers, `Example04.test.ts` sender contract, `Example05.test.ts` manual execution path), see the [CCIP starter kit examples map](/chainlink-local/learn/starter-kit-examples). - To learn how to use Chainlink Local in forked environments, refer to the guide on [Using Chainlink Local Simulator in your Hardhat project with forked environments](/chainlink-local/build/ccip/hardhat/local-simulator-fork). --- # Using Chainlink Local to Test CCIP in RemixIDE Source: https://docs.chain.link/chainlink-local/build/ccip/remix > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` There is one guide to help you test Chainlink CCIP in Remix IDE using Chainlink Local - without forking. Testing in forked environments is currently supported **only** for Foundry and Hardhat. ## Guides ### Using Chainlink Local Simulator in Remix IDE This [guide](/chainlink-local/build/ccip/remix/local-simulator) helps you to test [Chainlink CCIP getting started guide](/ccip/evm/getting-started) locally in Remix IDE. You will: - Deploy a CCIP sender contract - Deploy CCIP receiver contract - Use the local simulator to send data from the sender contract to the receiver contract --- # Using the Chainlink Local simulator in Remix IDE Source: https://docs.chain.link/chainlink-local/build/ccip/remix/local-simulator > **NOTE: Integrate Chainlink Local into your project** > > ### npm > > If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > npm install @chainlink/local@0.3.1 > ``` > > ### yarn > > If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM > package](https://www.npmjs.com/package/@chainlink/local): > > ```shell > yarn add @chainlink/local@0.3.1 > ``` > > ### foundry > > If you use [Foundry](https://book.getfoundry.sh/): > > ```shell > forge install smartcontractkit/chainlink-local@v0.3.1 > ``` > > and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file > > ### RemixIDE > > Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package: > > ```solidity > import {CCIPLocalSimulator} from "@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol"; > ``` In this guide, you will test the [Chainlink CCIP getting started guide](/ccip/evm/getting-started) locally in Remix IDE. You will: - Deploy a CCIP sender contract - Deploy a CCIP receiver contract - Use the local simulator to send data from the sender contract to the receiver contract ## Prerequisites [Remix IDE](https://remix.ethereum.org/) is an online development environment that allows you to write, deploy, and test smart contracts. By default Remix IDE does not persist the files that you open from an external source. To save files, you will need to manually create a workspace and copy the files into the workspace. 1. Open the [Remix IDE](https://remix.ethereum.org/) in your browser. 2. Create a [new workspace](https://remix-ide.readthedocs.io/en/latest/file_explorer.html#new-workspace). 3. Copy the content of the [Test Chainlink Local Simulator contract](https://github.com/smartcontractkit/documentation/blob/main/public/samples/CCIP/TestCCIPLocalSimulator.sol) into a new file in the workspace: ```sol // SPDX-License-Identifier: MIT pragma solidity 0.8.24; // solhint-disable no-unused-import import {CCIPLocalSimulator} from "@chainlink/local/src/ccip/CCIPLocalSimulator.sol"; ``` When you compile, Remix resolves the `@chainlink/local`, `@chainlink/contracts-ccip`, and `@chainlink/contracts` imports from npm into the `.deps` folder. Without a version suffix, Remix uses the latest release of each package (`0.3.1` for `@chainlink/local`). To pin a specific version, use the version-suffixed form, for example `@chainlink/local@0.3.1/src/ccip/CCIPLocalSimulator.sol`. 4. Copy the content of the [Sender contract](https://github.com/smartcontractkit/documentation/blob/main/public/samples/CCIP/Sender.sol) into a new file in the workspace. ```sol // SPDX-License-Identifier: MIT pragma solidity 0.8.24; import {IRouterClient} from "@chainlink/contracts-ccip/contracts/interfaces/IRouterClient.sol"; import {Client} from "@chainlink/contracts-ccip/contracts/libraries/Client.sol"; import {ExtraArgsCodec} from "@chainlink/contracts-ccip/contracts/libraries/ExtraArgsCodec.sol"; import {OwnerIsCreator} from "@chainlink/contracts/src/v0.8/shared/access/OwnerIsCreator.sol"; import {LinkTokenInterface} from "@chainlink/contracts/src/v0.8/shared/interfaces/LinkTokenInterface.sol"; /** * THIS IS AN EXAMPLE CONTRACT THAT USES HARDCODED VALUES FOR CLARITY. * THIS IS AN EXAMPLE CONTRACT THAT USES UN-AUDITED CODE. * DO NOT USE THIS CODE IN PRODUCTION. */ /// @title - A simple contract for sending string data across chains. contract Sender is OwnerIsCreator { error NotEnoughBalance(uint256 currentBalance, uint256 calculatedFees); event MessageSent( bytes32 indexed messageId, uint64 indexed destinationChainSelector, address receiver, string text, address feeToken, uint256 fees ); IRouterClient private s_router; LinkTokenInterface private s_linkToken; /// @notice Constructor initializes the contract with the router address. /// @param _router The address of the router contract. /// @param _link The address of the LINK token contract. constructor( address _router, address _link ) { s_router = IRouterClient(_router); s_linkToken = LinkTokenInterface(_link); } /// @notice Sends data to receiver on the destination chain. /// @dev Assumes your contract has sufficient LINK to cover fees. /// @param destinationChainSelector The identifier (aka selector) for the destination blockchain. /// @param receiver The address of the recipient on the destination blockchain. /// @param text The string text to be sent. /// @return messageId The ID of the message that was sent. function sendMessage( uint64 destinationChainSelector, address receiver, string calldata text ) external onlyOwner returns (bytes32 messageId) { // Create an EVM2AnyMessage struct in memory with necessary information for sending a cross-chain message Client.EVM2AnyMessage memory evm2AnyMessage = Client.EVM2AnyMessage({ receiver: abi.encode(receiver), // ABI-encoded receiver address data: abi.encode(text), // ABI-encoded string tokenAmounts: new Client.EVMTokenAmount[](0), // Empty array — no tokens are being sent extraArgs: ExtraArgsCodec._getBasicEncodedExtraArgsV3( 200_000, // Gas limit for the callback on the destination chain bytes4(0) // Default finality (wait for full finalization) ), feeToken: address(s_linkToken) // Pay CCIP fees in LINK }); // Get the fee required to send the message uint256 fees = s_router.getFee(destinationChainSelector, evm2AnyMessage); if (fees > s_linkToken.balanceOf(address(this))) { revert NotEnoughBalance(s_linkToken.balanceOf(address(this)), fees); } // Approve the Router to transfer LINK tokens on contract's behalf. It will spend the fees in LINK s_linkToken.approve(address(s_router), fees); // Send the message through the router and store the returned message ID messageId = s_router.ccipSend(destinationChainSelector, evm2AnyMessage); // Emit an event with message details emit MessageSent(messageId, destinationChainSelector, receiver, text, address(s_linkToken), fees); // Return the message ID return messageId; } } ``` 5. Copy the content of the [Receiver contract](https://github.com/smartcontractkit/documentation/blob/main/public/samples/CCIP/Receiver.sol) into a new file in the workspace. ```sol // SPDX-License-Identifier: MIT pragma solidity 0.8.24; import {CCIPReceiver} from "@chainlink/contracts-ccip/contracts/applications/CCIPReceiver.sol"; import {Client} from "@chainlink/contracts-ccip/contracts/libraries/Client.sol"; import {FinalityCodec} from "@chainlink/contracts-ccip/contracts/libraries/FinalityCodec.sol"; /** * THIS IS AN EXAMPLE CONTRACT THAT USES HARDCODED VALUES FOR CLARITY. * THIS IS AN EXAMPLE CONTRACT THAT USES UN-AUDITED CODE. * DO NOT USE THIS CODE IN PRODUCTION. */ /// @title - A simple contract for receiving string data across chains. contract Receiver is CCIPReceiver { event MessageReceived(bytes32 indexed messageId, uint64 indexed sourceChainSelector, address sender, string text); bytes32 private s_lastReceivedMessageId; string private s_lastReceivedText; /// @notice Constructor initializes the contract with the router address. /// @param router The address of the router contract. constructor( address router ) CCIPReceiver(router) {} /// @notice Handle a received message. function _ccipReceive( Client.Any2EVMMessage memory any2EvmMessage ) internal override { s_lastReceivedMessageId = any2EvmMessage.messageId; s_lastReceivedText = abi.decode(any2EvmMessage.data, (string)); emit MessageReceived( any2EvmMessage.messageId, any2EvmMessage.sourceChainSelector, abi.decode(any2EvmMessage.sender, (address)), abi.decode(any2EvmMessage.data, (string)) ); } /// @notice Returns the CCVs and finality config for a given source chain. /// @dev Override to advertise receiver finality policy to the OffRamp. function getCCVsAndFinalityConfig( uint64, bytes calldata ) external view override returns ( address[] memory requiredCCVs, address[] memory optionalCCVs, uint8 optionalThreshold, bytes4 allowedFinalityConfig ) { return (new address[](0), new address[](0), 0, FinalityCodec.WAIT_FOR_FINALITY_FLAG); } /// @notice Fetches the details of the last received message. /// @return messageId The ID of the last received message. /// @return text The last received text. function getLastReceivedMessageDetails() external view returns (bytes32 messageId, string memory text) { return (s_lastReceivedMessageId, s_lastReceivedText); } } ``` At this point, you should have three files in your workspace: - **TestCCIPLocalSimulator.sol**: The file imports the Chainlink Local simulator contract. - **Sender.sol**: The file contains the Sender contract that interacts with CCIP to send data to the Receiver contract. - **Receiver.sol**: The file contains the Receiver contract that receives data from the Sender contract. ## Deploy the contracts 1. Compile the contracts. In the Solidity Compiler tab, select version `0.8.24` to match the `pragma solidity 0.8.24` of the sample contracts. 2. Under the **Deploy & Run Transactions** tab, make sure *Remix VM* is selected in the **Environment** drop-down list. Remix will use a sandbox blockchain in the browser to deploy the contracts. 3. Deploy the [Chainlink Local simulator](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator#cciplocalsimulator): 1. Select the `TestCCIPLocalSimulator.sol` file in the file explorer. 2. In the *Contract* drop-down list, select `CCIPLocalSimulator`. 3. Click the **Deploy** button. 4. The `CCIPLocalSimulator` is shown in the **Deployed Contracts** section. 5. In the list of functions, click the [`configuration`](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator#configuration) function to retrieve the configuration details for the pre-deployed contracts and services needed for local CCIP simulations: ![Remix IDE Chainlink Local Simulator configuration](/images/chainlink-local/ccip/remix/cciplocalsimulator-configuration.jpg) 4. You will interact with the LINK token contract to fund the sender contract with LINK tokens. The LINK token contract is pre-deployed in the local simulator configuration, so you can load the LINK token contract instance: 1. Select `LinkToken` in the *Contract* drop-down list. 2. Fill in the *At Address* field with the address of the `LINK` token contract from the `CCIPLocalSimulator` configuration. 3. Click the **At Address** button. The `LinkToken` contract is shown in the **Deployed Contracts** section. 5. Deploy the `Sender.sol` contract: 1. Select the `Sender.sol` file in the file explorer. 2. In the *Contract* drop-down list, select `Sender`. 3. Under the *Deploy* section, fill in the constructor parameters: - `_router`: The address of the `sourceRouter` contract from the `CCIPLocalSimulator` configuration. - `_link`: The address of the `LINK` token contract from the `CCIPLocalSimulator` configuration. 4. Click the **Deploy** button. The `Sender` contract is shown in the **Deployed Contracts** section. 6. Deploy the `Receiver.sol` contract: 1. Select the `Receiver.sol` file in the file explorer. 2. In the *Contract* drop-down list, select `Receiver`. 3. Under the *Deploy* section, fill in the constructor parameters: - `_router`: The address of the `destinationRouter` contract from the `CCIPLocalSimulator` configuration. 4. Click the **Deploy** button. The `Receiver` contract is shown in the **Deployed Contracts** section. ## Transfer data from the sender to the receiver 1. Fund the sender contract with LINK tokens to pay for CCIP fees: 1. Copy the address of the `Sender` contract from the **Deployed Contracts** section. 2. In the `CCIPLocalSimulator` contract, fill in the [`requestLinkFromFaucet`](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator#requestlinkfromfaucet) function with the following inputs: - `to`: The address of the `Sender` contract. - `amount`: The amount of LINK tokens to transfer. For instance: 1000000000000000000. 3. Click the **Transact** button. 2. Send data from the sender contract to the receiver contract: 1. Copy the address of the `Receiver` contract from the **Deployed Contracts** section. 2. In the `LinkToken` contract, call the `approve` function to let the `Sender` contract spend the LINK for the CCIP fee: - `spender`: The address of the `Sender` contract. - `value`: The amount of LINK to approve. For instance 1000000000000000000. 3. In the `Sender` contract, fill in the `sendMessage` function with: - `destinationChainSelector`: The destination chain selector. You can find it in the `CCIPLocalSimulator` configuration. - `receiver`: The address of the `Receiver` contract. - `text`: The text to send. For instance Hello!. 4. Remix IDE fails to estimate the gas properly for the `sendMessage` function. To work around this, you need to set the gas limit manually to 3000000: ![RemixIDE Chainlink Local sendMessage force gas limit](/images/chainlink-local/ccip/remix/sendMessage-estimateGas.jpg) 5. Click the **Transact** button. 3. Check the receiver contract to verify the data transfer: 1. In the `Receiver` contract, click on the `getLastReceivedMessageDetails` function. 2. The `getLastReceivedMessageDetails` function returns the text sent from the `Sender` contract: ![RemixIDE Chainlink Local receivedMessage](/images/chainlink-local/ccip/remix/receivedMessage.jpg) ## Next steps You have successfully tested the CCIP getting started guide within a few minutes using Remix IDE. Testing locally is useful to debug your contracts and fix any issues before testing them on testnets, saving you time and resources. As an exercise, you can try any of the [CCIP guides](/ccip/tutorials) using the local simulator in Remix IDE. --- # Chainlink Local Source: https://docs.chain.link/chainlink-local **Chainlink Local** is an installable package that allows you to run Chainlink services locally. You can import Chainlink Local into your preferred local development environment, such as Foundry projects, Hardhat scripts, or the Remix IDE. Chainlink Local enables rapid exploration, prototyping, local development, and iteration with Chainlink services before transitioning to a testnet. For instance, you can use Chainlink Local to execute CCIP 2.0 token transfers and arbitrary messages on a local Hardhat or Anvil (Foundry) development node. Chainlink Local also supports forked nodes, allowing you to work with multiple locally running blockchain networks using historical network states. User contracts tested with Chainlink Local can be deployed to test networks without modifications, ensuring a seamless transition from local development to live testnets. **Key Features of Chainlink Local:** - **Local Simulation:** Run Chainlink services on a local development blockchain node, enabling fast and efficient testing and prototyping. - **CCIP 2.0 rules in local mode:** The local router applies the CCIP 2.0 OnRamp and OffRamp message rules (finality, one token per message, receiver CCV config validation), so a test that passes locally does not fail on a fork or in production. See [CCIP 2.0 behavior in Chainlink Local](/chainlink-local/learn/ccip-v2-local). - **Forked Networks:** Work with deployed Chainlink contracts using one or multiple forked networks, providing a more realistic testing environment. Fork routing supports every CCIP era: pre-1.6, 1.6 and CCIP 2.0 (CCV-based) lanes. - **Seamless Integration:** Import the package into Foundry, Hardhat 3, or Remix IDE projects without modifying your contracts for local testing. > **NOTE: Hardhat 2 users** > > Chainlink Local `0.3.x` (V3) does not compile under Hardhat 2. Hardhat 2 users stay on the `0.2.x` line (`npm install > @chainlink/local@0.2.9`), which supports pre-1.6 fork routing only. To get started testing CCIP with Chainlink Local, follow the installation and setup steps in the CCIP guides for [Foundry](/chainlink-local/build/ccip/foundry), [Hardhat](/chainlink-local/build/ccip/hardhat), or [Remix IDE](/chainlink-local/build/ccip/remix). For an index of every CCIP starter kit example and where its topic is documented, read the [CCIP starter kit examples map](/chainlink-local/learn/starter-kit-examples). --- # Chainlink Local Architecture Source: https://docs.chain.link/chainlink-local/learn/architecture [Chainlink Local](https://github.com/smartcontractkit/chainlink-local) is a package that you can import into your development environment (such as Hardhat, Foundry, or Remix IDE) to use Chainlink services locally. It supports two primary modes: - Local testing without forking. - Local testing with forking. This enables you to test Chainlink smart contracts and services, such as CCIP, either in a clean local blockchain state or by using a forked state from a live blockchain. After testing with Chainlink Local, you can deploy your contracts to test networks without any modifications. ## Local testing without forking In this mode, you work with mock contracts on a locally running development blockchain node, such as Hardhat, Anvil (Foundry), or Remix VM. **How it works**: Import the [Chainlink Local](https://www.npmjs.com/package/@chainlink/local) package and deploy a set of Chainlink smart contracts to a blank Hardhat/Anvil network EVM state as part of your tests. You can then deploy your smart contracts and start testing with them. For CCIP, the local router applies the CCIP 2.0 OnRamp and OffRamp message rules, so a test that passes locally does not fail on a fork or in production. Read [CCIP 2.0 behavior in Chainlink Local](/chainlink-local/learn/ccip-v2-local) for what is and is not enforced. ![Chainlink Local Architecture (Without Forking)](/images/chainlink-local/chainlink-local-no-fork.png) ## Local testing with forking In this mode, you work with deployed Chainlink smart contracts using one or more forked blockchains. This setup provides a more realistic testing environment by incorporating the state of a live blockchain. > **NOTE: Supported Development environments** > > Chainlink Local does not support forking with Remix IDE. Forking is currently supported only for Hardhat and Foundry. **How it works**: In your test scripts, you fork one or more blockchains to create locally running blockchain network(s). Chainlink Local provides the necessary interfaces to interact with the forked Chainlink services and utilities for testing in a forked environment. For example, in CCIP, Chainlink Local provides a utility function that helps you switch from one fork (as the source chain) to another fork (as the destination chain). Fork routing supports every CCIP era: pre-1.6, 1.6 and CCIP 2.0 (CCV-based) lanes, which live testnet lanes run today. Read [CCIP 2.0 behavior in Chainlink Local](/chainlink-local/learn/ccip-v2-local) for the fork-mode details. ![Chainlink Local Architecture (With Forking)](/images/chainlink-local/chainlink-local-fork.png) --- # CCIP 2.0 behavior in Chainlink Local Source: https://docs.chain.link/chainlink-local/learn/ccip-v2-local Chainlink Local `v0.3.x` (V3) targets CCIP 2.0: it pins `@chainlink/contracts-ccip` 2.0.0, and both the local-mode router and the fork simulator apply the CCIP 2.0 message rules. This page describes what those rules are in each mode, so you know what a passing local test proves before you move to a fork or a live lane. Read the [CCIP 2.0 concepts](/ccip/evm/concepts/best-practices) for the protocol itself; this page covers only the Chainlink Local behavior. ## Local mode (no fork) `CCIPLocalSimulator` deploys a [`CCIPLocalRouter`](/chainlink-local/api-reference/v0.3.1/ccip-local-router) that delivers messages synchronously inside `ccipSend`. The router mirrors `MockCCIPRouter` from `@chainlink/contracts-ccip` 2.0.0 (same ABI, events and behaviour) and additionally applies the CCIP 2.0 OnRamp and OffRamp message rules, so a test that passes locally does not fail on a fork or in production. ### Enforced at send time - **Finality**: the requested finality of `ExtraArgsV3` must use a single mode (the OnRamp check). A Faster-Than-Finality message that is not a token-only transfer is only delivered to a receiver whose `getCCVsAndFinalityConfig` allows the requested finality (the OffRamp check). Receivers without `IAny2EVMMessageReceiverV2` accept finalized messages only. - **One token per message**: more than one token in `tokenAmounts` reverts with `CanOnlySendOneTokenPerMessage`. - **No zero amounts**: a zero-amount token reverts with `CannotSendZeroTokens`. - **No V3 `tokenReceiver` on EVM lanes**: `GenericExtraArgsV3.tokenReceiver` reverts with `TokenReceiverNotAllowed`. - **Receiver CCV config validation**: duplicate required/optional CCVs and `optionalThreshold > optionalCCVs.length` are rejected the same way the OffRamp rejects them. - **Gas limit**: only V1/V2 extraArgs gas limits above `uint32` revert `MessageGasLimitTooHigh`. Local mode has no lane config, so lower lane caps are not enforced. ### Not simulated in local mode - **Token pools**: pool finality policies, rate limits and pool-required CCVs are not enforced; tokens go directly to the receiver. - **CCVs and block confirmations**: receiver CCV lists are validated, not verified. There are no CCV verifiers, so no quorum check happens. - **The supported-token list**: `getSupportedTokens` is informational. - **Manual execution**: `NO_EXECUTION_ADDRESS` messages are executed immediately. - **The lane's `maxPerMsgGasLimit`**: only the `uint32` ceiling above is enforced. Use fork mode to test these against the real contracts. ### Fees and message IDs The local router charges only what `router.setFee(...)` sets (default 0), in the fee token you choose (native or LINK). It returns a mock message ID that is not calculated from the message contents the way a real message ID is, so the `CCIPMessageSent` event some tools look for is never emitted locally. ## Fork mode `CCIPLocalSimulatorFork` (Foundry) and the Hardhat 3 JavaScript helper route messages on forked networks for every CCIP era: pre-1.6 (`EVM2EVMOnRamp`), 1.6 and CCIP 2.0 (CCV-based lanes, which live testnet lanes run today). ### CCIP 2.0 routing On CCIP 2.0 lanes the destination OffRamp selects the CCVs and executes the message. The default `V2VerificationMode` is `OFFRAMP_DERIVED`: the CCV selection is derived from the destination OffRamp's `getCCVsForMessage(encodedMessage)` and the raw encoded message is executed through the permissionless `execute` entrypoint, so routing does not depend on the local `MessageV1` codec. CCV attestations are simulated with a synthetic no-op verifier. Fast Transfer messages with data are only delivered to receivers that opt in through `getCCVsAndFinalityConfig`, as in production. ### Strict routing and message status Routing is strict by default: `switchChainAndRouteMessage` reverts with `CCIPLocalSimulatorFork__MessageNotRouted(messageId, reason)` when a captured message cannot be routed to any of the given forks, and with `CCIPLocalSimulatorFork__MessageExecutionFailed(messageId, reason)` (the decoded revert data) when it does not execute successfully. Call `setStrictRouting(false)` to record failures instead and read them with `getMessageStatus(messageId)`, which returns `NOT_FOUND`, `QUEUED`, `FAILED` or `SUCCESS`. With several destinations, either pass every destination fork at once with the `uint256[] forkIds` overload, or call `switchChainAndRouteMessage` once per destination fork: a 1.6 or 2.0 message to a chain that is not in the call stays `QUEUED` and is routed by the call that includes its destination fork. ### CCIP 2.0 routers Some chains have a dedicated CCIP 2.0 router deployed next to the router that `getNetworkDetails` returns (the `Register` is generated from the CCIP docs API and only carries one router per chain). Read it with `getCCIPV2RouterAddress(chainId)` (Ethereum Sepolia and Avalanche Fuji are pre-registered) or set it with `setCCIPV2RouterAddress`. Send through the CCIP 2.0 router to use its CCIP 2.0 lanes; messages sent through either router are routed by `switchChainAndRouteMessage`. ### Manual execution `NO_EXECUTION_ADDRESS` messages follow the CCIP 2.0 manual execution path: with the default `V2ExecutionMode.RESPECT_NO_EXEC`, they are queued instead of executed. List them with `getPendingV2MessageIds` and execute one with `executePendingV2Message(messageId)`. ### Not simulated in fork mode Real CCV attestations, RMN and executor fees are not modelled; CCVs on the lane are replaced by a synthetic verifier, and `executePendingV2Message` executes without charging the executor fee a real manual execution costs. Pinned fork state never sees testnet upgrades, so green tests only prove your code against that snapshot. ## Requirements - Fork tests need `evm_version = "cancun"` or later (deployed CCIP 2.0 contracts use Cancun opcodes; `paris` fails with `EvmError: NotActivated`) and Foundry >= 1.5.1. - Hardhat 3 (Node.js 22) is required for the JavaScript fork helper; Hardhat 2 is not supported in `0.3.x` (the contracts do not compile, `HH411`). Hardhat 2 users stay on `0.2.x` (`npm install @chainlink/local@0.2.9`), which supports pre-1.6 fork routing only. --- # Contributing to Chainlink Local Source: https://docs.chain.link/chainlink-local/learn/contributing Contributions to Chainlink Local are welcome! These contributions can include bug fixes, new features, and documentation updates. This guide provides a list of repositories you can contribute to: - [Chainlink Local](https://github.com/smartcontractkit/chainlink-local): The main repository for Chainlink Local. - [CCIP Foundry Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-foundry): A Foundry starter kit for Chainlink CCIP. It uses Chainlink Local test different scenarios on a local environment with and without forking. - [CCIP Hardhat Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-hardhat): A Hardhat starter kit for Chainlink CCIP. It uses Chainlink Local test different scenarios on a local environment with and without forking. - [Chainlink Technical Documentation](https://github.com/smartcontractkit/documentation): You are welcome to write new guides or update existing guides in the Chainlink documentation. --- # CCIP starter kit examples map Source: https://docs.chain.link/chainlink-local/learn/starter-kit-examples The [CCIP starter kits](https://github.com/smartcontractkit/ccip-starter-kit-foundry) ([Foundry](https://github.com/smartcontractkit/ccip-starter-kit-foundry) and [Hardhat 3](https://github.com/smartcontractkit/ccip-starter-kit-hardhat)) teach CCIP 2.0 through examples `Example01`-`Example10` plus two legacy examples, each with a chapter in the kit's own book and a test that runs against Chainlink Local. This page maps every example to what it teaches, its kit book chapter, and the docs.chain.link page that covers the same topic, so you can find where each feature is documented. The kits pin Chainlink Local `v0.3.1`, `@chainlink/contracts-ccip` 2.0.0 and `solc 0.8.26` with `evm_version = cancun`. Examples 01-10 use Ethereum Sepolia → Polygon Amoy as their primary CCIP 2.0 lane. ## Local mode examples (Example01-Example05) These tests run against the no-fork [`CCIPLocalSimulator`](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator): no RPC URLs needed, messages delivered synchronously inside `ccipSend`, with the CCIP 2.0 OnRamp and OffRamp message rules applied. Read [CCIP 2.0 behavior in local mode](/chainlink-local/learn/ccip-v2-local) for what is enforced. | Example | What it teaches | Chainlink Local guide | Related CCIP docs | | -------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | | 01 - Token Transfer + Fast Transfers | Token-only transfer to an EOA with `ExtraArgsV3` and non-zero block confirmations | [Foundry](/chainlink-local/build/ccip/foundry/local-simulator) · [Hardhat](/chainlink-local/build/ccip/hardhat/local-simulator) | [Transfer tokens from a contract](/ccip/evm/tutorials/application-developers/transfer-tokens-from-contract) | | 02 - Hello World to `BasicMessageReceiverWithCCVs` | Data-only message to a receiver with CCV config; the receiver's `minBlockDepth` gates Fast Transfers | [Foundry](/chainlink-local/build/ccip/foundry/data-messages-receiver-ccv-config) · [Hardhat](/chainlink-local/build/ccip/hardhat/data-messages-receiver-ccv-config) | [Send arbitrary data](/ccip/evm/tutorials/application-developers/send-arbitrary-data) | | 03 - Programmable Token Transfer (Fast Transfers) | Data + tokens in one message to a contract receiver, with the receiver finality gate | Kit book chapter | [Programmable token transfers](/ccip/evm/tutorials/application-developers/programmable-token-transfers) | | 04 - Programmable Token Transfer (sender contract) | Same transfer through a `BasicMessageSender` contract with default finality | Kit book chapter | [Programmable token transfers](/ccip/evm/tutorials/application-developers/programmable-token-transfers) | | 05 - ExtraArgsV3 no-execution tag | The `NO_EXECUTION_ADDRESS` executor for the manual execution path | Kit book chapter | [Manual execution](/ccip/evm/tutorials/application-developers/manual-execution) | Local mode does not model executors or manual execution: `NO_EXECUTION_ADDRESS` messages are executed immediately, so Example 05's test only verifies what the script sends. Whether the message stays pending until manually executed can only be observed on a real lane or a fork. ## Fork mode examples (Example06-Example10) These tests run against pinned forks of Ethereum Sepolia and Polygon Amoy through [`CCIPLocalSimulatorFork`](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork) (Foundry) or the [Hardhat 3 JavaScript fork helper](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork-js). They need archive-capable RPC URLs and, in Foundry, `FOUNDRY_PROFILE=fork`. Read [CCIP 2.0 behavior in fork mode](/chainlink-local/learn/ccip-v2-local) for what is simulated. | Example | What it teaches | Chainlink Local guide | Related CCIP docs | | ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | | 06 - CCT Burn and Mint | `CrossChainToken` + BurnMint pool deployment, TokenAdminRegistry registration, lane linking, pool finality config | [CCT burn and mint tutorial](/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork) · [fork guide](/chainlink-local/build/ccip/foundry/local-simulator-fork) | [Register a Burn and Mint token from an EOA](/ccip/evm/tutorials/cross-chain-tokens/register-from-eoa-burn-mint-foundry) | | 07 - CCT Lock and Release | `CrossChainToken` + `ERC20LockBox` + LockRelease pool, destination lock box liquidity | [CCT lock and release tutorial](/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork) | [Register a Lock and Mint token from an EOA](/ccip/evm/tutorials/cross-chain-tokens/register-from-eoa-lock-mint-foundry) | | 08 - CCT Burn and Mint with `AdvancedPoolHooks` | Attaching a pool hook with a sender allowlist and CCV threshold | Kit book chapter | [Configure a sender allowlist](/ccip/evm/tutorials/cross-chain-tokens/configure-sender-allowlist-advanced-pool-hooks-foundry) | | 09 - Pool-based CCVs on `AdvancedPoolHooks` | Pool-required CCVs consulted outbound by the OnRamp and verified inbound by the OffRamp; threshold CCVs | [Pool-based CCVs tutorial](/chainlink-local/build/ccip/foundry/pool-based-ccvs-fork) | [CCV starter kit](https://docs.chain.link/ccip/ccv-starter-kit) | | 10 - Policy engine on `AdvancedPoolHooks` | An ACE policy engine attached to the hook, capping transfer amounts | Kit book chapter | [Enforce ACE policies](/ccip/evm/tutorials/cross-chain-tokens/enforce-ace-policies-foundry) | Pool-required CCVs (Example 09) are the one CCIP 2.0 feature local mode cannot exercise: local mode has no token pools, so pool-required CCVs are not enforced there. Only the fork tests run them against the real OnRamp and OffRamp. ## Legacy examples | Example | What it teaches | Related CCIP docs | | -------------------------------------- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | | Legacy 01 - ExtraArgsV1 token transfer | The v1.x `EVMExtraArgsV1` format on an older lane | [Using `extraArgs`](/ccip/evm/concepts/best-practices#using-extraargs) | | Legacy 02 - ExtraArgsV2 token transfer | The `GenericExtraArgsV2` format; `allowOutOfOrderExecution` is deprecated in CCIP 2.0 | [Using `extraArgs`](/ccip/evm/concepts/best-practices#using-extraargs) | ## Kit books and tools Each kit ships an mdBook with one chapter per example, including the exact script and task commands for live-testnet runs: - [Foundry kit book](https://smartcontractkit.github.io/ccip-starter-kit-foundry/) - [Hardhat kit book](https://smartcontractkit.github.io/ccip-starter-kit-hardhat/) The books also cover the CCIP API, the CCIP SDK (`ccip-send`, `ccip-track`) and the CCIP CLI, which are not Chainlink Local features.