Releases: smartcontractkit/chainlink-local
v0.2.4-beta
v0.2.4-beta Release - 10 December 2024
This release adds full support for Chainlink Data Streams including a helper GenerateMockReports
off-chain component to mock the generation of unverified reports by Data Streams DON, used in local no-fork mode only. For forked mode you will need reports actually came from Data Streams DON, using data-streams-sdk for example.
Changelog
Dependencies
Package | Version |
---|---|
@chainlink/contracts-ccip | 1.5.1-beta.0 |
@chainlink/contracts | 1.1.1 |
- Chainlink CCIP
- Chainlink CCIP v1.5
- Chainlink Data Feeds
- Chainlink Data Streams
- Chainlink Automation
- Chainlink VRF 2
- Chainlink VRF 2.5
Added
- Added full support for Data Streams by adding
DataStreamsLocalSimulator.sol
(Foundry/Hardhat/Remix IDE local mode),DataStreamsLocalSimulatorFork.sol
(Foundry forked mode),DataStreamsLocalSimulatorFork.js
(Hardhat forked
mode) andMockReportGenerator.sol
&MockReportGenerator.js
to mock
generating unverified reports by Data Streams DON for local modes in Foundry
and Hardhat respectively.
Basic usage
Here's how you can test and simulate locally the basic Data Streams example from the Chainlink Official Documentation.
Foundry
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import {Test, console2} from "forge-std/Test.sol";
import {
DataStreamsLocalSimulator,
MockVerifierProxy
} from "@chainlink/local/src/data-streams/DataStreamsLocalSimulator.sol";
import {MockReportGenerator} from "@chainlink/local/src/data-streams/MockReportGenerator.sol";
import {ClientReportsVerifier} from "../../../src/test/data-streams/ClientReportsVerifier.sol";
contract ClientReportsVerifierTest is Test {
DataStreamsLocalSimulator public dataStreamsLocalSimulator;
MockReportGenerator public mockReportGenerator;
ClientReportsVerifier public consumer;
int192 initialPrice;
function setUp() public {
dataStreamsLocalSimulator = new DataStreamsLocalSimulator();
(,,, MockVerifierProxy mockVerifierProxy_,,) = dataStreamsLocalSimulator.configuration();
initialPrice = 1 ether;
mockReportGenerator = new MockReportGenerator(initialPrice);
consumer = new ClientReportsVerifier(address(mockVerifierProxy_));
}
function test_smoke() public {
mockReportGenerator.updateFees(1 ether, 0.5 ether);
bytes memory signedReportV3 = mockReportGenerator.generateReportV3();
dataStreamsLocalSimulator.requestLinkFromFaucet(address(consumer), 1 ether);
consumer.verifyReport(signedReportV3);
int192 lastDecodedPrice = consumer.lastDecodedPrice();
assertEq(lastDecodedPrice, initialPrice);
}
}
Hardhat
import { loadFixture } from "@nomicfoundation/hardhat-toolbox/network-helpers";
import { ethers } from "hardhat";
import { assert } from "chai";
import { MockReportGenerator } from "@chainlink/local/scripts/data-streams/MockReportGenerator";
describe("ClientReportsVerifier", function () {
async function deploy() {
const localSimulatorFactory = await ethers.getContractFactory("DataStreamsLocalSimulator");
const localSimulator = await localSimulatorFactory.deploy();
const config: {
wrappedNative_: string;
linkToken_: string;
mockVerifier_: string;
mockVerifierProxy_: string;
mockFeeManager_: string;
mockRewardManager_: string;
} = await localSimulator.configuration();
const initialPrice = ethers.parseEther("1");
const mockReportGenerator = new MockReportGenerator(initialPrice);
const consumerFactory = await ethers.getContractFactory("ClientReportsVerifier");
const consumer = await consumerFactory.deploy(config.mockVerifierProxy_);
await mockReportGenerator.updateFees(ethers.parseEther("1"), ethers.parseEther("0.5"));
await localSimulator.requestLinkFromFaucet(consumer.target, ethers.parseEther("1"));
// const mockFeeManager = await ethers.getContractAt("MockFeeManager", config.mockFeeManager_);
// await mockFeeManager.setMockDiscount(consumer.target, ethers.parseEther("1")); // 1e18 => 100% discount on fees
return { consumer, initialPrice, mockReportGenerator };
}
it("should verify Data Streams report", async function () {
const { consumer, initialPrice, mockReportGenerator } = await loadFixture(deploy);
const unverifiedReport = await mockReportGenerator.generateReportV3();
await consumer.verifyReport(unverifiedReport);
const lastDecodedPrice = await consumer.lastDecodedPrice();
assert(lastDecodedPrice === initialPrice);
});
});
Testing the release
To test this release install @chainlink-local
using the following commands:
Foundry (git)
forge install smartcontractkit/chainlink-local@v0.2.4-beta
and then set remappings to: @chainlink/local/=lib/chainlink-local/
in either remappings.txt
or foundry.toml
file
Hardhat (npm)
npm install @chainlink/local@v0.2.4-beta
and then create the following contract and compile it:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import {DataStreamsLocalSimulator} from "@chainlink/local/src/data-streams/DataStreamsLocalSimulator.sol";
Remix IDE
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import {DataStreamsLocalSimulator} from "https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4-beta/src/data-streams/DataStreamsLocalSimulator.sol";
PRs included
- Support for Chainlink Data Streams by @andrejrakic in #25
Full Changelog: v0.2.3...v0.2.4-beta
v0.2.3
v0.2.3 Release - 30 November 2024
This release adds support for EVMExtraArgsV2
and OZ's AccessControl
to CCIPLocalSimulator.sol
(no-fork local mode)
Changelog
Dependencies
Package | Version |
---|---|
@chainlink/contracts-ccip | 1.5.1-beta.0 |
@chainlink/contracts | 1.1.1 |
- Chainlink CCIP
- Chainlink CCIP v1.5
- Chainlink Data Feeds
- Chainlink Automation
- Chainlink VRF 2
- Chainlink VRF 2.5
Added
- Added
supportNewTokenViaAccessControlDefaultAdmin
function toCCIPLocalSimulator.sol
- Bumped
@chainlink/contracts-ccip
to1.5.1-beta.0
to reflect new changes in the CCIPTokenPool.sol
smart contract (check CCIPv1_5BurnMintPoolFork.t.sol and CCIPv1_5LockReleasePoolFork.t.sol tests) and to supportEVMExtraArgsV2
inMockCCIPRouter.sol
Basic usage
pragma solidity ^0.8.19;
import {Test} from "forge-std/Test.sol";
import {MockERC20BurnAndMintToken} from "../src/MockERC20BurnAndMintToken.sol";
import {CCIPLocalSimulator} from "@chainlink/local/src/ccip/CCIPLocalSimulator.sol";
contract MockERC20BurnAndMintTokenTest is Test {
CCIPLocalSimulator public ccipLocalSimulator;
MockERC20BurnAndMintToken public token;
function setUp() public {
token = new MockERC20BurnAndMintToken();
ccipLocalSimulator = new CCIPLocalSimulator();
}
function test_smoke() public {
ccipLocalSimulator.supportNewTokenViaAccessControlDefaultAdmin(address(token));
}
}
Testing the release
To test this release install @chainlink-local
using the following commands:
Foundry (git)
forge install smartcontractkit/chainlink-local@v0.2.3
and then set remappings to: @chainlink/local/=lib/chainlink-local/
in either remappings.txt
or foundry.toml
file
Hardhat (npm)
npm install @chainlink/local@v0.2.3
and then create the following contract and compile it:
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
import {CCIPLocalSimulator} from "@chainlink/local/src/ccip/CCIPLocalSimulator.sol";
Remix IDE
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
import {CCIPLocalSimulator} from "https://github.com/smartcontractkit/chainlink-local/blob/v0.2.3/src/ccip/CCIPLocalSimulator.sol";
PRs included
- Support EVMExtraArgsV2 and OZ's AccessControl in CCIPLocalSimulator by @andrejrakic in #26
Full Changelog: v0.2.2...v0.2.3
v0.2.2
v0.2.2 Release - 15 October 2024
This release adds support for CCIP v1.5 to Chainlink Local
Changelog
Dependencies
Package | Version |
---|---|
@chainlink/contracts-ccip | 1.5.0 |
@chainlink/contracts | 1.1.1 |
Services
- Chainlink CCIP
- Chainlink CCIP v1.5
- Chainlink Data Feeds
- Chainlink Automation
- Chainlink VRF 2
- Chainlink VRF 2.5
Added
- Support for Chainlink CCIP v1.5 (bumped
@chainlink/contracts-ccip
to
1.5.0
) - Added CCIP v1.5 config details to
Register.sol
for all available testnet
lanes - Set EVM Version strictly to
paris
for all contracts - Added
supportNewTokenViaOwner
andsupportNewTokenViaGetCCIPAdmin
functions
toCCIPLocalSimulator.sol
instead ofsupportNewToken
function - Added
rmnProxyAddress
,tokenAdminRegistryAddress
and
registryModuleOwnerCustomAddress
to theNetworkDetails
struct of the
Register.sol
smart contract - Added unit tests for new functions in the
CCIPLocalSimulator.sol
contract - Added e2e test for new changes in the
CCIPLocalSimulatorFork.sol
contract.
There is a test with ERC-20 token with anowner()
function implemented and
Burn & Mint Pool, and test with ERC-20 token with agetCCIPAdmin()
function
implemented and Lock & Release Pool - Genereted new docs artifacts
Changed
- Bumped Solidity compiler version from 0.8.19 to 0.8.24
- The
getSupportedTokens()
function now only exists in the
CCIPLocalSimulator.sol
contract, it has been removed from the CCIP's
Router.sol
contract. Calling that function from theRouter.sol
contract in
the Forking mode will now revert - Added
uint32[] memory tokenGasOverrides
as function parameter to the
executeSingleMessage
function in theCCIPLocalSimulatorFork.sol
contract
to reflect new changes in the CCIP'sEVM2EVMOffRamp.sol
smart contract - Bumped pragma solidity version of
BasicTokenSender.sol
,
CCIPReceiver_Unsafe.sol
,ProgrammableTokenTransfers
and
ProgrammableDefensiveTokenTransfers.sol
contracts from thesrc/test
folder
from0.8.19
to0.8.24
Removed
- Removed
supportNewToken
function fromCCIPLocalSimulator.sol
- Removed
CCIPLocalSimulatorV0.sol
andMockEvm2EvmOffRamp.sol
contracts as
they have not being used for a while - Removed
DOCUMENTATION.md
file since the official documentation is now
available at https://docs.chain.link/chainlink-local - Removed
remix-001.png
andremix-002.png
images from theassets
folder,
because they are no longer needed
Testing the release
To test this release install @chainlink-local
using the following commands:
Foundry (git)
forge install smartcontractkit/chainlink-local@v0.2.2
and then set remappings to: @chainlink/local/=lib/chainlink-local/
in either remappings.txt
or foundry.toml
file
Hardhat (npm)
npm install @chainlink/local@v0.2.2
and then create the following contract and compile it:
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
import {CCIPLocalSimulator} from "@chainlink/local/src/ccip/CCIPLocalSimulator.sol";
Remix IDE
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
import {CCIPLocalSimulator} from "https://github.com/smartcontractkit/chainlink-local/blob/v0.2.2/src/ccip/CCIPLocalSimulator.sol";
PRs included
- Automated API Reference Generation and Index File Creation by @aelmanaa in #14
- The v0.2.2 release by @andrejrakic in #24
New Contributors
Full Changelog: v0.2.1...v0.2.2
v0.2.2-beta.1
v0.2.2-beta.1 Release
This release bumps the version of @chainlink/contracts-ccip
package to 1.5.0-beta.1
for testing purposes and fixes a bug in the CCIPLocalSimulatorFork
contract.
Changed
- Bumped the version of
@chainlink/contracts-ccip
NPM package to1.5.0-beta.1
to test that release - Fixed the bug in the
CCIPLocalSimulatorFork.sol
where theswitchChainAndRouteMessage
function was used the outdatedEVM2EVMOffRamp
contract - Genereted new docs artifacts
Testing the release
To test this release install @chainlink-local
using the following commands:
Foundry (git)
forge install smartcontractkit/chainlink-local@v0.2.2-beta.1
and then set remappings to: @chainlink/local/=lib/chainlink-local/
in either remappings.txt
or foundry.toml
file
Hardhat (npm)
npm install @chainlink/local@v0.2.2-beta.1
and then create the following contract and compile it:
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
import {CCIPLocalSimulator} from "@chainlink/local/src/ccip/CCIPLocalSimulator.sol";
Remix IDE
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
import {CCIPLocalSimulator} from "https://github.com/smartcontractkit/chainlink-local/blob/v0.2.2-beta.1/src/ccip/CCIPLocalSimulator.sol";
PRs included
- Prepare for the 0.2.2-beta.1 release by @andrejrakic in #23
Full Changelog: v0.2.2-beta.0...v0.2.2-beta.1
v0.2.2-beta.0
v0.2.2-beta.0 Release
This release adds config details to the Register.sol for all CCIP v1.5 testnet lanes.
Added
- Added CCIP v1.5 config details to
Register.sol
for all available testnet lanes
Testing the release
To test this release install @chainlink-local
using the following commands:
Foundry (git)
forge install smartcontractkit/chainlink-local@v0.2.2-beta.0
and then set remappings to: @chainlink/local/=lib/chainlink-local/
in either remappings.txt
or foundry.toml
file
Hardhat (npm)
npm install @chainlink/local@v0.2.2-beta.0
and then create the following contract and compile it:
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
import {CCIPLocalSimulator} from "@chainlink/local/src/ccip/CCIPLocalSimulator.sol";
Remix IDE
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
import {CCIPLocalSimulator} from "https://github.com/smartcontractkit/chainlink-local/blob/v0.2.2-beta.0/src/ccip/CCIPLocalSimulator.sol";
PRs included
- CCIP v1.5 testnet lanes by @andrejrakic in #21
Full Changelog: v0.2.2-beta...v0.2.2-beta.0
v0.2.2-beta
v0.2.2-beta Release
This release adds a tentative support for CCIP v1.5.
Added
- Support for Chainlink CCIP v1.5 (bumped
@chainlink/contracts-ccip
to
1.5.0-beta.0
) - Set EVM Version strictly to
paris
for all contracts - Added
supportNewTokenViaOwner
andsupportNewTokenViaGetCCIPAdmin
functions
toCCIPLocalSimulator.sol
instead ofsupportNewToken
function - Added
rmnProxyAddress
,tokenAdminRegistryAddress
and
registryModuleOwnerCustomAddress
to theNetworkDetails
struct of the
Register.sol
smart contract - Added unit tests for new functions in the
CCIPLocalSimulator.sol
contract - Added e2e test for new changes in the
CCIPLocalSimulatorFork.sol
contract.
There is a test with ERC-20 token with anowner()
function implemented and
Burn & Mint Pool, and test with ERC-20 token with agetCCIPAdmin()
function
implemented and Lock & Release Pool
Changed
- Bumped Solidity compiler version from 0.8.19 to 0.8.24
- The
getSupportedTokens()
function now only exists in the
CCIPLocalSimulator.sol
contract, it has been removed from the CCIP's
Router.sol
contract. Calling that function from theRouter.sol
contract in
the Forking mode will now revert - Added
uint32[] memory tokenGasOverrides
as function parameter to the
executeSingleMessage
function in theCCIPLocalSimulatorFork.sol
contract
to reflect new changes in the CCIP'sEVM2EVMOffRamp.sol
smart contract - Bumped pragma solidity version of
BasicTokenSender.sol
,
CCIPReceiver_Unsafe.sol
,ProgrammableTokenTransfers
and
ProgrammableDefensiveTokenTransfers.sol
contracts from thesrc/test
folder
from0.8.19
to0.8.24
Removed
- Removed
supportNewToken
function fromCCIPLocalSimulator.sol
- Removed
CCIPLocalSimulatorV0.sol
andMockEvm2EvmOffRamp.sol
contracts as
they have not being used for a while
Testing the release
To test this release install @chainlink-local using the following commands:
Foundry (git)
forge install smartcontractkit/chainlink-local@v0.2.2-beta
and then set remappings to: @chainlink/local/=lib/chainlink-local/
in either remappings.txt
or foundry.toml
file
Hardhat (npm)
npm install @chainlink/local@v0.2.2-beta
and then create the following contract and compile it:
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
import {CCIPLocalSimulator} from "@chainlink/local/src/ccip/CCIPLocalSimulator.sol";
Remix IDE
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
import {CCIPLocalSimulator} from "https://github.com/smartcontractkit/chainlink-local/blob/v0.2.2-beta/src/ccip/CCIPLocalSimulator.sol";
PRs included
- Automated API Reference Generation and Index File Creation by @aelmanaa in #14
- Support for CCIP v1.5 and preparing for 0.2.2-beta release by @andrejrakic in #19
New Contributors
Full Changelog: v0.2.1...v0.2.2-beta
v0.2.1
v0.2.1 Release - 5 July 2024
This release adds support for Chainlink Data Feeds to Chainlink Local.
Documentation for this release is available at:
- https://cll-devrel.gitbook.io/chainlink-local-documentation/api-reference/mockv3aggregator.sol-api
- https://cll-devrel.gitbook.io/chainlink-local-documentation/api-reference/mockoffchainaggregator.sol-api
Testing the release
To test this release install @chainlink-local
using the following commands:
Foundry (git)
forge install smartcontractkit/chainlink-local@v0.2.1
and then set remappings to: @chainlink/local/=lib/chainlink-local/
in either remappings.txt
or foundry.toml
file
Hardhat (npm)
npm install @chainlink/local@v0.2.1
and then create the following contract and compile it:
pragma solidity ^0.8.0;
import {MockV3Aggregator} from "@chainlink/local/src/data-feeds/MockV3Aggregator.sol";
Remix IDE
pragma solidity ^0.8.0;
import {MockV3Aggregator} from "https://github.com/smartcontractkit/chainlink-local/blob/v0.2.1/src/data-feeds/MockV3Aggregator.sol";
Changelog
Dependencies
Package | Version |
---|---|
@chainlink/contracts-ccip | 1.4.0 |
@chainlink/contracts | 1.1.1 |
Services
- Chainlink CCIP
- Chainlink Data Feeds
- Chainlink VRF 2
- Chainlink VRF 2.5
Added
- Support for Chainlink Data Feeds by adding
MockV3Aggregator.sol
andMockOffchainAggregator.sol
mock contracts - Showcase tests for testing in a forking actual networks environment
v0.2.1-beta
v0.2.1-beta Release
This release fixes bugs from the v0.2.0-beta release that added support for Chainlink Data Feeds to Chainlink Local.
Documentation for this release is available at:
- https://cll-devrel.gitbook.io/chainlink-local-documentation/api-reference/mockv3aggregator.sol-api
- https://cll-devrel.gitbook.io/chainlink-local-documentation/api-reference/mockoffchainaggregator.sol-api
Testing the release
To test this release install @chainlink-local using the following commands:
Foundry (git)
forge install smartcontractkit/chainlink-local@v0.2.1-beta
and then set remappings to: @chainlink/local/=lib/chainlink-local/
in either remappings.txt
or foundry.toml
file
Hardhat (npm)
npm install @chainlink/local@v0.2.1-beta
and then create the following contract and compile it:
pragma solidity ^0.8.0;
import {MockV3Aggregator} from "@chainlink/local/src/data-feeds/MockV3Aggregator.sol";
Remix IDE
pragma solidity ^0.8.0;
import {MockV3Aggregator} from "https://github.com/smartcontractkit/chainlink-local/blob/v0.2.1-beta/src/data-feeds/MockV3Aggregator.sol";
Full Changelog: v0.2.0-beta...v0.2.1-beta
v0.2.0-beta
v0.2.0-beta Release
This release adds support for Chainlink Data Feeds to Chainlink Local.
Testing the release
To test this release install @chainlink-local
using the following commands:
Foundry (git)
forge install smartcontractkit/chainlink-local@v0.2.0-beta
and then set remappings to: @chainlink/local/=lib/chainlink-local/
in either remappings.txt
or foundry.toml
file
Hardhat (npm)
npm install @chainlink/local@v0.2.0-beta
and then create the following contract and compile it:
pragma solidity ^0.8.0;
import {MockV3Aggregator} from "@chainlink/local/src/data-feeds/MockV3Aggregator.sol";
Remix IDE
pragma solidity ^0.8.0;
import {MockV3Aggregator} from "https://github.com/smartcontractkit/chainlink-local/blob/v0.2.0-beta/src/data-feeds/MockV3Aggregator.sol";
Initial release of the project
Developers Can Get Started in Seconds Using the CCIP Local Simulator
We’re excited to announce that the Chainlink Cross-Chain Interoperability Protocol (CCIP) has officially entered general availability (GA)!
We believe that enabling developers to build quicker helps the entire ecosystem grow faster. That’s why we’ve also developed a simulator that allows you to build with CCIP on your local machine directly in Remix IDE, Hardhat or Anvil (Foundry).
Previously, developers had to build with CCIP directly on a testnet, which often meant having to wait 10+ minutes just to test a single cross-chain message or token transfer. In this initial simulator version, you can now build, deploy, and execute CCIP token transfers and arbitrary messages on a local Remix, Hardhat or Anvil (Foundry) network, both with and without forking. This greatly speeds up development, as CCIP messaging and token transfer transaction times have now been reduced to seconds.
Read more at the blog post here and watch the 5-minute live presentation of Chainlink Local here.