# https://docs.chain.link/chainlink-local llms-full.txt ## Chainlink Local Development Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [Chainlink Local](https://docs.chain.link/chainlink-local\#overview) **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 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. - **Forked Networks:** Work with deployed Chainlink contracts using one or multiple forked networks, providing a more realistic testing environment. - **Seamless Integration:** Integrate with Foundry, Hardhat, and Remix IDE for a streamlined development process. To get started testing CCIP with Chainlink Local, follow the installation and setup steps in the CCIP guides for [Foundry](https://docs.chain.link/chainlink-local/build/ccip/foundry), [Hardhat](https://docs.chain.link/chainlink-local/build/ccip/hardhat), or [Remix IDE](https://docs.chain.link/chainlink-local/build/ccip/remix). Play ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840143304&cv=11&fst=1748840143304&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=Chainlink%20Local%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=1543670587.1748840143&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## Chainlink Local API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [Chainlink Local API Reference](https://docs.chain.link/chainlink-local/api-reference\#overview) ## [Available Versions](https://docs.chain.link/chainlink-local/api-reference\#available-versions) ### [Latest Release](https://docs.chain.link/chainlink-local/api-reference\#latest-release) - **[Chainlink Local v0.2.3](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/)** (Current Version) - Added support for `EVMExtraArgsV2` and OZ's `AccessControl` in CCIPLocalSimulator - Added `supportNewTokenViaAccessControlDefaultAdmin` function - Bumped `@chainlink/contracts-ccip` to `1.5.1-beta.0` - Enhanced token pool support and EVMExtraArgsV2 compatibility ### [Previous Versions](https://docs.chain.link/chainlink-local/api-reference\#previous-versions) - **[Chainlink Local v0.2.2](https://docs.chain.link/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](https://docs.chain.link/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](https://docs.chain.link/chainlink-local/api-reference\#documentation-structure) Each version includes detailed documentation for: - CCIP Components (Router, Simulator) - Data Feed Contracts - Token Implementations - JavaScript Utilities - Testing Helpers ## Get the latest Chainlink content straight to your inbox. Email Address ## Chainlink Local Architecture [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [Chainlink Local Architecture](https://docs.chain.link/chainlink-local/learn/architecture\#overview) [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](https://docs.chain.link/chainlink-local/learn/architecture\#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. ![Chainlink Local Architecture (Without Forking)](https://docs.chain.link/images/chainlink-local/chainlink-local-no-fork.png) ## [Local testing with forking](https://docs.chain.link/chainlink-local/learn/architecture\#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. **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). ![Chainlink Local Architecture (With Forking)](https://docs.chain.link/images/chainlink-local/chainlink-local-fork.png) ## Get the latest Chainlink content straight to your inbox. Email Address ## Contributing to Chainlink [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [Contributing to Chainlink Local](https://docs.chain.link/chainlink-local/learn/contributing\#overview) 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. ## Get the latest Chainlink content straight to your inbox. Email Address ## Chainlink CCIP Testing [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [Using Chainlink Local to Test CCIP in Your Hardhat Project](https://docs.chain.link/chainlink-local/build/ccip/hardhat\#overview) There are two comprehensive guides to help you test Chainlink CCIP in your Hardhat project using Chainlink Local - one for each mode (with and without forking). We recommend starting with the first guide (without forking) for initial development before advancing to the guide that demonstrates how to test in forked environments. ## [Guides](https://docs.chain.link/chainlink-local/build/ccip/hardhat\#guides) ### [Using CCIP Local Simulator in your Hardhat project](https://docs.chain.link/chainlink-local/build/ccip/hardhat\#using-ccip-local-simulator-in-your-hardhat-project) This [guide](https://docs.chain.link/chainlink-local/build/ccip/hardhat/local-simulator) helps you set up and run CCIP 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 the local simulator without forking is ideal for initial development and testing in an isolated environment. ### [Using CCIP Local Simulator in your Hardhat project with forked environments](https://docs.chain.link/chainlink-local/build/ccip/hardhat\#using-ccip-local-simulator-in-your-hardhat-project-with-forked-environments) This [guide](https://docs.chain.link/chainlink-local/build/ccip/hardhat/local-simulator-fork) extends your testing capabilities by demonstrating how to use the CCIP Local Simulator in a forked environment. It includes instructions on: - Setting up forks of real blockchain networks (e.g., _Arbitrum Sepolia_ and _Ethereum Sepolia_) - Writing test cases - Running tests for cross-chain token transfers between two accounts Using the local simulator with forked environments is ideal for testing in a more realistic yet controlled setting. ## Get the latest Chainlink content straight to your inbox. Email Address ## Chainlink CCIP Testing [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [Using Chainlink Local to Test CCIP in RemixIDE](https://docs.chain.link/chainlink-local/build/ccip/remix\#overview) There is one comprehensive 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](https://docs.chain.link/chainlink-local/build/ccip/remix\#guides) ### [Using CCIP Local Simulator in Remix IDE](https://docs.chain.link/chainlink-local/build/ccip/remix\#using-ccip-local-simulator-in-remix-ide) This [guide](https://docs.chain.link/chainlink-local/build/ccip/remix/local-simulator) helps you to test [Chainlink CCIP getting started guide](https://docs.chain.link/ccip/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 ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840159415&cv=11&fst=1748840159415&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fbuild%2Fccip%2Fremix&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=Using%20Chainlink%20Local%20to%20Test%20CCIP%20in%20RemixIDE%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=383575031.1748840159&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## Testing Chainlink CCIP [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [Using Chainlink Local to Test CCIP in Your Foundry Project](https://docs.chain.link/chainlink-local/build/ccip/foundry\#overview) There are two comprehensive guides to help you test Chainlink CCIP in your Foundry project using Chainlink Local - one for each mode (with and without forking). We recommend starting with the first guide (without forking) for initial development before advancing to the guide that demonstrates how to test in forked environments. ## [Guides](https://docs.chain.link/chainlink-local/build/ccip/foundry\#guides) ### [Using the CCIP Local Simulator in your Foundry project](https://docs.chain.link/chainlink-local/build/ccip/foundry\#using-the-ccip-local-simulator-in-your-foundry-project) This [guide](https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator) helps you set up and run CCIP 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 the local simulator without forking is ideal for initial development and testing in an isolated environment. ### [Using the CCIP Local Simulator in your Foundry project with forked environments](https://docs.chain.link/chainlink-local/build/ccip/foundry\#using-the-ccip-local-simulator-in-your-foundry-project-with-forked-environments) This [guide](https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator-fork) extends your testing capabilities by demonstrating how to use the CCIP Local Simulator in a forked environment. It includes instructions on: - Setting up forks of real blockchain networks (such as Arbitrum Sepolia and Ethereum Sepolia) - Writing test cases - Running tests for cross-chain token transfers between two accounts Using the local simulator with forked environments is ideal for testing in a more realistic yet controlled setting. ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840159479&cv=11&fst=1748840159479&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fbuild%2Fccip%2Ffoundry&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=Using%20Chainlink%20Local%20to%20Test%20CCIP%20in%20Your%20Foundry%20Project%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=1138111736.1748840159&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## Chainlink CCIP Local Simulator [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [Using the CCIP local simulator in Remix IDE](https://docs.chain.link/chainlink-local/build/ccip/remix/local-simulator\#overview) In this guide, you will test the [Chainlink CCIP getting started guide](https://docs.chain.link/ccip/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](https://docs.chain.link/chainlink-local/build/ccip/remix/local-simulator\#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 CCIP Local Simulator contract](https://docs.chain.link/samples/CCIP/TestCCIPLocalSimulator.sol) into a new file in the workspace. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity // SPDX-License-Identifier: MIT pragma solidity 0.8.24; // solhint-disable no-unused-import import {CCIPLocalSimulator} from "@chainlink/local/src/ccip/CCIPLocalSimulator.sol"; ``` [Open in Remix](https://remix.ethereum.org/#url=https://docs.chain.link/samples/CCIP/TestCCIPLocalSimulator.sol&autoCompile=true) [What is Remix?](https://docs.chain.link/getting-started/conceptual-overview#what-is-remix) 4. Copy the content of the [Sender contract](https://docs.chain.link/samples/CCIP/Sender.sol) into a new file in the workspace. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity // SPDX-License-Identifier: MIT pragma solidity 0.8.24; import {IRouterClient} from "@chainlink/contracts-ccip/contracts/interfaces/IRouterClient.sol"; import {OwnerIsCreator} from "@chainlink/contracts/src/v0.8/shared/access/OwnerIsCreator.sol"; import {Client} from "@chainlink/contracts-ccip/contracts/libraries/Client.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 { // Custom errors to provide more descriptive revert messages. error NotEnoughBalance(uint256 currentBalance, uint256 calculatedFees); // Used to make sure contract has enough balance. // Event emitted when a message is sent to another chain. event MessageSent( bytes32 indexed messageId, // The unique ID of the CCIP message. uint64 indexed destinationChainSelector, // The chain selector of the destination chain. address receiver, // The address of the receiver on the destination chain. string text, // The text being sent. address feeToken, // the token address used to pay CCIP fees. uint256 fees // The fees paid for sending the CCIP message. ); 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 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. /// @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 indicating no tokens are being sent extraArgs: Client._argsToBytes( // Additional arguments, setting gas limit and allowing out-of-order execution. // Best Practice: For simplicity, the values are hardcoded. It is advisable to use a more dynamic approach // where you set the extra arguments off-chain. This allows adaptation depending on the lanes, messages, // and ensures compatibility with future CCIP upgrades. Read more about it here: https://docs.chain.link/ccip/concepts/best-practices/evm#using-extraargs Client.GenericExtraArgsV2({ gasLimit: 200_000, // Gas limit for the callback on the destination chain allowOutOfOrderExecution: true // Allows the message to be executed out of order relative to other messages from the same sender }) ), // Set the feeToken address, indicating LINK will be used for fees feeToken: address(s_linkToken) }); // 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; } } ``` [Open in Remix](https://remix.ethereum.org/#url=https://docs.chain.link/samples/CCIP/Sender.sol&autoCompile=true) [What is Remix?](https://docs.chain.link/getting-started/conceptual-overview#what-is-remix) 5. Copy the content of the [Receiver contract](https://docs.chain.link/samples/CCIP/Receiver.sol) into a new file in the workspace. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity // SPDX-License-Identifier: MIT pragma solidity 0.8.24; import {Client} from "@chainlink/contracts-ccip/contracts/libraries/Client.sol"; import {CCIPReceiver} from "@chainlink/contracts-ccip/contracts/applications/CCIPReceiver.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 emitted when a message is received from another chain. event MessageReceived( bytes32 indexed messageId, // The unique ID of the message. uint64 indexed sourceChainSelector, // The chain selector of the source chain. address sender, // The address of the sender from the source chain. string text // The text that was received. ); bytes32 private s_lastReceivedMessageId; // Store the last received messageId. string private s_lastReceivedText; // Store the last received text. /// @notice Constructor initializes the contract with the router address. /// @param router The address of the router contract. constructor(address router) CCIPReceiver(router) {} /// handle a received message function _ccipReceive( Client.Any2EVMMessage memory any2EvmMessage ) internal override { s_lastReceivedMessageId = any2EvmMessage.messageId; // fetch the messageId s_lastReceivedText = abi.decode(any2EvmMessage.data, (string)); // abi-decoding of the sent text emit MessageReceived( any2EvmMessage.messageId, any2EvmMessage.sourceChainSelector, // fetch the source chain identifier (aka selector) abi.decode(any2EvmMessage.sender, (address)), // abi-decoding of the sender address, abi.decode(any2EvmMessage.data, (string)) ); } /// @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); } } ``` [Open in Remix](https://remix.ethereum.org/#url=https://docs.chain.link/samples/CCIP/Receiver.sol&autoCompile=true) [What is Remix?](https://docs.chain.link/getting-started/conceptual-overview#what-is-remix) At this point, you should have three files in your workspace: - **TestCCIPLocalSimulator.sol**: The file imports the Chainlink CCIP 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](https://docs.chain.link/chainlink-local/build/ccip/remix/local-simulator\#deploy-the-contracts) 1. Compile the 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 [CCIP local simulator](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/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`](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator#configuration) function to retrieve the configuration details for the pre-deployed contracts and services needed for local CCIP simulations: ![Remix IDE CCIP Local Simulator configuration](https://docs.chain.link/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 simply 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](https://docs.chain.link/chainlink-local/build/ccip/remix/local-simulator\#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`](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/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`![Copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg). 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 `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!`![Copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg). 3. 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`![Copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg): ![RemixIDE CCIP Local sendMessage force gas limit](https://docs.chain.link/images/chainlink-local/ccip/remix/sendMessage-estimateGas.jpg) 4. 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 CCIP Local receivedMessage](https://docs.chain.link/images/chainlink-local/ccip/remix/receivedMessage.jpg) ## [Next steps](https://docs.chain.link/chainlink-local/build/ccip/remix/local-simulator\#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](https://docs.chain.link/ccip/tutorials) using the local simulator in Remix IDE. ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840142975&cv=11&fst=1748840142975&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fbuild%2Fccip%2Fremix%2Flocal-simulator&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=Using%20the%20CCIP%20local%20simulator%20in%20Remix%20IDE%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=1620544055.1748840143&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## Chainlink Local API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version:v0.2.3 # [Chainlink Local v0.2.3 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.3\#overview) ## [CCIP](https://docs.chain.link/chainlink-local/api-reference/v0.2.3\#ccip) These contracts provide Cross-Chain Interoperability Protocol (CCIP) functionality in a local testing environment: - [CCIPLocalSimulator](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator) \- Local CCIP message routing simulator - [CCIPLocalSimulatorFork](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork) \- CCIP simulator for forked networks - [CCIPLocalSimulatorFork JS](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork-js) \- JavaScript utilities for CCIP simulation - [Register](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/register) \- CCIP network configuration registry ## [Data Feeds](https://docs.chain.link/chainlink-local/api-reference/v0.2.3\#data-feeds) Contracts for simulating Chainlink Data Feeds: - [AggregatorInterface](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-interface) \- Basic price feed interface - [AggregatorV2V3Interface](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-v2-v3-interface) \- Combined V2/V3 price feed interface - [AggregatorV3Interface](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-v3-interface) \- Extended price feed interface - [MockOffchainAggregator](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator) \- Mock implementation of off-chain aggregator - [MockV3Aggregator](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator) \- Mock implementation of V3 aggregator ## [Token Contracts](https://docs.chain.link/chainlink-local/api-reference/v0.2.3\#token-contracts) Standard token implementations for testing: - [BurnMintERC677Helper](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/burn-mint-erc677-helper) \- Helper contract for ERC677 token operations - [LinkToken](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/link-token) \- LINK token implementation - [WETH9](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9) \- Wrapped Ether implementation ## Get the latest Chainlink content straight to your inbox. Email Address ## Chainlink CCIP Simulator [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [Using CCIP local simulator in your Hardhat project](https://docs.chain.link/chainlink-local/build/ccip/hardhat/local-simulator\#overview) You can use Chainlink Local to run CCIP 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 boilerplate that includes the Chainlink Local package and several CCIP examples. ## [Prerequisites](https://docs.chain.link/chainlink-local/build/ccip/hardhat/local-simulator\#prerequisites) 1. In a terminal, clone the [CCIP Hardhat Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-hardhat) repository and change directories: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```shell git clone https://github.com/smartcontractkit/ccip-starter-kit-hardhat && \ cd ./ccip-starter-kit-hardhat/ ``` 2. Install the [Chainlink Local](https://github.com/smartcontractkit/chainlink-local) package and other required packages: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```shell npm install ``` 3. Compile the contracts: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```shell npm run compile ``` ## [Test tokens transfers](https://docs.chain.link/chainlink-local/build/ccip/hardhat/local-simulator\#test-tokens-transfers) You will run a test to transfer tokens between two accounts. The test file `Example1.spec.ts` is located in the `./test/no-fork` directory. This file contains one test case: **Transfer with LINK fees**: This test case transfers tokens from the sender account to the receiver account, paying fees in LINK. At the end of the test, it verifies that the sender account was debited and the receiver account was credited. For a detailed explanation of the test file, refer to the [Examine the code](https://docs.chain.link/chainlink-local/build/ccip/hardhat/local-simulator#examine-the-code) section. In your terminal, run the following command to execute the test: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```shell npx hardhat test test/no-fork/Example1.spec.ts ``` Example output: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```text $ npx hardhat test test/no-fork/Example1.spec.ts Example 1 ✔ Should transfer CCIP test tokens from EOA to EOA (1057ms) 1 passing (1s) ``` ## [Examine the code](https://docs.chain.link/chainlink-local/build/ccip/hardhat/local-simulator\#examine-the-code) ### [Setup](https://docs.chain.link/chainlink-local/build/ccip/hardhat/local-simulator\#setup) To transfer tokens using CCIP, we need the following: - Destination chain selector - Source CCIP router - LINK token for paying CCIP fees - A test token contract (such as CCIP-BnM) - A sender account (Alice) - A receiver account (Bob) The `deployFixture` function is used to set up the initial state for the tests. This function deploys the CCIP local simulator contract and initializes the sender and receiver accounts. 1. Initialize the [CCIP local simulator](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator#cciplocalsimulator) contract: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```typescript const ccipLocalSimulatorFactory = await hre.ethers.getContractFactory("CCIPLocalSimulator") const ccipLocalSimulator: CCIPLocalSimulator = await ccipLocalSimulatorFactory.deploy() ``` 2. Initialize the sender and receiver accounts: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```typescript const [alice, bob] = await hre.ethers.getSigners() ``` ### [Test case: Transfer with LINK fees](https://docs.chain.link/chainlink-local/build/ccip/hardhat/local-simulator\#test-case-transfer-with-link-fees) The `it("Should transfer CCIP test tokens from EOA to EOA")` function tests the transfer of tokens between two externally owned accounts (EOA) while paying fees in LINK. Here are the steps involved in this test case: 1. Invoke the `deployFixture` function to set up the necessary variables: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```typescript const { ccipLocalSimulator, alice, bob } = await loadFixture(deployFixture) ``` 2. Invoke the [`configuration`](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator#configuration) function to retrieve the configuration details for the pre-deployed contracts and services needed for local CCIP simulations. 3. Connect to the source router and CCIP-BnM contracts. 4. Call `ccipBnM.drip` to request CCIP-BnM tokens for Alice (sender). 5. Create an array `Client.EVMTokenAmount[]` to specify the token transfer details: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```typescript const tokenAmounts = [\ {\ token: config.ccipBnM_,\ amount: amountToSend,\ },\ ] ``` 6. Construct the [Client.EVM2AnyMessage](https://docs.chain.link/ccip/api-reference/evm/v1.6.0/client#evm2anymessage) structure with the receiver, token amounts, and other necessary details. - Use an empty string for the `data` parameter because you are not sending any arbitrary data (only tokens). - Set `gasLimit` to `0` because you are sending tokens to an EOA, which means you do not expect any execution of receiver logic (and therefore do not need gas for that). ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```typescript const gasLimit = 0 const functionSelector = id("CCIP EVMExtraArgsV1").slice(0, 10) const defaultAbiCoder = AbiCoder.defaultAbiCoder() const extraArgs = defaultAbiCoder.encode(["uint256"], [gasLimit]) const encodedExtraArgs = `${functionSelector}${extraArgs.slice(2)}` const message = { receiver: defaultAbiCoder.encode(["address"], [bob.address]), data: defaultAbiCoder.encode(["string"], [""]), // no data tokenAmounts: tokenAmounts, feeToken: config.linkToken_, extraArgs: encodedExtraArgs, } ``` 7. Calculate the required fees for the transfer and approve the router to spend LINK tokens for these fees: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```typescript const fee = await mockCcipRouter.getFee(config.chainSelector_, message) await linkToken.connect(alice).approve(mockCcipRouterAddress, fee) ``` 8. Send the CCIP transfer request to the router: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```typescript await mockCcipRouter.connect(alice).ccipSend(config.chainSelector_, message) ``` 9. Verify that Alice's balance has decreased by the amount sent and Bob's balance has increased by the same amount: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```typescript expect(await ccipBnM.balanceOf(alice.address)).to.deep.equal(ONE_ETHER - amountToSend) expect(await ccipBnM.balanceOf(bob.address)).to.deep.equal(amountToSend) ``` ## [Next steps](https://docs.chain.link/chainlink-local/build/ccip/hardhat/local-simulator\#next-steps) For more advanced scenarios, please refer to other test files in the `./test/no-fork` directory. To learn how to use Chainlink local in forked environments, refer to the guide on [Using CCIP Local Simulator in your Hardhat project with forked environments](https://docs.chain.link/chainlink-local/build/ccip/hardhat/local-simulator-fork). ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840143018&cv=11&fst=1748840143018&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2h1v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fbuild%2Fccip%2Fhardhat%2Flocal-simulator&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=Using%20CCIP%20local%20simulator%20in%20your%20Hardhat%20project%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=1962054181.1748840143&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## Chainlink Local API Reference [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 You're not using the latest version. Update to v0.2.3 # [Chainlink Local v0.2.1 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.1\#overview) ## [CCIP](https://docs.chain.link/chainlink-local/api-reference/v0.2.1\#ccip) These contracts provide Cross-Chain Interoperability Protocol (CCIP) functionality in a local testing environment: - [CCIPLocalSimulator](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator) \- Local CCIP message routing simulator - [CCIPLocalSimulatorFork](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork) \- CCIP simulator for forked networks - [CCIPLocalSimulatorForkJS](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork-js) \- JavaScript utilities for CCIP simulation - [MockEvm2EvmOffRamp](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-evm2evm-offramp) \- Mock CCIP off-ramp contract - [Register](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/register) \- CCIP network configuration registry ## [Data Feeds](https://docs.chain.link/chainlink-local/api-reference/v0.2.1\#data-feeds) Contracts for simulating Chainlink Data Feeds: - [AggregatorInterface](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-interface) \- Basic price feed interface - [AggregatorV2V3Interface](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-v2-v3-interface) \- Combined V2/V3 price feed interface - [AggregatorV3Interface](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-v3-interface) \- Extended price feed interface - [MockOffchainAggregator](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-offchain-aggregator) \- Mock implementation of off-chain aggregator - [MockV3Aggregator](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-v3-aggregator) \- Mock implementation of V3 aggregator ## [Token Contracts](https://docs.chain.link/chainlink-local/api-reference/v0.2.1\#token-contracts) Standard token implementations for testing: - [BurnMintERC677Helper](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/burn-mint-erc677-helper) \- Helper contract for ERC677 token operations - [LinkToken](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/link-token) \- LINK token implementation - [WETH9](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/weth9) \- Wrapped Ether implementation ## Get the latest Chainlink content straight to your inbox. Email Address ## Chainlink Local API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version:v0.2.2Not using latest version (v0.2.3) # [Chainlink Local v0.2.2 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.2\#overview) ## [CCIP](https://docs.chain.link/chainlink-local/api-reference/v0.2.2\#ccip) These contracts provide Cross-Chain Interoperability Protocol (CCIP) functionality in a local testing environment: - [CCIPLocalSimulator](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator) \- Local CCIP message routing simulator - [CCIPLocalSimulatorFork](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork) \- CCIP simulator for forked networks - [CCIPLocalSimulatorFork JS](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork-js) \- JavaScript utilities for CCIP simulation - [Register](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/register) \- CCIP network configuration registry ## [Data Feeds](https://docs.chain.link/chainlink-local/api-reference/v0.2.2\#data-feeds) Contracts for simulating Chainlink Data Feeds: - [AggregatorInterface](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-interface) \- Basic price feed interface - [AggregatorV2V3Interface](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-v2-v3-interface) \- Combined V2/V3 price feed interface - [AggregatorV3Interface](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-v3-interface) \- Extended price feed interface - [MockOffchainAggregator](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator) \- Mock implementation of off-chain aggregator - [MockV3Aggregator](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator) \- Mock implementation of V3 aggregator ## [Token Contracts](https://docs.chain.link/chainlink-local/api-reference/v0.2.2\#token-contracts) Standard token implementations for testing: - [BurnMintERC677Helper](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/burn-mint-erc677-helper) \- Helper contract for ERC677 token operations - [LinkToken](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/link-token) \- LINK token implementation - [WETH9](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9) \- Wrapped Ether implementation ## Get the latest Chainlink content straight to your inbox. Email Address ## Chainlink CCIP Simulator [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [Using CCIP local simulator in your Foundry project](https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator\#overview) You can use Chainlink Local to run CCIP 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 and several CCIP examples. ## [Prerequisites](https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator\#prerequisites) 1. In a terminal, clone the [CCIP Foundry Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-foundry) repository and change directories. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```shell git clone https://github.com/smartcontractkit/ccip-starter-kit-foundry.git && \ cd ./ccip-starter-kit-foundry/ ``` 2. Run `npm install` to install the dependencies. This command installs the [Chainlink Local](https://github.com/smartcontractkit/chainlink-local) package and other required packages: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```shell npm install ``` 3. Run `forge install` to install packages: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```shell forge install ``` 4. Run `forge build` to compile the contracts: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```shell forge build ``` ## [Test tokens transfers](https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator\#test-tokens-transfers) You will run a test to transfer tokens between two accounts. The test file `Example01.t.sol` is located in the `./test/no-fork` directory. This file contains two test cases: 1. **Transfer with LINK fees**: This test case transfers tokens from the sender account to the receiver account, paying fees in LINK. At the end of the test, it verifies that the sender account was debited and the receiver account was credited. 2. **Transfer with native gas fees**: This test case transfers tokens from the sender account to the receiver account, paying fees in native gas. At the end of the test, it verifies that the sender account was debited and the receiver account was credited. For a detailed explanation of the test file, refer to the [Examine the code](https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator#examine-the-code) section. In your terminal, run the following command to execute the test: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```shell forge test --match-contract Example01Test ``` Example output: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```text $ forge test --match-contract Example01Test [⠊] Compiling... No files changed, compilation skipped Ran 2 tests for test/no-fork/Example01.t.sol:Example01Test [PASS] test_transferTokensFromEoaToEoaPayFeesInLink() (gas: 167576) [PASS] test_transferTokensFromEoaToEoaPayFeesInNative() (gas: 122348) Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 8.79ms (976.54µs CPU time) Ran 1 test suite in 201.00ms (8.79ms CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) ``` ## [Examine the code](https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator\#examine-the-code) ### [Setup](https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator\#setup) To transfer tokens using CCIP, we need the following: - Destination chain selector - Source CCIP router - LINK token for paying CCIP fees - A test token contract (such as CCIP-BnM) - A sender account (Alice) - A receiver account (Bob) The `setUp()` function is invoked before each test case to reinitialize all the variables, ensuring a clean state for each test: 1. Initialize the [CCIP local simulator](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator#cciplocalsimulator) contract: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity ccipLocalSimulator = new CCIPLocalSimulator(); ``` 2. Invoke the [`configuration`](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator#configuration) function to retrieve the configuration details for the pre-deployed contracts and services needed for local CCIP simulations: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity ( uint64 chainSelector, IRouterClient sourceRouter, , , LinkToken linkToken, BurnMintERC677Helper ccipBnM, ) = ccipLocalSimulator.configuration(); ``` **Note**: The [`configuration`](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator#configuration) function also returns the destination router, WETH9, and CCIP-LnM contracts, but we are not using them in these test cases. Hence, there are commas in the return values. 3. Initialize the sender and receiver accounts: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity alice = makeAddr("alice") bob = makeAddr("bob") ``` 4. All the variables are stored in the contract state for use in the test cases. ### [Prepare scenario (helper function)](https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator\#prepare-scenario-helper-function) The `prepareScenario()` function is invoked at the beginning of each test case. It performs the following actions: 1. Request CCIP-BnM tokens for Alice (sender): ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity ccipBnMToken.drip(alice); ``` 2. Approve the source router to spend tokens on behalf of Alice (sender): ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity amountToSend = 100; ccipBnMToken.approve(address(router), amountToSend); ``` 3. Create an array [Client.EVMTokenAmount](https://docs.chain.link/ccip/api-reference/evm/v1.6.0/client#evmtokenamount)\[\] to specify the token transfer details. This array and the amount to send are returned by the prepareScenario() function for use in the calling test case: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity tokensToSendDetails = new Client.EVMTokenAmount[](1); Client.EVMTokenAmount memory tokenToSendDetails = Client.EVMTokenAmount({token: address(ccipBnMToken), amount: amountToSend}); tokensToSendDetails[0] = tokenToSendDetails; ``` ### [Test case 1: Transfer with LINK fees](https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator\#test-case-1-transfer-with-link-fees) The `test_transferTokensFromEoaToEoaPayFeesInLink` function tests the transfer of tokens between two externally owned accounts (EOA) while paying fees in LINK. Here are the steps involved in this test case: 01. Invoke the `prepareScenario()` function to set up the necessary variables: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity (Client.EVMTokenAmount[] memory tokensToSendDetails, uint256 amountToSend) = prepareScenario(); ``` 02. Record the initial token balances for Alice (sender) and Bob (receiver): ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint256 balanceOfAliceBefore = ccipBnMToken.balanceOf(alice); uint256 balanceOfBobBefore = ccipBnMToken.balanceOf(bob); ``` 03. Begin impersonating Alice (sender) to perform the subsequent actions: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity vm.startPrank(alice); ``` 04. Request 5 LINK tokens from the CCIP Local Simulator faucet for Alice (sender): ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity ccipLocalSimulator.requestLinkFromFaucet(alice, 5 ether); ``` 05. Construct the [Client.EVM2AnyMessage](https://docs.chain.link/ccip/api-reference/evm/v1.6.0/client#evm2anymessage) structure with the receiver, token amounts, and other necessary details. - Set the `data` parameter to an empty string because you are not sending any arbitrary data, only tokens. - In `extraArgs`, set the gas limit to `0`. This gas limit is for execution of receiver logic, which doesn't apply here because you're sending tokens to an EOA. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity Client.EVM2AnyMessage memory message = Client.EVM2AnyMessage({ receiver: abi.encode(bob), data: abi.encode(""), tokenAmounts: tokensToSendDetails, extraArgs: Client._argsToBytes(Client.EVMExtraArgsV1({gasLimit: 0})), feeToken: address(linkToken) }); ``` 06. Calculate the required fees for the transfer and approve the router to spend LINK tokens for these fees: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint256 fees = router.getFee(destinationChainSelector, message); linkToken.approve(address(router), fees); ``` 07. Send the CCIP transfer request to the router: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity router.ccipSend(destinationChainSelector, message); ``` 08. Stop impersonating (sender): ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity vm.stopPrank(); ``` 09. Record the final token balances for Alice (sender) and Bob (receiver): ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint256 balanceOfAliceAfter = ccipBnMToken.balanceOf(alice); uint256 balanceOfBobAfter = ccipBnMToken.balanceOf(bob); ``` 10. Verify that Alice's balance has decreased by the amount sent and Bob's balance has increased by the same amount: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity assertEq(balanceOfAliceAfter, balanceOfAliceBefore - amountToSend); assertEq(balanceOfBobAfter, balanceOfBobBefore + amountToSend); ``` ### [Test case 2: Transfer with native gas fees](https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator\#test-case-2-transfer-with-native-gas-fees) The `test_transferTokensFromEoaToEoaPayFeesInNative` function tests the transfer of tokens between two externally owned accounts (EOA) while paying fees in native gas. Here are the steps involved in this test case: 1. Invoke the `prepareScenario()` function to set up the necessary variables. (This step is the same as in the previous test case.) 2. Record the initial token balances of Alice (sender) and Bob (receiver). (This step is the same as in the previous test case.) 3. Begin impersonating Alice (sender) and provide her with native gas to pay for the fees: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity vm.startPrank(alice); deal(alice, 5 ether); ``` 4. Construct the [Client.EVM2AnyMessage](https://docs.chain.link/ccip/api-reference/evm/v1.6.0/client#evm2anymessage) structure. This step is the same as in the previous test case. The main difference is that the `feeToken` is set with `address(0)` to indicate that the fees are paid in native gas: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity Client.EVM2AnyMessage memory message = Client.EVM2AnyMessage({ receiver: abi.encode(bob), data: abi.encode(""), tokenAmounts: tokensToSendDetails, extraArgs: Client._argsToBytes(Client.EVMExtraArgsV1({gasLimit: 0})), feeToken: address(0) }); ``` 5. Calculate the required fees for the transfer and send the CCIP transfer request along with the necessary native gas: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint256 fees = router.getFee(destinationChainSelector, message); router.ccipSend{value: fees}(destinationChainSelector, message); ``` 6. Stop impersonating Alice (sender) and verify the token balances for Alice (sender) and Bob (receiver). (This step is the same as in the previous test case.) ## [Next steps](https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator\#next-steps) For more advanced scenarios, please refer to other test files in the `./test/no-fork` directory. To learn how to use Chainlink Local in forked environments, refer to the guide on [Using the CCIP Local Simulator in your Foundry project with forked environments](https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator-fork). ## Get the latest Chainlink content straight to your inbox. Email Address ## CCIP Local Simulator Guide [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [Using the CCIP Local Simulator to fork mainnets](https://docs.chain.link/chainlink-local/build/ccip/foundry/forking-mainnets\#overview) This guide explains how to use the CCIP Local Simulator to test cross-chain transactions in forked mainnet environments using Foundry. You'll learn how to leverage the `Register.sol` contract to streamline the simulation process and properly configure mainnet details that aren't included by default. ## [Understanding Network Registration](https://docs.chain.link/chainlink-local/build/ccip/foundry/forking-mainnets\#understanding-network-registration) The `Register.sol` smart contract contains pre-configured details for test networks to help accelerate cross-chain transaction simulations in Foundry. However, mainnet details are intentionally excluded and must be manually configured. Here's an example of how to verify network details for a test network such as Sepolia: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/build/ccip/foundry/forking-mainnets\#working-with-mainnet-forks) The CCIP Local Simulator supports any forked environment where CCIP contracts exist. Since mainnet details aren't included in `Register.sol`, you'll need to configure them manually. Let's walk through a complete example that demonstrates how to simulate cross-chain messages between Ethereum and Polygon mainnets. This example shows: 1. Setting up mainnet forks 2. Configuring network details 3. Creating and sending a cross-chain message 4. Routing the message between chains Here's the complete implementation: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity pragma solidity ^0.8.0; import { Test, console } from "forge-std/Test.sol"; import { CCIPLocalSimulatorFork, Register } from "@chainlink/local/src/ccip/CCIPLocalSimulatorFork.sol"; import { IRouterClient } from "@chainlink/contracts-ccip/src/v0.8/ccip/interfaces/IRouterClient.sol"; import { Client } from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Client.sol"; contract ExampleTest is Test { CCIPLocalSimulatorFork public ccipLocalSimulatorFork; uint256 public ethereumMainnetForkId; uint256 public polygonMainnetForkId; function setUp() public { // Create forks of both networks string memory ETHEREUM_MAINNET_RPC_URL = vm.envString("ETHEREUM_MAINNET_RPC_URL"); string memory POLYGON_MAINNET_RPC_URL = vm.envString("POLYGON_MAINNET_RPC_URL"); ethereumMainnetForkId = vm.createFork(ETHEREUM_MAINNET_RPC_URL); polygonMainnetForkId = vm.createFork(POLYGON_MAINNET_RPC_URL); address ethereumMainnetCcipRouterAddress = 0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D; uint64 polygonMainnetChainSelector = 4051577828743386545; ccipLocalSimulatorFork = new CCIPLocalSimulatorFork(); ccipLocalSimulatorFork.setNetworkDetails( polygonMainnetForkId, Register.NetworkDetails({ chainSelector: polygonMainnetChainSelector, routerAddress: polygonMainnetCcipRouterAddress, linkAddress: address(0), // not needed for this test wrappedNativeAddress: address(0), // not needed for this test ccipBnMAddress: address(0), // not needed for this test ccipLnMAddress: address(0), // not needed for this test rmnProxyAddress: address(0), // not needed for this test registryModuleOwnerCustomAddress: address(0), // not needed for this test tokenAdminRegistryAddress: address(0) // not needed for this test }) ); vm.makePersistent(address(ccipLocalSimulatorFork)); } function test_example() public { // Set up the source chain (Ethereum) vm.selectFork(ethereumMainnetForkId); Register.NetworkDetails memory polygonMainnetNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails( polygonMainnetForkId ); address alice = makeAddr("alice"); vm.deal(alice, 1 ether); // Prepare the cross-chain message vm.startPrank(alice); Client.EVM2AnyMessage memory message = Client.EVM2AnyMessage({ receiver: abi.encode(ccipReceiverAddress), data: abi.encode("Hello world"), tokenAmounts: new Client.EVMTokenAmount[](0), extraArgs: "", feeToken: address(0) }); // Send the message using CCIP IRouterClient(ethereumMainnetCcipRouterAddress).ccipSend(polygonMainnetNetworkDetails.routerAddress, message); vm.stopPrank(); // Route the message to Polygon ccipLocalSimulatorFork.switchChainAndRouteMessage(polygonMainnetForkId); } } ``` **Code explanation**: - **Network Setup**: The `setUp()` function creates forks of both Ethereum and Polygon mainnets and initializes the CCIP simulator. - **Network Configuration**: We configure Polygon mainnet details using [`setNetworkDetails()`](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork#setnetworkdetails). This step is crucial because mainnet details aren't included in `Register.sol`. The configuration includes: - `chainSelector`: The unique CCIP identifier for the Polygon network. Check the [CCIP Directory](https://docs.chain.link/ccip/directory/mainnet) for the correct value. - `routerAddress`: The address of the CCIP router on Polygon. Check the [CCIP Directory](https://docs.chain.link/ccip/directory/mainnet) for the correct value. - Parameters that can be set to `address(0)` because they are optional for messaging. - **Message Transfer**: The `test_example()` function demonstrates: - Setting up a test user (alice) with funds - Creating a cross-chain message - Sending the message through CCIP - Routing the message to the destination chain After this configuration, you can simulate cross-chain messages between mainnet forks, enabling thorough testing of your cross-chain applications in a local environment. ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840165097&cv=11&fst=1748840165097&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fbuild%2Fccip%2Ffoundry%2Fforking-mainnets&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=Using%20the%20CCIP%20Local%20Simulator%20to%20fork%20mainnets%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=1108136595.1748840165&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## MockOffchainAggregator API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [MockOffchainAggregator v0.2.3 API Reference](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#overview) ## [MockOffchainAggregator](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#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) ## [Variables](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#variables) ### [decimals](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#decimals) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint8 public decimals ``` ### [getAnswer](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#getanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity mapping(uint256 => int256) public getAnswer ``` ### [getTimestamp](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#gettimestamp) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity mapping(uint256 => uint256) public getTimestamp ``` ### [latestAnswer](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#latestanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity int256 public latestAnswer ``` ### [latestRound](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#latestround) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint256 public latestRound ``` ### [latestTimestamp](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#latesttimestamp) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint256 public latestTimestamp ``` ### [maxAnswer](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#maxanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity int192 public maxAnswer ``` ### [minAnswer](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#minanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity int192 public minAnswer ``` ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#functions) ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#constructor) Initializes the contract with decimals and initial answer. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity constructor(uint8 _decimals, int256 _initialAnswer) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#parameters) | Parameter | Type | Description | | --- | --- | --- | | \_decimals | `uint8` | The number of decimals for the aggregator | | \_initialAnswer | `int256` | The initial answer to be set | ### [getRoundData](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#getrounddata) Gets the round data for a specific round ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#parameters-1) | Parameter | Type | Description | | --- | --- | --- | | \_roundId | `uint80` | The round ID to get the data for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#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](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#latestrounddata) Gets the latest round data. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#returns-1) | 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](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#updateanswer) Updates the answer in the mock aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function updateAnswer(int256 _answer) public ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#parameters-2) | Parameter | Type | Description | | --- | --- | --- | | \_answer | `int256` | The new answer to be set | ### [updateMinAndMaxAnswers](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#updateminandmaxanswers) Updates the minimum and maximum answers the aggregator can report. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function updateMinAndMaxAnswers(int192 _minAnswer, int192 _maxAnswer) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#parameters-3) | Parameter | Type | Description | | --- | --- | --- | | \_minAnswer | `int192` | The new minimum answer | | \_maxAnswer | `int192` | The new maximum answer | #### [Possible Reverts](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#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](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#updaterounddata) Updates the round data in the mock aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v023/mock-offchain-aggregator\#parameters-4) | 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 | ## Get the latest Chainlink content straight to your inbox. Email Address ## WETH9 API Reference [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 You're not using the latest version. Update to v0.2.3 # [WETH9 v0.2.2 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#overview) ## [WETH9](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#variables) ### [allowance](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#allowance) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity mapping(address => mapping(address => uint256)) public allowance ``` ### [balanceOf](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#balanceof) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity mapping(address => uint256) public balanceOf ``` ### [decimals](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#decimals) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint8 public decimals ``` ### [name](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#name) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity string public name ``` ### [symbol](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#symbol) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity string public symbol ``` ## [Events](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#events) ### [Approval](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#approval) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity event Approval(address indexed src, address indexed guy, uint256 wad) ``` Emitted when an approval is set. #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#parameters) | Parameter | Type | Description | | --- | --- | --- | | src | address | The owner of the tokens | | guy | address | The approved spender | | wad | uint256 | The amount of tokens approved | ### [Deposit](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#deposit) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity event Deposit(address indexed dst, uint256 wad) ``` Emitted when ETH is wrapped to WETH. #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#parameters-1) | Parameter | Type | Description | | --- | --- | --- | | dst | address | The recipient of the WETH | | wad | uint256 | The amount of ETH wrapped | ### [Transfer](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#transfer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity event Transfer(address indexed src, address indexed dst, uint256 wad) ``` Emitted when tokens are transferred. #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#parameters-2) | 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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#withdrawal) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity event Withdrawal(address indexed src, uint256 wad) ``` Emitted when WETH is unwrapped back to ETH. #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#parameters-3) | Parameter | Type | Description | | --- | --- | --- | | src | address | The address unwrapping WETH | | wad | uint256 | The amount of WETH unwrapped | ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#functions) ### [approve](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#approve) Approves a spender to transfer tokens on behalf of the owner. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function approve(address guy, uint256 wad) public returns (bool) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#parameters-4) | Parameter | Type | Description | | --- | --- | --- | | guy | address | The address to approve | | wad | uint256 | The amount of tokens to approve | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#returns) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | bool | Always returns true | ### [deposit](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#deposit-1) Wraps ETH to WETH by sending ETH to the contract. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function deposit() external payable ``` ### [totalSupply](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#totalsupply) Returns the total amount of WETH in circulation. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function totalSupply() public view returns (uint256) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#returns-1) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | uint256 | The total supply of WETH (contract's ETH balance) | ### [transfer](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#transfer-1) Transfers tokens to a specified address. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function transfer(address dst, uint256 wad) public returns (bool) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#parameters-5) | Parameter | Type | Description | | --- | --- | --- | | dst | address | The recipient address | | wad | uint256 | The amount of tokens to transfer | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#returns-2) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | bool | Always returns true | ### [transferFrom](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#transferfrom) Transfers tokens from one address to another. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function transferFrom(address src, address dst, uint256 wad) public returns (bool) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#parameters-6) | Parameter | Type | Description | | --- | --- | --- | | src | address | The source address | | dst | address | The destination address | | wad | uint256 | The amount of tokens to transfer | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#returns-3) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | bool | Always returns true | ### [withdraw](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#withdraw) Unwraps WETH back to ETH. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function withdraw(uint256 wad) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/weth9\#parameters-7) | Parameter | Type | Description | | --- | --- | --- | | wad | uint256 | The amount of WETH to unwrap | ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840164993&cv=11&fst=1748840164993&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv0.2.2%2Fweth9&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=WETH9%20v0.2.2%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=1060130365.1748840165&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## Chainlink CCIP Simulator [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [Using the CCIP Local Simulator in your Foundry project with forked environments](https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator-fork\#overview) You can use Chainlink Local to run CCIP 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). This project includes the `Example01ForkTest` file located in the `./test/fork` directory, demonstrating how to set up and run token transfer tests between two accounts using CCIP in forked environments. Forked environments allow you to simulate real-world blockchain networks by forking the state of existing chains. In this example, you will fork _Arbitrum Sepolia_ and _Ethereum Sepolia_. ## [Prerequisites](https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator-fork\#prerequisites) This guide assumes that you are familiar with the guide [Using the CCIP Local Simulator in your Foundry project](https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator). If not, please get familiar with it and run all the prerequisites. Set up an `.env` file with the following data: - `ARBITRUM_SEPOLIA_RPC_URL`: The Remote Procedure Call (RPC) URL for the Arbitrum Sepolia network. You can obtain one by creating an account on [Alchemy](https://www.alchemy.com/) or [Infura](https://www.infura.io/) and setting up an Arbitrum Sepolia project. - `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. ## [Test tokens transfers](https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator-fork\#test-tokens-transfers) You will run a test to transfer tokens between two accounts in a forked environment. The test file `Example01ForkTest.t.sol` is located in the `./test/fork` directory. This file contains two test cases: 1. **Transfer with LINK fees**: This test case transfers tokens from the sender account to the receiver account, paying fees in LINK. At the end of the test, it verifies that the sender account was debited and the receiver account was credited. 2. **Transfer with native gas fees**: This test case transfers tokens from the sender account to the receiver account, paying fees in native gas. At the end of the test, it verifies that the sender account was debited and the receiver account was credited. In these tests, we simulate transfers from a source blockchain (which is a fork of _Arbitrum Sepolia_) to a destination blockchain (which is a fork of _Ethereum Sepolia_). Forked environments allow you to simulate real-world blockchain networks by forking the state of existing chains, providing a realistic testing scenario. For a detailed explanation of the test file, refer to the [Examine the code](https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator-fork#examine-the-code) section. In your terminal, run the following command to execute the test: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```shell forge test --match-contract Example01ForkTest ``` Example output: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```text $ forge test --match-contract Example01ForkTest [⠊] Compiling... No files changed, compilation skipped Ran 2 tests for test/fork/Example01Fork.t.sol:Example01ForkTest [PASS] test_transferTokensFromEoaToEoaPayFeesInLink() (gas: 475199) [PASS] test_transferTokensFromEoaToEoaPayFeesInNative() (gas: 451096) Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 11.71s (17.29s CPU time) Ran 1 test suite in 11.90s (11.71s CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) ``` ## [Examine the code](https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator-fork\#examine-the-code) ### [Setup](https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator-fork\#setup) To transfer tokens using CCIP in a forked environment, we need the following: - Destination chain selector - Source CCIP router - LINK token for paying CCIP fees - A test token contract (such as CCIP-BnM) on both source and destination chains - A sender account (Alice) - A receiver account (Bob) The `setUp()` function is invoked before each test case to reinitialize all the variables, ensuring a clean state for each test: 1. Initialize the source and destination forks: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity string memory DESTINATION_RPC_URL = vm.envString("ETHEREUM_SEPOLIA_RPC_URL"); string memory SOURCE_RPC_URL = vm.envString("ARBITRUM_SEPOLIA_RPC_URL"); destinationFork = vm.createSelectFork(DESTINATION_RPC_URL); sourceFork = vm.createFork(SOURCE_RPC_URL); ``` 2. Initialize the sender and receiver accounts: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity bob = makeAddr("bob"); alice = makeAddr("alice"); ``` 3. Initialize the [fork CCIP local simulator](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork#cciplocalsimulatorfork). **Note**: `vm.makePersistent` is used to make the `ccipLocalSimulatorFork` address persistent across forks: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity ccipLocalSimulatorFork = new CCIPLocalSimulatorFork(); vm.makePersistent(address(ccipLocalSimulatorFork)); ``` 4. Retrieve and set up the network details for the destination chain. **Note**: [`Register.NetworkDetails`](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/register#networkdetails) is a struct that stores network details (such as chain selector, router address, link address, wrapped native address, or CCIP test tokens), and [`getNetworkDetails`](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork#getnetworkdetails) pulls network details based on chain IDs: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity Register.NetworkDetails memory destinationNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); destinationCCIPBnMToken = BurnMintERC677Helper(destinationNetworkDetails.ccipBnMAddress); destinationChainSelector = destinationNetworkDetails.chainSelector; ``` 5. Switch to the source fork and retrieve the network details for the source chain: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity vm.selectFork(sourceFork); Register.NetworkDetails memory sourceNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); sourceCCIPBnMToken = BurnMintERC677Helper(sourceNetworkDetails.ccipBnMAddress); sourceLinkToken = IERC20(sourceNetworkDetails.linkAddress); sourceRouter = IRouterClient(sourceNetworkDetails.routerAddress); ``` 6. All the variables are stored in the contract state for use in the test cases. ### [Prepare scenario (helper function)](https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator-fork\#prepare-scenario-helper-function) The `prepareScenario()` function is invoked at the beginning of each test case. It performs the following actions: 1. Select the source fork and request CCIP-BnM tokens for Alice: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity vm.selectFork(sourceFork); vm.startPrank(alice); sourceCCIPBnMToken.drip(alice); ``` 2. Approve the source router to spend tokens on behalf of Alice: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint256 amountToSend = 100; sourceCCIPBnMToken.approve(address(sourceRouter), amountToSend); ``` 3. Create an array [Client.EVMTokenAmount](https://docs.chain.link/ccip/api-reference/evm/v1.6.0/client#evmtokenamount)\[\] to specify the token transfer details. This array and the amount to send are returned by the `prepareScenario()` function for use in the calling test case: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity tokensToSendDetails = new Client.EVMTokenAmount[](1); Client.EVMTokenAmount memory tokenToSendDetails = Client.EVMTokenAmount({token: address(ccipBnMToken), amount: amountToSend}); tokensToSendDetails[0] = tokenToSendDetails; ``` 4. Stop impersonating Alice (sender): ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity vm.stopPrank(); ``` ### [Test case 1: Transfer with LINK fees](https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator-fork\#test-case-1-transfer-with-link-fees) The `test_transferTokensFromEoaToEoaPayFeesInLink` function tests the transfer of tokens between two externally owned accounts (EOA) while paying fees in LINK. Here are the steps involved in this test case: 01. Invoke the `prepareScenario()` function to set up the necessary variables: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity (Client.EVMTokenAmount[] memory tokensToSendDetails, uint256 amountToSend) = prepareScenario(); ``` 02. Select the destination fork and record the initial token balance of Bob receiver: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity vm.selectFork(destinationFork); uint256 balanceOfBobBefore = destinationCCIPBnMToken.balanceOf(bob); ``` 03. Select the source fork and record the initial token balance of Alice (sender): ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity vm.selectFork(sourceFork); uint256 balanceOfAliceBefore = sourceCCIPBnMToken.balanceOf(alice); ``` 04. Request 10 LINK tokens from the CCIP local simulator faucet for Alice (sender): ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity ccipLocalSimulatorFork.requestLinkFromFaucet(alice, 10 ether); ``` 05. Construct the [Client.EVM2AnyMessage](https://docs.chain.link/ccip/api-reference/evm/v1.6.0/client#evm2anymessage) structure with the receiver, token amounts, and other necessary details. - Set the `data` parameter to an empty string because you are not sending any arbitrary data, only tokens. - In `extraArgs`, set the gas limit to `0`. This gas limit is for execution of receiver logic, which doesn't apply here because you're sending tokens to an EOA. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity Client.EVM2AnyMessage memory message = Client.EVM2AnyMessage({ receiver: abi.encode(bob), data: abi.encode(""), tokenAmounts: tokensToSendDetails, extraArgs: Client._argsToBytes(Client.EVMExtraArgsV1({gasLimit: 0})), feeToken: address(sourceLinkToken) }); ``` 06. Calculate the required fees for the transfer and approve the router to spend LINK tokens for these fees: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint256 fees = sourceRouter.getFee(destinationChainSelector, message); sourceLinkToken.approve(address(sourceRouter), fees); ``` 07. Send the CCIP transfer request to the router: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity sourceRouter.ccipSend(destinationChainSelector, message); ``` 08. Stop impersonating Alice (sender): ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity vm.stopPrank(); ``` 09. Record Alice's final token balance and verify that it has decreased by the amount sent: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint256 balanceOfAliceAfter = sourceCCIPBnMToken.balanceOf(alice); assertEq(balanceOfAliceAfter, balanceOfAliceBefore - amountToSend); ``` 10. Call the [`switchChainAndRouteMessage`](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork#switchchainandroutemessage) function to switch to the destination fork and route the message to complete the transfer: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity ccipLocalSimulatorFork.switchChainAndRouteMessage(destinationFork); ``` 11. Record Bob's final token balance and verify that it has increased by the amount sent: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint256 balanceOfBobAfter = destinationCCIPBnMToken.balanceOf(bob); assertEq(balanceOfBobAfter, balanceOfBobBefore + amountToSend); ``` ### [Test case 2: Transfer with native gas fees](https://docs.chain.link/chainlink-local/build/ccip/foundry/local-simulator-fork\#test-case-2-transfer-with-native-gas-fees) The `test_transferTokensFromEoaToEoaPayFeesInNative` function tests the transfer of tokens between two externally owned accounts (EOA) while paying fees in native gas. Here are the steps involved in this test case: 01. Invoke the `prepareScenario()` function to set up the necessary variables. (This function is the same as in the previous test case.) 02. Select the destination fork and record Bob's initial token balance. (This step is the same as in the previous test case.) 03. Select the source fork and record Alice's initial token balance. (This step is the same as in the previous test case.) 04. Begin impersonating Alice (sender) and provide her with native gas: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity vm.startPrank(alice); deal(alice, 5 ether); ``` 05. Construct the [Client.EVM2AnyMessage](https://docs.chain.link/ccip/api-reference/evm/v1.6.0/client#evm2anymessage) structure. This step is the same as in the previous test case. The main difference is that the `feeToken` is set with `address(0)` to indicate that the fees are paid in native gas: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity Client.EVM2AnyMessage memory message = Client.EVM2AnyMessage({ receiver: abi.encode(bob), data: abi.encode(""), tokenAmounts: tokensToSendDetails, extraArgs: Client._argsToBytes(Client.EVMExtraArgsV1({gasLimit: 0})), feeToken: address(0) }); ``` 06. Calculate the required fees for the transfer and send the CCIP transfer request along with the necessary native gas: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint256 fees = sourceRouter.getFee(destinationChainSelector, message); sourceRouter.ccipSend{value: fees}(destinationChainSelector, message, fees); ``` 07. Stop impersonating Alice (sender). (This step is the same as in the previous test case.) 08. Verify Alice's (sender) balance. (This step is the same as in the previous test case.) 09. Call the [`switchChainAndRouteMessage`](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork#switchchainandroutemessage) function to switch to the destination fork and route the message to complete the transfer. (This step is the same as in the previous test case.) 10. Verify Bob's (receiver) balance. (This step is the same as in the previous test case.) ## Get the latest Chainlink content straight to your inbox. Email Address ## WETH9 API Reference [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 You're not using the latest version. Update to v0.2.3 # [WETH9 v0.2.1 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/weth9\#overview) ## [WETH9](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/weth9\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/weth9\#events) ### [Approval](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/weth9\#approval) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/weth9\#deposit) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/weth9\#transfer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/weth9\#withdrawal) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/weth9\#variables) ### [allowance](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/weth9\#allowance) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity mapping(address => mapping(address => uint256)) public allowance ``` Maps owner addresses to spender addresses to approved amounts. ### [balanceOf](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/weth9\#balanceof) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity mapping(address => uint256) public balanceOf ``` Maps addresses to their token balances. ### [decimals](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/weth9\#decimals) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint8 public decimals = 18 ``` The number of decimal places used by the token. ### [name](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/weth9\#name) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity string public name = "Wrapped Ether" ``` The name of the token. ### [symbol](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/weth9\#symbol) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity string public symbol = "WETH" ``` The symbol of the token. ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/weth9\#functions) ### [\_deposit](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/weth9\#_deposit) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function _deposit() internal ``` Internal function to handle ETH deposits and mint corresponding WETH tokens. ### [approve](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/weth9\#approve) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/weth9\#deposit-1) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function deposit() external payable ``` Deposits ETH and mints WETH tokens. ### [receive](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/weth9\#receive) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity receive() external payable ``` Fallback function to handle direct ETH transfers. Calls `_deposit()` to wrap received ETH into WETH. ### [totalSupply](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/weth9\#totalsupply) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/weth9\#transfer-1) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/weth9\#transferfrom) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function transferFrom(address src, address dst, uint256 wad) public returns (bool) ``` Transfers tokens from one address to another. **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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/weth9\#withdraw) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function withdraw(uint256 wad) external ``` Withdraws ETH by burning WETH tokens. **Parameters:** | Parameter | Type | Description | | --- | --- | --- | | wad | `uint256` | The amount to withdraw | ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840165252&cv=11&fst=1748840165252&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2h1v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247~103308613&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv0.2.1%2Fweth9&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=WETH9%20v0.2.1%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=919645783.1748840165&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## AggregatorV3Interface API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [AggregatorV3Interface v0.2.3 API Reference](https://docs.chain.link/chainlink-local/api-reference/v023/aggregator-v3-interface\#overview) ## [AggregatorV3Interface](https://docs.chain.link/chainlink-local/api-reference/v023/aggregator-v3-interface\#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) ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v023/aggregator-v3-interface\#functions) ### [decimals](https://docs.chain.link/chainlink-local/api-reference/v023/aggregator-v3-interface\#decimals) Gets the number of decimals used by the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function decimals() external view returns (uint8) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v023/aggregator-v3-interface\#returns) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `uint8` | The number of decimals | ### [description](https://docs.chain.link/chainlink-local/api-reference/v023/aggregator-v3-interface\#description) Gets the description of the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function description() external view returns (string memory) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v023/aggregator-v3-interface\#returns-1) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `string` | The description of the aggregator | ### [getRoundData](https://docs.chain.link/chainlink-local/api-reference/v023/aggregator-v3-interface\#getrounddata) Gets the round data for a specific round ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v023/aggregator-v3-interface\#parameters) | Parameter | Type | Description | | --- | --- | --- | | \_roundId | `uint80` | The round ID to get the data for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v023/aggregator-v3-interface\#returns-2) | 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](https://docs.chain.link/chainlink-local/api-reference/v023/aggregator-v3-interface\#latestrounddata) Gets the latest round data. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v023/aggregator-v3-interface\#returns-3) | 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](https://docs.chain.link/chainlink-local/api-reference/v023/aggregator-v3-interface\#version) Gets the version of the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function version() external view returns (uint256) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v023/aggregator-v3-interface\#returns-4) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `uint256` | The version of the aggregator | ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840164913&cv=11&fst=1748840164913&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247~103308615&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv023%2Faggregator-v3-interface&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=AggregatorV3Interface%20v0.2.3%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=375327268.1748840165&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## WETH9 API Reference [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 # [WETH9 v0.2.3 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#overview) ## [WETH9](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#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) ## [Variables](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#variables) ### [allowance](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#allowance) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity mapping(address => mapping(address => uint256)) public allowance ``` ### [balanceOf](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#balanceof) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity mapping(address => uint256) public balanceOf ``` ### [decimals](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#decimals) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint8 public decimals = 18 ``` ### [name](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#name) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity string public name = "Wrapped Ether" ``` ### [symbol](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#symbol) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity string public symbol = "WETH" ``` ## [Events](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#events) ### [Approval](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#approval) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity event Approval(address indexed src, address indexed guy, uint256 wad) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#deposit) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity event Deposit(address indexed dst, uint256 wad) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#parameters-1) | Parameter | Type | Description | | --- | --- | --- | | dst | `address` | The address receiving the WETH | | wad | `uint256` | The amount of ETH being wrapped | ### [Transfer](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#transfer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity event Transfer(address indexed src, address indexed dst, uint256 wad) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#parameters-2) | 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](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#withdrawal) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity event Withdrawal(address indexed src, uint256 wad) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#parameters-3) | Parameter | Type | Description | | --- | --- | --- | | src | `address` | The address unwrapping the WETH | | wad | `uint256` | The amount of WETH being unwrapped | ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#functions) ### [approve](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#approve) Approves another address to spend tokens. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function approve(address guy, uint256 wad) public returns (bool) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#parameters-4) | Parameter | Type | Description | | --- | --- | --- | | guy | `address` | The address to approve | | wad | `uint256` | The amount of tokens to approve | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#returns) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `bool` | Always returns true | ### [deposit](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#deposit-1) Deposits ETH to receive WETH. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function deposit() external payable ``` ### [totalSupply](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#totalsupply) Gets the total supply of WETH. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function totalSupply() public view returns (uint256) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#returns-1) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `uint256` | The total supply of WETH | ### [transfer](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#transfer-1) Transfers tokens to another address. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function transfer(address dst, uint256 wad) public returns (bool) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#parameters-5) | Parameter | Type | Description | | --- | --- | --- | | dst | `address` | The recipient address | | wad | `uint256` | The amount of tokens to transfer | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#returns-2) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `bool` | Returns true if the transfer succeeds | ### [transferFrom](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#transferfrom) Transfers tokens from one address to another. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function transferFrom(address src, address dst, uint256 wad) public returns (bool) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#parameters-6) | Parameter | Type | Description | | --- | --- | --- | | src | `address` | The source address | | dst | `address` | The destination address | | wad | `uint256` | The amount of tokens to transfer | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#returns-3) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `bool` | Returns true if the transfer succeeds | #### [Possible Reverts](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#withdraw) Withdraws ETH by unwrapping WETH. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function withdraw(uint256 wad) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#parameters-7) | Parameter | Type | Description | | --- | --- | --- | | wad | `uint256` | The amount of WETH to unwrap | #### [Possible Reverts](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/weth9\#possible-reverts-1) - Reverts if the caller has insufficient WETH balance ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840165295&cv=11&fst=1748840165295&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~102938614~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247~103308613&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv0.2.3%2Fweth9&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=WETH9%20v0.2.3%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=657392481.1748840165&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## Chainlink CCIP Register API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 # [Register v0.2.3 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/register\#overview) ## [Register](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/register\#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) ## [Structs](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/register\#structs) ### [NetworkDetails](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/register\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/register\#variables) ### [s\_networkDetails](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/register\#s_networkdetails) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity mapping(uint256 chainId => NetworkDetails) internal s_networkDetails ``` ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/register\#functions) ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/register\#constructor) Initializes the contract with predefined network details for various supported chains. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity constructor() ``` ### [getNetworkDetails](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/register\#getnetworkdetails) Retrieves the network details for a specified chain ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getNetworkDetails(uint256 chainId) external view returns (NetworkDetails memory networkDetails) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/register\#parameters) | Parameter | Type | Description | | --- | --- | --- | | chainId | `uint256` | The ID of the chain to get details for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/register\#returns) | Type | Description | | --- | --- | | `NetworkDetails` | The network configuration details for the chain | ### [setNetworkDetails](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/register\#setnetworkdetails) Sets or updates the network details for a specified chain ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function setNetworkDetails(uint256 chainId, NetworkDetails memory networkDetails) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/register\#parameters-1) | Parameter | Type | Description | | --- | --- | --- | | chainId | `uint256` | The ID of the chain to set details for | | networkDetails | `NetworkDetails` | The network configuration details to be stored | ## Get the latest Chainlink content straight to your inbox. Email Address ## MockV3Aggregator API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [MockV3Aggregator v0.2.3 API Reference](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#overview) ## [MockV3Aggregator](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#mockv3aggregator) A mock implementation of the AggregatorV2V3Interface for testing purposes. [`MockV3Aggregator`](https://github.com/smartcontractkit/chainlink-local/blob/7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab/src/data-feeds/MockV3Aggregator.sol) ## [Variables](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#variables) ### [aggregator](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#aggregator) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity address public aggregator ``` ### [proposedAggregator](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#proposedaggregator) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity address public proposedAggregator ``` ### [version](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#version) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint256 public constant override version = 0 ``` ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#functions) ### [confirmAggregator](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#confirmaggregator) Confirms the proposed aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function confirmAggregator(address _aggregator) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#parameters) | Parameter | Type | Description | | --- | --- | --- | | \_aggregator | `address` | The address of the proposed aggregator | #### [Possible Reverts](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#possible-reverts) - Reverts if the provided aggregator address does not match the proposed aggregator with "Invalid proposed aggregator" ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#constructor) Initializes the contract with decimals and initial answer. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity constructor(uint8 _decimals, int256 _initialAnswer) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#parameters-1) | Parameter | Type | Description | | --- | --- | --- | | \_decimals | `uint8` | The number of decimals for the aggregator | | \_initialAnswer | `int256` | The initial answer to be set | ### [decimals](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#decimals) Gets the number of decimals used by the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function decimals() external view returns (uint8) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#returns) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `uint8` | The number of decimals | ### [description](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#description) Gets the description of the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function description() external pure returns (string memory) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#returns-1) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `string` | The contract path as the description | ### [getAnswer](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#getanswer) Gets the answer for a specific round ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#parameters-2) | Parameter | Type | Description | | --- | --- | --- | | roundId | `uint256` | The round ID to get answer for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#returns-2) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `int256` | The answer for the given round ID | ### [getRoundData](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#getrounddata) Gets the round data for a specific round ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#parameters-3) | Parameter | Type | Description | | --- | --- | --- | | \_roundId | `uint80` | The round ID to get the data for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#returns-3) | 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](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#gettimestamp) Gets the timestamp for a specific round ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#parameters-4) | Parameter | Type | Description | | --- | --- | --- | | roundId | `uint256` | The round ID to get timestamp for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#returns-4) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `uint256` | The timestamp for the given round ID | ### [latestAnswer](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#latestanswer) Gets the latest answer from the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestAnswer() external view returns (int256) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#returns-5) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `int256` | The latest answer | ### [latestRound](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#latestround) Gets the latest round ID from the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestRound() external view returns (uint256) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#returns-6) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `uint256` | The latest round ID | ### [latestRoundData](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#latestrounddata) Gets the latest round data. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#returns-7) | 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](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#latesttimestamp) Gets the timestamp of the latest answer. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestTimestamp() external view returns (uint256) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#returns-8) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `uint256` | The timestamp of the latest answer | ### [proposeAggregator](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#proposeaggregator) Proposes a new aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function proposeAggregator(AggregatorV2V3Interface _aggregator) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#parameters-5) | Parameter | Type | Description | | --- | --- | --- | | \_aggregator | `AggregatorV2V3Interface` | The address of the proposed aggregator | #### [Possible Reverts](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#possible-reverts-1) - 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](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#updateanswer) Updates the answer in the mock aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function updateAnswer(int256 _answer) public ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#parameters-6) | Parameter | Type | Description | | --- | --- | --- | | \_answer | `int256` | The new answer to be set | ### [updateRoundData](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#updaterounddata) Updates the round data in the mock aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v023/mock-v3-aggregator\#parameters-7) | 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 | ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840169849&cv=11&fst=1748840169849&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv023%2Fmock-v3-aggregator&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=MockV3Aggregator%20v0.2.3%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=750529555.1748840169&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## MockV3Aggregator API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [MockV3Aggregator v0.2.2 API Reference](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#overview) ## [MockV3Aggregator](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#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](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#inheritance) This contract inherits from: - [`AggregatorV2V3Interface`](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-v2-v3-interface) \- Combined interface that includes both AggregatorInterface and AggregatorV3Interface functionality ## [Variables](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#variables) ### [aggregator](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#aggregator) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity address public aggregator ``` ### [proposedAggregator](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#proposedaggregator) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity address public proposedAggregator ``` ### [version](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#version) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint256 public constant version ``` ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#functions) ### [confirmAggregator](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#confirmaggregator) Confirms and sets a previously proposed aggregator as the current one. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function confirmAggregator(address _aggregator) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#parameters) | Parameter | Type | Description | | --- | --- | --- | | \_aggregator | address | The address of the proposed aggregator | ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#constructor) Initializes the mock aggregator with specified decimals and initial answer. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity constructor(uint8 _decimals, int256 _initialAnswer) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#parameters-1) | 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](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#decimals) Retrieves the number of decimal places used by the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function decimals() external view returns (uint8) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#returns) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | uint8 | The number of decimals | ### [description](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#description) Returns the description of the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function description() external pure returns (string memory) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#returns-1) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | string | The source file path of the mock aggregator | ### [getAnswer](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#getanswer) Retrieves the answer for a specific round. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#parameters-2) | Parameter | Type | Description | | --- | --- | --- | | roundId | uint256 | The round ID to get the answer for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#returns-2) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | int256 | The answer for the given round ID | ### [getRoundData](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#getrounddata) Retrieves the complete round data for a specific round ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#parameters-3) | Parameter | Type | Description | | --- | --- | --- | | \_roundId | uint80 | The round ID to get the data for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#returns-3) | 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](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#gettimestamp) Retrieves the timestamp for a specific round. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#parameters-4) | Parameter | Type | Description | | --- | --- | --- | | roundId | uint256 | The round ID to get the timestamp for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#returns-4) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | uint256 | The timestamp for the given round ID | ### [latestAnswer](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#latestanswer) Retrieves the most recent answer. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestAnswer() external view returns (int256) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#returns-5) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | int256 | The latest answer | ### [latestRound](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#latestround) Retrieves the most recent round ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestRound() external view returns (uint256) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#returns-6) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | uint256 | The latest round ID | ### [latestRoundData](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#latestrounddata) Retrieves the complete round data for the most recent round. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#returns-7) | 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](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#latesttimestamp) Retrieves the timestamp of the most recent answer. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestTimestamp() external view returns (uint256) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#returns-8) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | uint256 | The timestamp of the latest answer | ### [proposeAggregator](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#proposeaggregator) Proposes a new aggregator for future use. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function proposeAggregator(AggregatorV2V3Interface _aggregator) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#parameters-5) | Parameter | Type | Description | | --- | --- | --- | | \_aggregator | AggregatorV2V3Interface | The address of the proposed aggregator | ### [updateAnswer](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#updateanswer) Updates the latest answer in the underlying mock aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function updateAnswer(int256 _answer) public ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#parameters-6) | Parameter | Type | Description | | --- | --- | --- | | \_answer | int256 | The new answer to be set | ### [updateRoundData](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#updaterounddata) Updates all data for a specific round in the underlying mock aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v022/mock-v3-aggregator\#parameters-7) | 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 | ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840169443&cv=11&fst=1748840169443&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv022%2Fmock-v3-aggregator&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=MockV3Aggregator%20v0.2.2%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=1731027655.1748840169&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## AggregatorV3Interface API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [AggregatorV3Interface v0.2.2 API Reference](https://docs.chain.link/chainlink-local/api-reference/v022/aggregator-v3-interface\#overview) ## [AggregatorV3Interface](https://docs.chain.link/chainlink-local/api-reference/v022/aggregator-v3-interface\#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](https://docs.chain.link/chainlink-local/api-reference/v022/aggregator-v3-interface\#functions) ### [decimals](https://docs.chain.link/chainlink-local/api-reference/v022/aggregator-v3-interface\#decimals) Retrieves the number of decimal places used by the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function decimals() external view returns (uint8) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v022/aggregator-v3-interface\#returns) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | uint8 | The number of decimals | ### [description](https://docs.chain.link/chainlink-local/api-reference/v022/aggregator-v3-interface\#description) Retrieves the description of the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function description() external view returns (string memory) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v022/aggregator-v3-interface\#returns-1) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | string | The description of the aggregator | ### [getRoundData](https://docs.chain.link/chainlink-local/api-reference/v022/aggregator-v3-interface\#getrounddata) Retrieves the complete round data for a specific round ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v022/aggregator-v3-interface\#parameters) | Parameter | Type | Description | | --- | --- | --- | | \_roundId | uint80 | The round ID to get the data for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v022/aggregator-v3-interface\#returns-2) | 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](https://docs.chain.link/chainlink-local/api-reference/v022/aggregator-v3-interface\#latestrounddata) Retrieves the complete round data for the most recent round. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v022/aggregator-v3-interface\#returns-3) | 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](https://docs.chain.link/chainlink-local/api-reference/v022/aggregator-v3-interface\#version) Retrieves the version number of the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function version() external view returns (uint256) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v022/aggregator-v3-interface\#returns-4) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | uint256 | The version of the aggregator | ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840169266&cv=11&fst=1748840169266&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~102015666~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv022%2Faggregator-v3-interface&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=AggregatorV3Interface%20v0.2.2%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=520591496.1748840169&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## MockEvm2EvmOffRamp API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [MockEvm2EvmOffRamp v0.2.1 API Reference](https://docs.chain.link/chainlink-local/api-reference/v021/mock-evm2evm-offramp\#overview) ## [MockEvm2EvmOffRamp](https://docs.chain.link/chainlink-local/api-reference/v021/mock-evm2evm-offramp\#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](https://docs.chain.link/chainlink-local/api-reference/v021/mock-evm2evm-offramp\#errors) ### [CanOnlySimulatorCall](https://docs.chain.link/chainlink-local/api-reference/v021/mock-evm2evm-offramp\#canonlysimulatorcall) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity error CanOnlySimulatorCall() ``` Thrown when a non-simulator address attempts to call restricted functions. ### [ReceiverError](https://docs.chain.link/chainlink-local/api-reference/v021/mock-evm2evm-offramp\#receivererror) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity error ReceiverError(bytes error) ``` Thrown when the CCIP receiver execution fails. ### [TokenHandlingError](https://docs.chain.link/chainlink-local/api-reference/v021/mock-evm2evm-offramp\#tokenhandlingerror) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity error TokenHandlingError(bytes error) ``` Thrown when token release or minting operations encounter non-rate-limiting errors. ### [UnsupportedToken](https://docs.chain.link/chainlink-local/api-reference/v021/mock-evm2evm-offramp\#unsupportedtoken) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity error UnsupportedToken(IERC20 token) ``` Thrown when attempting to interact with a token that doesn't have an associated pool. ## [Structs](https://docs.chain.link/chainlink-local/api-reference/v021/mock-evm2evm-offramp\#structs) ### [DynamicConfig](https://docs.chain.link/chainlink-local/api-reference/v021/mock-evm2evm-offramp\#dynamicconfig) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v021/mock-evm2evm-offramp\#variables) ### [i\_sourceChainSelector](https://docs.chain.link/chainlink-local/api-reference/v021/mock-evm2evm-offramp\#i_sourcechainselector) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint64 internal immutable i_sourceChainSelector ``` The chain selector identifying the source chain for this off-ramp. ### [s\_ccipLocalSimulator](https://docs.chain.link/chainlink-local/api-reference/v021/mock-evm2evm-offramp\#s_cciplocalsimulator) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity address internal s_ccipLocalSimulator ``` The address of the local CCIP simulator controlling this off-ramp. ### [s\_dynamicConfig](https://docs.chain.link/chainlink-local/api-reference/v021/mock-evm2evm-offramp\#s_dynamicconfig) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity DynamicConfig internal s_dynamicConfig ``` Current dynamic configuration settings for the off-ramp. ### [s\_poolsBySourceToken](https://docs.chain.link/chainlink-local/api-reference/v021/mock-evm2evm-offramp\#s_poolsbysourcetoken) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity EnumerableMapAddresses.AddressToAddressMap private s_poolsBySourceToken ``` Maps source token addresses to their corresponding token pool addresses. ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v021/mock-evm2evm-offramp\#functions) ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v021/mock-evm2evm-offramp\#constructor) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v021/mock-evm2evm-offramp\#executesinglemessage) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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. **Parameters:** | Parameter | Type | Description | | --- | --- | --- | | message | `Internal.EVM2EVMMessage` | The cross-chain message to process | | offchainTokenData | `bytes[]` | Token data provided by off-chain DON | ### [getPoolBySourceToken](https://docs.chain.link/chainlink-local/api-reference/v021/mock-evm2evm-offramp\#getpoolbysourcetoken) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v021/mock-evm2evm-offramp\#_releaseorminttokens) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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. **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 | ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840169360&cv=11&fst=1748840169360&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103211513~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv021%2Fmock-evm2evm-offramp&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=MockEvm2EvmOffRamp%20v0.2.1%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=640217570.1748840169&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## CCIP Network Registration API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 You're not using the latest version. Update to v0.2.3 # [Register v0.2.1 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/register\#overview) ## [Register](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/register\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/register\#structs) ### [NetworkDetails](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/register\#networkdetails) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/register\#variables) ### [s\_networkDetails](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/register\#s_networkdetails) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/register\#functions) ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/register\#constructor) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/register\#getnetworkdetails) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/register\#setnetworkdetails) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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 | ## Get the latest Chainlink content straight to your inbox. Email Address ## MockV3Aggregator API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [MockV3Aggregator v0.2.1 API Reference](https://docs.chain.link/chainlink-local/api-reference/v021/mock-v3-aggregator\#overview) ## [MockV3Aggregator](https://docs.chain.link/chainlink-local/api-reference/v021/mock-v3-aggregator\#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](https://docs.chain.link/chainlink-local/api-reference/v021/mock-v3-aggregator\#variables) ### [aggregator](https://docs.chain.link/chainlink-local/api-reference/v021/mock-v3-aggregator\#aggregator) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity address public aggregator ``` The address of the current MockOffchainAggregator implementation. ### [proposedAggregator](https://docs.chain.link/chainlink-local/api-reference/v021/mock-v3-aggregator\#proposedaggregator) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity address public proposedAggregator ``` The address of the proposed new aggregator implementation. ### [version](https://docs.chain.link/chainlink-local/api-reference/v021/mock-v3-aggregator\#version) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint256 public constant override version = 0 ``` The version number of this aggregator implementation. ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v021/mock-v3-aggregator\#functions) ### [confirmAggregator](https://docs.chain.link/chainlink-local/api-reference/v021/mock-v3-aggregator\#confirmaggregator) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function confirmAggregator(address _aggregator) external ``` Confirms a proposed aggregator upgrade. **Parameters:** | Parameter | Type | Description | | --- | --- | --- | | \_aggregator | `address` | The proposed aggregator address to confirm | ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v021/mock-v3-aggregator\#constructor) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v021/mock-v3-aggregator\#decimals) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v021/mock-v3-aggregator\#description) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v021/mock-v3-aggregator\#getanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v021/mock-v3-aggregator\#getrounddata) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v021/mock-v3-aggregator\#gettimestamp) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v021/mock-v3-aggregator\#latestanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestAnswer() external view returns (int256) ``` Retrieves the most recent answer. **Returns:** | Type | Description | | --- | --- | | `int256` | The latest price feed answer | ### [latestRound](https://docs.chain.link/chainlink-local/api-reference/v021/mock-v3-aggregator\#latestround) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestRound() external view returns (uint256) ``` Retrieves the most recent round ID. **Returns:** | Type | Description | | --- | --- | | `uint256` | The latest round ID | ### [latestRoundData](https://docs.chain.link/chainlink-local/api-reference/v021/mock-v3-aggregator\#latestrounddata) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v021/mock-v3-aggregator\#latesttimestamp) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v021/mock-v3-aggregator\#proposeaggregator) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function proposeAggregator(AggregatorV2V3Interface _aggregator) external ``` Proposes a new aggregator implementation. **Parameters:** | Parameter | Type | Description | | --- | --- | --- | | \_aggregator | `AggregatorV2V3Interface` | The new aggregator implementation | ### [updateAnswer](https://docs.chain.link/chainlink-local/api-reference/v021/mock-v3-aggregator\#updateanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v021/mock-v3-aggregator\#updaterounddata) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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 | ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840169386&cv=11&fst=1748840169386&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104573694~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv021%2Fmock-v3-aggregator&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=MockV3Aggregator%20v0.2.1%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=1715921346.1748840169&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## Chainlink Register API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 You're not using the latest version. Update to v0.2.3 # [Register v0.2.2 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/register\#overview) ## [Register](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/register\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/register\#structs) ### [NetworkDetails](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/register\#networkdetails) Configuration details for a CCIP network. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity struct NetworkDetails { uint64 chainSelector; address routerAddress; address linkAddress; address wrappedNativeAddress; address ccipBnMAddress; address ccipLnMAddress; address rmnProxyAddress; address registryModuleOwnerCustomAddress; address tokenAdminRegistryAddress; } ``` #### [Fields](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/register\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/register\#variables) ### [s\_networkDetails](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/register\#s_networkdetails) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity mapping(uint256 chainId => NetworkDetails) internal s_networkDetails ``` ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/register\#functions) ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/register\#constructor) Initializes the contract with predefined network configurations for various test networks. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity constructor() ``` ### [getNetworkDetails](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/register\#getnetworkdetails) Fetches the network configuration for a specified chain ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getNetworkDetails(uint256 chainId) external view returns (NetworkDetails memory networkDetails) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/register\#parameters) | Parameter | Type | Description | | --- | --- | --- | | chainId | uint256 | The ID of the chain to get the details for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/register\#returns) | Parameter | Type | Description | | --- | --- | --- | | networkDetails | NetworkDetails | The network details for the specified chain ID | ### [setNetworkDetails](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/register\#setnetworkdetails) Updates or adds network configuration details for a specific chain ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function setNetworkDetails(uint256 chainId, NetworkDetails memory networkDetails) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/register\#parameters-1) | 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 | ## Get the latest Chainlink content straight to your inbox. Email Address ## Chainlink CCIP Simulator [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [Using CCIP Local Simulator in Your Hardhat Project - Forked Environments](https://docs.chain.link/chainlink-local/build/ccip/hardhat/local-simulator-fork\#overview) You can use Chainlink Local to run CCIP in forked environments 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 includes the `Example1.spec.tst` file located in the `./test/fork` directory, demonstrating how to set up and run token transfer tests between two accounts using CCIP in forked environments. Forked environments allow you to simulate real-world blockchain networks by forking the state of existing chains. In this example, we will fork _Arbitrum Sepolia_ and _Ethereum Sepolia_. ## [Prerequisites](https://docs.chain.link/chainlink-local/build/ccip/hardhat/local-simulator-fork\#prerequisites) This guide assumes that you are familiar with the guide [Using CCIP Local Simulator in Your Hardhat Project](https://docs.chain.link/chainlink-local/build/ccip/hardhat/local-simulator). If not, please get familiar with it and run all the prerequisites. Set an environment variable file. For higher security, the examples repository imports [@chainlink/env-enc](https://www.npmjs.com/package/@chainlink/env-enc). Use this tool to encrypt your environment variables at rest. 1. Set an encryption password for your environment variables. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```shell npx env-enc set-pw ``` 2. Run `npx env-enc set` to configure a `.env.enc` file with: - `ARBITRUM_SEPOLIA_RPC_URL`: The Remote Procedure Call (RPC) URL for the Arbitrum Sepolia network. You can obtain one by creating an account on [Alchemy](https://www.alchemy.com/) or [Infura](https://www.infura.io/) and setting up an Arbitrum Sepolia project. - `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. ## [Test tokens transfers](https://docs.chain.link/chainlink-local/build/ccip/hardhat/local-simulator-fork\#test-tokens-transfers) You will run a test to transfer tokens between two accounts in a forked environment. The test file `Example1.spec.ts` is located in the `./test/fork` directory. This file contains one test case: **Transfer with LINK fees**: This test case transfers tokens from the sender account to the receiver account, paying fees in LINK. At the end of the test, it verifies that the sender account was debited and the receiver account was credited. In this test, we simulate a transfer of tokens from an Externally Owned Account (EOA) on a source blockchain (which is a fork of _Arbitrum Sepolia_) to an EOA on a destination blockchain (which is a fork of _Ethereum Sepolia_). Forked environments allow you to simulate real-world blockchain networks by forking the state of existing chains, providing a realistic testing scenario. For a detailed explanation of the test file, refer to the [Examine the code](https://docs.chain.link/chainlink-local/build/ccip/hardhat/local-simulator-fork#examine-the-code) section. In your terminal, run the following command to execute the test: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```shell npx hardhat test test/fork/Example1.spec.ts ``` Example output: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```text $ npx hardhat test test/fork/Example1.spec.ts Example 1 - Fork ✔ Should transfer CCIP test tokens from EOA to EOA (10889ms) 1 passing (11s) ``` ## [Examine the code](https://docs.chain.link/chainlink-local/build/ccip/hardhat/local-simulator-fork\#examine-the-code) To transfer tokens using CCIP in a forked environment, we need the following: - Destination chain selector - Source CCIP router - LINK token for paying CCIP fees - A test token contract (such as CCIP-BnM) on both source and destination chains - A sender account (Alice) - A receiver account (Bob) The `it("Should transfer CCIP test tokens from EOA to EOA")` function sets up the necessary environment and runs the test. Here are the steps involved: 01. Initialize the sender and receiver accounts: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```typescript const [alice, bob] = await hre.ethers.getSigners() ``` 02. Set the source and destination chains: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```typescript const [source, destination] = ["ethereumSepolia", "arbitrumSepolia"] ``` 03. Retrieve the necessary addresses and configurations (such as the LINK token address, source router address, and so on). 04. Fork the source network: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```typescript await hre.network.provider.request({ method: "hardhat_reset", params: [\ {\ forking: {\ jsonRpcUrl: getProviderRpcUrl(source),\ },\ },\ ], }) ``` 05. Connect to the source router and CCIP-BnM contracts. 06. Call `sourceCCIPBnM.drip` to request CCIP-BnM tokens for Alice (sender). 07. Approve the source router to spend tokens on behalf of Alice (sender). 08. Construct the `Client.EVM2AnyMessage` structure. This step is similar to the non fork example. 09. Call the source router to estimate the fees. 10. Call the [`requestLinkFromFaucet`](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork-js#requestlinkfromthefaucet) function to request LINK tokens for Alice (sender). 11. Connect to the LINK contract and approve the LINK token for paying CCIP fees. 12. Estimate Alice (sender) balance before the transfer. 13. Call the source router to send the CCIP request. 14. Wait for the transaction to be included in a block. 15. Call the [`getEvm2EvmMessage`](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork-js#getevm2evmmessage) function to parse the transaction receipt and extract the `CCIPSendRequested` event and then decodes it to an object. 16. Verify that Alice's balance has decreased by the amount sent. 17. Fork and switch to the destination network: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```typescript await hre.network.provider.request({ method: "hardhat_reset", params: [\ {\ forking: {\ jsonRpcUrl: getProviderRpcUrl(destination),\ },\ },\ ], }) ``` 18. Call the [`routeMessage`](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork-js#routemessage) function to route the message to the destination router. 19. Connect to the CCIP-BnM contract using the CCIP-BnM destination address. 20. Verify that Bob's balance has increased by the amount sent. ## Get the latest Chainlink content straight to your inbox. Email Address ## AggregatorInterface API Reference [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 # [AggregatorInterface v0.2.3 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-interface\#overview) ## [AggregatorInterface](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-interface\#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) ## [Events](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-interface\#events) ### [AnswerUpdated](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-interface\#answerupdated) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-interface\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-interface\#newround) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-interface\#parameters-1) | 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](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-interface\#functions) ### [getAnswer](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-interface\#getanswer) Gets the answer for a specific round ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-interface\#parameters-2) | Parameter | Type | Description | | --- | --- | --- | | roundId | `uint256` | The round ID to get the answer for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-interface\#returns) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `int256` | The answer for the given round ID | ### [getTimestamp](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-interface\#gettimestamp) Gets the timestamp for a specific round ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-interface\#parameters-3) | Parameter | Type | Description | | --- | --- | --- | | roundId | `uint256` | The round ID to get the timestamp for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-interface\#returns-1) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `uint256` | The timestamp for the given round ID | ### [latestAnswer](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-interface\#latestanswer) Gets the latest answer from the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestAnswer() external view returns (int256) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-interface\#returns-2) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `int256` | The latest answer | ### [latestRound](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-interface\#latestround) Gets the latest round ID from the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestRound() external view returns (uint256) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-interface\#returns-3) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `uint256` | The latest round ID | ### [latestTimestamp](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-interface\#latesttimestamp) Gets the timestamp of the latest answer from the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestTimestamp() external view returns (uint256) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-interface\#returns-4) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `uint256` | The timestamp of the latest answer | ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840169264&cv=11&fst=1748840169264&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv0.2.3%2Faggregator-interface&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=AggregatorInterface%20v0.2.3%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=1748392854.1748840169&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## Chainlink Aggregator API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 You're not using the latest version. Update to v0.2.3 # [AggregatorInterface v0.2.1 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-interface\#overview) ## [AggregatorInterface](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-interface\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-interface\#events) ### [AnswerUpdated](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-interface\#answerupdated) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-interface\#newround) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-interface\#functions) ### [getAnswer](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-interface\#getanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-interface\#gettimestamp) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-interface\#latestanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestAnswer() external view returns (int256) ``` Retrieves the most recent answer. **Returns:** | Type | Description | | --- | --- | | `int256` | The latest price feed answer | ### [latestRound](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-interface\#latestround) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestRound() external view returns (uint256) ``` Retrieves the most recent round ID. **Returns:** | Type | Description | | --- | --- | | `uint256` | The latest round ID | ### [latestTimestamp](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-interface\#latesttimestamp) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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 | ## Get the latest Chainlink content straight to your inbox. Email Address ## Chainlink LinkToken API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version:v0.2.2Not using latest version (v0.2.3) # [LinkToken v0.2.2 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/link-token\#overview) ## [LinkToken](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/link-token\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/link-token\#functions) ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/link-token\#constructor) Initializes a new LINK token with standard token details. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity constructor() ``` ### [\_onCreate](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/link-token\#_oncreate) Internal hook that handles the initial token supply minting. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function _onCreate() internal virtual ``` ## Get the latest Chainlink content straight to your inbox. Email Address ## CCIPLocalSimulatorFork API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [CCIPLocalSimulatorFork v0.2.3 API Reference](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#overview) ## [CCIPLocalSimulatorFork](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#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) ## [Interfaces](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#interfaces) ### [IRouterFork](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#irouterfork) Interface for interacting with the CCIP Router contract in a forked environment. #### [OffRamp](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#offramp) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#getofframps) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getOffRamps() external view returns (OffRamp[] memory) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#returns) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `OffRamp[]` | Array of off-ramp configurations | ### [IEVM2EVMOffRampFork](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#ievm2evmofframpfork) Interface for executing CCIP messages on an off-ramp contract in a forked environment. #### [executeSingleMessage](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#executesinglemessage) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function executeSingleMessage( Internal.EVM2EVMMessage memory message, bytes[] memory offchainTokenData, uint32[] memory tokenGasOverrides ) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#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](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#events) ### [CCIPSendRequested](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#ccipsendrequested) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity event CCIPSendRequested(Internal.EVM2EVMMessage message) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#parameters-1) | Parameter | Type | Description | | --- | --- | --- | | message | `EVM2EVMMessage` | The EVM2EVM message that was sent | ## [Variables](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#variables) ### [i\_register](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#i_register) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity Register immutable i_register ``` ### [LINK\_FAUCET](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#link_faucet) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity address constant LINK_FAUCET = 0x4281eCF07378Ee595C564a59048801330f3084eE ``` ### [s\_processedMessages](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#s_processedmessages) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity mapping(bytes32 messageId => bool isProcessed) internal s_processedMessages ``` ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#functions) ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#constructor) Initializes the contract and sets up logging and persistence. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity constructor() ``` ### [switchChainAndRouteMessage](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#switchchainandroutemessage) Routes a cross-chain message on the destination network after switching to the specified fork. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function switchChainAndRouteMessage(uint256 forkId) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#parameters-2) | Parameter | Type | Description | | --- | --- | --- | | forkId | `uint256` | The ID of the destination network fork (returned by `createFork()` or `createSelectFork()`) | ### [getNetworkDetails](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#getnetworkdetails) Returns the network configuration details for a specified chain ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getNetworkDetails(uint256 chainId) external view returns (Register.NetworkDetails memory) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#parameters-3) | Parameter | Type | Description | | --- | --- | --- | | chainId | `uint256` | The blockchain network chain ID (e.g., 11155111 for Ethereum Sepolia) | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#returns-1) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `NetworkDetails` | The network configuration details for the specified chain | ### [setNetworkDetails](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#setnetworkdetails) Updates or adds new network configuration details for a specified chain ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function setNetworkDetails(uint256 chainId, Register.NetworkDetails memory networkDetails) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#parameters-4) | 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](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#requestlinkfromfaucet) Requests LINK tokens from the faucet for a specified address. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#parameters-5) | Parameter | Type | Description | | --- | --- | --- | | to | `address` | The address to receive the LINK tokens | | amount | `uint256` | The amount of LINK tokens to transfer | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v023/ccip-local-simulator-fork\#returns-2) | Parameter | Type | Description | | --- | --- | --- | | success | `bool` | Returns true if the token transfer was successful | ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840173047&cv=11&fst=1748840173047&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55t0h2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247~103308614&ptag_exp=101509157~102938614~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv023%2Fccip-local-simulator-fork&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=CCIPLocalSimulatorFork%20v0.2.3%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=115897923.1748840173&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## LinkToken API Reference [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 # [LinkToken v0.2.3 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/link-token\#overview) ## [LinkToken](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/link-token\#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) ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/link-token\#functions) ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/link-token\#constructor) Initializes the contract with fixed token details. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity constructor() ``` ### [\_onCreate](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/link-token\#_oncreate) Internal hook called during contract creation. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function _onCreate() internal virtual ``` ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840172701&cv=11&fst=1748840172701&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv0.2.3%2Flink-token&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=LinkToken%20v0.2.3%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=1149164498.1748840173&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## Chainlink Aggregator API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [AggregatorV2V3Interface v0.2.1 API Reference](https://docs.chain.link/chainlink-local/api-reference/v021/aggregator-v2-v3-interface\#overview) ## [AggregatorV2V3Interface](https://docs.chain.link/chainlink-local/api-reference/v021/aggregator-v2-v3-interface\#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. ## [Interface Inheritance](https://docs.chain.link/chainlink-local/api-reference/v021/aggregator-v2-v3-interface\#interface-inheritance) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity interface AggregatorV2V3Interface is AggregatorInterface, AggregatorV3Interface {} ``` This interface provides access to all functions and events from both parent interfaces. ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840172822&cv=11&fst=1748840172822&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103211513~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247~103308615&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv021%2Faggregator-v2-v3-interface&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=AggregatorV2V3Interface%20v0.2.1%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=785977761.1748840173&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## AggregatorInterface API Reference [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version:v0.2.2Not using latest version (v0.2.3) # [AggregatorInterface v0.2.2 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-interface\#overview) ## [AggregatorInterface](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-interface\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-interface\#events) ### [AnswerUpdated](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-interface\#answerupdated) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-interface\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-interface\#newround) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-interface\#parameters-1) | 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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-interface\#functions) ### [getAnswer](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-interface\#getanswer) Retrieves the price answer for a specific round. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-interface\#parameters-2) | Parameter | Type | Description | | --- | --- | --- | | roundId | uint256 | The round ID to get the answer for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-interface\#returns) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | int256 | The answer for the given round ID | ### [getTimestamp](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-interface\#gettimestamp) Retrieves the timestamp for a specific round. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-interface\#parameters-3) | Parameter | Type | Description | | --- | --- | --- | | roundId | uint256 | The round ID to get the timestamp for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-interface\#returns-1) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | uint256 | The timestamp for the given round ID | ### [latestAnswer](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-interface\#latestanswer) Retrieves the most recent price answer. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestAnswer() external view returns (int256) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-interface\#returns-2) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | int256 | The latest answer | ### [latestRound](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-interface\#latestround) Retrieves the most recent round ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestRound() external view returns (uint256) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-interface\#returns-3) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | uint256 | The latest round ID | ### [latestTimestamp](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-interface\#latesttimestamp) Retrieves the timestamp of the most recent answer. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestTimestamp() external view returns (uint256) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-interface\#returns-4) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | uint256 | The timestamp of the latest answer | ## Get the latest Chainlink content straight to your inbox. Email Address ## LinkToken API Reference [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 You're not using the latest version. Update to v0.2.3 # [LinkToken v0.2.1 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/link-token\#overview) ## [LinkToken](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/link-token\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/link-token\#variables) ### [NAME](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/link-token\#name) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity string private constant NAME = "ChainLink Token" ``` The name of the token. ### [SYMBOL](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/link-token\#symbol) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity string private constant SYMBOL = "LINK" ``` The symbol of the token. ### [TOTAL\_SUPPLY](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/link-token\#total_supply) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint private constant TOTAL_SUPPLY = 10 ** 27 ``` The total supply of LINK tokens (1 billion LINK with 18 decimals). ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/link-token\#functions) ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/link-token\#constructor) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity constructor() ERC677(NAME, SYMBOL) ``` Initializes the contract with the token name and symbol, then calls `_onCreate()`. ### [\_onCreate](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/link-token\#_oncreate) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function _onCreate() internal virtual ``` Hook that is called when this contract is created. ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840172824&cv=11&fst=1748840172824&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv0.2.1%2Flink-token&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=LinkToken%20v0.2.1%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=1286905260.1748840173&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## BurnMintERC677Helper API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [BurnMintERC677Helper v0.2.1 API Reference](https://docs.chain.link/chainlink-local/api-reference/v021/burn-mint-erc677-helper\#overview) ## [BurnMintERC677Helper](https://docs.chain.link/chainlink-local/api-reference/v021/burn-mint-erc677-helper\#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. ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v021/burn-mint-erc677-helper\#functions) ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v021/burn-mint-erc677-helper\#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 | ### [drip](https://docs.chain.link/chainlink-local/api-reference/v021/burn-mint-erc677-helper\#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 | ## Get the latest Chainlink content straight to your inbox. Email Address ## CCT Token Locking Guide [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [CCT - owner() token with Lock and Release Pool in forked environments](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork\#overview) This tutorial will guide you through the process of testing the procedure of enabling your own tokens in CCIP. We will use the CCT-compatible ERC-20 token with `owner()` function implemented. We will use Lock & Release Pool for transferring this token across different blockchains using Chainlink CCIP. ## [Prerequisites](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork\#prerequisites) 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](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork\#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 utilize 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()`. - **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. - **Lock & Mint 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. If you don't have an existing token: For all blockchains where tokens need to be burned and minted (for example, the source or destination chain in the case of Burn and Mint, or the destination blockchain in the case of Lock and Mint), Chainlink provides a [BurnMintERC677](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.1/contracts/src/v0.8/shared/token/ERC677/BurnMintERC677.sol) contract that you can use to deploy your token in minutes. This token follows the [ERC677](https://github.com/ethereum/EIPs/issues/677) or [ERC777](https://ethereum.org/en/developers/docs/standards/tokens/erc-777/), allowing you to use it as-is or extend it to meet your specific requirements. ### [Understanding the Procedure](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork\#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.](https://docs.chain.link/images/ccip/CCIP_enabled_tokens_flowchart.jpg) ## [Before You Begin](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork\#before-you-begin) 1. **Install Foundry**: If you haven't already, follow the instructions in the [Foundry documentation](https://book.getfoundry.sh/getting-started/installation) to install Foundry. 2. **Create new Foundry project**: Create a new Foundry project by running the following command: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```bash forge init ``` 3. **Set up your environment**: Create a `.env` file, and fill in the required values: Example `.env` file: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```bash ETHEREUM_SEPOLIA_RPC_URL= BASE_SEPOLIA_RPC_URL= ``` ## [Create the `owner()` ERC-20 token](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork\#create-the-owner-erc-20-token) Inside the `test` folder create the new Solidity file and name it `CCIPv1_5LockReleasePoolFork.t.sol`. We will use only this file through out the rest of this guide. Create the CCT-compatible ERC-20 token with `owner()` function. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity // test/CCIPv1_5LockReleasePoolFork.t.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { ERC20, IERC20 } from "@chainlink/contracts-ccip/src/v0.8/vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/ERC20.sol"; import { OwnerIsCreator } from "@chainlink/contracts-ccip/src/v0.8/shared/access/OwnerIsCreator.sol"; contract MockERC20TokenOwner is ERC20, OwnerIsCreator { constructor() ERC20("MockERC20Token", "MTK") {} function mint(address account, uint256 amount) public onlyOwner { _mint(account, amount); } } ``` ## [Test the CCT enabling procedure](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork\#test-the-cct-enabling-procedure) Expand the existing `CCIPv1_5LockReleasePoolFork.t.sol` file to create and set up our basic test. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity // test/CCIPv1_5LockReleasePoolFork.t.sol import { Test, Vm } from "forge-std/Test.sol"; import { CCIPLocalSimulatorFork, Register } from "../../../src/ccip/CCIPLocalSimulatorFork.sol"; import { LockReleaseTokenPool, TokenPool } from "@chainlink/contracts-ccip/src/v0.8/ccip/pools/LockReleaseTokenPool.sol"; import { RegistryModuleOwnerCustom } from "@chainlink/contracts-ccip/src/v0.8/ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol"; import { TokenAdminRegistry } from "@chainlink/contracts-ccip/src/v0.8/ccip/tokenAdminRegistry/TokenAdminRegistry.sol"; import { RateLimiter } from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/RateLimiter.sol"; import { IRouterClient } from "@chainlink/contracts-ccip/src/v0.8/ccip/interfaces/IRouterClient.sol"; import { Client } from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Client.sol"; /** * The token code part from previous section goes here... */ contract CCIPv1_5LockReleasePoolFork is Test { CCIPLocalSimulatorFork public ccipLocalSimulatorFork; MockERC20TokenOwner public mockERC20TokenEthSepolia; MockERC20TokenOwner public mockERC20TokenBaseSepolia; LockReleaseTokenPool public lockReleaseTokenPoolEthSepolia; LockReleaseTokenPool public lockReleaseTokenPoolBaseSepolia; Register.NetworkDetails ethSepoliaNetworkDetails; Register.NetworkDetails baseSepoliaNetworkDetails; uint256 ethSepoliaFork; uint256 baseSepoliaFork; address alice; function setUp() public { alice = makeAddr("alice"); string memory ETHEREUM_SEPOLIA_RPC_URL = vm.envString("ETHEREUM_SEPOLIA_RPC_URL"); string memory BASE_SEPOLIA_RPC_URL = vm.envString("BASE_SEPOLIA_RPC_URL"); ethSepoliaFork = vm.createSelectFork(ETHEREUM_SEPOLIA_RPC_URL); baseSepoliaFork = vm.createFork(BASE_SEPOLIA_RPC_URL); ccipLocalSimulatorFork = new CCIPLocalSimulatorFork(); vm.makePersistent(address(ccipLocalSimulatorFork)); } } ``` #### [Step 1) Deploy token on Ethereum Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork\#step-1-deploy-token-on-ethereum-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5LockReleasePoolFork is Test { function setUp() public { // Code from previous section goes here... // Step 1) Deploy token on Ethereum Sepolia vm.startPrank(alice); mockERC20TokenEthSepolia = new MockERC20TokenOwner(); vm.stopPrank(); } } ``` #### [Step 2) Deploy token on Base Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork\#step-2-deploy-token-on-base-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5LockReleasePoolFork is Test { function setUp() public { // Code from previous section goes here... // Step 2) Deploy token on Base Sepolia vm.selectFork(baseSepoliaFork); vm.startPrank(alice); mockERC20TokenBaseSepolia = new MockERC20TokenOwner(); vm.stopPrank(); } } ``` #### [Step 3) Deploy LockReleaseTokenPool on Ethereum Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork\#step-3-deploy-lockreleasetokenpool-on-ethereum-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5LockReleasePoolFork is Test { // Code from previous section goes here... function test_forkSupportNewCCIPToken() public { // Step 3) Deploy LockReleaseTokenPool on Ethereum Sepolia vm.selectFork(ethSepoliaFork); ethSepoliaNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); address[] memory allowlist = new address[](0); uint8 localTokenDecimals = 18; vm.startPrank(alice); lockReleaseTokenPoolEthSepolia = new LockReleaseTokenPool( IERC20(address(mockERC20TokenEthSepolia)), localTokenDecimals, allowlist, ethSepoliaNetworkDetails.rmnProxyAddress, true, // acceptLiquidity ethSepoliaNetworkDetails.routerAddress ); vm.stopPrank(); } } ``` #### [Step 4) Deploy LockReleaseTokenPool on Base Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork\#step-4-deploy-lockreleasetokenpool-on-base-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5LockReleasePoolFork is Test { function test_forkSupportNewCCIPToken() public { // Code from previous section goes here... // Step 4) Deploy LockReleaseTokenPool on Base Sepolia vm.selectFork(baseSepoliaFork); baseSepoliaNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); vm.startPrank(alice); lockReleaseTokenPoolBaseSepolia = new LockReleaseTokenPool( IERC20(address(mockERC20TokenBaseSepolia)), localTokenDecimals, allowlist, baseSepoliaNetworkDetails.rmnProxyAddress, true, // acceptLiquidity baseSepoliaNetworkDetails.routerAddress ); vm.stopPrank(); } } ``` #### [Step 5) Set the LiquidityManager address and Add liquidity to the pool on Ethereum Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork\#step-5-set-the-liquiditymanager-address-and-add-liquidity-to-the-pool-on-ethereum-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5LockReleasePoolFork is Test { function test_forkSupportNewCCIPToken() public { // Code from previous section goes here... // Step 5) Set the LiquidityManager address and Add liquidity to the pool on Ethereum Sepolia vm.selectFork(ethSepoliaFork); uint256 amountToMint = 1_000_000; uint128 liquidityAmount = 100_000; vm.startPrank(alice); mockERC20TokenEthSepolia.mint(address(alice), amountToMint); mockERC20TokenEthSepolia.approve(address(lockReleaseTokenPoolEthSepolia), liquidityAmount); lockReleaseTokenPoolEthSepolia.setRebalancer(address(alice)); lockReleaseTokenPoolEthSepolia.provideLiquidity(liquidityAmount); vm.stopPrank(); } } ``` #### [Step 6) Set the LiquidityManager address and Add liquidity to the pool on Base Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork\#step-6-set-the-liquiditymanager-address-and-add-liquidity-to-the-pool-on-base-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5LockReleasePoolFork is Test { function test_forkSupportNewCCIPToken() public { // Code from previous section goes here... // Step 6) Set the LiquidityManager address and Add liquidity to the pool on Base Sepolia vm.selectFork(baseSepoliaFork); vm.startPrank(alice); mockERC20TokenBaseSepolia.mint(address(alice), amountToMint); mockERC20TokenBaseSepolia.approve(address(lockReleaseTokenPoolBaseSepolia), liquidityAmount); lockReleaseTokenPoolBaseSepolia.setRebalancer(address(alice)); lockReleaseTokenPoolBaseSepolia.provideLiquidity(liquidityAmount); vm.stopPrank(); } } ``` #### [Step 7) Claim Admin role on Ethereum Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork\#step-7-claim-admin-role-on-ethereum-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5LockReleasePoolFork is Test { function test_forkSupportNewCCIPToken() public { // Code from previous section goes here... // Step 7) Claim Admin role on Ethereum Sepolia vm.selectFork(ethSepoliaFork); RegistryModuleOwnerCustom registryModuleOwnerCustomEthSepolia = RegistryModuleOwnerCustom( ethSepoliaNetworkDetails.registryModuleOwnerCustomAddress ); vm.startPrank(alice); registryModuleOwnerCustomEthSepolia.registerAdminViaOwner(address(mockERC20TokenEthSepolia)); vm.stopPrank(); } } ``` #### [Step 8) Claim Admin role on Base Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork\#step-8-claim-admin-role-on-base-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5LockReleasePoolFork is Test { function test_forkSupportNewCCIPToken() public { // Code from previous section goes here... // Step 8) Claim Admin role on Base Sepolia vm.selectFork(baseSepoliaFork); RegistryModuleOwnerCustom registryModuleOwnerCustomBaseSepolia = RegistryModuleOwnerCustom( baseSepoliaNetworkDetails.registryModuleOwnerCustomAddress ); vm.startPrank(alice); registryModuleOwnerCustomBaseSepolia.registerAdminViaOwner(address(mockERC20TokenBaseSepolia)); vm.stopPrank(); } } ``` #### [Step 9) Accept Admin role on Ethereum Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork\#step-9-accept-admin-role-on-ethereum-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5LockReleasePoolFork is Test { function test_forkSupportNewCCIPToken() public { // Code from previous section goes here... // Step 9) Accept Admin role on Ethereum Sepolia vm.selectFork(ethSepoliaFork); TokenAdminRegistry tokenAdminRegistryEthSepolia = TokenAdminRegistry( ethSepoliaNetworkDetails.tokenAdminRegistryAddress ); vm.startPrank(alice); tokenAdminRegistryEthSepolia.acceptAdminRole(address(mockERC20TokenEthSepolia)); vm.stopPrank(); } } ``` #### [Step 10) Accept Admin role on Base Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork\#step-10-accept-admin-role-on-base-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5LockReleasePoolFork is Test { function test_forkSupportNewCCIPToken() public { // Code from previous section goes here... // Step 10) Accept Admin role on Base Sepolia vm.selectFork(baseSepoliaFork); TokenAdminRegistry tokenAdminRegistryBaseSepolia = TokenAdminRegistry( baseSepoliaNetworkDetails.tokenAdminRegistryAddress ); vm.startPrank(alice); tokenAdminRegistryBaseSepolia.acceptAdminRole(address(mockERC20TokenBaseSepolia)); vm.stopPrank(); } } ``` #### [Step 11) Link token to pool on Ethereum Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork\#step-11-link-token-to-pool-on-ethereum-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5LockReleasePoolFork is Test { function test_forkSupportNewCCIPToken() public { // Code from previous section goes here... // Step 11) Link token to pool on Ethereum Sepolia vm.selectFork(ethSepoliaFork); vm.startPrank(alice); tokenAdminRegistryEthSepolia.setPool(address(mockERC20TokenEthSepolia), address(lockReleaseTokenPoolEthSepolia)); vm.stopPrank(); } } ``` #### [Step 12) Link token to pool on Base Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork\#step-12-link-token-to-pool-on-base-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5LockReleasePoolFork is Test { function test_forkSupportNewCCIPToken() public { // Code from previous section goes here... // Step 12) Link token to pool on Base Sepolia vm.selectFork(baseSepoliaFork); vm.startPrank(alice); tokenAdminRegistryBaseSepolia.setPool(address(mockERC20TokenBaseSepolia), address(lockReleaseTokenPoolBaseSepolia)); vm.stopPrank(); } } ``` #### [Step 13) Configure Token Pool on Ethereum Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork\#step-13-configure-token-pool-on-ethereum-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5LockReleasePoolFork is Test { function test_forkSupportNewCCIPToken() public { // Code from previous section goes here... // Step 13) Configure Token Pool on Ethereum Sepolia vm.selectFork(ethSepoliaFork); vm.startPrank(alice); TokenPool.ChainUpdate[] memory chains = new TokenPool.ChainUpdate[](1); bytes[] memory remotePoolAddressesEthSepolia = new bytes[](1); remotePoolAddressesEthSepolia[0] = abi.encode(address(lockReleaseTokenPoolBaseSepolia)); chains[0] = TokenPool.ChainUpdate({ remoteChainSelector: baseSepoliaNetworkDetails.chainSelector, remotePoolAddresses: remotePoolAddressesEthSepolia, remoteTokenAddress: abi.encode(address(mockERC20TokenBaseSepolia)), outboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: liquidityAmount, rate: 167 }), inboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: liquidityAmount, rate: 167 }) }); uint64[] memory remoteChainSelectorsToRemove = new uint64[](0); lockReleaseTokenPoolEthSepolia.applyChainUpdates(remoteChainSelectorsToRemove, chains); vm.stopPrank(); } } ``` #### [Step 14) Configure Token Pool on Base Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork\#step-14-configure-token-pool-on-base-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5LockReleasePoolFork is Test { function test_forkSupportNewCCIPToken() public { // Code from previous section goes here... // Step 14) Configure Token Pool on Base Sepolia vm.selectFork(baseSepoliaFork); vm.startPrank(alice); chains = new TokenPool.ChainUpdate[](1); bytes[] memory remotePoolAddressesBaseSepolia = new bytes[](1); remotePoolAddressesBaseSepolia[0] = abi.encode(address(lockReleaseTokenPoolEthSepolia)); chains[0] = TokenPool.ChainUpdate({ remoteChainSelector: ethSepoliaNetworkDetails.chainSelector, remotePoolAddresses: remotePoolAddressesBaseSepolia, remoteTokenAddress: abi.encode(address(mockERC20TokenEthSepolia)), outboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: liquidityAmount, rate: 167 }), inboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: liquidityAmount, rate: 167 }) }); lockReleaseTokenPoolBaseSepolia.applyChainUpdates(remoteChainSelectorsToRemove, chains); vm.stopPrank(); } } ``` #### [Step 15) Mint tokens on Ethereum Sepolia and transfer them to Base Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork\#step-15-mint-tokens-on-ethereum-sepolia-and-transfer-them-to-base-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5LockReleasePoolFork is Test { function test_forkSupportNewCCIPToken() public { // Code from previous section goes here... // Step 15) Transfer tokens from Ethereum Sepolia to Base Sepolia vm.selectFork(ethSepoliaFork); address linkEthSepoliaAddress = ethSepoliaNetworkDetails.linkAddress; address routerEthSepoliaAddress = ethSepoliaNetworkDetails.routerAddress; ccipLocalSimulatorFork.requestLinkFromFaucet(address(alice), 20 ether); uint256 amountToSend = 100; Client.EVMTokenAmount[] memory tokenToSendDetails = new Client.EVMTokenAmount[](1); Client.EVMTokenAmount memory tokenAmount = Client.EVMTokenAmount({ token: address(mockERC20TokenEthSepolia), amount: amountToSend }); tokenToSendDetails[0] = tokenAmount; vm.startPrank(alice); mockERC20TokenEthSepolia.approve(routerEthSepoliaAddress, amountToSend); IERC20(linkEthSepoliaAddress).approve(routerEthSepoliaAddress, 20 ether); uint256 balanceOfAliceBeforeEthSepolia = mockERC20TokenEthSepolia.balanceOf(alice); uint64 destinationChainSelector = baseSepoliaNetworkDetails.chainSelector; IRouterClient routerEthSepolia = IRouterClient(routerEthSepoliaAddress); routerEthSepolia.ccipSend( destinationChainSelector, Client.EVM2AnyMessage({ receiver: abi.encode(address(alice)), data: "", tokenAmounts: tokenToSendDetails, extraArgs: Client._argsToBytes(Client.EVMExtraArgsV1({ gasLimit: 0 })), feeToken: linkEthSepoliaAddress }) ); uint256 balanceOfAliceAfterEthSepolia = mockERC20TokenEthSepolia.balanceOf(alice); vm.stopPrank(); assertEq(balanceOfAliceAfterEthSepolia, balanceOfAliceBeforeEthSepolia - amountToSend); ccipLocalSimulatorFork.switchChainAndRouteMessage(baseSepoliaFork); uint256 balanceOfAliceAfterBaseSepolia = mockERC20TokenBaseSepolia.balanceOf(alice); assertEq(balanceOfAliceAfterBaseSepolia, balanceOfAliceBeforeEthSepolia + amountToSend); } } ``` ## [Final code - full example](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork\#final-code---full-example) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity // test/CCIPv1_5LockReleasePoolFork.t.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { Test, Vm } from "forge-std/Test.sol"; import { CCIPLocalSimulatorFork, Register } from "../../../src/ccip/CCIPLocalSimulatorFork.sol"; import { LockReleaseTokenPool, TokenPool } from "@chainlink/contracts-ccip/src/v0.8/ccip/pools/LockReleaseTokenPool.sol"; import { RegistryModuleOwnerCustom } from "@chainlink/contracts-ccip/src/v0.8/ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol"; import { TokenAdminRegistry } from "@chainlink/contracts-ccip/src/v0.8/ccip/tokenAdminRegistry/TokenAdminRegistry.sol"; import { RateLimiter } from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/RateLimiter.sol"; import { IRouterClient } from "@chainlink/contracts-ccip/src/v0.8/ccip/interfaces/IRouterClient.sol"; import { Client } from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Client.sol"; import { ERC20, IERC20 } from "@chainlink/contracts-ccip/src/v0.8/vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/ERC20.sol"; import { OwnerIsCreator } from "@chainlink/contracts-ccip/src/v0.8/shared/access/OwnerIsCreator.sol"; contract MockERC20TokenOwner is ERC20, OwnerIsCreator { constructor() ERC20("MockERC20Token", "MTK") {} function mint(address account, uint256 amount) public onlyOwner { _mint(account, amount); } } contract CCIPv1_5LockReleasePoolFork is Test { CCIPLocalSimulatorFork public ccipLocalSimulatorFork; MockERC20TokenOwner public mockERC20TokenEthSepolia; MockERC20TokenOwner public mockERC20TokenBaseSepolia; LockReleaseTokenPool public lockReleaseTokenPoolEthSepolia; LockReleaseTokenPool public lockReleaseTokenPoolBaseSepolia; Register.NetworkDetails ethSepoliaNetworkDetails; Register.NetworkDetails baseSepoliaNetworkDetails; uint256 ethSepoliaFork; uint256 baseSepoliaFork; address alice; function setUp() public { alice = makeAddr("alice"); string memory ETHEREUM_SEPOLIA_RPC_URL = vm.envString("ETHEREUM_SEPOLIA_RPC_URL"); string memory BASE_SEPOLIA_RPC_URL = vm.envString("BASE_SEPOLIA_RPC_URL"); ethSepoliaFork = vm.createSelectFork(ETHEREUM_SEPOLIA_RPC_URL); baseSepoliaFork = vm.createFork(BASE_SEPOLIA_RPC_URL); ccipLocalSimulatorFork = new CCIPLocalSimulatorFork(); vm.makePersistent(address(ccipLocalSimulatorFork)); // Step 1) Deploy token on Ethereum Sepolia vm.startPrank(alice); mockERC20TokenEthSepolia = new MockERC20TokenOwner(); vm.stopPrank(); // Step 2) Deploy token on Base Sepolia vm.selectFork(baseSepoliaFork); vm.startPrank(alice); mockERC20TokenBaseSepolia = new MockERC20TokenOwner(); vm.stopPrank(); } function test_forkSupportNewCCIPToken() public { // Step 3) Deploy LockReleaseTokenPool on Ethereum Sepolia vm.selectFork(ethSepoliaFork); ethSepoliaNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); address[] memory allowlist = new address[](0); uint8 localTokenDecimals = 18; vm.startPrank(alice); lockReleaseTokenPoolEthSepolia = new LockReleaseTokenPool( IERC20(address(mockERC20TokenEthSepolia)), localTokenDecimals, allowlist, ethSepoliaNetworkDetails.rmnProxyAddress, true, // acceptLiquidity ethSepoliaNetworkDetails.routerAddress ); vm.stopPrank(); // Step 4) Deploy LockReleaseTokenPool on Base Sepolia vm.selectFork(baseSepoliaFork); baseSepoliaNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); vm.startPrank(alice); lockReleaseTokenPoolBaseSepolia = new LockReleaseTokenPool( IERC20(address(mockERC20TokenBaseSepolia)), localTokenDecimals, allowlist, baseSepoliaNetworkDetails.rmnProxyAddress, true, // acceptLiquidity baseSepoliaNetworkDetails.routerAddress ); vm.stopPrank(); // Step 5) Set the LiquidityManager address and Add liquidity to the pool on Ethereum Sepolia vm.selectFork(ethSepoliaFork); uint256 amountToMint = 1_000_000; uint128 liquidityAmount = 100_000; vm.startPrank(alice); mockERC20TokenEthSepolia.mint(address(alice), amountToMint); mockERC20TokenEthSepolia.approve(address(lockReleaseTokenPoolEthSepolia), liquidityAmount); lockReleaseTokenPoolEthSepolia.setRebalancer(address(alice)); lockReleaseTokenPoolEthSepolia.provideLiquidity(liquidityAmount); vm.stopPrank(); // Step 6) Set the LiquidityManager address and Add liquidity to the pool on Base Sepolia vm.selectFork(baseSepoliaFork); vm.startPrank(alice); mockERC20TokenBaseSepolia.mint(address(alice), amountToMint); mockERC20TokenBaseSepolia.approve(address(lockReleaseTokenPoolBaseSepolia), liquidityAmount); lockReleaseTokenPoolBaseSepolia.setRebalancer(address(alice)); lockReleaseTokenPoolBaseSepolia.provideLiquidity(liquidityAmount); vm.stopPrank(); // Step 7) Claim Admin role on Ethereum Sepolia vm.selectFork(ethSepoliaFork); RegistryModuleOwnerCustom registryModuleOwnerCustomEthSepolia = RegistryModuleOwnerCustom( ethSepoliaNetworkDetails.registryModuleOwnerCustomAddress ); vm.startPrank(alice); registryModuleOwnerCustomEthSepolia.registerAdminViaOwner(address(mockERC20TokenEthSepolia)); vm.stopPrank(); // Step 8) Claim Admin role on Base Sepolia vm.selectFork(baseSepoliaFork); RegistryModuleOwnerCustom registryModuleOwnerCustomBaseSepolia = RegistryModuleOwnerCustom( baseSepoliaNetworkDetails.registryModuleOwnerCustomAddress ); vm.startPrank(alice); registryModuleOwnerCustomBaseSepolia.registerAdminViaOwner(address(mockERC20TokenBaseSepolia)); vm.stopPrank(); // Step 9) Accept Admin role on Ethereum Sepolia vm.selectFork(ethSepoliaFork); TokenAdminRegistry tokenAdminRegistryEthSepolia = TokenAdminRegistry( ethSepoliaNetworkDetails.tokenAdminRegistryAddress ); vm.startPrank(alice); tokenAdminRegistryEthSepolia.acceptAdminRole(address(mockERC20TokenEthSepolia)); vm.stopPrank(); // Step 10) Accept Admin role on Base Sepolia vm.selectFork(baseSepoliaFork); TokenAdminRegistry tokenAdminRegistryBaseSepolia = TokenAdminRegistry( baseSepoliaNetworkDetails.tokenAdminRegistryAddress ); vm.startPrank(alice); tokenAdminRegistryBaseSepolia.acceptAdminRole(address(mockERC20TokenBaseSepolia)); vm.stopPrank(); // Step 11) Link token to pool on Ethereum Sepolia vm.selectFork(ethSepoliaFork); vm.startPrank(alice); tokenAdminRegistryEthSepolia.setPool(address(mockERC20TokenEthSepolia), address(lockReleaseTokenPoolEthSepolia)); vm.stopPrank(); // Step 12) Link token to pool on Base Sepolia vm.selectFork(baseSepoliaFork); vm.startPrank(alice); tokenAdminRegistryBaseSepolia.setPool(address(mockERC20TokenBaseSepolia), address(lockReleaseTokenPoolBaseSepolia)); vm.stopPrank(); // Step 13) Configure Token Pool on Ethereum Sepolia vm.selectFork(ethSepoliaFork); vm.startPrank(alice); TokenPool.ChainUpdate[] memory chains = new TokenPool.ChainUpdate[](1); bytes[] memory remotePoolAddressesEthSepolia = new bytes[](1); remotePoolAddressesEthSepolia[0] = abi.encode(address(lockReleaseTokenPoolBaseSepolia)); chains[0] = TokenPool.ChainUpdate({ remoteChainSelector: baseSepoliaNetworkDetails.chainSelector, remotePoolAddresses: remotePoolAddressesEthSepolia, remoteTokenAddress: abi.encode(address(mockERC20TokenBaseSepolia)), outboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: liquidityAmount, rate: 167 }), inboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: liquidityAmount, rate: 167 }) }); uint64[] memory remoteChainSelectorsToRemove = new uint64[](0); lockReleaseTokenPoolEthSepolia.applyChainUpdates(remoteChainSelectorsToRemove, chains); vm.stopPrank(); // Step 14) Configure Token Pool on Base Sepolia vm.selectFork(baseSepoliaFork); vm.startPrank(alice); chains = new TokenPool.ChainUpdate[](1); bytes[] memory remotePoolAddressesBaseSepolia = new bytes[](1); remotePoolAddressesBaseSepolia[0] = abi.encode(address(lockReleaseTokenPoolEthSepolia)); chains[0] = TokenPool.ChainUpdate({ remoteChainSelector: ethSepoliaNetworkDetails.chainSelector, remotePoolAddresses: remotePoolAddressesBaseSepolia, remoteTokenAddress: abi.encode(address(mockERC20TokenEthSepolia)), outboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: liquidityAmount, rate: 167 }), inboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: liquidityAmount, rate: 167 }) }); lockReleaseTokenPoolBaseSepolia.applyChainUpdates(remoteChainSelectorsToRemove, chains); vm.stopPrank(); // Step 15) Transfer tokens from Ethereum Sepolia to Base Sepolia vm.selectFork(ethSepoliaFork); address linkEthSepoliaAddress = ethSepoliaNetworkDetails.linkAddress; address routerEthSepoliaAddress = ethSepoliaNetworkDetails.routerAddress; ccipLocalSimulatorFork.requestLinkFromFaucet(address(alice), 20 ether); uint256 amountToSend = 100; Client.EVMTokenAmount[] memory tokenToSendDetails = new Client.EVMTokenAmount[](1); Client.EVMTokenAmount memory tokenAmount = Client.EVMTokenAmount({ token: address(mockERC20TokenEthSepolia), amount: amountToSend }); tokenToSendDetails[0] = tokenAmount; vm.startPrank(alice); mockERC20TokenEthSepolia.approve(routerEthSepoliaAddress, amountToSend); IERC20(linkEthSepoliaAddress).approve(routerEthSepoliaAddress, 20 ether); uint256 balanceOfAliceBeforeEthSepolia = mockERC20TokenEthSepolia.balanceOf(alice); uint64 destinationChainSelector = baseSepoliaNetworkDetails.chainSelector; IRouterClient routerEthSepolia = IRouterClient(routerEthSepoliaAddress); routerEthSepolia.ccipSend( destinationChainSelector, Client.EVM2AnyMessage({ receiver: abi.encode(address(alice)), data: "", tokenAmounts: tokenToSendDetails, extraArgs: Client._argsToBytes(Client.EVMExtraArgsV1({ gasLimit: 0 })), feeToken: linkEthSepoliaAddress }) ); uint256 balanceOfAliceAfterEthSepolia = mockERC20TokenEthSepolia.balanceOf(alice); vm.stopPrank(); assertEq(balanceOfAliceAfterEthSepolia, balanceOfAliceBeforeEthSepolia - amountToSend); ccipLocalSimulatorFork.switchChainAndRouteMessage(baseSepoliaFork); uint256 balanceOfAliceAfterBaseSepolia = mockERC20TokenBaseSepolia.balanceOf(alice); assertEq(balanceOfAliceAfterBaseSepolia, balanceOfAliceBeforeEthSepolia + amountToSend); } } ``` ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840172936&cv=11&fst=1748840172936&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fbuild%2Fccip%2Ffoundry%2Fcct-lock-and-release-fork&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=CCT%20-%20owner()%20token%20with%20Lock%20and%20Release%20Pool%20in%20forked%20environments%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=1793860329.1748840173&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## AggregatorV3Interface API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 You're not using the latest version. Update to v0.2.3 # [AggregatorV3Interface v0.2.2 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-v3-interface\#overview) ## [AggregatorV3Interface](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-v3-interface\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-v3-interface\#functions) ### [decimals](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-v3-interface\#decimals) Retrieves the number of decimal places used by the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function decimals() external view returns (uint8) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-v3-interface\#returns) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | uint8 | The number of decimals | ### [description](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-v3-interface\#description) Retrieves the description of the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function description() external view returns (string memory) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-v3-interface\#returns-1) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | string | The description of the aggregator | ### [getRoundData](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-v3-interface\#getrounddata) Retrieves the complete round data for a specific round ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-v3-interface\#parameters) | Parameter | Type | Description | | --- | --- | --- | | \_roundId | uint80 | The round ID to get the data for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-v3-interface\#returns-2) | 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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-v3-interface\#latestrounddata) Retrieves the complete round data for the most recent round. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-v3-interface\#returns-3) | 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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-v3-interface\#version) Retrieves the version number of the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function version() external view returns (uint256) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-v3-interface\#returns-4) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | uint256 | The version of the aggregator | ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840172897&cv=11&fst=1748840172897&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv0.2.2%2Faggregator-v3-interface&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=AggregatorV3Interface%20v0.2.2%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=305085922.1748840173&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## Mock Offchain Aggregator [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 # [MockOffchainAggregator v0.2.3 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#overview) ## [MockOffchainAggregator](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#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) ## [Variables](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#variables) ### [decimals](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#decimals) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint8 public decimals ``` ### [getAnswer](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#getanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity mapping(uint256 => int256) public getAnswer ``` ### [getTimestamp](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#gettimestamp) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity mapping(uint256 => uint256) public getTimestamp ``` ### [latestAnswer](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#latestanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity int256 public latestAnswer ``` ### [latestRound](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#latestround) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint256 public latestRound ``` ### [latestTimestamp](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#latesttimestamp) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint256 public latestTimestamp ``` ### [maxAnswer](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#maxanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity int192 public maxAnswer ``` ### [minAnswer](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#minanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity int192 public minAnswer ``` ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#functions) ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#constructor) Initializes the contract with decimals and initial answer. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity constructor(uint8 _decimals, int256 _initialAnswer) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#parameters) | Parameter | Type | Description | | --- | --- | --- | | \_decimals | `uint8` | The number of decimals for the aggregator | | \_initialAnswer | `int256` | The initial answer to be set | ### [getRoundData](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#getrounddata) Gets the round data for a specific round ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#parameters-1) | Parameter | Type | Description | | --- | --- | --- | | \_roundId | `uint80` | The round ID to get the data for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#latestrounddata) Gets the latest round data. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#returns-1) | 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](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#updateanswer) Updates the answer in the mock aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function updateAnswer(int256 _answer) public ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#parameters-2) | Parameter | Type | Description | | --- | --- | --- | | \_answer | `int256` | The new answer to be set | ### [updateMinAndMaxAnswers](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#updateminandmaxanswers) Updates the minimum and maximum answers the aggregator can report. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function updateMinAndMaxAnswers(int192 _minAnswer, int192 _maxAnswer) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#parameters-3) | Parameter | Type | Description | | --- | --- | --- | | \_minAnswer | `int192` | The new minimum answer | | \_maxAnswer | `int192` | The new maximum answer | #### [Possible Reverts](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#updaterounddata) Updates the round data in the mock aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-offchain-aggregator\#parameters-4) | 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 | ## Get the latest Chainlink content straight to your inbox. Email Address ## CCIPLocalSimulator API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 # [CCIPLocalSimulator v0.2.3 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#overview) ## [CCIPLocalSimulator](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#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) ## [Variables](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#variables) ### [CHAIN\_SELECTOR](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#chain_selector) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint64 constant CHAIN_SELECTOR = 16015286601757825753 ``` ### [i\_ccipBnM](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#i_ccipbnm) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity BurnMintERC677Helper internal immutable i_ccipBnM ``` ### [i\_ccipLnM](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#i_cciplnm) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity BurnMintERC677Helper internal immutable i_ccipLnM ``` ### [i\_linkToken](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#i_linktoken) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity LinkToken internal immutable i_linkToken ``` ### [i\_mockRouter](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#i_mockrouter) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity MockCCIPRouter internal immutable i_mockRouter ``` ### [i\_wrappedNative](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#i_wrappednative) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity WETH9 internal immutable i_wrappedNative ``` ### [s\_supportedTokens](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#s_supportedtokens) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity address[] internal s_supportedTokens ``` ## [Errors](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#errors) ### [CCIPLocalSimulator\_\_MsgSenderIsNotTokenOwner](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#cciplocalsimulator__msgsenderisnottokenowner) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity error CCIPLocalSimulator__MsgSenderIsNotTokenOwner() ``` ### [CCIPLocalSimulator\_\_RequiredRoleNotFound](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#cciplocalsimulator__requiredrolenotfound) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity error CCIPLocalSimulator__RequiredRoleNotFound(address account, bytes32 role, address token) ``` ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#functions) ### [configuration](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#configuration) Returns the configuration details for pre-deployed contracts and services needed for local CCIP simulations. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function configuration() public view returns (uint64 chainSelector_, IRouterClient sourceRouter_, IRouterClient destinationRouter_, WETH9 wrappedNative_, LinkToken linkToken_, BurnMintERC677Helper ccipBnM_, BurnMintERC677Helper ccipLnM_) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#constructor) Initializes the contract with pre-deployed token instances. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity constructor() ``` ### [getSupportedTokens](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#getsupportedtokens) Gets the list of supported token addresses for a given chain selector. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getSupportedTokens(uint64 chainSelector) external view returns (address[] memory tokens) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#parameters) | Parameter | Type | Description | | --- | --- | --- | | chainSelector | `uint64` | The unique CCIP Chain Selector | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#returns-1) | Parameter | Type | Description | | --- | --- | --- | | tokens | `address[]` | Returns a list of token addresses that are supported for cross-chain transfers | ### [isChainSupported](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#ischainsupported) Checks if a given chain selector is supported. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function isChainSupported(uint64 chainSelector) public pure returns (bool supported) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#parameters-1) | Parameter | Type | Description | | --- | --- | --- | | chainSelector | `uint64` | The unique CCIP Chain Selector | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#returns-2) | Parameter | Type | Description | | --- | --- | --- | | supported | `bool` | Returns true if `chainSelector` is supported by the simulator | ### [requestLinkFromFaucet](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#requestlinkfromfaucet) Transfers LINK tokens from the faucet to a specified address. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#parameters-2) | 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](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#returns-3) | Parameter | Type | Description | | --- | --- | --- | | success | `bool` | Returns `true` if the transfer of tokens was successful | ### [supportNewTokenViaAccessControlDefaultAdmin](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#supportnewtokenviaaccesscontroldefaultadmin) Adds a new token to supported tokens list via AccessControl's DEFAULT\_ADMIN\_ROLE. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function supportNewTokenViaAccessControlDefaultAdmin(address tokenAddress) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#parameters-3) | Parameter | Type | Description | | --- | --- | --- | | tokenAddress | `address` | The address of the token to add to the list of supported tokens | ### [supportNewTokenViaGetCCIPAdmin](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#supportnewtokenviagetccipadmin) Adds a new token to supported tokens list via CCIP admin role. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#parameters-4) | Parameter | Type | Description | | --- | --- | --- | | tokenAddress | `address` | The address of the token to add to the list of supported tokens | ### [supportNewTokenViaOwner](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#supportnewtokenviaowner) Adds a new token to supported tokens list via token owner. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function supportNewTokenViaOwner(address tokenAddress) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator\#parameters-5) | Parameter | Type | Description | | --- | --- | --- | | tokenAddress | `address` | The address of the token to add to the list of supported tokens | ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840176784&cv=11&fst=1748840176784&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv0.2.3%2Fccip-local-simulator&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=CCIPLocalSimulator%20v0.2.3%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=2122912684.1748840176&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## Chainlink Aggregator API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 You're not using the latest version. Update to v0.2.3 # [AggregatorV3Interface v0.2.1 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-v3-interface\#overview) ## [AggregatorV3Interface](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-v3-interface\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-v3-interface\#functions) ### [decimals](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-v3-interface\#decimals) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-v3-interface\#description) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-v3-interface\#getrounddata) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-v3-interface\#latestrounddata) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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 | ### [version](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-v3-interface\#version) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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 | ## Get the latest Chainlink content straight to your inbox. Email Address ## MockOffchainAggregator API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 You're not using the latest version. Update to v0.2.3 # [MockOffchainAggregator v0.2.1 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-offchain-aggregator\#overview) ## [MockOffchainAggregator](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-offchain-aggregator\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-offchain-aggregator\#variables) ### [decimals](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-offchain-aggregator\#decimals) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint8 public decimals ``` The number of decimal places in the answer values. ### [getAnswer](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-offchain-aggregator\#getanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity mapping(uint256 => int256) public getAnswer ``` Maps round IDs to their corresponding price answers. ### [getTimestamp](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-offchain-aggregator\#gettimestamp) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity mapping(uint256 => uint256) public getTimestamp ``` Maps round IDs to their update timestamps. ### [latestAnswer](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-offchain-aggregator\#latestanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity int256 public latestAnswer ``` The most recent price answer. ### [latestRound](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-offchain-aggregator\#latestround) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint256 public latestRound ``` The most recent round ID. ### [latestTimestamp](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-offchain-aggregator\#latesttimestamp) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint256 public latestTimestamp ``` The timestamp of the most recent update. ### [maxAnswer](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-offchain-aggregator\#maxanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity int192 public maxAnswer ``` The highest answer the system can report. Not exposed from the Proxy contract. ### [minAnswer](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-offchain-aggregator\#minanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity int192 public minAnswer ``` The lowest answer the system can report. Not exposed from the Proxy contract. ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-offchain-aggregator\#functions) ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-offchain-aggregator\#constructor) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity constructor(uint8 _decimals, int256 _initialAnswer) ``` Initializes the aggregator with decimal precision and an initial answer. **Parameters:** | Parameter | Type | Description | | --- | --- | --- | | \_decimals | `uint8` | The number of decimal places in answers | | \_initialAnswer | `int256` | The initial price answer | ### [getRoundData](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-offchain-aggregator\#getrounddata) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-offchain-aggregator\#latestrounddata) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-offchain-aggregator\#updateanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-offchain-aggregator\#updateminandmaxanswers) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-offchain-aggregator\#updaterounddata) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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 | ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840177004&cv=11&fst=1748840177004&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~102938614~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv0.2.1%2Fmock-offchain-aggregator&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=MockOffchainAggregator%20v0.2.1%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=1844397947.1748840177&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## MockV3Aggregator API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 # [MockV3Aggregator v0.2.3 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#overview) ## [MockV3Aggregator](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#mockv3aggregator) A mock implementation of the AggregatorV2V3Interface for testing purposes. [`MockV3Aggregator`](https://github.com/smartcontractkit/chainlink-local/blob/7d8b2f888e1f10c8841ccd9e0f4af0f5baf11dab/src/data-feeds/MockV3Aggregator.sol) ## [Variables](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#variables) ### [aggregator](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#aggregator) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity address public aggregator ``` ### [proposedAggregator](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#proposedaggregator) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity address public proposedAggregator ``` ### [version](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#version) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint256 public constant override version = 0 ``` ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#functions) ### [confirmAggregator](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#confirmaggregator) Confirms the proposed aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function confirmAggregator(address _aggregator) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#parameters) | Parameter | Type | Description | | --- | --- | --- | | \_aggregator | `address` | The address of the proposed aggregator | #### [Possible Reverts](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#possible-reverts) - Reverts if the provided aggregator address does not match the proposed aggregator with "Invalid proposed aggregator" ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#constructor) Initializes the contract with decimals and initial answer. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity constructor(uint8 _decimals, int256 _initialAnswer) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#parameters-1) | Parameter | Type | Description | | --- | --- | --- | | \_decimals | `uint8` | The number of decimals for the aggregator | | \_initialAnswer | `int256` | The initial answer to be set | ### [decimals](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#decimals) Gets the number of decimals used by the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function decimals() external view returns (uint8) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#returns) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `uint8` | The number of decimals | ### [description](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#description) Gets the description of the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function description() external pure returns (string memory) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#returns-1) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `string` | The contract path as the description | ### [getAnswer](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#getanswer) Gets the answer for a specific round ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#parameters-2) | Parameter | Type | Description | | --- | --- | --- | | roundId | `uint256` | The round ID to get answer for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#returns-2) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `int256` | The answer for the given round ID | ### [getRoundData](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#getrounddata) Gets the round data for a specific round ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#parameters-3) | Parameter | Type | Description | | --- | --- | --- | | \_roundId | `uint80` | The round ID to get the data for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#returns-3) | 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](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#gettimestamp) Gets the timestamp for a specific round ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#parameters-4) | Parameter | Type | Description | | --- | --- | --- | | roundId | `uint256` | The round ID to get timestamp for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#returns-4) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `uint256` | The timestamp for the given round ID | ### [latestAnswer](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#latestanswer) Gets the latest answer from the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestAnswer() external view returns (int256) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#returns-5) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `int256` | The latest answer | ### [latestRound](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#latestround) Gets the latest round ID from the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestRound() external view returns (uint256) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#returns-6) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `uint256` | The latest round ID | ### [latestRoundData](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#latestrounddata) Gets the latest round data. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#returns-7) | 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](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#latesttimestamp) Gets the timestamp of the latest answer. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestTimestamp() external view returns (uint256) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#returns-8) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `uint256` | The timestamp of the latest answer | ### [proposeAggregator](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#proposeaggregator) Proposes a new aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function proposeAggregator(AggregatorV2V3Interface _aggregator) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#parameters-5) | Parameter | Type | Description | | --- | --- | --- | | \_aggregator | `AggregatorV2V3Interface` | The address of the proposed aggregator | #### [Possible Reverts](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#possible-reverts-1) - 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](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#updateanswer) Updates the answer in the mock aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function updateAnswer(int256 _answer) public ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#parameters-6) | Parameter | Type | Description | | --- | --- | --- | | \_answer | `int256` | The new answer to be set | ### [updateRoundData](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#updaterounddata) Updates the round data in the mock aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/mock-v3-aggregator\#parameters-7) | 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 | ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840176692&cv=11&fst=1748840176692&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2h1v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247~103308614&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv0.2.3%2Fmock-v3-aggregator&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=MockV3Aggregator%20v0.2.3%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=469848052.1748840176&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## CCIPLocalSimulator API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 You're not using the latest version. Update to v0.2.3 # [CCIPLocalSimulator v0.2.1 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator\#overview) ## [CCIPLocalSimulator](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator\#variables) ### [CHAIN\_SELECTOR](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator\#chain_selector) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint64 constant CHAIN_SELECTOR = 16015286601757825753 ``` The unique identifier for the simulated chain in CCIP operations. ### [i\_ccipBnM](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator\#i_ccipbnm) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity BurnMintERC677Helper internal immutable i_ccipBnM ``` The CCIP BnM token contract instance used for cross-chain token transfers. ### [i\_ccipLnM](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator\#i_cciplnm) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity BurnMintERC677Helper internal immutable i_ccipLnM ``` The CCIP LnM token contract instance used for cross-chain token transfers. ### [i\_linkToken](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator\#i_linktoken) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity LinkToken internal immutable i_linkToken ``` The LINK token contract instance used for paying CCIP fees. ### [i\_mockRouter](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator\#i_mockrouter) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity MockCCIPRouter internal immutable i_mockRouter ``` The mock CCIP router contract instance that simulates cross-chain message routing. ### [i\_wrappedNative](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator\#i_wrappednative) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity WETH9 internal immutable i_wrappedNative ``` The wrapped native token contract instance used for fee payments. ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator\#functions) ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator\#constructor) Initializes the simulator by deploying necessary token contracts and configuring supported tokens. ### [configuration](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator\#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 | ### [isChainSupported](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator\#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 | ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840176608&cv=11&fst=1748840176608&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv0.2.1%2Fccip-local-simulator&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=CCIPLocalSimulator%20v0.2.1%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=878906161.1748840176&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## MockEvm2EvmOffRamp API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 You're not using the latest version. Update to v0.2.3 # [MockEvm2EvmOffRamp v0.2.1 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-evm2evm-offramp\#overview) ## [MockEvm2EvmOffRamp](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-evm2evm-offramp\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-evm2evm-offramp\#errors) ### [CanOnlySimulatorCall](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-evm2evm-offramp\#canonlysimulatorcall) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity error CanOnlySimulatorCall() ``` Thrown when a non-simulator address attempts to call restricted functions. ### [ReceiverError](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-evm2evm-offramp\#receivererror) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity error ReceiverError(bytes error) ``` Thrown when the CCIP receiver execution fails. ### [TokenHandlingError](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-evm2evm-offramp\#tokenhandlingerror) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity error TokenHandlingError(bytes error) ``` Thrown when token release or minting operations encounter non-rate-limiting errors. ### [UnsupportedToken](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-evm2evm-offramp\#unsupportedtoken) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity error UnsupportedToken(IERC20 token) ``` Thrown when attempting to interact with a token that doesn't have an associated pool. ## [Structs](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-evm2evm-offramp\#structs) ### [DynamicConfig](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-evm2evm-offramp\#dynamicconfig) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-evm2evm-offramp\#variables) ### [i\_sourceChainSelector](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-evm2evm-offramp\#i_sourcechainselector) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint64 internal immutable i_sourceChainSelector ``` The chain selector identifying the source chain for this off-ramp. ### [s\_ccipLocalSimulator](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-evm2evm-offramp\#s_cciplocalsimulator) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity address internal s_ccipLocalSimulator ``` The address of the local CCIP simulator controlling this off-ramp. ### [s\_dynamicConfig](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-evm2evm-offramp\#s_dynamicconfig) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity DynamicConfig internal s_dynamicConfig ``` Current dynamic configuration settings for the off-ramp. ### [s\_poolsBySourceToken](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-evm2evm-offramp\#s_poolsbysourcetoken) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity EnumerableMapAddresses.AddressToAddressMap private s_poolsBySourceToken ``` Maps source token addresses to their corresponding token pool addresses. ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-evm2evm-offramp\#functions) ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-evm2evm-offramp\#constructor) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-evm2evm-offramp\#executesinglemessage) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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. **Parameters:** | Parameter | Type | Description | | --- | --- | --- | | message | `Internal.EVM2EVMMessage` | The cross-chain message to process | | offchainTokenData | `bytes[]` | Token data provided by off-chain DON | ### [getPoolBySourceToken](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-evm2evm-offramp\#getpoolbysourcetoken) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-evm2evm-offramp\#_releaseorminttokens) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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. **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 | ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840176816&cv=11&fst=1748840176816&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv0.2.1%2Fmock-evm2evm-offramp&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=MockEvm2EvmOffRamp%20v0.2.1%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=1661077515.1748840177&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## CCT Burn and Mint [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page # [CCT - getCCIPAdmin() token with Burn and Mint Pool in forked environments](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork\#overview) This tutorial will guide you through the process of testing the procedure of enabling your own tokens in CCIP. We will use the CCT-compatible ERC-20 token with `getCCIPAdmin` function and burning & minting capabilities. We will use Burn & Mint Pool for transferring this token across different blockchains using Chainlink CCIP. ## [Prerequisites](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork\#prerequisites) 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](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork\#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 utilize 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()`. - **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. - **Lock & Mint 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. If you don't have an existing token: For all blockchains where tokens need to be burned and minted (for example, the source or destination chain in the case of Burn and Mint, or the destination blockchain in the case of Lock and Mint), Chainlink provides a [BurnMintERC677](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.1/contracts/src/v0.8/shared/token/ERC677/BurnMintERC677.sol) contract that you can use to deploy your token in minutes. This token follows the [ERC677](https://github.com/ethereum/EIPs/issues/677) or [ERC777](https://ethereum.org/en/developers/docs/standards/tokens/erc-777/), allowing you to use it as-is or extend it to meet your specific requirements. ### [Understanding the Procedure](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork\#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.](https://docs.chain.link/images/ccip/CCIP_enabled_tokens_flowchart.jpg) ## [Before You Begin](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork\#before-you-begin) 1. **Install Foundry**: If you haven't already, follow the instructions in the [Foundry documentation](https://book.getfoundry.sh/getting-started/installation) to install Foundry. 2. **Create new Foundry project**: Create a new Foundry project by running the following command: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```bash forge init ``` 3. **Set up your environment**: Create a `.env` file, and fill in the required values: Example `.env` file: ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```bash ETHEREUM_SEPOLIA_RPC_URL= BASE_SEPOLIA_RPC_URL= ``` ## [Create the `getCCIPAdmin()` ERC-20 token](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork\#create-the-getccipadmin-erc-20-token) Inside the `test` folder create the new Solidity file and name it `CCIPv1_5ForkBurnMintPoolFork.t.sol`. We will use only this file through out the rest of this guide. Create the CCT-compatible ERC-20 token with `getCCIPAdmin()` function and burning and minting capabilities. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity // test/CCIPv1_5ForkBurnMintPoolFork.t.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { ERC20, ERC20Burnable, IERC20 } from "@chainlink/contracts-ccip/src/v0.8/vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import { AccessControl } from "@chainlink/contracts-ccip/src/v0.8/vendor/openzeppelin-solidity/v4.8.3/contracts/access/AccessControl.sol"; contract MockERC20BurnAndMintToken is IBurnMintERC20, ERC20Burnable, AccessControl { address internal immutable i_CCIPAdmin; bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE"); constructor() ERC20("MockERC20BurnAndMintToken", "MTK") { _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(MINTER_ROLE, msg.sender); _grantRole(BURNER_ROLE, msg.sender); i_CCIPAdmin = msg.sender; } function mint(address account, uint256 amount) public onlyRole(MINTER_ROLE) { _mint(account, amount); } function burn(uint256 amount) public override(IBurnMintERC20, ERC20Burnable) onlyRole(BURNER_ROLE) { super.burn(amount); } function burnFrom( address account, uint256 amount ) public override(IBurnMintERC20, ERC20Burnable) onlyRole(BURNER_ROLE) { super.burnFrom(account, amount); } function burn(address account, uint256 amount) public virtual override { burnFrom(account, amount); } function getCCIPAdmin() public view returns (address) { return i_CCIPAdmin; } } ``` ## [Test the CCT enabling procedure](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork\#test-the-cct-enabling-procedure) Expand the existing `CCIPv1_5ForkBurnMintPoolFork.t.sol` file to create and set up our basic test. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity // test/CCIPv1_5ForkBurnMintPoolFork.t.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { Test, Vm } from "forge-std/Test.sol"; import { CCIPLocalSimulatorFork, Register } from "../../../src/ccip/CCIPLocalSimulatorFork.sol"; import { BurnMintTokenPool, TokenPool } from "@chainlink/contracts-ccip/src/v0.8/ccip/pools/BurnMintTokenPool.sol"; import { LockReleaseTokenPool } from "@chainlink/contracts-ccip/src/v0.8/ccip/pools/LockReleaseTokenPool.sol"; // not used in this test import { IBurnMintERC20 } from "@chainlink/contracts-ccip/src/v0.8/shared/token/ERC20/IBurnMintERC20.sol"; import { RegistryModuleOwnerCustom } from "@chainlink/contracts-ccip/src/v0.8/ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol"; import { TokenAdminRegistry } from "@chainlink/contracts-ccip/src/v0.8/ccip/tokenAdminRegistry/TokenAdminRegistry.sol"; import { RateLimiter } from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/RateLimiter.sol"; import { IRouterClient } from "@chainlink/contracts-ccip/src/v0.8/ccip/interfaces/IRouterClient.sol"; import { Client } from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Client.sol"; /** * The token code part from previous section goes here... */ contract CCIPv1_5BurnMintPoolFork is Test { CCIPLocalSimulatorFork public ccipLocalSimulatorFork; MockERC20BurnAndMintToken public mockERC20TokenEthSepolia; MockERC20BurnAndMintToken public mockERC20TokenBaseSepolia; BurnMintTokenPool public burnMintTokenPoolEthSepolia; BurnMintTokenPool public burnMintTokenPoolBaseSepolia; Register.NetworkDetails ethSepoliaNetworkDetails; Register.NetworkDetails baseSepoliaNetworkDetails; uint256 ethSepoliaFork; uint256 baseSepoliaFork; address alice; function setUp() public { alice = makeAddr("alice"); string memory ETHEREUM_SEPOLIA_RPC_URL = vm.envString("ETHEREUM_SEPOLIA_RPC_URL"); string memory BASE_SEPOLIA_RPC_URL = vm.envString("BASE_SEPOLIA_RPC_URL"); ethSepoliaFork = vm.createSelectFork(ETHEREUM_SEPOLIA_RPC_URL); baseSepoliaFork = vm.createFork(BASE_SEPOLIA_RPC_URL); ccipLocalSimulatorFork = new CCIPLocalSimulatorFork(); vm.makePersistent(address(ccipLocalSimulatorFork)); } } ``` #### [Step 1) Deploy token on Ethereum Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork\#step-1-deploy-token-on-ethereum-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5BurnMintPoolFork is Test { function setUp() public { // Code from previous section goes here... // Step 1) Deploy token on Ethereum Sepolia vm.startPrank(alice); mockERC20TokenEthSepolia = new MockERC20BurnAndMintToken(); vm.stopPrank(); } } ``` #### [Step 2) Deploy token on Base Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork\#step-2-deploy-token-on-base-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5BurnMintPoolFork is Test { function setUp() public { // Code from previous section goes here... // Step 2) Deploy token on Base Sepolia vm.selectFork(baseSepoliaFork); vm.startPrank(alice); mockERC20TokenBaseSepolia = new MockERC20BurnAndMintToken(); vm.stopPrank(); } } ``` #### [Step 3) Deploy BurnMintTokenPool on Ethereum Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork\#step-3-deploy-burnminttokenpool-on-ethereum-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5BurnMintPoolFork is Test { // Code from previous section goes here... function test_forkSupportNewCCIPToken() public { // Step 3) Deploy BurnMintTokenPool on Ethereum Sepolia vm.selectFork(ethSepoliaFork); ethSepoliaNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); address[] memory allowlist = new address[](0); uint8 localTokenDecimals = 18; vm.startPrank(alice); burnMintTokenPoolEthSepolia = new BurnMintTokenPool( IBurnMintERC20(address(mockERC20TokenEthSepolia)), localTokenDecimals, allowlist, ethSepoliaNetworkDetails.rmnProxyAddress, ethSepoliaNetworkDetails.routerAddress ); vm.stopPrank(); } } ``` #### [Step 4) Deploy BurnMintTokenPool on Base Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork\#step-4-deploy-burnminttokenpool-on-base-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5BurnMintPoolFork is Test { function test_forkSupportNewCCIPToken() public { // Code from previous section goes here... // Step 4) Deploy BurnMintTokenPool on Base Sepolia vm.selectFork(baseSepoliaFork); baseSepoliaNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); vm.startPrank(alice); burnMintTokenPoolBaseSepolia = new BurnMintTokenPool( IBurnMintERC20(address(mockERC20TokenBaseSepolia)), localTokenDecimals, allowlist, baseSepoliaNetworkDetails.rmnProxyAddress, baseSepoliaNetworkDetails.routerAddress ); vm.stopPrank(); } } ``` #### [Step 5) Grant Mint and Burn roles to BurnMintTokenPool on Ethereum Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork\#step-5-grant-mint-and-burn-roles-to-burnminttokenpool-on-ethereum-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5BurnMintPoolFork is Test { function test_forkSupportNewCCIPToken() public { // Code from previous section goes here... // Step 5) Grant Mint and Burn roles to BurnMintTokenPool on Ethereum Sepolia vm.selectFork(ethSepoliaFork); vm.startPrank(alice); mockERC20TokenEthSepolia.grantRole(mockERC20TokenEthSepolia.MINTER_ROLE(), address(burnMintTokenPoolEthSepolia)); mockERC20TokenEthSepolia.grantRole(mockERC20TokenEthSepolia.BURNER_ROLE(), address(burnMintTokenPoolEthSepolia)); vm.stopPrank(); } } ``` #### [Step 6) Grant Mint and Burn roles to BurnMintTokenPool on Base Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork\#step-6-grant-mint-and-burn-roles-to-burnminttokenpool-on-base-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5BurnMintPoolFork is Test { function test_forkSupportNewCCIPToken() public { // Code from previous section goes here... // Step 6) Grant Mint and Burn roles to BurnMintTokenPool on Base Sepolia vm.selectFork(baseSepoliaFork); vm.startPrank(alice); mockERC20TokenBaseSepolia.grantRole(mockERC20TokenBaseSepolia.MINTER_ROLE(), address(burnMintTokenPoolBaseSepolia)); mockERC20TokenBaseSepolia.grantRole(mockERC20TokenBaseSepolia.BURNER_ROLE(), address(burnMintTokenPoolBaseSepolia)); vm.stopPrank(); } } ``` #### [Step 7) Claim Admin role on Ethereum Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork\#step-7-claim-admin-role-on-ethereum-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5BurnMintPoolFork is Test { function test_forkSupportNewCCIPToken() public { // Code from previous section goes here... // Step 7) Claim Admin role on Ethereum Sepolia vm.selectFork(ethSepoliaFork); RegistryModuleOwnerCustom registryModuleOwnerCustomEthSepolia = RegistryModuleOwnerCustom( ethSepoliaNetworkDetails.registryModuleOwnerCustomAddress ); vm.startPrank(alice); registryModuleOwnerCustomEthSepolia.registerAdminViaGetCCIPAdmin(address(mockERC20TokenEthSepolia)); vm.stopPrank(); } } ``` #### [Step 8) Claim Admin role on Base Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork\#step-8-claim-admin-role-on-base-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5BurnMintPoolFork is Test { function test_forkSupportNewCCIPToken() public { // Code from previous section goes here... // Step 8) Claim Admin role on Base Sepolia vm.selectFork(baseSepoliaFork); RegistryModuleOwnerCustom registryModuleOwnerCustomBaseSepolia = RegistryModuleOwnerCustom( baseSepoliaNetworkDetails.registryModuleOwnerCustomAddress ); vm.startPrank(alice); registryModuleOwnerCustomBaseSepolia.registerAdminViaGetCCIPAdmin(address(mockERC20TokenBaseSepolia)); vm.stopPrank(); } } ``` #### [Step 9) Accept Admin role on Ethereum Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork\#step-9-accept-admin-role-on-ethereum-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5BurnMintPoolFork is Test { function test_forkSupportNewCCIPToken() public { // Code from previous section goes here... // Step 9) Accept Admin role on Ethereum Sepolia vm.selectFork(ethSepoliaFork); TokenAdminRegistry tokenAdminRegistryEthSepolia = TokenAdminRegistry( ethSepoliaNetworkDetails.tokenAdminRegistryAddress ); vm.startPrank(alice); tokenAdminRegistryEthSepolia.acceptAdminRole(address(mockERC20TokenEthSepolia)); vm.stopPrank(); } } ``` #### [Step 10) Accept Admin role on Base Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork\#step-10-accept-admin-role-on-base-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5BurnMintPoolFork is Test { function test_forkSupportNewCCIPToken() public { // Code from previous section goes here... // Step 10) Accept Admin role on Base Sepolia vm.selectFork(baseSepoliaFork); TokenAdminRegistry tokenAdminRegistryBaseSepolia = TokenAdminRegistry( baseSepoliaNetworkDetails.tokenAdminRegistryAddress ); vm.startPrank(alice); tokenAdminRegistryBaseSepolia.acceptAdminRole(address(mockERC20TokenBaseSepolia)); vm.stopPrank(); } } ``` #### [Step 11) Link token to pool on Ethereum Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork\#step-11-link-token-to-pool-on-ethereum-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5BurnMintPoolFork is Test { function test_forkSupportNewCCIPToken() public { // Code from previous section goes here... // Step 11) Link token to pool on Ethereum Sepolia vm.selectFork(ethSepoliaFork); vm.startPrank(alice); tokenAdminRegistryEthSepolia.setPool(address(mockERC20TokenEthSepolia), address(burnMintTokenPoolEthSepolia)); vm.stopPrank(); } } ``` #### [Step 12) Link token to pool on Base Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork\#step-12-link-token-to-pool-on-base-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5BurnMintPoolFork is Test { function test_forkSupportNewCCIPToken() public { // Code from previous section goes here... // Step 12) Link token to pool on Base Sepolia vm.selectFork(baseSepoliaFork); vm.startPrank(alice); tokenAdminRegistryBaseSepolia.setPool(address(mockERC20TokenBaseSepolia), address(burnMintTokenPoolBaseSepolia)); vm.stopPrank(); } } ``` #### [Step 13) Configure Token Pool on Ethereum Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork\#step-13-configure-token-pool-on-ethereum-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5BurnMintPoolFork is Test { function test_forkSupportNewCCIPToken() public { // Code from previous section goes here... // Step 13) Configure Token Pool on Ethereum Sepolia vm.selectFork(ethSepoliaFork); vm.startPrank(alice); TokenPool.ChainUpdate[] memory chains = new TokenPool.ChainUpdate[](1); bytes[] memory remotePoolAddressesEthSepolia = new bytes[](1); remotePoolAddressesEthSepolia[0] = abi.encode(address(burnMintTokenPoolEthSepolia)); chains[0] = TokenPool.ChainUpdate({ remoteChainSelector: baseSepoliaNetworkDetails.chainSelector, remotePoolAddresses: remotePoolAddressesEthSepolia, remoteTokenAddress: abi.encode(address(mockERC20TokenBaseSepolia)), outboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: 100_000, rate: 167 }), inboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: 100_000, rate: 167 }) }); uint64[] memory remoteChainSelectorsToRemove = new uint64[](0); burnMintTokenPoolEthSepolia.applyChainUpdates(remoteChainSelectorsToRemove, chains); vm.stopPrank(); } } ``` #### [Step 14) Configure Token Pool on Base Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork\#step-14-configure-token-pool-on-base-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5BurnMintPoolFork is Test { function test_forkSupportNewCCIPToken() public { // Code from previous section goes here... // Step 14) Configure Token Pool on Base Sepolia vm.selectFork(baseSepoliaFork); vm.startPrank(alice); chains = new TokenPool.ChainUpdate[](1); bytes[] memory remotePoolAddressesBaseSepolia = new bytes[](1); remotePoolAddressesBaseSepolia[0] = abi.encode(address(burnMintTokenPoolEthSepolia)); chains[0] = TokenPool.ChainUpdate({ remoteChainSelector: ethSepoliaNetworkDetails.chainSelector, remotePoolAddresses: remotePoolAddressesBaseSepolia, remoteTokenAddress: abi.encode(address(mockERC20TokenEthSepolia)), outboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: 100_000, rate: 167 }), inboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: 100_000, rate: 167 }) }); burnMintTokenPoolBaseSepolia.applyChainUpdates(remoteChainSelectorsToRemove, chains); vm.stopPrank(); } } ``` #### [Step 15) Mint tokens on Ethereum Sepolia and transfer them to Base Sepolia](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork\#step-15-mint-tokens-on-ethereum-sepolia-and-transfer-them-to-base-sepolia) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity contract CCIPv1_5BurnMintPoolFork is Test { function test_forkSupportNewCCIPToken() public { // Code from previous section goes here... // Step 15) Mint tokens on Ethereum Sepolia and transfer them to Base Sepolia vm.selectFork(ethSepoliaFork); address linkSepolia = ethSepoliaNetworkDetails.linkAddress; ccipLocalSimulatorFork.requestLinkFromFaucet(address(alice), 20 ether); uint256 amountToSend = 100; Client.EVMTokenAmount[] memory tokenToSendDetails = new Client.EVMTokenAmount[](1); Client.EVMTokenAmount memory tokenAmount = Client.EVMTokenAmount({ token: address(mockERC20TokenEthSepolia), amount: amountToSend }); tokenToSendDetails[0] = tokenAmount; vm.startPrank(alice); mockERC20TokenEthSepolia.mint(address(alice), amountToSend); mockERC20TokenEthSepolia.approve(ethSepoliaNetworkDetails.routerAddress, amountToSend); IERC20(linkSepolia).approve(ethSepoliaNetworkDetails.routerAddress, 20 ether); uint256 balanceOfAliceBeforeEthSepolia = mockERC20TokenEthSepolia.balanceOf(alice); IRouterClient routerEthSepolia = IRouterClient(ethSepoliaNetworkDetails.routerAddress); routerEthSepolia.ccipSend( baseSepoliaNetworkDetails.chainSelector, Client.EVM2AnyMessage({ receiver: abi.encode(address(alice)), data: "", tokenAmounts: tokenToSendDetails, extraArgs: Client._argsToBytes(Client.EVMExtraArgsV1({ gasLimit: 0 })), feeToken: linkSepolia }) ); uint256 balanceOfAliceAfterEthSepolia = mockERC20TokenEthSepolia.balanceOf(alice); vm.stopPrank(); assertEq(balanceOfAliceAfterEthSepolia, balanceOfAliceBeforeEthSepolia - amountToSend); ccipLocalSimulatorFork.switchChainAndRouteMessage(baseSepoliaFork); uint256 balanceOfAliceAfterBaseSepolia = mockERC20TokenBaseSepolia.balanceOf(alice); assertEq(balanceOfAliceAfterBaseSepolia, amountToSend); } } ``` ## [Final code - full example](https://docs.chain.link/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork\#final-code---full-example) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity // test/CCIPv1_5ForkBurnMintPoolFork.t.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { Test, Vm } from "forge-std/Test.sol"; import { CCIPLocalSimulatorFork, Register } from "../../../src/ccip/CCIPLocalSimulatorFork.sol"; import { BurnMintTokenPool, TokenPool } from "@chainlink/contracts-ccip/src/v0.8/ccip/pools/BurnMintTokenPool.sol"; import { LockReleaseTokenPool } from "@chainlink/contracts-ccip/src/v0.8/ccip/pools/LockReleaseTokenPool.sol"; // not used in this test import { IBurnMintERC20 } from "@chainlink/contracts-ccip/src/v0.8/shared/token/ERC20/IBurnMintERC20.sol"; import { RegistryModuleOwnerCustom } from "@chainlink/contracts-ccip/src/v0.8/ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol"; import { TokenAdminRegistry } from "@chainlink/contracts-ccip/src/v0.8/ccip/tokenAdminRegistry/TokenAdminRegistry.sol"; import { RateLimiter } from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/RateLimiter.sol"; import { IRouterClient } from "@chainlink/contracts-ccip/src/v0.8/ccip/interfaces/IRouterClient.sol"; import { Client } from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Client.sol"; import { ERC20, ERC20Burnable, IERC20 } from "@chainlink/contracts-ccip/src/v0.8/vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import { AccessControl } from "@chainlink/contracts-ccip/src/v0.8/vendor/openzeppelin-solidity/v4.8.3/contracts/access/AccessControl.sol"; contract MockERC20BurnAndMintToken is IBurnMintERC20, ERC20Burnable, AccessControl { address internal immutable i_CCIPAdmin; bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE"); constructor() ERC20("MockERC20BurnAndMintToken", "MTK") { _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(MINTER_ROLE, msg.sender); _grantRole(BURNER_ROLE, msg.sender); i_CCIPAdmin = msg.sender; } function mint(address account, uint256 amount) public onlyRole(MINTER_ROLE) { _mint(account, amount); } function burn(uint256 amount) public override(IBurnMintERC20, ERC20Burnable) onlyRole(BURNER_ROLE) { super.burn(amount); } function burnFrom( address account, uint256 amount ) public override(IBurnMintERC20, ERC20Burnable) onlyRole(BURNER_ROLE) { super.burnFrom(account, amount); } function burn(address account, uint256 amount) public virtual override { burnFrom(account, amount); } function getCCIPAdmin() public view returns (address) { return i_CCIPAdmin; } } contract CCIPv1_5BurnMintPoolFork is Test { CCIPLocalSimulatorFork public ccipLocalSimulatorFork; MockERC20BurnAndMintToken public mockERC20TokenEthSepolia; MockERC20BurnAndMintToken public mockERC20TokenBaseSepolia; BurnMintTokenPool public burnMintTokenPoolEthSepolia; BurnMintTokenPool public burnMintTokenPoolBaseSepolia; Register.NetworkDetails ethSepoliaNetworkDetails; Register.NetworkDetails baseSepoliaNetworkDetails; uint256 ethSepoliaFork; uint256 baseSepoliaFork; address alice; function setUp() public { alice = makeAddr("alice"); string memory ETHEREUM_SEPOLIA_RPC_URL = vm.envString("ETHEREUM_SEPOLIA_RPC_URL"); string memory BASE_SEPOLIA_RPC_URL = vm.envString("BASE_SEPOLIA_RPC_URL"); ethSepoliaFork = vm.createSelectFork(ETHEREUM_SEPOLIA_RPC_URL); baseSepoliaFork = vm.createFork(BASE_SEPOLIA_RPC_URL); ccipLocalSimulatorFork = new CCIPLocalSimulatorFork(); vm.makePersistent(address(ccipLocalSimulatorFork)); // Step 1) Deploy token on Ethereum Sepolia vm.startPrank(alice); mockERC20TokenEthSepolia = new MockERC20BurnAndMintToken(); vm.stopPrank(); // Step 2) Deploy token on Base Sepolia vm.selectFork(baseSepoliaFork); vm.startPrank(alice); mockERC20TokenBaseSepolia = new MockERC20BurnAndMintToken(); vm.stopPrank(); } function test_forkSupportNewCCIPToken() public { // Step 3) Deploy BurnMintTokenPool on Ethereum Sepolia vm.selectFork(ethSepoliaFork); ethSepoliaNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); address[] memory allowlist = new address[](0); uint8 localTokenDecimals = 18; vm.startPrank(alice); burnMintTokenPoolEthSepolia = new BurnMintTokenPool( IBurnMintERC20(address(mockERC20TokenEthSepolia)), localTokenDecimals, allowlist, ethSepoliaNetworkDetails.rmnProxyAddress, ethSepoliaNetworkDetails.routerAddress ); vm.stopPrank(); // Step 4) Deploy BurnMintTokenPool on Base Sepolia vm.selectFork(baseSepoliaFork); baseSepoliaNetworkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); vm.startPrank(alice); burnMintTokenPoolBaseSepolia = new BurnMintTokenPool( IBurnMintERC20(address(mockERC20TokenBaseSepolia)), localTokenDecimals, allowlist, baseSepoliaNetworkDetails.rmnProxyAddress, baseSepoliaNetworkDetails.routerAddress ); vm.stopPrank(); // Step 5) Grant Mint and Burn roles to BurnMintTokenPool on Ethereum Sepolia vm.selectFork(ethSepoliaFork); vm.startPrank(alice); mockERC20TokenEthSepolia.grantRole(mockERC20TokenEthSepolia.MINTER_ROLE(), address(burnMintTokenPoolEthSepolia)); mockERC20TokenEthSepolia.grantRole(mockERC20TokenEthSepolia.BURNER_ROLE(), address(burnMintTokenPoolEthSepolia)); vm.stopPrank(); // Step 6) Grant Mint and Burn roles to BurnMintTokenPool on Base Sepolia vm.selectFork(baseSepoliaFork); vm.startPrank(alice); mockERC20TokenBaseSepolia.grantRole(mockERC20TokenBaseSepolia.MINTER_ROLE(), address(burnMintTokenPoolBaseSepolia)); mockERC20TokenBaseSepolia.grantRole(mockERC20TokenBaseSepolia.BURNER_ROLE(), address(burnMintTokenPoolBaseSepolia)); vm.stopPrank(); // Step 7) Claim Admin role on Ethereum Sepolia vm.selectFork(ethSepoliaFork); RegistryModuleOwnerCustom registryModuleOwnerCustomEthSepolia = RegistryModuleOwnerCustom( ethSepoliaNetworkDetails.registryModuleOwnerCustomAddress ); vm.startPrank(alice); registryModuleOwnerCustomEthSepolia.registerAdminViaGetCCIPAdmin(address(mockERC20TokenEthSepolia)); vm.stopPrank(); // Step 8) Claim Admin role on Base Sepolia vm.selectFork(baseSepoliaFork); RegistryModuleOwnerCustom registryModuleOwnerCustomBaseSepolia = RegistryModuleOwnerCustom( baseSepoliaNetworkDetails.registryModuleOwnerCustomAddress ); vm.startPrank(alice); registryModuleOwnerCustomBaseSepolia.registerAdminViaGetCCIPAdmin(address(mockERC20TokenBaseSepolia)); vm.stopPrank(); // Step 9) Accept Admin role on Ethereum Sepolia vm.selectFork(ethSepoliaFork); TokenAdminRegistry tokenAdminRegistryEthSepolia = TokenAdminRegistry( ethSepoliaNetworkDetails.tokenAdminRegistryAddress ); vm.startPrank(alice); tokenAdminRegistryEthSepolia.acceptAdminRole(address(mockERC20TokenEthSepolia)); vm.stopPrank(); // Step 10) Accept Admin role on Base Sepolia vm.selectFork(baseSepoliaFork); TokenAdminRegistry tokenAdminRegistryBaseSepolia = TokenAdminRegistry( baseSepoliaNetworkDetails.tokenAdminRegistryAddress ); vm.startPrank(alice); tokenAdminRegistryBaseSepolia.acceptAdminRole(address(mockERC20TokenBaseSepolia)); vm.stopPrank(); // Step 11) Link token to pool on Ethereum Sepolia vm.selectFork(ethSepoliaFork); vm.startPrank(alice); tokenAdminRegistryEthSepolia.setPool(address(mockERC20TokenEthSepolia), address(burnMintTokenPoolEthSepolia)); vm.stopPrank(); // Step 12) Link token to pool on Base Sepolia vm.selectFork(baseSepoliaFork); vm.startPrank(alice); tokenAdminRegistryBaseSepolia.setPool(address(mockERC20TokenBaseSepolia), address(burnMintTokenPoolBaseSepolia)); vm.stopPrank(); // Step 13) Configure Token Pool on Ethereum Sepolia vm.selectFork(ethSepoliaFork); vm.startPrank(alice); TokenPool.ChainUpdate[] memory chains = new TokenPool.ChainUpdate[](1); bytes[] memory remotePoolAddressesEthSepolia = new bytes[](1); remotePoolAddressesEthSepolia[0] = abi.encode(address(burnMintTokenPoolEthSepolia)); chains[0] = TokenPool.ChainUpdate({ remoteChainSelector: baseSepoliaNetworkDetails.chainSelector, remotePoolAddresses: remotePoolAddressesEthSepolia, remoteTokenAddress: abi.encode(address(mockERC20TokenBaseSepolia)), outboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: 100_000, rate: 167 }), inboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: 100_000, rate: 167 }) }); uint64[] memory remoteChainSelectorsToRemove = new uint64[](0); burnMintTokenPoolEthSepolia.applyChainUpdates(remoteChainSelectorsToRemove, chains); vm.stopPrank(); // Step 14) Configure Token Pool on Base Sepolia vm.selectFork(baseSepoliaFork); vm.startPrank(alice); chains = new TokenPool.ChainUpdate[](1); bytes[] memory remotePoolAddressesBaseSepolia = new bytes[](1); remotePoolAddressesBaseSepolia[0] = abi.encode(address(burnMintTokenPoolEthSepolia)); chains[0] = TokenPool.ChainUpdate({ remoteChainSelector: ethSepoliaNetworkDetails.chainSelector, remotePoolAddresses: remotePoolAddressesBaseSepolia, remoteTokenAddress: abi.encode(address(mockERC20TokenEthSepolia)), outboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: 100_000, rate: 167 }), inboundRateLimiterConfig: RateLimiter.Config({ isEnabled: true, capacity: 100_000, rate: 167 }) }); burnMintTokenPoolBaseSepolia.applyChainUpdates(remoteChainSelectorsToRemove, chains); vm.stopPrank(); // Step 15) Mint tokens on Ethereum Sepolia and transfer them to Base Sepolia vm.selectFork(ethSepoliaFork); address linkSepolia = ethSepoliaNetworkDetails.linkAddress; ccipLocalSimulatorFork.requestLinkFromFaucet(address(alice), 20 ether); uint256 amountToSend = 100; Client.EVMTokenAmount[] memory tokenToSendDetails = new Client.EVMTokenAmount[](1); Client.EVMTokenAmount memory tokenAmount = Client.EVMTokenAmount({ token: address(mockERC20TokenEthSepolia), amount: amountToSend }); tokenToSendDetails[0] = tokenAmount; vm.startPrank(alice); mockERC20TokenEthSepolia.mint(address(alice), amountToSend); mockERC20TokenEthSepolia.approve(ethSepoliaNetworkDetails.routerAddress, amountToSend); IERC20(linkSepolia).approve(ethSepoliaNetworkDetails.routerAddress, 20 ether); uint256 balanceOfAliceBeforeEthSepolia = mockERC20TokenEthSepolia.balanceOf(alice); IRouterClient routerEthSepolia = IRouterClient(ethSepoliaNetworkDetails.routerAddress); routerEthSepolia.ccipSend( baseSepoliaNetworkDetails.chainSelector, Client.EVM2AnyMessage({ receiver: abi.encode(address(alice)), data: "", tokenAmounts: tokenToSendDetails, extraArgs: Client._argsToBytes(Client.EVMExtraArgsV1({ gasLimit: 0 })), feeToken: linkSepolia }) ); uint256 balanceOfAliceAfterEthSepolia = mockERC20TokenEthSepolia.balanceOf(alice); vm.stopPrank(); assertEq(balanceOfAliceAfterEthSepolia, balanceOfAliceBeforeEthSepolia - amountToSend); ccipLocalSimulatorFork.switchChainAndRouteMessage(baseSepoliaFork); uint256 balanceOfAliceAfterBaseSepolia = mockERC20TokenBaseSepolia.balanceOf(alice); assertEq(balanceOfAliceAfterBaseSepolia, amountToSend); } } ``` ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840176626&cv=11&fst=1748840176626&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fbuild%2Fccip%2Ffoundry%2Fcct-burn-and-mint-fork&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=CCT%20-%20getCCIPAdmin()%20token%20with%20Burn%20and%20Mint%20Pool%20in%20forked%20environments%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=82933995.1748840176&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## MockOffchainAggregator API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 You're not using the latest version. Update to v0.2.3 # [MockOffchainAggregator v0.2.2 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#overview) ## [MockOffchainAggregator](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#variables) ### [decimals](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#decimals) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint8 public decimals ``` ### [getAnswer](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#getanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity mapping(uint256 => int256) public getAnswer ``` ### [getTimestamp](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#gettimestamp) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity mapping(uint256 => uint256) public getTimestamp ``` ### [latestAnswer](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#latestanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity int256 public latestAnswer ``` ### [latestRound](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#latestround) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint256 public latestRound ``` ### [latestTimestamp](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#latesttimestamp) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint256 public latestTimestamp ``` ### [maxAnswer](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#maxanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity int192 public maxAnswer ``` ### [minAnswer](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#minanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity int192 public minAnswer ``` ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#functions) ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#constructor) Initializes a new mock aggregator with the specified decimal precision and starting price. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity constructor(uint8 _decimals, int256 _initialAnswer) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#getrounddata) Retrieves the complete round data for a specific round ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#parameters-1) | Parameter | Type | Description | | --- | --- | --- | | \_roundId | uint80 | The round ID to get the data for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#latestrounddata) Retrieves the complete round data for the most recent round. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#returns-1) | 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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#updateanswer) Updates the latest answer and associated data. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function updateAnswer(int256 _answer) public ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#parameters-2) | Parameter | Type | Description | | --- | --- | --- | | \_answer | int256 | The new answer to be set | ### [updateMinAndMaxAnswers](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#updateminandmaxanswers) Updates the minimum and maximum allowed answers for the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function updateMinAndMaxAnswers(int192 _minAnswer, int192 _maxAnswer) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#parameters-3) | Parameter | Type | Description | | --- | --- | --- | | \_minAnswer | int192 | The new minimum answer | | \_maxAnswer | int192 | The new maximum answer | ### [updateRoundData](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#updaterounddata) Updates all data for a specific round. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-offchain-aggregator\#parameters-4) | 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 | ## Get the latest Chainlink content straight to your inbox. Email Address ## CCIPLocalSimulator API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 You're not using the latest version. Update to v0.2.3 # [CCIPLocalSimulator v0.2.2 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#overview) ## [CCIPLocalSimulator](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#errors) ### [CCIPLocalSimulator\_\_MsgSenderIsNotTokenOwner](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#cciplocalsimulator__msgsenderisnottokenowner) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity error CCIPLocalSimulator__MsgSenderIsNotTokenOwner() ``` Thrown when a caller attempts to add a token but is not the token owner or CCIP admin. ## [Variables](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#variables) ### [CHAIN\_SELECTOR](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#chain_selector) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint64 constant CHAIN_SELECTOR = 16015286601757825753 ``` ### [i\_ccipBnM](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#i_ccipbnm) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity BurnMintERC677Helper internal immutable i_ccipBnM ``` ### [i\_ccipLnM](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#i_cciplnm) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity BurnMintERC677Helper internal immutable i_ccipLnM ``` ### [i\_linkToken](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#i_linktoken) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity LinkToken internal immutable i_linkToken ``` ### [i\_mockRouter](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#i_mockrouter) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity MockCCIPRouter internal immutable i_mockRouter ``` ### [i\_wrappedNative](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#i_wrappednative) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity WETH9 internal immutable i_wrappedNative ``` ### [s\_supportedTokens](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#s_supportedtokens) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity address[] internal s_supportedTokens ``` ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#functions) ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#constructor) Initializes the contract by deploying and configuring all required token instances. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity constructor() ``` ### [configuration](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#configuration) Retrieves the complete configuration for local CCIP simulations. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function configuration() public view returns ( uint64 chainSelector_, IRouterClient sourceRouter_, IRouterClient destinationRouter_, WETH9 wrappedNative_, LinkToken linkToken_, BurnMintERC677Helper ccipBnM_, BurnMintERC677Helper ccipLnM_ ) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#getsupportedtokens) Retrieves the list of tokens supported for cross-chain transfers. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getSupportedTokens(uint64 chainSelector) external view returns (address[] memory tokens) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#parameters) | Parameter | Type | Description | | --- | --- | --- | | chainSelector | uint64 | The unique CCIP Chain Selector | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#returns-1) | Parameter | Type | Description | | --- | --- | --- | | tokens | address\[\] | Returns a list of token addresses that are supported for cross-chain transfers by the simulator | ### [isChainSupported](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#ischainsupported) Verifies if a given chain selector is supported by the simulator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function isChainSupported(uint64 chainSelector) public pure returns (bool supported) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#parameters-1) | Parameter | Type | Description | | --- | --- | --- | | chainSelector | uint64 | The unique CCIP Chain Selector | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#returns-2) | Parameter | Type | Description | | --- | --- | --- | | supported | bool | Returns true if `chainSelector` is supported by the simulator | ### [requestLinkFromFaucet](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#requestlinkfromfaucet) Transfers LINK tokens from the faucet to a specified recipient address. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#parameters-2) | 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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#returns-3) | Parameter | Type | Description | | --- | --- | --- | | success | bool | Returns true if the transfer of tokens was successful, otherwise false | ### [supportNewTokenViaGetCCIPAdmin](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#supportnewtokenviagetccipadmin) Adds support for a new token using CCIP admin verification. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#parameters-3) | Parameter | Type | Description | | --- | --- | --- | | tokenAddress | address | The address of the token to add to the list of supported tokens | ### [supportNewTokenViaOwner](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#supportnewtokenviaowner) Adds support for a new token using owner verification. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function supportNewTokenViaOwner(address tokenAddress) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator\#parameters-4) | Parameter | Type | Description | | --- | --- | --- | | tokenAddress | address | The address of the token to add to the list of supported tokens | ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840176887&cv=11&fst=1748840176887&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv0.2.2%2Fccip-local-simulator&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=CCIPLocalSimulator%20v0.2.2%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=1735336376.1748840177&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## MockV3Aggregator API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 You're not using the latest version. Update to v0.2.3 # [MockV3Aggregator v0.2.1 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-v3-aggregator\#overview) ## [MockV3Aggregator](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-v3-aggregator\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-v3-aggregator\#variables) ### [aggregator](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-v3-aggregator\#aggregator) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity address public aggregator ``` The address of the current MockOffchainAggregator implementation. ### [proposedAggregator](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-v3-aggregator\#proposedaggregator) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity address public proposedAggregator ``` The address of the proposed new aggregator implementation. ### [version](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-v3-aggregator\#version) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint256 public constant override version = 0 ``` The version number of this aggregator implementation. ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-v3-aggregator\#functions) ### [confirmAggregator](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-v3-aggregator\#confirmaggregator) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function confirmAggregator(address _aggregator) external ``` Confirms a proposed aggregator upgrade. **Parameters:** | Parameter | Type | Description | | --- | --- | --- | | \_aggregator | `address` | The proposed aggregator address to confirm | ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-v3-aggregator\#constructor) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-v3-aggregator\#decimals) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-v3-aggregator\#description) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-v3-aggregator\#getanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-v3-aggregator\#getrounddata) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-v3-aggregator\#gettimestamp) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-v3-aggregator\#latestanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestAnswer() external view returns (int256) ``` Retrieves the most recent answer. **Returns:** | Type | Description | | --- | --- | | `int256` | The latest price feed answer | ### [latestRound](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-v3-aggregator\#latestround) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestRound() external view returns (uint256) ``` Retrieves the most recent round ID. **Returns:** | Type | Description | | --- | --- | | `uint256` | The latest round ID | ### [latestRoundData](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-v3-aggregator\#latestrounddata) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-v3-aggregator\#latesttimestamp) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-v3-aggregator\#proposeaggregator) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function proposeAggregator(AggregatorV2V3Interface _aggregator) external ``` Proposes a new aggregator implementation. **Parameters:** | Parameter | Type | Description | | --- | --- | --- | | \_aggregator | `AggregatorV2V3Interface` | The new aggregator implementation | ### [updateAnswer](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-v3-aggregator\#updateanswer) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/mock-v3-aggregator\#updaterounddata) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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 | ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840183086&cv=11&fst=1748840183086&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103103155~103103157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247~104617979~104617981&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv0.2.1%2Fmock-v3-aggregator&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=MockV3Aggregator%20v0.2.1%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=538750721.1748840183&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## AggregatorV3Interface API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 # [AggregatorV3Interface v0.2.3 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-v3-interface\#overview) ## [AggregatorV3Interface](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-v3-interface\#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) ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-v3-interface\#functions) ### [decimals](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-v3-interface\#decimals) Gets the number of decimals used by the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function decimals() external view returns (uint8) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-v3-interface\#returns) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `uint8` | The number of decimals | ### [description](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-v3-interface\#description) Gets the description of the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function description() external view returns (string memory) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-v3-interface\#returns-1) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `string` | The description of the aggregator | ### [getRoundData](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-v3-interface\#getrounddata) Gets the round data for a specific round ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-v3-interface\#parameters) | Parameter | Type | Description | | --- | --- | --- | | \_roundId | `uint80` | The round ID to get the data for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-v3-interface\#returns-2) | 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](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-v3-interface\#latestrounddata) Gets the latest round data. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-v3-interface\#returns-3) | 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](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-v3-interface\#version) Gets the version of the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function version() external view returns (uint256) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-v3-interface\#returns-4) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `uint256` | The version of the aggregator | ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840183068&cv=11&fst=1748840183068&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55t0h2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104611959~104611961~104612245~104612247&ptag_exp=101509157~102015666~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv0.2.3%2Faggregator-v3-interface&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=AggregatorV3Interface%20v0.2.3%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=14598621.1748840183&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## MockV3Aggregator API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version:v0.2.2Not using latest version (v0.2.3) # [MockV3Aggregator v0.2.2 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#overview) ## [MockV3Aggregator](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#inheritance) This contract inherits from: - [`AggregatorV2V3Interface`](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-v2-v3-interface) \- Combined interface that includes both AggregatorInterface and AggregatorV3Interface functionality ## [Variables](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#variables) ### [aggregator](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#aggregator) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity address public aggregator ``` ### [proposedAggregator](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#proposedaggregator) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity address public proposedAggregator ``` ### [version](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#version) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity uint256 public constant version ``` ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#functions) ### [confirmAggregator](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#confirmaggregator) Confirms and sets a previously proposed aggregator as the current one. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function confirmAggregator(address _aggregator) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#parameters) | Parameter | Type | Description | | --- | --- | --- | | \_aggregator | address | The address of the proposed aggregator | ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#constructor) Initializes the mock aggregator with specified decimals and initial answer. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity constructor(uint8 _decimals, int256 _initialAnswer) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#parameters-1) | 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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#decimals) Retrieves the number of decimal places used by the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function decimals() external view returns (uint8) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#returns) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | uint8 | The number of decimals | ### [description](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#description) Returns the description of the aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function description() external pure returns (string memory) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#returns-1) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | string | The source file path of the mock aggregator | ### [getAnswer](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#getanswer) Retrieves the answer for a specific round. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getAnswer(uint256 roundId) external view returns (int256) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#parameters-2) | Parameter | Type | Description | | --- | --- | --- | | roundId | uint256 | The round ID to get the answer for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#returns-2) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | int256 | The answer for the given round ID | ### [getRoundData](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#getrounddata) Retrieves the complete round data for a specific round ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#parameters-3) | Parameter | Type | Description | | --- | --- | --- | | \_roundId | uint80 | The round ID to get the data for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#returns-3) | 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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#gettimestamp) Retrieves the timestamp for a specific round. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getTimestamp(uint256 roundId) external view returns (uint256) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#parameters-4) | Parameter | Type | Description | | --- | --- | --- | | roundId | uint256 | The round ID to get the timestamp for | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#returns-4) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | uint256 | The timestamp for the given round ID | ### [latestAnswer](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#latestanswer) Retrieves the most recent answer. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestAnswer() external view returns (int256) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#returns-5) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | int256 | The latest answer | ### [latestRound](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#latestround) Retrieves the most recent round ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestRound() external view returns (uint256) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#returns-6) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | uint256 | The latest round ID | ### [latestRoundData](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#latestrounddata) Retrieves the complete round data for the most recent round. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#returns-7) | 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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#latesttimestamp) Retrieves the timestamp of the most recent answer. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function latestTimestamp() external view returns (uint256) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#returns-8) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | uint256 | The timestamp of the latest answer | ### [proposeAggregator](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#proposeaggregator) Proposes a new aggregator for future use. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function proposeAggregator(AggregatorV2V3Interface _aggregator) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#parameters-5) | Parameter | Type | Description | | --- | --- | --- | | \_aggregator | AggregatorV2V3Interface | The address of the proposed aggregator | ### [updateAnswer](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#updateanswer) Updates the latest answer in the underlying mock aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function updateAnswer(int256 _answer) public ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#parameters-6) | Parameter | Type | Description | | --- | --- | --- | | \_answer | int256 | The new answer to be set | ### [updateRoundData](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#updaterounddata) Updates all data for a specific round in the underlying mock aggregator. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/mock-v3-aggregator\#parameters-7) | 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 | ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840183344&cv=11&fst=1748840183344&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247~103308614&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv0.2.2%2Fmock-v3-aggregator&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=MockV3Aggregator%20v0.2.2%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=1225453225.1748840183&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## CCIP Local Simulator [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 You're not using the latest version. Update to v0.2.3 # [CCIPLocalSimulatorFork v0.2.2 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#overview) ## [CCIPLocalSimulatorFork](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#events) ### [CCIPSendRequested](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#ccipsendrequested) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity event CCIPSendRequested(Internal.EVM2EVMMessage message) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#parameters) | Parameter | Type | Description | | --- | --- | --- | | message | Internal.EVM2EVMMessage | The EVM2EVM message that was sent | ## [Interfaces](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#interfaces) ### [IEVM2EVMOffRampFork](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#ievm2evmofframpfork) Interface for executing CCIP messages on the off-ramp. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity interface IEVM2EVMOffRampFork { function executeSingleMessage( Internal.EVM2EVMMessage memory message, bytes[] memory offchainTokenData, uint32[] memory tokenGasOverrides ) external; } ``` ### [IRouterFork](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#irouterfork) Interface for accessing off-ramp configurations. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity interface IRouterFork { struct OffRamp { uint64 sourceChainSelector; address offRamp; } function getOffRamps() external view returns (OffRamp[] memory); } ``` ## [Structs](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#structs) ### [OffRamp](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#offramp) Configuration for a CCIP off-ramp. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity struct OffRamp { uint64 sourceChainSelector; address offRamp; } ``` #### [Fields](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#fields) | Field | Type | Description | | --- | --- | --- | | sourceChainSelector | uint64 | The chain selector for the source chain | | offRamp | address | The address of the offRamp contract | ## [Variables](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#variables) ### [i\_register](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#i_register) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity Register immutable i_register ``` ### [LINK\_FAUCET](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#link_faucet) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity address constant LINK_FAUCET = 0x4281eCF07378Ee595C564a59048801330f3084eE ``` ### [s\_processedMessages](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#s_processedmessages) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity mapping(bytes32 messageId => bool isProcessed) internal s_processedMessages ``` ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#functions) ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#constructor) Sets up the simulator environment by creating a persistent register instance and enabling event recording. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity constructor() ``` ### [getNetworkDetails](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#getnetworkdetails) Fetches the network configuration for a specified blockchain network ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getNetworkDetails(uint256 chainId) external view returns (Register.NetworkDetails memory) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#parameters-1) | Parameter | Type | Description | | --- | --- | --- | | chainId | uint256 | The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#returns) | Parameter | Type | Description | | --- | --- | --- | | networkDetails | Register.NetworkDetails | The tuple containing: chainSelector, routerAddress, linkAddress, wrappedNativeAddress, ccipBnMAddress, ccipLnMAddress | ### [requestLinkFromFaucet](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#requestlinkfromfaucet) Transfers LINK tokens from the faucet to a specified recipient address. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#parameters-2) | 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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#returns-1) | Parameter | Type | Description | | --- | --- | --- | | success | bool | Returns true if the transfer of tokens was successful, otherwise false | ### [setNetworkDetails](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#setnetworkdetails) Registers or updates the network configuration for a specific blockchain. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function setNetworkDetails(uint256 chainId, Register.NetworkDetails memory networkDetails) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#parameters-3) | 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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#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. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function switchChainAndRouteMessage(uint256 forkId) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork\#parameters-4) | Parameter | Type | Description | | --- | --- | --- | | forkId | uint256 | The ID of the destination network fork. This is the returned value of `createFork()` or `createSelectFork()` | ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840183131&cv=11&fst=1748840183131&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~102015666~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv0.2.2%2Fccip-local-simulator-fork&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=CCIPLocalSimulatorFork%20v0.2.2%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=381569023.1748840183&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## BurnMintERC677Helper API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 You're not using the latest version. Update to v0.2.3 # [BurnMintERC677Helper v0.2.1 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/burn-mint-erc677-helper\#overview) ## [BurnMintERC677Helper](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/burn-mint-erc677-helper\#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. ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/burn-mint-erc677-helper\#functions) ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/burn-mint-erc677-helper\#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 | ### [drip](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/burn-mint-erc677-helper\#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 | ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840183022&cv=11&fst=1748840183022&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104573694~104612245~104612247&ptag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv0.2.1%2Fburn-mint-erc677-helper&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=BurnMintERC677Helper%20v0.2.1%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=261848140.1748840183&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## BurnMintERC677Helper API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 # [BurnMintERC677Helper v0.2.3 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/burn-mint-erc677-helper\#overview) ## [BurnMintERC677Helper](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/burn-mint-erc677-helper\#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) ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/burn-mint-erc677-helper\#functions) ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/burn-mint-erc677-helper\#constructor) Initializes the token with a name and symbol, setting fixed decimals and initial supply. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity constructor(string memory name, string memory symbol) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/burn-mint-erc677-helper\#parameters) | Parameter | Type | Description | | --- | --- | --- | | name | `string` | The name of the token | | symbol | `string` | The symbol of the token | ### [drip](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/burn-mint-erc677-helper\#drip) Mints exactly one token (1e18 units) to a specified address. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function drip(address to) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/burn-mint-erc677-helper\#parameters-1) | Parameter | Type | Description | | --- | --- | --- | | to | `address` | The address to receive the minted token | ## Get the latest Chainlink content straight to your inbox. Email Address ## AggregatorV2V3Interface API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 You're not using the latest version. Update to v0.2.3 # [AggregatorV2V3Interface v0.2.1 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-v2-v3-interface\#overview) ## [AggregatorV2V3Interface](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-v2-v3-interface\#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. ## [Interface Inheritance](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/aggregator-v2-v3-interface\#interface-inheritance) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity interface AggregatorV2V3Interface is AggregatorInterface, AggregatorV3Interface {} ``` This interface provides access to all functions and events from both parent interfaces. ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840183098&cv=11&fst=1748840183098&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247~103308613&ptag_exp=101509157~102015666~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv0.2.1%2Faggregator-v2-v3-interface&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=AggregatorV2V3Interface%20v0.2.1%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=2025697009.1748840183&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## CCIP Local Simulator [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 You're not using the latest version. Update to v0.2.3 # [CCIPLocalSimulatorFork v0.2.1 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork\#overview) ## [CCIPLocalSimulatorFork](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork\#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. ## [Events](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork\#events) ### [CCIPSendRequested](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork\#ccipsendrequested) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity event CCIPSendRequested(Internal.EVM2EVMMessage message) ``` Emitted when a cross-chain message is requested to be sent through CCIP. ## [Variables](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork\#variables) ### [i\_register](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork\#i_register) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity Register immutable i_register ``` Stores and manages network configuration details required for CCIP operations. ### [LINK\_FAUCET](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork\#link_faucet) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity address constant LINK_FAUCET = 0x4281eCF07378Ee595C564a59048801330f3084eE ``` Provides test LINK tokens to addresses during testing. ### [s\_processedMessages](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork\#s_processedmessages) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity mapping(bytes32 messageId => bool isProcessed) internal s_processedMessages ``` Prevents duplicate processing by tracking which messages have already been handled. ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork\#functions) ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork\#constructor) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity constructor() public ``` Initializes the simulator environment by deploying and configuring a persistent Register contract. ### [getNetworkDetails](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork\#getnetworkdetails) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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. **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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork\#requestlinkfromfaucet) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` Transfers LINK tokens from the faucet to a specified address for testing purposes. **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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork\#setnetworkdetails) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function setNetworkDetails(uint256 chainId, Register.NetworkDetails memory networkDetails) external ``` Updates or adds CCIP configuration details for a specific blockchain network. **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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork\#switchchainandroutemessage) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function switchChainAndRouteMessage(uint256 forkId) external ``` Processes a cross-chain message by switching to the destination fork and executing the message. **Parameters:** | Parameter | Type | Description | | --- | --- | --- | | forkId | `uint256` | The ID of the destination network fork. This is the returned value of `createFork()` or `createSelectFork()` | ## Get the latest Chainlink content straight to your inbox. Email Address ## CCIP Local Simulator [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version:v0.2.3 # [CCIPLocalSimulatorFork v0.2.3 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#overview) ## [CCIPLocalSimulatorFork](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#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) ## [Interfaces](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#interfaces) ### [IRouterFork](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#irouterfork) Interface for interacting with the CCIP Router contract in a forked environment. #### [OffRamp](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#offramp) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```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](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#getofframps) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getOffRamps() external view returns (OffRamp[] memory) ``` #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#returns) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `OffRamp[]` | Array of off-ramp configurations | ### [IEVM2EVMOffRampFork](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#ievm2evmofframpfork) Interface for executing CCIP messages on an off-ramp contract in a forked environment. #### [executeSingleMessage](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#executesinglemessage) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function executeSingleMessage( Internal.EVM2EVMMessage memory message, bytes[] memory offchainTokenData, uint32[] memory tokenGasOverrides ) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#events) ### [CCIPSendRequested](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#ccipsendrequested) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity event CCIPSendRequested(Internal.EVM2EVMMessage message) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#parameters-1) | Parameter | Type | Description | | --- | --- | --- | | message | `EVM2EVMMessage` | The EVM2EVM message that was sent | ## [Variables](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#variables) ### [i\_register](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#i_register) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity Register immutable i_register ``` ### [LINK\_FAUCET](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#link_faucet) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity address constant LINK_FAUCET = 0x4281eCF07378Ee595C564a59048801330f3084eE ``` ### [s\_processedMessages](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#s_processedmessages) ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity mapping(bytes32 messageId => bool isProcessed) internal s_processedMessages ``` ## [Functions](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#functions) ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#constructor) Initializes the contract and sets up logging and persistence. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity constructor() ``` ### [switchChainAndRouteMessage](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#switchchainandroutemessage) Routes a cross-chain message on the destination network after switching to the specified fork. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function switchChainAndRouteMessage(uint256 forkId) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#parameters-2) | Parameter | Type | Description | | --- | --- | --- | | forkId | `uint256` | The ID of the destination network fork (returned by `createFork()` or `createSelectFork()`) | ### [getNetworkDetails](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#getnetworkdetails) Returns the network configuration details for a specified chain ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function getNetworkDetails(uint256 chainId) external view returns (Register.NetworkDetails memory) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#parameters-3) | Parameter | Type | Description | | --- | --- | --- | | chainId | `uint256` | The blockchain network chain ID (e.g., 11155111 for Ethereum Sepolia) | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#returns-1) | Parameter | Type | Description | | --- | --- | --- | | (unnamed) | `NetworkDetails` | The network configuration details for the specified chain | ### [setNetworkDetails](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#setnetworkdetails) Updates or adds new network configuration details for a specified chain ID. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function setNetworkDetails(uint256 chainId, Register.NetworkDetails memory networkDetails) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#parameters-4) | 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](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#requestlinkfromfaucet) Requests LINK tokens from the faucet for a specified address. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#parameters-5) | Parameter | Type | Description | | --- | --- | --- | | to | `address` | The address to receive the LINK tokens | | amount | `uint256` | The amount of LINK tokens to transfer | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/ccip-local-simulator-fork\#returns-2) | Parameter | Type | Description | | --- | --- | --- | | success | `bool` | Returns true if the token transfer was successful | ## Get the latest Chainlink content straight to your inbox. Email Address ## Chainlink Aggregator API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 # [AggregatorV2V3Interface v0.2.3 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-v2-v3-interface\#overview) ## [AggregatorV2V3Interface](https://docs.chain.link/chainlink-local/api-reference/v0.2.3/aggregator-v2-v3-interface\#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) ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840183080&cv=11&fst=1748840183080&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~102015666~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~103116026~103200004~103211513~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv0.2.3%2Faggregator-v2-v3-interface&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=AggregatorV2V3Interface%20v0.2.3%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=1627514687.1748840183&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## Chainlink Aggregator API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 You're not using the latest version. Update to v0.2.3 # [AggregatorV2V3Interface v0.2.2 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-v2-v3-interface\#overview) ## [AggregatorV2V3Interface](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-v2-v3-interface\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-v2-v3-interface\#inheritance) This interface inherits from: - [`AggregatorInterface`](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-interface) \- Provides basic price feed functionality - [`AggregatorV3Interface`](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/aggregator-v3-interface) \- Provides extended price feed functionality ## Get the latest Chainlink content straight to your inbox. Email Address ## BurnMintERC677Helper API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 You're not using the latest version. Update to v0.2.3 # [BurnMintERC677Helper v0.2.2 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/burn-mint-erc677-helper\#overview) ## [BurnMintERC677Helper](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/burn-mint-erc677-helper\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/burn-mint-erc677-helper\#functions) ### [constructor](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/burn-mint-erc677-helper\#constructor) Creates a new BurnMintERC677Helper token with the specified name and symbol. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity constructor( string memory name, string memory symbol ) BurnMintERC677(name, symbol, 18, 0) ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/burn-mint-erc677-helper\#parameters) | Parameter | Type | Description | | --- | --- | --- | | name | string | The name of the token | | symbol | string | The symbol of the token | ### [drip](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/burn-mint-erc677-helper\#drip) Mints a single token to the specified address for testing purposes. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```solidity function drip(address to) external ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/burn-mint-erc677-helper\#parameters-1) | Parameter | Type | Description | | --- | --- | --- | | to | address | The address to receive the minted token | ## Get the latest Chainlink content straight to your inbox. Email Address [iframe](https://td.doubleclick.net/td/rul/346357746?random=1748840186784&cv=11&fst=1748840186784&fmt=3&bg=ffffff&guid=ON&async=1&gcl_ctr=1>m=45be55s2v891173849z8847174275za200zb847174275&gcd=13l3l3l3l1l1&dma=0&tag_exp=101509157~102938614~103116026~103200004~103233427~103252644~103252646~103351866~103351868~104481633~104481635~104559073~104559075~104612245~104612247&ptag_exp=101509157~102015666~103116026~103200004~103233427~103252644~103252646~103351869~103351871~104481633~104481635~104559073~104559075~104612245~104612247&u_w=1280&u_h=1024&url=https%3A%2F%2Fdocs.chain.link%2Fchainlink-local%2Fapi-reference%2Fv0.2.2%2Fburn-mint-erc677-helper&_ng=1&label=_duuCKn_k4cYEPL_k6UB&hn=www.googleadservices.com&frm=0&tiba=BurnMintERC677Helper%20v0.2.2%20API%20Reference%20%7C%20Chainlink%20Documentation&value=0&bttype=purchase&npa=0&pscdl=noapi&auid=647050840.1748840187&uaa=x86&uab=64&uafvl=Google%2520Chrome%3B137.0.7151.55%7CChromium%3B137.0.7151.55%7CNot%252FA)Brand%3B24.0.0.0&uamb=0&uam=&uap=Linux%20x86_64&uapv=6.6.72&uaw=0&ec_mode=a&fledge=1&capi=1&_tu=Cg&em=tv.1&ct_cookie_present=0) ## Chainlink CCIP Local Simulator [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version:v0.2.1Not using latest version (v0.2.3) # [CCIPLocalSimulatorFork v0.2.1 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork-js\#overview) ## [CCIPLocalSimulatorFork](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork-js\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork-js\#types) ### [EVM2EVMMessage](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork-js\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork-js\#functions) ### [requestLinkFromTheFaucet](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork-js\#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 ### [getEvm2EvmMessage](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork-js\#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 ### [routeMessage](https://docs.chain.link/chainlink-local/api-reference/v0.2.1/ccip-local-simulator-fork-js\#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 ## Get the latest Chainlink content straight to your inbox. Email Address ## CCIP Local Simulator API [iframe](https://www.googletagmanager.com/ns.html?id=GTM-N6DQ47T) Chainlink CCIP is now officially live on Solana. [View lanes and tokens.](https://docs.chain.link/ccip/directory/mainnet/chain/solana-mainnet?utm_medium=referral&utm_source=chainlink-docs&utm_campaign=solana-ccip) On this page API Version: v0.2.3 (Latest)v0.2.2v0.2.1 You're not using the latest version. Update to v0.2.3 # [CCIPLocalSimulatorFork v0.2.2 API Reference](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork-js\#overview) ## [CCIPLocalSimulatorFork](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork-js\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork-js\#types) ### [Evm2EvmMessage](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork-js\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork-js\#functions) ### [getEvm2EvmMessage](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork-js\#getevm2evmmessage) Extracts and parses a CCIP message from a transaction receipt by looking for the CCIPSendRequested event. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```javascript function getEvm2EvmMessage(receipt) => Evm2EvmMessage | null ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork-js\#parameters) | Parameter | Type | Description | | --- | --- | --- | | receipt | `object` | The transaction receipt from the `ccipSend` call | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork-js\#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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork-js\#requestlinkfromthefaucet) Requests LINK tokens from a faucet contract for testing purposes. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```javascript async function requestLinkFromTheFaucet(linkAddress, to, amount) => Promise ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork-js\#parameters-1) | 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](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork-js\#returns-1) | Type | Description | | --- | --- | | `Promise` | Promise resolving to the transaction hash of the fund transfer | ### [routeMessage](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork-js\#routemessage) Routes a cross-chain message on the destination network by finding the appropriate off-ramp and executing the message. ![copy to clipboard](https://docs.chain.link/assets/icons/copyIcon.svg) ```javascript async function routeMessage(routerAddress, evm2EvmMessage) => Promise ``` #### [Parameters](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork-js\#parameters-2) | Parameter | Type | Description | | --- | --- | --- | | routerAddress | `string` | Address of the destination Router | | evm2EvmMessage | `Evm2EvmMessage` | Sent cross-chain message | #### [Returns](https://docs.chain.link/chainlink-local/api-reference/v0.2.2/ccip-local-simulator-fork-js\#returns-2) | Type | Description | | --- | --- | | `Promise` | Resolves with no value if the message is successfully routed |