CCIPLocalSimulator.sol - usage with Foundry, Hardhat & Remix IDE
To use Chainlink Local in a localhost environment in any smart contract development framework, user must import the CCIPLocalSimulator.sol
singleton contract from the @chainlink/local
package. Then deploy it on your local development network, and after that the simulator is ready for usage.
Foundry:
Hardhat:
Create CCIPLocalSimulator.sol
file inside the contracts
folder and paste the following code:
And then use it inside your JavaScript/TypeScript tests and scripts:
Remix IDE:
Create CCIPLocalSimulator.sol
and paste the following code:
Compile it and deploy it to RemixVM. If deployment fails, go back to the "Solidity compiler" tab, toggle the "Advanced Configurations" and under "Compiler configuration" check the "Enable optimization" check box. Then compile it and try deploying it again.
After that deploy your smart contracts using addresses provided by the configuration()
function (Router, LinkToken, etc.) and start interacting and testing your smart contracts.
If you encounter the NotEnoughGasForCall
custom error provided by the Router smart contract, scroll up to the "Gas Limit" section, select the "Custom" radio button and try again.
Last updated