diff --git a/package-lock.json b/package-lock.json index 43adf3e90ae..739d99c1de8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,7 @@ "@chainlink/contracts-1.4.0": "npm:@chainlink/contracts@1.4.0", "@chainlink/contracts-ccip": "2.0.0", "@chainlink/design-system": "^0.2.8", - "@chainlink/local": "0.2.7-beta", + "@chainlink/local": "^0.3.1", "@chainlink/solana-sdk": "^0.2.2", "@metamask/providers": "^22.1.1", "@nanostores/persistent": "^1.3.5", @@ -6080,47 +6080,35 @@ } }, "node_modules/@chainlink/local": { - "version": "0.2.7-beta", - "resolved": "https://registry.npmjs.org/@chainlink/local/-/local-0.2.7-beta.tgz", - "integrity": "sha512-rZXUer6bSaWRw9KZO1FNuZE/vLQRGDIwAiA5clkTkmtuiflHOW3ghj+Z0E5U7/23GKLNrkJItCkR6LNXyX+Byw==", + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@chainlink/local/-/local-0.3.1.tgz", + "integrity": "sha512-oo14xscchoV0orxbjjcUhGlMdQjLIizex5IdMR1PH6GBvw+KaoITSFmxzvyArN5VLO3MAXD5Qk7wOTK8WITs3g==", "license": "MIT", "dependencies": { "@chainlink/contracts": "1.5.0", - "@chainlink/contracts-ccip": "1.6.2" - }, - "peerDependencies": { - "@chainlink/contracts": ">=1.5.0 <2.0.0", - "@chainlink/contracts-ccip": ">=1.6.0 <2.0.0" - } - }, - "node_modules/@chainlink/local/node_modules/@chainlink/contracts-ccip": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/@chainlink/contracts-ccip/-/contracts-ccip-1.6.2.tgz", - "integrity": "sha512-dHAOxhpTo9Dp1S5wFeSEN3hV9t2gy7iCXNdnZxmskD+gRVb7qGpTqoXPXXu8qEf2zVmRsrs/nSbrTU/UpqfHQg==", - "license": "BUSL-1.1", - "dependencies": { - "@chainlink/contracts": "1.5.0", - "@changesets/cli": "^2.29.5", - "@changesets/get-github-info": "^0.6.0", + "@chainlink/contracts-ccip": "2.0.0", "@openzeppelin/contracts-4.8.3": "npm:@openzeppelin/contracts@4.8.3", - "@openzeppelin/contracts-5.0.2": "npm:@openzeppelin/contracts@5.0.2", - "semver": "^7.7.2" + "@openzeppelin/contracts-5.3.0": "npm:@openzeppelin/contracts@5.3.0", + "forge-std": "github:foundry-rs/forge-std#v1.9.4" }, "engines": { - "node": ">=20", - "pnpm": ">=10" - } - }, - "node_modules/@chainlink/local/node_modules/semver": { - "version": "7.7.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", - "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", - "license": "ISC", - "bin": { - "semver": "bin/semver.js" + "node": ">=22" }, - "engines": { - "node": ">=10" + "peerDependencies": { + "@nomicfoundation/hardhat-ethers": "^4.0.5", + "ethers": "^6.17.0", + "hardhat": "^3.1.10" + }, + "peerDependenciesMeta": { + "@nomicfoundation/hardhat-ethers": { + "optional": true + }, + "ethers": { + "optional": true + }, + "hardhat": { + "optional": true + } } }, "node_modules/@chainlink/solana-sdk": { @@ -27409,6 +27397,11 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/forge-std": { + "version": "1.9.4", + "resolved": "git+ssh://git@github.com/foundry-rs/forge-std.git#1eea5bae12ae557d589f9f0f0edae2faa47cb262", + "license": "(Apache-2.0 OR MIT)" + }, "node_modules/form-data": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.6.tgz", diff --git a/package.json b/package.json index 9861a08433f..b6f031cc19c 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "@chainlink/contracts-1.4.0": "npm:@chainlink/contracts@1.4.0", "@chainlink/contracts-ccip": "2.0.0", "@chainlink/design-system": "^0.2.8", - "@chainlink/local": "0.2.7-beta", + "@chainlink/local": "^0.3.1", "@chainlink/solana-sdk": "^0.2.2", "@metamask/providers": "^22.1.1", "@nanostores/persistent": "^1.3.5", diff --git a/public/samples/CCIP/TestCCIPLocalSimulator.sol b/public/samples/CCIP/TestCCIPLocalSimulator.sol index 1ec5ae393c8..1c02d6086ed 100644 --- a/public/samples/CCIP/TestCCIPLocalSimulator.sol +++ b/public/samples/CCIP/TestCCIPLocalSimulator.sol @@ -2,4 +2,4 @@ pragma solidity 0.8.24; // solhint-disable no-unused-import -// import {CCIPLocalSimulator} from "@chainlink/local/src/ccip/CCIPLocalSimulator.sol"; +import {CCIPLocalSimulator} from "@chainlink/local/src/ccip/CCIPLocalSimulator.sol"; diff --git a/public/samples/CCIP/remappings.txt b/public/samples/CCIP/remappings.txt index 2ad778f4ce1..39193931696 100644 --- a/public/samples/CCIP/remappings.txt +++ b/public/samples/CCIP/remappings.txt @@ -3,3 +3,8 @@ @chainlink/contracts-ccip/contracts/=../../../node_modules/@chainlink/contracts-ccip/contracts/ @openzeppelin/contracts/=../../../node_modules/@openzeppelin/contracts/ @openzeppelin/contracts@5.3.0/=../../../node_modules/@openzeppelin/contracts-5.3.0/ +@chainlink/contracts-ccip/=../../../node_modules/@chainlink/contracts-ccip/ +@chainlink/contracts/=../../../node_modules/@chainlink/contracts/ +@chainlink/local/=../../../node_modules/@chainlink/local/ +@openzeppelin/contracts@4.8.3/=../../../node_modules/@openzeppelin/contracts-4.8.3/ +forge-std/=../../../node_modules/forge-std/src/ diff --git a/src/config/sidebar.ts b/src/config/sidebar.ts index 36c3887b7d6..8f72285c5d8 100644 --- a/src/config/sidebar.ts +++ b/src/config/sidebar.ts @@ -14,6 +14,14 @@ import type { ChainType, CcipVersion } from "./types.js" import chainlinkLocalV021Contents from "./sidebar/chainlink-local/api-reference/v0_2_1.json" with { type: "json" } import chainlinkLocalV022Contents from "./sidebar/chainlink-local/api-reference/v0_2_2.json" with { type: "json" } import chainlinkLocalV023Contents from "./sidebar/chainlink-local/api-reference/v0_2_3.json" with { type: "json" } +import chainlinkLocalV024Contents from "./sidebar/chainlink-local/api-reference/v0_2_4.json" with { type: "json" } +import chainlinkLocalV025Contents from "./sidebar/chainlink-local/api-reference/v0_2_5.json" with { type: "json" } +import chainlinkLocalV026Contents from "./sidebar/chainlink-local/api-reference/v0_2_6.json" with { type: "json" } +import chainlinkLocalV027Contents from "./sidebar/chainlink-local/api-reference/v0_2_7.json" with { type: "json" } +import chainlinkLocalV028Contents from "./sidebar/chainlink-local/api-reference/v0_2_8.json" with { type: "json" } +import chainlinkLocalV029Contents from "./sidebar/chainlink-local/api-reference/v0_2_9.json" with { type: "json" } +import chainlinkLocalV030Contents from "./sidebar/chainlink-local/api-reference/v0_3_0.json" with { type: "json" } +import chainlinkLocalV031Contents from "./sidebar/chainlink-local/api-reference/v0_3_1.json" with { type: "json" } /** * Represents a single item in the sidebar navigation. @@ -2514,6 +2522,14 @@ export const SIDEBAR_WITH_SUNSET_PRODUCTS: Partial> "mock-evm2evm-offramp": { onlyAvailableIn: ["v0.2.1"], }, + "ccip-local-router": { + notAvailableIn: ["v0.2.1", "v0.2.2", "v0.2.3", "v0.2.4", "v0.2.5", "v0.2.6", "v0.2.7", "v0.2.8", "v0.2.9"], + }, + "data-streams-local-simulator": { + notAvailableIn: ["v0.2.1", "v0.2.2", "v0.2.3"], + }, + "data-streams-local-simulator-fork": { + notAvailableIn: ["v0.2.1", "v0.2.2", "v0.2.3"], + }, + "data-streams-register": { + notAvailableIn: ["v0.2.1", "v0.2.2", "v0.2.3"], + }, + "mock-fee-manager": { + notAvailableIn: ["v0.2.1", "v0.2.2", "v0.2.3"], + }, + "mock-report-generator": { + notAvailableIn: ["v0.2.1", "v0.2.2", "v0.2.3"], + }, + "mock-reward-manager": { + notAvailableIn: ["v0.2.1", "v0.2.2", "v0.2.3"], + }, + "mock-verifier": { + notAvailableIn: ["v0.2.1", "v0.2.2", "v0.2.3"], + }, + "mock-verifier-proxy": { + notAvailableIn: ["v0.2.1", "v0.2.2", "v0.2.3"], + }, + "report-versions": { + notAvailableIn: ["v0.2.1", "v0.2.2", "v0.2.3"], + }, }, } diff --git a/src/content/chainlink-local/api-reference/index.mdx b/src/content/chainlink-local/api-reference/index.mdx index fcae7b660a1..e0a587b6aa6 100644 --- a/src/content/chainlink-local/api-reference/index.mdx +++ b/src/content/chainlink-local/api-reference/index.mdx @@ -13,11 +13,18 @@ import { Aside } from "@components" ### Latest Release -- **[Chainlink Local v0.2.3](/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 +- **[Chainlink Local v0.3.1](/chainlink-local/api-reference/v0.3.1)** (Current Version) + - Targets CCIP 2.0: pins `@chainlink/contracts-ccip` 2.0.0 and `@chainlink/contracts` 1.5.0 + - New `CCIPLocalRouter` applies the CCIP 2.0 OnRamp and OffRamp message rules in local mode + - `CCIPLocalSimulatorFork` and the Hardhat 3 JavaScript helper route CCIP 2.0 (CCV-based) lanes alongside the pre-1.6 and 1.6 eras + - New fork-simulator surface: `getMessageStatus`, `setStrictRouting`, CCIP 2.0 router lookups (`getCCIPV2RouterAddress` / `setCCIPV2RouterAddress`), lane CCV configuration + - Data Streams contracts: `DataStreamsLocalSimulator`, `DataStreamsLocalSimulatorFork`, mock verifier/proxy/fee manager/reward manager, `MockReportGenerator`, `ReportVersions` + + ### Previous Versions @@ -37,6 +44,7 @@ import { Aside } from "@components" Each version includes detailed documentation for: - CCIP Components (Router, Simulator) +- Data Streams Components (Simulator, Verifier, Report Generator) - Data Feed Contracts - Token Implementations - JavaScript Utilities diff --git a/src/content/chainlink-local/api-reference/v0.2.4/aggregator-interface.mdx b/src/content/chainlink-local/api-reference/v0.2.4/aggregator-interface.mdx new file mode 100644 index 00000000000..d463c0d59ca --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.4/aggregator-interface.mdx @@ -0,0 +1,136 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "AggregatorInterface v0.2.4 API Reference" +metadata: + description: "API documentation for AggregatorInterface in Solidity, version v0.2.4." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## AggregatorInterface + +Basic price feed interface. + +[AggregatorInterface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-feeds/interfaces/AggregatorInterface.sol) + +## Events + +### AnswerUpdated + +```solidity +event AnswerUpdated(int256 current, uint256 roundId, uint256 updatedAt) +``` + +Emitted when the answer is updated. + +#### Parameters + +| Name | Type | Description | +| --------- | ------- | ------------------------------------------------ | +| current | int256 | - The updated answer. | +| roundId | uint256 | - The round ID for which the answer was updated. | +| updatedAt | uint256 | - The timestamp when the answer was updated. | + +### NewRound + +```solidity +event NewRound(uint256 roundId, address startedBy, uint256 startedAt) +``` + +Emitted when a new round is started. + +#### Parameters + +| Name | Type | Description | +| --------- | ------- | ---------------------------------------------------- | +| roundId | uint256 | - The round ID of the new round. | +| startedBy | address | - The address of the account that started the round. | +| startedAt | uint256 | - The timestamp when the round was started. | + +## Functions + +### getAnswer + +```solidity +function getAnswer(uint256 roundId) external view returns (int256) +``` + +Gets the answer for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------- | +| roundId | uint256 | - The round ID to get the answer for. | + +#### Returns + +| Name | Type | Description | +| ---- | ------ | ------------------------------------------- | +| [0] | int256 | int256 - The answer for the given round ID. | + +### getTimestamp + +```solidity +function getTimestamp(uint256 roundId) external view returns (uint256) +``` + +Gets the timestamp for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ---------------------------------------- | +| roundId | uint256 | - The round ID to get the timestamp for. | + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ----------------------------------------------- | +| [0] | uint256 | uint256 - The timestamp for the given round ID. | + +### latestAnswer + +```solidity +function latestAnswer() external view returns (int256) +``` + +Gets the latest answer from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------ | --------------------------- | +| [0] | int256 | int256 - The latest answer. | + +### latestRound + +```solidity +function latestRound() external view returns (uint256) +``` + +Gets the latest round ID from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ------------------------------ | +| [0] | uint256 | uint256 - The latest round ID. | + +### latestTimestamp + +```solidity +function latestTimestamp() external view returns (uint256) +``` + +Gets the timestamp of the latest answer from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | --------------------------------------------- | +| [0] | uint256 | uint256 - The timestamp of the latest answer. | diff --git a/src/content/chainlink-local/api-reference/v0.2.4/aggregator-v2-v3-interface.mdx b/src/content/chainlink-local/api-reference/v0.2.4/aggregator-v2-v3-interface.mdx new file mode 100644 index 00000000000..f10002b4e50 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.4/aggregator-v2-v3-interface.mdx @@ -0,0 +1,18 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "AggregatorV2V3Interface v0.2.4 API Reference" +metadata: + description: "API documentation for AggregatorV2V3Interface in Solidity, version v0.2.4." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## AggregatorV2V3Interface + +Combined V2/V3 price feed interface. + +[AggregatorV2V3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-feeds/interfaces/AggregatorV2V3Interface.sol) diff --git a/src/content/chainlink-local/api-reference/v0.2.4/aggregator-v3-interface.mdx b/src/content/chainlink-local/api-reference/v0.2.4/aggregator-v3-interface.mdx new file mode 100644 index 00000000000..2a9a9e3cbad --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.4/aggregator-v3-interface.mdx @@ -0,0 +1,109 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "AggregatorV3Interface v0.2.4 API Reference" +metadata: + description: "API documentation for AggregatorV3Interface in Solidity, version v0.2.4." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## AggregatorV3Interface + +Extended price feed interface. + +[AggregatorV3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-feeds/interfaces/AggregatorV3Interface.sol) + +## Functions + +### decimals + +```solidity +function decimals() external view returns (uint8) +``` + +Gets the number of decimals used by the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ----- | ------------------------------- | +| [0] | uint8 | uint8 - The number of decimals. | + +### description + +```solidity +function description() external view returns (string) +``` + +Gets the description of the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------ | -------------------------------------------------- | +| [0] | string | string memory - The description of the aggregator. | + +### getRoundData + +```solidity +function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the round data for a specific round ID. + +_This function should raise "No data present" if no data is available for the +given round ID._ + +#### Parameters + +| Name | Type | Description | +| --------- | ------ | ----------------------------------- | +| \_roundId | uint80 | - The round ID to get the data for. | + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------ | +| roundId | uint80 | - The round ID. | +| answer | int256 | - The answer for the round. | +| startedAt | uint256 | - The timestamp when the round started. | +| updatedAt | uint256 | - The timestamp when the round was updated. | +| answeredInRound | uint80 | - The round ID in which the answer was computed. | + +### latestRoundData + +```solidity +function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the latest round data. + +_This function should raise "No data present" if no data is available._ + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------------- | +| roundId | uint80 | - The latest round ID. | +| answer | int256 | - The latest answer. | +| startedAt | uint256 | - The timestamp when the latest round started. | +| updatedAt | uint256 | - The timestamp when the latest round was updated. | +| answeredInRound | uint80 | - The round ID in which the latest answer was computed. | + +### version + +```solidity +function version() external view returns (uint256) +``` + +Gets the version of the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ---------------------------------------- | +| [0] | uint256 | uint256 - The version of the aggregator. | diff --git a/src/content/chainlink-local/api-reference/v0.2.4/burn-mint-erc677-helper.mdx b/src/content/chainlink-local/api-reference/v0.2.4/burn-mint-erc677-helper.mdx new file mode 100644 index 00000000000..a6eb1b65be4 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.4/burn-mint-erc677-helper.mdx @@ -0,0 +1,55 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "BurnMintERC677Helper v0.2.4 API Reference" +metadata: + description: "API documentation for BurnMintERC677Helper in Solidity, version v0.2.4." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## BurnMintERC677Helper + +Helper contract for ERC677 token operations. + +[BurnMintERC677Helper](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/ccip/BurnMintERC677Helper.sol) + +## Functions + +### constructor + +```solidity +constructor(string name, string symbol) public +``` + +Constructor to initialize the BurnMintERC677Helper contract with a name and +symbol. + +_Calls the parent constructor of BurnMintERC677 with fixed decimals (18) and +initial supply (0)._ + +#### Parameters + +| Name | Type | Description | +| ------ | ------ | -------------------------- | +| name | string | - The name of the token. | +| symbol | string | - The symbol of the token. | + +### drip + +```solidity +function drip(address to) external +``` + +Mints one full token (1e18) to the specified address. + +_Calls the internal `_mint` function from the BurnMintERC677 contract._ + +#### Parameters + +| Name | Type | Description | +| ---- | ------- | ------------------------------------------ | +| to | address | - The address to receive the minted token. | diff --git a/src/content/chainlink-local/api-reference/v0.2.4/ccip-local-simulator-fork-js.mdx b/src/content/chainlink-local/api-reference/v0.2.4/ccip-local-simulator-fork-js.mdx new file mode 100644 index 00000000000..a3e0ed07027 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.4/ccip-local-simulator-fork-js.mdx @@ -0,0 +1,86 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalSimulatorFork JS v0.2.4 API Reference" +metadata: + description: "API documentation for the CCIPLocalSimulatorFork JS JavaScript helpers, version v0.2.4." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalSimulatorFork JS + +Hardhat 2 JavaScript helpers for fork routing. + +[CCIPLocalSimulatorFork JS](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/scripts/CCIPLocalSimulatorFork.js) + +## Types + +### Evm2EvmMessage : `Object` + +**Properties** + +| Name | Type | +| ------------------- | ------------------------------------------ | +| sourceChainSelector | `bigint` | +| sender | `string` | +| receiver | `string` | +| sequenceNumber | `bigint` | +| gasLimit | `bigint` | +| strict | `boolean` | +| nonce | `bigint` | +| feeToken | `string` | +| feeTokenAmount | `bigint` | +| data | `string` | +| tokenAmounts | `Array.<\{token: string, amount: bigint}>` | +| sourceTokenData | `Array.` | +| messageId | `string` | + +## Functions + +### requestLinkFromTheFaucet(linkAddress, to, amount) ⇒ `Promise.` + +Requests LINK tokens from the faucet and returns the transaction hash + +**Returns**: `Promise.` - Promise resolving to the +transaction hash of the fund transfer + +| Param | Type | Description | +| ----------- | -------- | ------------------------------------------------------- | +| linkAddress | `string` | The address of the LINK contract on the current network | +| to | `string` | The address to send LINK to | +| amount | `bigint` | The amount of LINK to request | + +### getEvm2EvmMessage(receipt) ⇒ `Evm2EvmMessage` | `null` + +Parses a transaction receipt to extract the sent message Scans through +transaction logs to find a `CCIPSendRequested` event and then decodes it to an +object + +**Returns**: `Evm2EvmMessage` | +`null` - Returns either the sent message or null if provided receipt +does not contain `CCIPSendRequested` log + +| Param | Type | Description | +| ------- | -------- | ------------------------------------------------ | +| receipt | `object` | The transaction receipt from the `ccipSend` call | + +### routeMessage(routerAddress, evm2EvmMessage) ⇒ `Promise.` + +Routes the sent message from the source network on the destination (current) +network + +**Returns**: `Promise.` - Either resolves with no value +if the message is successfully routed, or reverts +**Throws**: + +- `Error` Fails if no off-ramp matches the message's source chain + selector or if calling `router.getOffRamps()` + +| Param | Type | Description | +| -------------- | ---------------- | --------------------------------- | +| routerAddress | `string` | Address of the destination Router | +| evm2EvmMessage | `Evm2EvmMessage` | Sent cross-chain message | diff --git a/src/content/chainlink-local/api-reference/v0.2.4/ccip-local-simulator-fork.mdx b/src/content/chainlink-local/api-reference/v0.2.4/ccip-local-simulator-fork.mdx new file mode 100644 index 00000000000..2943c1e5722 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.4/ccip-local-simulator-fork.mdx @@ -0,0 +1,197 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalSimulatorFork v0.2.4 API Reference" +metadata: + description: "API documentation for CCIPLocalSimulatorFork in Solidity, version v0.2.4." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalSimulatorFork + +CCIP simulator for forked networks. + +[CCIPLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/ccip/CCIPLocalSimulatorFork.sol) + +## Structs + +### OffRamp + +Structure representing an offRamp configuration + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | + +```solidity +struct OffRamp { + uint64 sourceChainSelector; + address offRamp; +} +``` + +## Variables + +### i_register + +```solidity +contract Register i_register +``` + +The immutable register instance + +### LINK_FAUCET + +```solidity +address LINK_FAUCET +``` + +The address of the LINK faucet + +### s_processedMessages + +```solidity +mapping(bytes32 => bool) s_processedMessages +``` + +Mapping to track processed messages + +## Events + +### CCIPSendRequested + +```solidity +event CCIPSendRequested(struct Internal.EVM2EVMMessage message) +``` + +Event emitted when a CCIP send request is made + +#### Parameters + +| Name | Type | Description | +| ------- | ------------------------------ | ----------------------------------- | +| message | struct Internal.EVM2EVMMessage | - The EVM2EVM message that was sent | + +## Functions + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the contract + +### executeSingleMessage + +```solidity +function executeSingleMessage(struct Internal.EVM2EVMMessage message, bytes[] offchainTokenData, uint32[] tokenGasOverrides) external +``` + +Executes a single CCIP message on the offRamp + +#### Parameters + +| Name | Type | Description | +| ----------------- | ------------------------------ | --------------------------------- | +| message | struct Internal.EVM2EVMMessage | - The CCIP message to be executed | +| offchainTokenData | bytes[] | - Additional offchain token data | +| tokenGasOverrides | uint32[] | | + +Works with Foundry only + +### getNetworkDetails + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) +``` + +Returns the default values for currently CCIP supported networks. If network is +not present or some of the values are changed, user can manually add new network +details using the `setNetworkDetails` function. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------------------------------------------------------------------------ | +| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | + +#### Returns + +| Name | Type | Description | +| ---- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | + +### getOffRamps + +```solidity +function getOffRamps() external view returns (struct IRouterFork.OffRamp[]) +``` + +Gets the list of offRamps + +#### Returns + +| Name | Type | Description | +| ---- | ---------------------------- | ----------------------------------- | +| [0] | struct IRouterFork.OffRamp[] | offRamps - Array of OffRamp structs | + +### requestLinkFromFaucet + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------- | +| to | address | - The address to which LINK tokens are to be sent. | +| amount | uint256 | - The amount of LINK tokens to send. | + +#### Returns + +| Name | Type | Description | +| ------- | ---- | ----------------------------------------------------------------------------- | +| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | + +### setNetworkDetails + +```solidity +function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external +``` + +If network details are not present or some of the values are changed, user can +manually add new network details using the `setNetworkDetails` function. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | +| networkDetails | struct Register.NetworkDetails | - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | + +### switchChainAndRouteMessage + +```solidity +function switchChainAndRouteMessage(uint256 forkId) external +``` + +To be called after the sending of the cross-chain message (`ccipSend`). Goes +through the list of past logs and looks for the `CCIPSendRequested` event. +Switches to a destination network fork. Routes the sent cross-chain message on +the destination network. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------------------------------------------------------------------- | +| forkId | uint256 | - The ID of the destination network fork. This is the returned value of `createFork()` or `createSelectFork()` | diff --git a/src/content/chainlink-local/api-reference/v0.2.4/ccip-local-simulator.mdx b/src/content/chainlink-local/api-reference/v0.2.4/ccip-local-simulator.mdx new file mode 100644 index 00000000000..c16cf0bd211 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.4/ccip-local-simulator.mdx @@ -0,0 +1,233 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalSimulator v0.2.4 API Reference" +metadata: + description: "API documentation for CCIPLocalSimulator in Solidity, version v0.2.4." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalSimulator + +Local CCIP simulator (no-fork mode). + +[CCIPLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/ccip/CCIPLocalSimulator.sol) + +## Variables + +### CHAIN_SELECTOR + +```solidity +uint64 CHAIN_SELECTOR +``` + +The unique CCIP Chain Selector constant + +### i_ccipBnM + +```solidity +contract BurnMintERC677Helper i_ccipBnM +``` + +The BurnMintERC677Helper instance for CCIP-BnM token + +### i_ccipLnM + +```solidity +contract BurnMintERC677Helper i_ccipLnM +``` + +The BurnMintERC677Helper instance for CCIP-LnM token + +### i_linkToken + +```solidity +contract LinkToken i_linkToken +``` + +The LINK token instance + +### i_mockRouter + +```solidity +contract MockCCIPRouter i_mockRouter +``` + +The mock CCIP router instance + +### i_wrappedNative + +```solidity +contract WETH9 i_wrappedNative +``` + +The wrapped native token instance + +### s_supportedTokens + +```solidity +address[] s_supportedTokens +``` + +The list of supported token addresses + +## Errors + +### CCIPLocalSimulator\_\_MsgSenderIsNotTokenOwner + +```solidity +error CCIPLocalSimulator__MsgSenderIsNotTokenOwner() +``` + +### CCIPLocalSimulator\_\_RequiredRoleNotFound + +```solidity +error CCIPLocalSimulator__RequiredRoleNotFound(address account, bytes32 role, address token) +``` + +## Functions + +### configuration + +```solidity +function configuration() public view returns (uint64 chainSelector_, contract IRouterClient sourceRouter_, contract IRouterClient destinationRouter_, contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract BurnMintERC677Helper ccipBnM_, contract BurnMintERC677Helper ccipLnM_) +``` + +Returns configuration details for pre-deployed contracts and services needed for +local CCIP simulations. + +#### Returns + +| Name | Type | Description | +| ------------------- | ----------------------------- | ----------------------------------------------------------- | +| chainSelector\_ | uint64 | - The unique CCIP Chain Selector. | +| sourceRouter\_ | contract IRouterClient | - The source chain Router contract. | +| destinationRouter\_ | contract IRouterClient | - The destination chain Router contract. | +| wrappedNative\_ | contract WETH9 | - The wrapped native token which can be used for CCIP fees. | +| linkToken\_ | contract LinkToken | - The LINK token. | +| ccipBnM\_ | contract BurnMintERC677Helper | - The ccipBnM token. | +| ccipLnM\_ | contract BurnMintERC677Helper | - The ccipLnM token. | + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the contract and pre-deployed token instances + +### getSupportedTokens + +```solidity +function getSupportedTokens(uint64 chainSelector) external view returns (address[] tokens) +``` + +Gets a list of token addresses that are supported for cross-chain transfers by +the simulator. + +#### Parameters + +| Name | Type | Description | +| ------------- | ------ | --------------------------------- | +| chainSelector | uint64 | - The unique CCIP Chain Selector. | + +#### Returns + +| Name | Type | Description | +| ------ | --------- | -------------------------------------------------------------------------------------------------- | +| tokens | address[] | - Returns a list of token addresses that are supported for cross-chain transfers by the simulator. | + +### isChainSupported + +```solidity +function isChainSupported(uint64 chainSelector) public pure returns (bool supported) +``` + +Checks whether the provided `chainSelector` is supported by the simulator. + +#### Parameters + +| Name | Type | Description | +| ------------- | ------ | --------------------------------- | +| chainSelector | uint64 | - The unique CCIP Chain Selector. | + +#### Returns + +| Name | Type | Description | +| --------- | ---- | ---------------------------------------------------------------- | +| supported | bool | - Returns true if `chainSelector` is supported by the simulator. | + +### requestLinkFromFaucet + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------- | +| to | address | - The address to which LINK tokens are to be sent. | +| amount | uint256 | - The amount of LINK tokens to send. | + +#### Returns + +| Name | Type | Description | +| ------- | ---- | ----------------------------------------------------------------------------- | +| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | + +### supportNewTokenViaAccessControlDefaultAdmin + +```solidity +function supportNewTokenViaAccessControlDefaultAdmin(address tokenAddress) external +``` + +Allows user to support any new token, besides CCIP BnM and CCIP LnM, for +cross-chain transfers. The caller must have the DEFAULT_ADMIN_ROLE as defined by +the contract itself. Reverts if the caller is not the admin of the token using +OZ's AccessControl DEFAULT_ADMIN_ROLE. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ------------------------------------------------------------------ | +| tokenAddress | address | - The address of the token to add to the list of supported tokens. | + +### supportNewTokenViaGetCCIPAdmin + +```solidity +function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external +``` + +Allows user to support any new token, besides CCIP BnM and CCIP LnM, for +cross-chain transfers. Reverts if token does not implement getCCIPAdmin() +function. Reverts if the caller is not the token CCIPAdmin. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ------------------------------------------------------------------ | +| tokenAddress | address | - The address of the token to add to the list of supported tokens. | + +### supportNewTokenViaOwner + +```solidity +function supportNewTokenViaOwner(address tokenAddress) external +``` + +Allows user to support any new token, besides CCIP BnM and CCIP LnM, for +cross-chain transfers. Reverts if token does not implement owner() function. +Reverts if the caller is not the token owner. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ------------------------------------------------------------------ | +| tokenAddress | address | - The address of the token to add to the list of supported tokens. | diff --git a/src/content/chainlink-local/api-reference/v0.2.4/data-streams-local-simulator-fork.mdx b/src/content/chainlink-local/api-reference/v0.2.4/data-streams-local-simulator-fork.mdx new file mode 100644 index 00000000000..3f94b4c9f92 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.4/data-streams-local-simulator-fork.mdx @@ -0,0 +1,121 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "DataStreamsLocalSimulatorFork v0.2.4 API Reference" +metadata: + description: "API documentation for DataStreamsLocalSimulatorFork in Solidity, version v0.2.4." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## DataStreamsLocalSimulatorFork + +Data Streams simulator for forked networks. + +[DataStreamsLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-streams/DataStreamsLocalSimulatorFork.sol) + +## Variables + +### i_register + +```solidity +contract Register i_register +``` + +The immutable register instance + +### LINK_FAUCET + +```solidity +address LINK_FAUCET +``` + +The address of the LINK faucet + +## Functions + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the contract + +### getNetworkDetails + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) +``` + +Returns the default values for currently Data Streams supported networks. If +network is not present or some of the values are changed, user can manually add +new network details using the `setNetworkDetails` function. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ----------------------------------------------------------------------------- | +| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | + +#### Returns + +| Name | Type | Description | +| ---- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | + +### requestLinkFromFaucet + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------- | +| to | address | - The address to which LINK tokens are to be sent. | +| amount | uint256 | - The amount of LINK tokens to send. | + +#### Returns + +| Name | Type | Description | +| ------- | ---- | ----------------------------------------------------------------------------- | +| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | + +### requestNativeFromFaucet + +```solidity +function requestNativeFromFaucet(address to, uint256 amount) external +``` + +Requests native coints from the faucet. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | --------------------------------------------------- | +| to | address | - The address to which native coins are to be sent. | +| amount | uint256 | - The amount of native coins to send. | + +### setNetworkDetails + +```solidity +function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external +``` + +If network details are not present or some of the values are changed, user can +manually add new network details using the `setNetworkDetails` function. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- | +| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | +| networkDetails | struct Register.NetworkDetails | - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | diff --git a/src/content/chainlink-local/api-reference/v0.2.4/data-streams-local-simulator.mdx b/src/content/chainlink-local/api-reference/v0.2.4/data-streams-local-simulator.mdx new file mode 100644 index 00000000000..99305200892 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.4/data-streams-local-simulator.mdx @@ -0,0 +1,110 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "DataStreamsLocalSimulator v0.2.4 API Reference" +metadata: + description: "API documentation for DataStreamsLocalSimulator in Solidity, version v0.2.4." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## DataStreamsLocalSimulator + +Local Data Streams simulator (no-fork mode). + +[DataStreamsLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-streams/DataStreamsLocalSimulator.sol) + +## Variables + +### i_linkToken + +```solidity +contract LinkToken i_linkToken +``` + +The LINK token instance + +### i_wrappedNative + +```solidity +contract WETH9 i_wrappedNative +``` + +The wrapped native token instance + +### s_mockFeeManager + +```solidity +contract MockFeeManager s_mockFeeManager +``` + +### s_mockRewardManager + +```solidity +contract MockRewardManager s_mockRewardManager +``` + +### s_mockVerifier + +```solidity +contract MockVerifier s_mockVerifier +``` + +### s_mockVerifierProxy + +```solidity +contract MockVerifierProxy s_mockVerifierProxy +``` + +## Functions + +### configuration + +```solidity +function configuration() public view returns (contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract MockVerifier mockVerifier_, contract MockVerifierProxy mockVerifierProxy_, contract MockFeeManager mockFeeManager_, contract MockRewardManager mockRewardManager_) +``` + +@notice Returns configuration details for pre-deployed contracts and services +needed for local Data Streams simulations. + +#### Returns + +| Name | Type | Description | +| ------------------- | -------------------------- | ----------------------------------- | +| wrappedNative\_ | contract WETH9 | - The wrapped native token. | +| linkToken\_ | contract LinkToken | - The LINK token. | +| mockVerifier\_ | contract MockVerifier | - The mock verifier contract. | +| mockVerifierProxy\_ | contract MockVerifierProxy | - The mock verifier proxy contract. | +| mockFeeManager\_ | contract MockFeeManager | - The mock fee manager contract. | +| mockRewardManager\_ | contract MockRewardManager | - The mock reward manager contract. | + +### constructor + +```solidity +constructor() public +``` + +### requestLinkFromFaucet + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------- | +| to | address | - The address to which LINK tokens are to be sent. | +| amount | uint256 | - The amount of LINK tokens to send. | + +#### Returns + +| Name | Type | Description | +| ------- | ---- | ----------------------------------------------------------------------------- | +| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | diff --git a/src/content/chainlink-local/api-reference/v0.2.4/data-streams-register.mdx b/src/content/chainlink-local/api-reference/v0.2.4/data-streams-register.mdx new file mode 100644 index 00000000000..cbb1bdb6e28 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.4/data-streams-register.mdx @@ -0,0 +1,84 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Register (Data Streams) v0.2.4 API Reference" +metadata: + description: "API documentation for Register (Data Streams) in Solidity, version v0.2.4." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## Register (Data Streams) + +Data Streams network configuration registry. + +[Register (Data Streams)](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-streams/Register.sol) + +## Structs + +### NetworkDetails + +```solidity +struct NetworkDetails { + address verifierProxyAddress; + address linkAddress; +} +``` + +## Variables + +### s_networkDetails + +```solidity +mapping(uint256 => struct Register.NetworkDetails) s_networkDetails +``` + +Mapping to store network details based on chain ID. + +## Functions + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the network details for various chains. + +### getNetworkDetails + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails networkDetails) +``` + +Retrieves network details for a given chain ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | --------------------------------------------- | +| chainId | uint256 | - The ID of the chain to get the details for. | + +#### Returns + +| Name | Type | Description | +| -------------- | ------------------------------ | ------------------------------------------------- | +| networkDetails | struct Register.NetworkDetails | - The network details for the specified chain ID. | + +### setNetworkDetails + +```solidity +function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external +``` + +Sets the network details for a given chain ID. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------------------------------ | -------------------------------------------------------- | +| chainId | uint256 | - The ID of the chain to set the details for. | +| networkDetails | struct Register.NetworkDetails | - The network details to set for the specified chain ID. | diff --git a/src/content/chainlink-local/api-reference/v0.2.4/index.mdx b/src/content/chainlink-local/api-reference/v0.2.4/index.mdx new file mode 100644 index 00000000000..5553ede1d24 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.4/index.mdx @@ -0,0 +1,56 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Chainlink Local v0.2.4 API Reference" +metadata: + description: "API reference documentation for Chainlink Local v0.2.4" +isIndex: true +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +Chainlink Local v0.2.4 adds the Data Streams local simulators (`DataStreamsLocalSimulator`, `DataStreamsLocalSimulatorFork`) and their mock verifier stack, and pins `@chainlink/contracts-ccip` 1.5.1-beta.0 and `@chainlink/contracts` 1.3.0. + +## CCIP + +These contracts provide Cross-Chain Interoperability Protocol (CCIP) functionality in a local testing environment: + +- [CCIPLocalSimulator](/chainlink-local/api-reference/v0.2.4/ccip-local-simulator) - Local CCIP simulator (no-fork mode) +- [CCIPLocalSimulatorFork](/chainlink-local/api-reference/v0.2.4/ccip-local-simulator-fork) - CCIP simulator for forked networks +- [CCIPLocalSimulatorFork JS](/chainlink-local/api-reference/v0.2.4/ccip-local-simulator-fork-js) - JavaScript helpers for fork routing +- [Register](/chainlink-local/api-reference/v0.2.4/register) - CCIP network configuration registry + +## Data Streams + +Contracts for simulating Chainlink Data Streams: + +- [DataStreamsLocalSimulator](/chainlink-local/api-reference/v0.2.4/data-streams-local-simulator) - Local Data Streams simulator (no-fork mode) +- [DataStreamsLocalSimulatorFork](/chainlink-local/api-reference/v0.2.4/data-streams-local-simulator-fork) - Data Streams simulator for forked networks +- [MockVerifier](/chainlink-local/api-reference/v0.2.4/mock-verifier) - Mock Data Streams verifier +- [MockVerifierProxy](/chainlink-local/api-reference/v0.2.4/mock-verifier-proxy) - Mock Data Streams verifier proxy +- [MockReportGenerator](/chainlink-local/api-reference/v0.2.4/mock-report-generator) - Signed report generator for every report schema +- [MockFeeManager](/chainlink-local/api-reference/v0.2.4/mock-fee-manager) - Mock verifier fee manager +- [MockRewardManager](/chainlink-local/api-reference/v0.2.4/mock-reward-manager) - Mock reward manager +- [ReportVersions](/chainlink-local/api-reference/v0.2.4/report-versions) - Data Streams report schemas +- [Register (Data Streams)](/chainlink-local/api-reference/v0.2.4/data-streams-register) - Data Streams network configuration registry + +## Data Feeds + +Contracts for simulating Chainlink Data Feeds: + +- [AggregatorInterface](/chainlink-local/api-reference/v0.2.4/aggregator-interface) - Basic price feed interface +- [AggregatorV2V3Interface](/chainlink-local/api-reference/v0.2.4/aggregator-v2-v3-interface) - Combined V2/V3 price feed interface +- [AggregatorV3Interface](/chainlink-local/api-reference/v0.2.4/aggregator-v3-interface) - Extended price feed interface +- [MockOffchainAggregator](/chainlink-local/api-reference/v0.2.4/mock-offchain-aggregator) - Mock implementation of off-chain aggregator +- [MockV3Aggregator](/chainlink-local/api-reference/v0.2.4/mock-v3-aggregator) - Mock implementation of V3 aggregator + +## Token Contracts + +Standard token implementations for testing: + +- [BurnMintERC677Helper](/chainlink-local/api-reference/v0.2.4/burn-mint-erc677-helper) - Helper contract for ERC677 token operations +- [LinkToken](/chainlink-local/api-reference/v0.2.4/link-token) - LINK token implementation +- [WETH9](/chainlink-local/api-reference/v0.2.4/weth9) - Wrapped Ether implementation diff --git a/src/content/chainlink-local/api-reference/v0.2.4/link-token.mdx b/src/content/chainlink-local/api-reference/v0.2.4/link-token.mdx new file mode 100644 index 00000000000..848311f8838 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.4/link-token.mdx @@ -0,0 +1,44 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "LinkToken v0.2.4 API Reference" +metadata: + description: "API documentation for LinkToken in Solidity, version v0.2.4." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## LinkToken + +LINK token implementation. + +[LinkToken](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/shared/LinkToken.sol) + +## Functions + +### \_onCreate + +```solidity +function _onCreate() internal virtual +``` + +Hook that is called when this contract is created. + +_Useful to override constructor behaviour in child contracts (e.g., LINK bridge +tokens). The default implementation mints 10\*\*27 tokens to the contract +deployer._ + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the LinkToken contract with a fixed total supply, +name, and symbol. + +_Calls the ERC677 constructor with the name and symbol, and then mints the total +supply to the contract deployer._ diff --git a/src/content/chainlink-local/api-reference/v0.2.4/mock-fee-manager.mdx b/src/content/chainlink-local/api-reference/v0.2.4/mock-fee-manager.mdx new file mode 100644 index 00000000000..5c9bff1f97a --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.4/mock-fee-manager.mdx @@ -0,0 +1,174 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockFeeManager v0.2.4 API Reference" +metadata: + description: "API documentation for MockFeeManager in Solidity, version v0.2.4." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockFeeManager + +Mock verifier fee manager. + +[MockFeeManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-streams/MockFeeManager.sol) + +## Structs + +### Asset + +```solidity +struct Asset { + address assetAddress; + uint256 amount; +} +``` + +## Variables + +### i_linkAddress + +```solidity +address i_linkAddress +``` + +### i_nativeAddress + +```solidity +address i_nativeAddress +``` + +### i_proxyAddress + +```solidity +address i_proxyAddress +``` + +### i_rewardManager + +```solidity +contract IRewardManager i_rewardManager +``` + +### s_mockDiscounts + +```solidity +mapping(address => uint256) s_mockDiscounts +``` + +### s_nativeSurcharge + +```solidity +uint256 s_nativeSurcharge +``` + +## Errors + +### ExpiredReport + +```solidity +error ExpiredReport() +``` + +### InvalidAddress + +```solidity +error InvalidAddress() +``` + +### InvalidDeposit + +```solidity +error InvalidDeposit() +``` + +### InvalidDiscount + +```solidity +error InvalidDiscount() +``` + +### InvalidQuote + +```solidity +error InvalidQuote() +``` + +### InvalidSurcharge + +```solidity +error InvalidSurcharge() +``` + +### Unauthorized + +```solidity +error Unauthorized() +``` + +## Functions + +### \_processFee + +```solidity +function _processFee(bytes payload, bytes parameterPayload, address subscriber) internal +``` + +### constructor + +```solidity +constructor(address linkAddress, address nativeAddress, address proxyAddress, address rewardManager) public +``` + +### getFeeAndReward + +```solidity +function getFeeAndReward(address subscriber, bytes report, address quoteAddress) public view returns (struct Common.Asset, struct Common.Asset, uint256) +``` + +### getMockDiscount + +```solidity +function getMockDiscount(address subscriber) external view returns (uint256) +``` + +### processFee + +```solidity +function processFee(bytes payload, bytes parameterPayload, address subscriber) external payable +``` + +### processFeeBulk + +```solidity +function processFeeBulk(bytes[] payloads, bytes parameterPayload, address subscriber) external payable +``` + +### setMockDiscount + +```solidity +function setMockDiscount(address subscriber, uint256 discount) external +``` + +### setNativeSurcharge + +```solidity +function setNativeSurcharge(uint64 surcharge) external +``` + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) external pure returns (bool) +``` + +\_Returns true if this contract implements the interface defined by +`interfaceId`. See the corresponding +https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP +section] to learn more about how these ids are created. + +This function call must use less than 30 000 gas.\_ diff --git a/src/content/chainlink-local/api-reference/v0.2.4/mock-offchain-aggregator.mdx b/src/content/chainlink-local/api-reference/v0.2.4/mock-offchain-aggregator.mdx new file mode 100644 index 00000000000..4fbbe09ada8 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.4/mock-offchain-aggregator.mdx @@ -0,0 +1,190 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockOffchainAggregator v0.2.4 API Reference" +metadata: + description: "API documentation for MockOffchainAggregator in Solidity, version v0.2.4." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockOffchainAggregator + +Mock implementation of off-chain aggregator. + +[MockOffchainAggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-feeds/MockOffchainAggregator.sol) + +## Variables + +### decimals + +```solidity +uint8 decimals +``` + +The number of decimals used by the aggregator. + +### getAnswer + +```solidity +mapping(uint256 => int256) getAnswer +``` + +Mapping to get the answer for a specific round ID. + +### getTimestamp + +```solidity +mapping(uint256 => uint256) getTimestamp +``` + +Mapping to get the timestamp for a specific round ID. + +### latestAnswer + +```solidity +int256 latestAnswer +``` + +The latest answer reported by the aggregator. + +### latestRound + +```solidity +uint256 latestRound +``` + +The latest round ID. + +### latestTimestamp + +```solidity +uint256 latestTimestamp +``` + +The timestamp of the latest answer. + +### maxAnswer + +```solidity +int192 maxAnswer +``` + +The maximum answer the aggregator is allowed to report. + +### minAnswer + +```solidity +int192 minAnswer +``` + +The minimum answer the aggregator is allowed to report. + +## Functions + +### constructor + +```solidity +constructor(uint8 _decimals, int256 _initialAnswer) public +``` + +Constructor to initialize the MockOffchainAggregator contract with initial +parameters. + +#### Parameters + +| Name | Type | Description | +| --------------- | ------ | ------------------------------------------------------ | +| \_decimals | uint8 | - The number of decimals for the aggregator. | +| \_initialAnswer | int256 | - The initial answer to be set in the mock aggregator. | + +### getRoundData + +```solidity +function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the round data for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| --------- | ------ | ----------------------------------- | +| \_roundId | uint80 | - The round ID to get the data for. | + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------ | +| roundId | uint80 | - The round ID. | +| answer | int256 | - The answer for the round. | +| startedAt | uint256 | - The timestamp when the round started. | +| updatedAt | uint256 | - The timestamp when the round was updated. | +| answeredInRound | uint80 | - The round ID in which the answer was computed. | + +### latestRoundData + +```solidity +function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the latest round data. + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------------- | +| roundId | uint80 | - The latest round ID. | +| answer | int256 | - The latest answer. | +| startedAt | uint256 | - The timestamp when the latest round started. | +| updatedAt | uint256 | - The timestamp when the latest round was updated. | +| answeredInRound | uint80 | - The round ID in which the latest answer was computed. | + +### updateAnswer + +```solidity +function updateAnswer(int256 _answer) public +``` + +Updates the answer in the mock aggregator. + +#### Parameters + +| Name | Type | Description | +| -------- | ------ | --------------------------- | +| \_answer | int256 | - The new answer to be set. | + +### updateMinAndMaxAnswers + +```solidity +function updateMinAndMaxAnswers(int192 _minAnswer, int192 _maxAnswer) external +``` + +Updates the minimum and maximum answers the aggregator can report. + +#### Parameters + +| Name | Type | Description | +| ----------- | ------ | ------------------------- | +| \_minAnswer | int192 | - The new minimum answer. | +| \_maxAnswer | int192 | - The new maximum answer. | + +### updateRoundData + +```solidity +function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public +``` + +Updates the round data in the mock aggregator. + +#### Parameters + +| Name | Type | Description | +| ----------- | ------- | --------------------------------------- | +| \_roundId | uint80 | - The round ID to be updated. | +| \_answer | int256 | - The new answer to be set. | +| \_timestamp | uint256 | - The timestamp to be set. | +| \_startedAt | uint256 | - The timestamp when the round started. | diff --git a/src/content/chainlink-local/api-reference/v0.2.4/mock-report-generator.mdx b/src/content/chainlink-local/api-reference/v0.2.4/mock-report-generator.mdx new file mode 100644 index 00000000000..37b5a3220ec --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.4/mock-report-generator.mdx @@ -0,0 +1,192 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockReportGenerator v0.2.4 API Reference" +metadata: + description: "API documentation for MockReportGenerator in Solidity, version v0.2.4." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockReportGenerator + +Signed report generator for every report schema. + +[MockReportGenerator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-streams/MockReportGenerator.sol) + +## Variables + +### i_donAddress + +```solidity +address i_donAddress +``` + +### i_donDigest + +```solidity +uint256 i_donDigest +``` + +### i_reportV2MockFeedId + +```solidity +bytes32 i_reportV2MockFeedId +``` + +### i_reportV3MockFeedId + +```solidity +bytes32 i_reportV3MockFeedId +``` + +### i_reportV4MockFeedId + +```solidity +bytes32 i_reportV4MockFeedId +``` + +### s_ask + +```solidity +int192 s_ask +``` + +### s_bid + +```solidity +int192 s_bid +``` + +### s_expiresPeriod + +```solidity +uint32 s_expiresPeriod +``` + +### s_linkFee + +```solidity +uint192 s_linkFee +``` + +### s_marketStatus + +```solidity +uint32 s_marketStatus +``` + +### s_nativeFee + +```solidity +uint192 s_nativeFee +``` + +### s_price + +```solidity +int192 s_price +``` + +## Errors + +### MockReportGenerator\_\_CastOverflow + +```solidity +error MockReportGenerator__CastOverflow() +``` + +### MockReportGenerator\_\_InvalidAsk + +```solidity +error MockReportGenerator__InvalidAsk() +``` + +### MockReportGenerator\_\_InvalidBid + +```solidity +error MockReportGenerator__InvalidBid() +``` + +## Functions + +### constructor + +```solidity +constructor(int192 initialPrice) public +``` + +### generateReport + +```solidity +function generateReport(struct ReportVersions.ReportV2 report) external returns (bytes signedReport) +``` + +### generateReport + +```solidity +function generateReport(struct ReportVersions.ReportV3 report) external returns (bytes signedReport) +``` + +### generateReport + +```solidity +function generateReport(struct ReportVersions.ReportV4 report) external returns (bytes signedReport) +``` + +### generateReportV2 + +```solidity +function generateReportV2() external returns (bytes signedReport, struct ReportVersions.ReportV2 report) +``` + +### generateReportV3 + +```solidity +function generateReportV3() external returns (bytes signedReport, struct ReportVersions.ReportV3 report) +``` + +### generateReportV4 + +```solidity +function generateReportV4() external returns (bytes signedReport, struct ReportVersions.ReportV4 report) +``` + +### getMockDonAddress + +```solidity +function getMockDonAddress() external view returns (address) +``` + +### updateExpiresPeriod + +```solidity +function updateExpiresPeriod(uint32 period) external +``` + +### updateFees + +```solidity +function updateFees(uint192 nativeFee, uint192 linkFee) external +``` + +### updateMarketStatus + +```solidity +function updateMarketStatus(uint32 status) external +``` + +### updatePrice + +```solidity +function updatePrice(int192 price) public +``` + +### updatePriceBidAndAsk + +```solidity +function updatePriceBidAndAsk(int192 price, int192 bid, int192 ask) external +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.4/mock-reward-manager.mdx b/src/content/chainlink-local/api-reference/v0.2.4/mock-reward-manager.mdx new file mode 100644 index 00000000000..82f6c77d0e1 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.4/mock-reward-manager.mdx @@ -0,0 +1,87 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockRewardManager v0.2.4 API Reference" +metadata: + description: "API documentation for MockRewardManager in Solidity, version v0.2.4." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockRewardManager + +Mock reward manager. + +[MockRewardManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-streams/MockRewardManager.sol) + +## Variables + +### i_linkAddress + +```solidity +address i_linkAddress +``` + +### s_feeManagerAddress + +```solidity +address s_feeManagerAddress +``` + +## Errors + +### Unauthorized + +```solidity +error Unauthorized() +``` + +## Events + +### FeePaid + +```solidity +event FeePaid(struct IRewardManager.FeePayment[] payments, address payer) +``` + +## Functions + +### claimRewards + +```solidity +function claimRewards(bytes32[]) external pure +``` + +### constructor + +```solidity +constructor(address linkAddress) public +``` + +### onFeePaid + +```solidity +function onFeePaid(struct IRewardManager.FeePayment[] payments, address payer) external +``` + +### setFeeManager + +```solidity +function setFeeManager(address newFeeManager) external +``` + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) external pure returns (bool) +``` + +\_Returns true if this contract implements the interface defined by +`interfaceId`. See the corresponding +https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP +section] to learn more about how these ids are created. + +This function call must use less than 30 000 gas.\_ diff --git a/src/content/chainlink-local/api-reference/v0.2.4/mock-v3-aggregator.mdx b/src/content/chainlink-local/api-reference/v0.2.4/mock-v3-aggregator.mdx new file mode 100644 index 00000000000..0f67ccf2343 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.4/mock-v3-aggregator.mdx @@ -0,0 +1,277 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockV3Aggregator v0.2.4 API Reference" +metadata: + description: "API documentation for MockV3Aggregator in Solidity, version v0.2.4." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockV3Aggregator + +Mock implementation of V3 aggregator. + +[MockV3Aggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-feeds/MockV3Aggregator.sol) + +## Variables + +### aggregator + +```solidity +address aggregator +``` + +The address of the current aggregator. + +### proposedAggregator + +```solidity +address proposedAggregator +``` + +The address of the proposed aggregator. + +### version + +```solidity +uint256 version +``` + +The version of the aggregator. + +## Functions + +### confirmAggregator + +```solidity +function confirmAggregator(address _aggregator) external +``` + +Confirms the proposed aggregator. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ----------------------------------------- | +| \_aggregator | address | - The address of the proposed aggregator. | + +### constructor + +```solidity +constructor(uint8 _decimals, int256 _initialAnswer) public +``` + +Constructor to initialize the MockV3Aggregator contract with initial parameters. + +#### Parameters + +| Name | Type | Description | +| --------------- | ------ | ------------------------------------------------------ | +| \_decimals | uint8 | - The number of decimals for the aggregator. | +| \_initialAnswer | int256 | - The initial answer to be set in the mock aggregator. | + +### decimals + +```solidity +function decimals() external view returns (uint8) +``` + +Gets the number of decimals used by the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ----- | ------------------------------- | +| [0] | uint8 | uint8 - The number of decimals. | + +### description + +```solidity +function description() external pure returns (string) +``` + +Gets the description of the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------ | -------------------------------------------------- | +| [0] | string | string memory - The description of the aggregator. | + +### getAnswer + +```solidity +function getAnswer(uint256 roundId) external view returns (int256) +``` + +Gets the answer for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------- | +| roundId | uint256 | - The round ID to get the answer for. | + +#### Returns + +| Name | Type | Description | +| ---- | ------ | ------------------------------------------- | +| [0] | int256 | int256 - The answer for the given round ID. | + +### getRoundData + +```solidity +function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the round data for a specific round ID. + +_This function should raise "No data present" if no data is available for the +given round ID._ + +#### Parameters + +| Name | Type | Description | +| --------- | ------ | ----------------------------------- | +| \_roundId | uint80 | - The round ID to get the data for. | + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------ | +| roundId | uint80 | - The round ID. | +| answer | int256 | - The answer for the round. | +| startedAt | uint256 | - The timestamp when the round started. | +| updatedAt | uint256 | - The timestamp when the round was updated. | +| answeredInRound | uint80 | - The round ID in which the answer was computed. | + +### getTimestamp + +```solidity +function getTimestamp(uint256 roundId) external view returns (uint256) +``` + +Gets the timestamp for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ---------------------------------------- | +| roundId | uint256 | - The round ID to get the timestamp for. | + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ----------------------------------------------- | +| [0] | uint256 | uint256 - The timestamp for the given round ID. | + +### latestAnswer + +```solidity +function latestAnswer() external view returns (int256) +``` + +Gets the latest answer from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------ | --------------------------- | +| [0] | int256 | int256 - The latest answer. | + +### latestRound + +```solidity +function latestRound() external view returns (uint256) +``` + +Gets the latest round ID from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ------------------------------ | +| [0] | uint256 | uint256 - The latest round ID. | + +### latestRoundData + +```solidity +function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the latest round data. + +_This function should raise "No data present" if no data is available._ + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------------- | +| roundId | uint80 | - The latest round ID. | +| answer | int256 | - The latest answer. | +| startedAt | uint256 | - The timestamp when the latest round started. | +| updatedAt | uint256 | - The timestamp when the latest round was updated. | +| answeredInRound | uint80 | - The round ID in which the latest answer was computed. | + +### latestTimestamp + +```solidity +function latestTimestamp() external view returns (uint256) +``` + +Gets the timestamp of the latest answer from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | --------------------------------------------- | +| [0] | uint256 | uint256 - The timestamp of the latest answer. | + +### proposeAggregator + +```solidity +function proposeAggregator(contract AggregatorV2V3Interface _aggregator) external +``` + +Proposes a new aggregator. + +#### Parameters + +| Name | Type | Description | +| ------------ | -------------------------------- | ----------------------------------------- | +| \_aggregator | contract AggregatorV2V3Interface | - The address of the proposed aggregator. | + +### updateAnswer + +```solidity +function updateAnswer(int256 _answer) public +``` + +Updates the answer in the mock aggregator. + +#### Parameters + +| Name | Type | Description | +| -------- | ------ | --------------------------- | +| \_answer | int256 | - The new answer to be set. | + +### updateRoundData + +```solidity +function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public +``` + +Updates the round data in the mock aggregator. + +#### Parameters + +| Name | Type | Description | +| ----------- | ------- | --------------------------------------- | +| \_roundId | uint80 | - The round ID to be updated. | +| \_answer | int256 | - The new answer to be set. | +| \_timestamp | uint256 | - The timestamp to be set. | +| \_startedAt | uint256 | - The timestamp when the round started. | diff --git a/src/content/chainlink-local/api-reference/v0.2.4/mock-verifier-proxy.mdx b/src/content/chainlink-local/api-reference/v0.2.4/mock-verifier-proxy.mdx new file mode 100644 index 00000000000..8ea0b02581c --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.4/mock-verifier-proxy.mdx @@ -0,0 +1,98 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockVerifierProxy v0.2.4 API Reference" +metadata: + description: "API documentation for MockVerifierProxy in Solidity, version v0.2.4." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockVerifierProxy + +Mock Data Streams verifier proxy. + +[MockVerifierProxy](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-streams/MockVerifierProxy.sol) + +## Variables + +### s_feeManager + +```solidity +contract IVerifierFeeManager s_feeManager +``` + +### s_verifier + +```solidity +address s_verifier +``` + +## Errors + +### VerifierInvalid + +```solidity +error VerifierInvalid() +``` + +### VerifierNotFound + +```solidity +error VerifierNotFound() +``` + +### ZeroAddress + +```solidity +error ZeroAddress() +``` + +## Events + +### VerifierInitialized + +```solidity +event VerifierInitialized(address verifierAddress) +``` + +## Functions + +### \_verify + +```solidity +function _verify(bytes payload) internal returns (bytes) +``` + +### getVerifier + +```solidity +function getVerifier(bytes32) external view returns (address) +``` + +### initializeVerifier + +```solidity +function initializeVerifier(address verifierAddress) external +``` + +### setFeeManager + +```solidity +function setFeeManager(contract IVerifierFeeManager feeManager) external +``` + +### verify + +```solidity +function verify(bytes payload, bytes parameterPayload) external payable returns (bytes) +``` + +### verifyBulk + +```solidity +function verifyBulk(bytes[] payloads, bytes parameterPayload) external payable returns (bytes[] verifiedReports) +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.4/mock-verifier.mdx b/src/content/chainlink-local/api-reference/v0.2.4/mock-verifier.mdx new file mode 100644 index 00000000000..5ba1db2d196 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.4/mock-verifier.mdx @@ -0,0 +1,165 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockVerifier v0.2.4 API Reference" +metadata: + description: "API documentation for MockVerifier in Solidity, version v0.2.4." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockVerifier + +Mock Data Streams verifier. + +[MockVerifier](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-streams/MockVerifier.sol) + +## Variables + +### i_verifierProxy + +```solidity +address i_verifierProxy +``` + +### MOCK_DATA_STREAM_DON_ADDRESS + +```solidity +address MOCK_DATA_STREAM_DON_ADDRESS +``` + +### N_2 + +```solidity +uint256 N_2 +``` + +### s_inactiveDigests + +```solidity +mapping(bytes32 => mapping(bytes32 => bool)) s_inactiveDigests +``` + +### s_inactiveFeeds + +```solidity +mapping(bytes32 => bool) s_inactiveFeeds +``` + +### s_verifiedSignatures + +```solidity +mapping(bytes => bool) s_verifiedSignatures +``` + +## Errors + +### AccessForbidden + +```solidity +error AccessForbidden() +``` + +### AlreadyUsedSignature + +```solidity +error AlreadyUsedSignature() +``` + +### BadVerification + +```solidity +error BadVerification() +``` + +### DigestInactive + +```solidity +error DigestInactive(bytes32 feedId, bytes32 configDigest) +``` + +### InactiveFeed + +```solidity +error InactiveFeed(bytes32 feedId) +``` + +### InvalidS + +```solidity +error InvalidS() +``` + +### InvalidSignatureLength + +```solidity +error InvalidSignatureLength() +``` + +### InvalidV + +```solidity +error InvalidV() +``` + +## Events + +### ReportVerified + +```solidity +event ReportVerified(bytes32 feedId, address sender) +``` + +## Functions + +### activateConfig + +```solidity +function activateConfig(bytes32 feedId, bytes32 configDigest) external +``` + +### activateFeed + +```solidity +function activateFeed(bytes32 feedId) external +``` + +### constructor + +```solidity +constructor(address verifierProxy) public +``` + +### deactivateConfig + +```solidity +function deactivateConfig(bytes32 feedId, bytes32 configDigest) external +``` + +### deactivateFeed + +```solidity +function deactivateFeed(bytes32 feedId) external +``` + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) external pure returns (bool) +``` + +\_Returns true if this contract implements the interface defined by +`interfaceId`. See the corresponding +https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP +section] to learn more about how these ids are created. + +This function call must use less than 30 000 gas.\_ + +### verify + +```solidity +function verify(bytes signedReport, address sender) external returns (bytes verifierResponse) +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.4/register.mdx b/src/content/chainlink-local/api-reference/v0.2.4/register.mdx new file mode 100644 index 00000000000..9295019a73b --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.4/register.mdx @@ -0,0 +1,91 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Register v0.2.4 API Reference" +metadata: + description: "API documentation for Register in Solidity, version v0.2.4." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## Register + +CCIP network configuration registry. + +[Register](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/ccip/Register.sol) + +## Structs + +### NetworkDetails + +```solidity +struct NetworkDetails { + uint64 chainSelector; + address routerAddress; + address linkAddress; + address wrappedNativeAddress; + address ccipBnMAddress; + address ccipLnMAddress; + address rmnProxyAddress; + address registryModuleOwnerCustomAddress; + address tokenAdminRegistryAddress; +} +``` + +## Variables + +### s_networkDetails + +```solidity +mapping(uint256 => struct Register.NetworkDetails) s_networkDetails +``` + +Mapping to store network details based on chain ID. + +## Functions + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the network details for various chains. + +### getNetworkDetails + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails networkDetails) +``` + +Retrieves network details for a given chain ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | --------------------------------------------- | +| chainId | uint256 | - The ID of the chain to get the details for. | + +#### Returns + +| Name | Type | Description | +| -------------- | ------------------------------ | ------------------------------------------------- | +| networkDetails | struct Register.NetworkDetails | - The network details for the specified chain ID. | + +### setNetworkDetails + +```solidity +function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external +``` + +Sets the network details for a given chain ID. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------------------------------ | -------------------------------------------------------- | +| chainId | uint256 | - The ID of the chain to set the details for. | +| networkDetails | struct Register.NetworkDetails | - The network details to set for the specified chain ID. | diff --git a/src/content/chainlink-local/api-reference/v0.2.4/report-versions.mdx b/src/content/chainlink-local/api-reference/v0.2.4/report-versions.mdx new file mode 100644 index 00000000000..4708cb138a4 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.4/report-versions.mdx @@ -0,0 +1,84 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "ReportVersions v0.2.4 API Reference" +metadata: + description: "API documentation for ReportVersions in Solidity, version v0.2.4." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## ReportVersions + +Data Streams report schemas. + +[ReportVersions](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/data-streams/ReportVersions.sol) + +## Structs + +### ReportV2 + +_Represents a data report from a Data Streams stream for v2 schema (crypto +streams). The `price` value is carried to either 8 or 18 decimal places, +depending on the stream. For more information, see +https://docs.chain.link/data-streams/crypto-streams and +https://docs.chain.link/data-streams/reference/report-schema_ + +```solidity +struct ReportV2 { + bytes32 feedId; + uint32 validFromTimestamp; + uint32 observationsTimestamp; + uint192 nativeFee; + uint192 linkFee; + uint32 expiresAt; + int192 benchmarkPrice; +} +``` + +### ReportV3 + +_Represents a data report from a Data Streams stream for v3 schema (crypto +streams). The `price`, `bid`, and `ask` values are carried to either 8 or 18 +decimal places, depending on the stream. For more information, see +https://docs.chain.link/data-streams/crypto-streams and +https://docs.chain.link/data-streams/reference/report-schema_ + +```solidity +struct ReportV3 { + bytes32 feedId; + uint32 validFromTimestamp; + uint32 observationsTimestamp; + uint192 nativeFee; + uint192 linkFee; + uint32 expiresAt; + int192 price; + int192 bid; + int192 ask; +} +``` + +### ReportV4 + +_Represents a data report from a Data Streams stream for v4 schema (RWA stream). +The `price` value is carried to either 8 or 18 decimal places, depending on the +stream. The `marketStatus` indicates whether the market is currently open. +Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). For more +information, see https://docs.chain.link/data-streams/rwa-streams and +https://docs.chain.link/data-streams/reference/report-schema-v4_ + +```solidity +struct ReportV4 { + bytes32 feedId; + uint32 validFromTimestamp; + uint32 observationsTimestamp; + uint192 nativeFee; + uint192 linkFee; + uint32 expiresAt; + int192 price; + uint32 marketStatus; +} +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.4/weth9.mdx b/src/content/chainlink-local/api-reference/v0.2.4/weth9.mdx new file mode 100644 index 00000000000..328b30dd0d8 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.4/weth9.mdx @@ -0,0 +1,126 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "WETH9 v0.2.4 API Reference" +metadata: + description: "API documentation for WETH9 in Solidity, version v0.2.4." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## WETH9 + +Wrapped Ether implementation. + +[WETH9](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.4/src/shared/WETH9.sol) + +## Variables + +### allowance + +```solidity +mapping(address => mapping(address => uint256)) allowance +``` + +### balanceOf + +```solidity +mapping(address => uint256) balanceOf +``` + +### decimals + +```solidity +uint8 decimals +``` + +### name + +```solidity +string name +``` + +### symbol + +```solidity +string symbol +``` + +## Events + +### Approval + +```solidity +event Approval(address src, address guy, uint256 wad) +``` + +### Deposit + +```solidity +event Deposit(address dst, uint256 wad) +``` + +### Transfer + +```solidity +event Transfer(address src, address dst, uint256 wad) +``` + +### Withdrawal + +```solidity +event Withdrawal(address src, uint256 wad) +``` + +## Functions + +### \_deposit + +```solidity +function _deposit() internal +``` + +### approve + +```solidity +function approve(address guy, uint256 wad) public returns (bool) +``` + +### deposit + +```solidity +function deposit() external payable +``` + +### receive + +```solidity +receive() external payable +``` + +### totalSupply + +```solidity +function totalSupply() public view returns (uint256) +``` + +### transfer + +```solidity +function transfer(address dst, uint256 wad) public returns (bool) +``` + +### transferFrom + +```solidity +function transferFrom(address src, address dst, uint256 wad) public returns (bool) +``` + +### withdraw + +```solidity +function withdraw(uint256 wad) external +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.5/aggregator-interface.mdx b/src/content/chainlink-local/api-reference/v0.2.5/aggregator-interface.mdx new file mode 100644 index 00000000000..3c8036603b4 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.5/aggregator-interface.mdx @@ -0,0 +1,136 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "AggregatorInterface v0.2.5 API Reference" +metadata: + description: "API documentation for AggregatorInterface in Solidity, version v0.2.5." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## AggregatorInterface + +Basic price feed interface. + +[AggregatorInterface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-feeds/interfaces/AggregatorInterface.sol) + +## Events + +### AnswerUpdated + +```solidity +event AnswerUpdated(int256 current, uint256 roundId, uint256 updatedAt) +``` + +Emitted when the answer is updated. + +#### Parameters + +| Name | Type | Description | +| --------- | ------- | ------------------------------------------------ | +| current | int256 | - The updated answer. | +| roundId | uint256 | - The round ID for which the answer was updated. | +| updatedAt | uint256 | - The timestamp when the answer was updated. | + +### NewRound + +```solidity +event NewRound(uint256 roundId, address startedBy, uint256 startedAt) +``` + +Emitted when a new round is started. + +#### Parameters + +| Name | Type | Description | +| --------- | ------- | ---------------------------------------------------- | +| roundId | uint256 | - The round ID of the new round. | +| startedBy | address | - The address of the account that started the round. | +| startedAt | uint256 | - The timestamp when the round was started. | + +## Functions + +### getAnswer + +```solidity +function getAnswer(uint256 roundId) external view returns (int256) +``` + +Gets the answer for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------- | +| roundId | uint256 | - The round ID to get the answer for. | + +#### Returns + +| Name | Type | Description | +| ---- | ------ | ------------------------------------------- | +| [0] | int256 | int256 - The answer for the given round ID. | + +### getTimestamp + +```solidity +function getTimestamp(uint256 roundId) external view returns (uint256) +``` + +Gets the timestamp for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ---------------------------------------- | +| roundId | uint256 | - The round ID to get the timestamp for. | + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ----------------------------------------------- | +| [0] | uint256 | uint256 - The timestamp for the given round ID. | + +### latestAnswer + +```solidity +function latestAnswer() external view returns (int256) +``` + +Gets the latest answer from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------ | --------------------------- | +| [0] | int256 | int256 - The latest answer. | + +### latestRound + +```solidity +function latestRound() external view returns (uint256) +``` + +Gets the latest round ID from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ------------------------------ | +| [0] | uint256 | uint256 - The latest round ID. | + +### latestTimestamp + +```solidity +function latestTimestamp() external view returns (uint256) +``` + +Gets the timestamp of the latest answer from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | --------------------------------------------- | +| [0] | uint256 | uint256 - The timestamp of the latest answer. | diff --git a/src/content/chainlink-local/api-reference/v0.2.5/aggregator-v2-v3-interface.mdx b/src/content/chainlink-local/api-reference/v0.2.5/aggregator-v2-v3-interface.mdx new file mode 100644 index 00000000000..cd1eb1eda8a --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.5/aggregator-v2-v3-interface.mdx @@ -0,0 +1,18 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "AggregatorV2V3Interface v0.2.5 API Reference" +metadata: + description: "API documentation for AggregatorV2V3Interface in Solidity, version v0.2.5." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## AggregatorV2V3Interface + +Combined V2/V3 price feed interface. + +[AggregatorV2V3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-feeds/interfaces/AggregatorV2V3Interface.sol) diff --git a/src/content/chainlink-local/api-reference/v0.2.5/aggregator-v3-interface.mdx b/src/content/chainlink-local/api-reference/v0.2.5/aggregator-v3-interface.mdx new file mode 100644 index 00000000000..5464f97574c --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.5/aggregator-v3-interface.mdx @@ -0,0 +1,109 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "AggregatorV3Interface v0.2.5 API Reference" +metadata: + description: "API documentation for AggregatorV3Interface in Solidity, version v0.2.5." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## AggregatorV3Interface + +Extended price feed interface. + +[AggregatorV3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-feeds/interfaces/AggregatorV3Interface.sol) + +## Functions + +### decimals + +```solidity +function decimals() external view returns (uint8) +``` + +Gets the number of decimals used by the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ----- | ------------------------------- | +| [0] | uint8 | uint8 - The number of decimals. | + +### description + +```solidity +function description() external view returns (string) +``` + +Gets the description of the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------ | -------------------------------------------------- | +| [0] | string | string memory - The description of the aggregator. | + +### getRoundData + +```solidity +function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the round data for a specific round ID. + +_This function should raise "No data present" if no data is available for the +given round ID._ + +#### Parameters + +| Name | Type | Description | +| --------- | ------ | ----------------------------------- | +| \_roundId | uint80 | - The round ID to get the data for. | + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------ | +| roundId | uint80 | - The round ID. | +| answer | int256 | - The answer for the round. | +| startedAt | uint256 | - The timestamp when the round started. | +| updatedAt | uint256 | - The timestamp when the round was updated. | +| answeredInRound | uint80 | - The round ID in which the answer was computed. | + +### latestRoundData + +```solidity +function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the latest round data. + +_This function should raise "No data present" if no data is available._ + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------------- | +| roundId | uint80 | - The latest round ID. | +| answer | int256 | - The latest answer. | +| startedAt | uint256 | - The timestamp when the latest round started. | +| updatedAt | uint256 | - The timestamp when the latest round was updated. | +| answeredInRound | uint80 | - The round ID in which the latest answer was computed. | + +### version + +```solidity +function version() external view returns (uint256) +``` + +Gets the version of the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ---------------------------------------- | +| [0] | uint256 | uint256 - The version of the aggregator. | diff --git a/src/content/chainlink-local/api-reference/v0.2.5/burn-mint-erc677-helper.mdx b/src/content/chainlink-local/api-reference/v0.2.5/burn-mint-erc677-helper.mdx new file mode 100644 index 00000000000..7dbdd55dc0c --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.5/burn-mint-erc677-helper.mdx @@ -0,0 +1,55 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "BurnMintERC677Helper v0.2.5 API Reference" +metadata: + description: "API documentation for BurnMintERC677Helper in Solidity, version v0.2.5." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## BurnMintERC677Helper + +Helper contract for ERC677 token operations. + +[BurnMintERC677Helper](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/ccip/BurnMintERC677Helper.sol) + +## Functions + +### constructor + +```solidity +constructor(string name, string symbol) public +``` + +Constructor to initialize the BurnMintERC677Helper contract with a name and +symbol. + +_Calls the parent constructor of BurnMintERC677 with fixed decimals (18) and +initial supply (0)._ + +#### Parameters + +| Name | Type | Description | +| ------ | ------ | -------------------------- | +| name | string | - The name of the token. | +| symbol | string | - The symbol of the token. | + +### drip + +```solidity +function drip(address to) external +``` + +Mints one full token (1e18) to the specified address. + +_Calls the internal `_mint` function from the BurnMintERC677 contract._ + +#### Parameters + +| Name | Type | Description | +| ---- | ------- | ------------------------------------------ | +| to | address | - The address to receive the minted token. | diff --git a/src/content/chainlink-local/api-reference/v0.2.5/ccip-local-simulator-fork-js.mdx b/src/content/chainlink-local/api-reference/v0.2.5/ccip-local-simulator-fork-js.mdx new file mode 100644 index 00000000000..bc0c6f9a0ef --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.5/ccip-local-simulator-fork-js.mdx @@ -0,0 +1,86 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalSimulatorFork JS v0.2.5 API Reference" +metadata: + description: "API documentation for the CCIPLocalSimulatorFork JS JavaScript helpers, version v0.2.5." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalSimulatorFork JS + +Hardhat 2 JavaScript helpers for fork routing. + +[CCIPLocalSimulatorFork JS](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/scripts/CCIPLocalSimulatorFork.js) + +## Types + +### Evm2EvmMessage : `Object` + +**Properties** + +| Name | Type | +| ------------------- | ------------------------------------------ | +| sourceChainSelector | `bigint` | +| sender | `string` | +| receiver | `string` | +| sequenceNumber | `bigint` | +| gasLimit | `bigint` | +| strict | `boolean` | +| nonce | `bigint` | +| feeToken | `string` | +| feeTokenAmount | `bigint` | +| data | `string` | +| tokenAmounts | `Array.<\{token: string, amount: bigint}>` | +| sourceTokenData | `Array.` | +| messageId | `string` | + +## Functions + +### requestLinkFromTheFaucet(linkAddress, to, amount) ⇒ `Promise.` + +Requests LINK tokens from the faucet and returns the transaction hash + +**Returns**: `Promise.` - Promise resolving to the +transaction hash of the fund transfer + +| Param | Type | Description | +| ----------- | -------- | ------------------------------------------------------- | +| linkAddress | `string` | The address of the LINK contract on the current network | +| to | `string` | The address to send LINK to | +| amount | `bigint` | The amount of LINK to request | + +### getEvm2EvmMessage(receipt) ⇒ `Evm2EvmMessage` | `null` + +Parses a transaction receipt to extract the sent message Scans through +transaction logs to find a `CCIPSendRequested` event and then decodes it to an +object + +**Returns**: `Evm2EvmMessage` | +`null` - Returns either the sent message or null if provided receipt +does not contain `CCIPSendRequested` log + +| Param | Type | Description | +| ------- | -------- | ------------------------------------------------ | +| receipt | `object` | The transaction receipt from the `ccipSend` call | + +### routeMessage(routerAddress, evm2EvmMessage) ⇒ `Promise.` + +Routes the sent message from the source network on the destination (current) +network + +**Returns**: `Promise.` - Either resolves with no value +if the message is successfully routed, or reverts +**Throws**: + +- `Error` Fails if no off-ramp matches the message's source chain + selector or if calling `router.getOffRamps()` + +| Param | Type | Description | +| -------------- | ---------------- | --------------------------------- | +| routerAddress | `string` | Address of the destination Router | +| evm2EvmMessage | `Evm2EvmMessage` | Sent cross-chain message | diff --git a/src/content/chainlink-local/api-reference/v0.2.5/ccip-local-simulator-fork.mdx b/src/content/chainlink-local/api-reference/v0.2.5/ccip-local-simulator-fork.mdx new file mode 100644 index 00000000000..511fa352ae2 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.5/ccip-local-simulator-fork.mdx @@ -0,0 +1,197 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalSimulatorFork v0.2.5 API Reference" +metadata: + description: "API documentation for CCIPLocalSimulatorFork in Solidity, version v0.2.5." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalSimulatorFork + +CCIP simulator for forked networks. + +[CCIPLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/ccip/CCIPLocalSimulatorFork.sol) + +## Structs + +### OffRamp + +Structure representing an offRamp configuration + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | + +```solidity +struct OffRamp { + uint64 sourceChainSelector; + address offRamp; +} +``` + +## Variables + +### i_register + +```solidity +contract Register i_register +``` + +The immutable register instance + +### LINK_FAUCET + +```solidity +address LINK_FAUCET +``` + +The address of the LINK faucet + +### s_processedMessages + +```solidity +mapping(bytes32 => bool) s_processedMessages +``` + +Mapping to track processed messages + +## Events + +### CCIPSendRequested + +```solidity +event CCIPSendRequested(struct Internal.EVM2EVMMessage message) +``` + +Event emitted when a CCIP send request is made + +#### Parameters + +| Name | Type | Description | +| ------- | ------------------------------ | ----------------------------------- | +| message | struct Internal.EVM2EVMMessage | - The EVM2EVM message that was sent | + +## Functions + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the contract + +### executeSingleMessage + +```solidity +function executeSingleMessage(struct Internal.EVM2EVMMessage message, bytes[] offchainTokenData, uint32[] tokenGasOverrides) external +``` + +Executes a single CCIP message on the offRamp + +#### Parameters + +| Name | Type | Description | +| ----------------- | ------------------------------ | --------------------------------- | +| message | struct Internal.EVM2EVMMessage | - The CCIP message to be executed | +| offchainTokenData | bytes[] | - Additional offchain token data | +| tokenGasOverrides | uint32[] | | + +Works with Foundry only + +### getNetworkDetails + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) +``` + +Returns the default values for currently CCIP supported networks. If network is +not present or some of the values are changed, user can manually add new network +details using the `setNetworkDetails` function. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------------------------------------------------------------------------ | +| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | + +#### Returns + +| Name | Type | Description | +| ---- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | + +### getOffRamps + +```solidity +function getOffRamps() external view returns (struct IRouterFork.OffRamp[]) +``` + +Gets the list of offRamps + +#### Returns + +| Name | Type | Description | +| ---- | ---------------------------- | ----------------------------------- | +| [0] | struct IRouterFork.OffRamp[] | offRamps - Array of OffRamp structs | + +### requestLinkFromFaucet + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------- | +| to | address | - The address to which LINK tokens are to be sent. | +| amount | uint256 | - The amount of LINK tokens to send. | + +#### Returns + +| Name | Type | Description | +| ------- | ---- | ----------------------------------------------------------------------------- | +| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | + +### setNetworkDetails + +```solidity +function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external +``` + +If network details are not present or some of the values are changed, user can +manually add new network details using the `setNetworkDetails` function. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | +| networkDetails | struct Register.NetworkDetails | - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | + +### switchChainAndRouteMessage + +```solidity +function switchChainAndRouteMessage(uint256 forkId) external +``` + +To be called after the sending of the cross-chain message (`ccipSend`). Goes +through the list of past logs and looks for the `CCIPSendRequested` event. +Switches to a destination network fork. Routes the sent cross-chain message on +the destination network. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------------------------------------------------------------------- | +| forkId | uint256 | - The ID of the destination network fork. This is the returned value of `createFork()` or `createSelectFork()` | diff --git a/src/content/chainlink-local/api-reference/v0.2.5/ccip-local-simulator.mdx b/src/content/chainlink-local/api-reference/v0.2.5/ccip-local-simulator.mdx new file mode 100644 index 00000000000..c33f11dd80d --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.5/ccip-local-simulator.mdx @@ -0,0 +1,233 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalSimulator v0.2.5 API Reference" +metadata: + description: "API documentation for CCIPLocalSimulator in Solidity, version v0.2.5." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalSimulator + +Local CCIP simulator (no-fork mode). + +[CCIPLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/ccip/CCIPLocalSimulator.sol) + +## Variables + +### CHAIN_SELECTOR + +```solidity +uint64 CHAIN_SELECTOR +``` + +The unique CCIP Chain Selector constant + +### i_ccipBnM + +```solidity +contract BurnMintERC677Helper i_ccipBnM +``` + +The BurnMintERC677Helper instance for CCIP-BnM token + +### i_ccipLnM + +```solidity +contract BurnMintERC677Helper i_ccipLnM +``` + +The BurnMintERC677Helper instance for CCIP-LnM token + +### i_linkToken + +```solidity +contract LinkToken i_linkToken +``` + +The LINK token instance + +### i_mockRouter + +```solidity +contract MockCCIPRouter i_mockRouter +``` + +The mock CCIP router instance + +### i_wrappedNative + +```solidity +contract WETH9 i_wrappedNative +``` + +The wrapped native token instance + +### s_supportedTokens + +```solidity +address[] s_supportedTokens +``` + +The list of supported token addresses + +## Errors + +### CCIPLocalSimulator\_\_MsgSenderIsNotTokenOwner + +```solidity +error CCIPLocalSimulator__MsgSenderIsNotTokenOwner() +``` + +### CCIPLocalSimulator\_\_RequiredRoleNotFound + +```solidity +error CCIPLocalSimulator__RequiredRoleNotFound(address account, bytes32 role, address token) +``` + +## Functions + +### configuration + +```solidity +function configuration() public view returns (uint64 chainSelector_, contract IRouterClient sourceRouter_, contract IRouterClient destinationRouter_, contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract BurnMintERC677Helper ccipBnM_, contract BurnMintERC677Helper ccipLnM_) +``` + +Returns configuration details for pre-deployed contracts and services needed for +local CCIP simulations. + +#### Returns + +| Name | Type | Description | +| ------------------- | ----------------------------- | ----------------------------------------------------------- | +| chainSelector\_ | uint64 | - The unique CCIP Chain Selector. | +| sourceRouter\_ | contract IRouterClient | - The source chain Router contract. | +| destinationRouter\_ | contract IRouterClient | - The destination chain Router contract. | +| wrappedNative\_ | contract WETH9 | - The wrapped native token which can be used for CCIP fees. | +| linkToken\_ | contract LinkToken | - The LINK token. | +| ccipBnM\_ | contract BurnMintERC677Helper | - The ccipBnM token. | +| ccipLnM\_ | contract BurnMintERC677Helper | - The ccipLnM token. | + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the contract and pre-deployed token instances + +### getSupportedTokens + +```solidity +function getSupportedTokens(uint64 chainSelector) external view returns (address[] tokens) +``` + +Gets a list of token addresses that are supported for cross-chain transfers by +the simulator. + +#### Parameters + +| Name | Type | Description | +| ------------- | ------ | --------------------------------- | +| chainSelector | uint64 | - The unique CCIP Chain Selector. | + +#### Returns + +| Name | Type | Description | +| ------ | --------- | -------------------------------------------------------------------------------------------------- | +| tokens | address[] | - Returns a list of token addresses that are supported for cross-chain transfers by the simulator. | + +### isChainSupported + +```solidity +function isChainSupported(uint64 chainSelector) public pure returns (bool supported) +``` + +Checks whether the provided `chainSelector` is supported by the simulator. + +#### Parameters + +| Name | Type | Description | +| ------------- | ------ | --------------------------------- | +| chainSelector | uint64 | - The unique CCIP Chain Selector. | + +#### Returns + +| Name | Type | Description | +| --------- | ---- | ---------------------------------------------------------------- | +| supported | bool | - Returns true if `chainSelector` is supported by the simulator. | + +### requestLinkFromFaucet + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------- | +| to | address | - The address to which LINK tokens are to be sent. | +| amount | uint256 | - The amount of LINK tokens to send. | + +#### Returns + +| Name | Type | Description | +| ------- | ---- | ----------------------------------------------------------------------------- | +| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | + +### supportNewTokenViaAccessControlDefaultAdmin + +```solidity +function supportNewTokenViaAccessControlDefaultAdmin(address tokenAddress) external +``` + +Allows user to support any new token, besides CCIP BnM and CCIP LnM, for +cross-chain transfers. The caller must have the DEFAULT_ADMIN_ROLE as defined by +the contract itself. Reverts if the caller is not the admin of the token using +OZ's AccessControl DEFAULT_ADMIN_ROLE. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ------------------------------------------------------------------ | +| tokenAddress | address | - The address of the token to add to the list of supported tokens. | + +### supportNewTokenViaGetCCIPAdmin + +```solidity +function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external +``` + +Allows user to support any new token, besides CCIP BnM and CCIP LnM, for +cross-chain transfers. Reverts if token does not implement getCCIPAdmin() +function. Reverts if the caller is not the token CCIPAdmin. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ------------------------------------------------------------------ | +| tokenAddress | address | - The address of the token to add to the list of supported tokens. | + +### supportNewTokenViaOwner + +```solidity +function supportNewTokenViaOwner(address tokenAddress) external +``` + +Allows user to support any new token, besides CCIP BnM and CCIP LnM, for +cross-chain transfers. Reverts if token does not implement owner() function. +Reverts if the caller is not the token owner. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ------------------------------------------------------------------ | +| tokenAddress | address | - The address of the token to add to the list of supported tokens. | diff --git a/src/content/chainlink-local/api-reference/v0.2.5/data-streams-local-simulator-fork.mdx b/src/content/chainlink-local/api-reference/v0.2.5/data-streams-local-simulator-fork.mdx new file mode 100644 index 00000000000..e81877c801e --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.5/data-streams-local-simulator-fork.mdx @@ -0,0 +1,121 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "DataStreamsLocalSimulatorFork v0.2.5 API Reference" +metadata: + description: "API documentation for DataStreamsLocalSimulatorFork in Solidity, version v0.2.5." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## DataStreamsLocalSimulatorFork + +Data Streams simulator for forked networks. + +[DataStreamsLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-streams/DataStreamsLocalSimulatorFork.sol) + +## Variables + +### i_register + +```solidity +contract Register i_register +``` + +The immutable register instance + +### LINK_FAUCET + +```solidity +address LINK_FAUCET +``` + +The address of the LINK faucet + +## Functions + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the contract + +### getNetworkDetails + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) +``` + +Returns the default values for currently Data Streams supported networks. If +network is not present or some of the values are changed, user can manually add +new network details using the `setNetworkDetails` function. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ----------------------------------------------------------------------------- | +| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | + +#### Returns + +| Name | Type | Description | +| ---- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | + +### requestLinkFromFaucet + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------- | +| to | address | - The address to which LINK tokens are to be sent. | +| amount | uint256 | - The amount of LINK tokens to send. | + +#### Returns + +| Name | Type | Description | +| ------- | ---- | ----------------------------------------------------------------------------- | +| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | + +### requestNativeFromFaucet + +```solidity +function requestNativeFromFaucet(address to, uint256 amount) external +``` + +Requests native coints from the faucet. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | --------------------------------------------------- | +| to | address | - The address to which native coins are to be sent. | +| amount | uint256 | - The amount of native coins to send. | + +### setNetworkDetails + +```solidity +function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external +``` + +If network details are not present or some of the values are changed, user can +manually add new network details using the `setNetworkDetails` function. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- | +| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | +| networkDetails | struct Register.NetworkDetails | - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | diff --git a/src/content/chainlink-local/api-reference/v0.2.5/data-streams-local-simulator.mdx b/src/content/chainlink-local/api-reference/v0.2.5/data-streams-local-simulator.mdx new file mode 100644 index 00000000000..f0354aeed91 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.5/data-streams-local-simulator.mdx @@ -0,0 +1,110 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "DataStreamsLocalSimulator v0.2.5 API Reference" +metadata: + description: "API documentation for DataStreamsLocalSimulator in Solidity, version v0.2.5." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## DataStreamsLocalSimulator + +Local Data Streams simulator (no-fork mode). + +[DataStreamsLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-streams/DataStreamsLocalSimulator.sol) + +## Variables + +### i_linkToken + +```solidity +contract LinkToken i_linkToken +``` + +The LINK token instance + +### i_wrappedNative + +```solidity +contract WETH9 i_wrappedNative +``` + +The wrapped native token instance + +### s_mockFeeManager + +```solidity +contract MockFeeManager s_mockFeeManager +``` + +### s_mockRewardManager + +```solidity +contract MockRewardManager s_mockRewardManager +``` + +### s_mockVerifier + +```solidity +contract MockVerifier s_mockVerifier +``` + +### s_mockVerifierProxy + +```solidity +contract MockVerifierProxy s_mockVerifierProxy +``` + +## Functions + +### configuration + +```solidity +function configuration() public view returns (contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract MockVerifier mockVerifier_, contract MockVerifierProxy mockVerifierProxy_, contract MockFeeManager mockFeeManager_, contract MockRewardManager mockRewardManager_) +``` + +@notice Returns configuration details for pre-deployed contracts and services +needed for local Data Streams simulations. + +#### Returns + +| Name | Type | Description | +| ------------------- | -------------------------- | ----------------------------------- | +| wrappedNative\_ | contract WETH9 | - The wrapped native token. | +| linkToken\_ | contract LinkToken | - The LINK token. | +| mockVerifier\_ | contract MockVerifier | - The mock verifier contract. | +| mockVerifierProxy\_ | contract MockVerifierProxy | - The mock verifier proxy contract. | +| mockFeeManager\_ | contract MockFeeManager | - The mock fee manager contract. | +| mockRewardManager\_ | contract MockRewardManager | - The mock reward manager contract. | + +### constructor + +```solidity +constructor() public +``` + +### requestLinkFromFaucet + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------- | +| to | address | - The address to which LINK tokens are to be sent. | +| amount | uint256 | - The amount of LINK tokens to send. | + +#### Returns + +| Name | Type | Description | +| ------- | ---- | ----------------------------------------------------------------------------- | +| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | diff --git a/src/content/chainlink-local/api-reference/v0.2.5/data-streams-register.mdx b/src/content/chainlink-local/api-reference/v0.2.5/data-streams-register.mdx new file mode 100644 index 00000000000..cc32de4b256 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.5/data-streams-register.mdx @@ -0,0 +1,84 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Register (Data Streams) v0.2.5 API Reference" +metadata: + description: "API documentation for Register (Data Streams) in Solidity, version v0.2.5." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## Register (Data Streams) + +Data Streams network configuration registry. + +[Register (Data Streams)](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-streams/Register.sol) + +## Structs + +### NetworkDetails + +```solidity +struct NetworkDetails { + address verifierProxyAddress; + address linkAddress; +} +``` + +## Variables + +### s_networkDetails + +```solidity +mapping(uint256 => struct Register.NetworkDetails) s_networkDetails +``` + +Mapping to store network details based on chain ID. + +## Functions + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the network details for various chains. + +### getNetworkDetails + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails networkDetails) +``` + +Retrieves network details for a given chain ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | --------------------------------------------- | +| chainId | uint256 | - The ID of the chain to get the details for. | + +#### Returns + +| Name | Type | Description | +| -------------- | ------------------------------ | ------------------------------------------------- | +| networkDetails | struct Register.NetworkDetails | - The network details for the specified chain ID. | + +### setNetworkDetails + +```solidity +function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external +``` + +Sets the network details for a given chain ID. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------------------------------ | -------------------------------------------------------- | +| chainId | uint256 | - The ID of the chain to set the details for. | +| networkDetails | struct Register.NetworkDetails | - The network details to set for the specified chain ID. | diff --git a/src/content/chainlink-local/api-reference/v0.2.5/index.mdx b/src/content/chainlink-local/api-reference/v0.2.5/index.mdx new file mode 100644 index 00000000000..b72681a4c0f --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.5/index.mdx @@ -0,0 +1,56 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Chainlink Local v0.2.5 API Reference" +metadata: + description: "API reference documentation for Chainlink Local v0.2.5" +isIndex: true +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +Chainlink Local v0.2.5 upgrades to CCIP v1.6: it pins `@chainlink/contracts-ccip` 1.6.0 and `@chainlink/contracts` 1.4.0, the fork simulator routes messages on 1.6 lanes, and the JavaScript helper gains `getEvm2AnyRampMessage` for parsing 1.6 `CCIPMessageSent` events. + +## CCIP + +These contracts provide Cross-Chain Interoperability Protocol (CCIP) functionality in a local testing environment: + +- [CCIPLocalSimulator](/chainlink-local/api-reference/v0.2.5/ccip-local-simulator) - Local CCIP simulator (no-fork mode) +- [CCIPLocalSimulatorFork](/chainlink-local/api-reference/v0.2.5/ccip-local-simulator-fork) - CCIP simulator for forked networks +- [CCIPLocalSimulatorFork JS](/chainlink-local/api-reference/v0.2.5/ccip-local-simulator-fork-js) - JavaScript helpers for fork routing +- [Register](/chainlink-local/api-reference/v0.2.5/register) - CCIP network configuration registry + +## Data Streams + +Contracts for simulating Chainlink Data Streams: + +- [DataStreamsLocalSimulator](/chainlink-local/api-reference/v0.2.5/data-streams-local-simulator) - Local Data Streams simulator (no-fork mode) +- [DataStreamsLocalSimulatorFork](/chainlink-local/api-reference/v0.2.5/data-streams-local-simulator-fork) - Data Streams simulator for forked networks +- [MockVerifier](/chainlink-local/api-reference/v0.2.5/mock-verifier) - Mock Data Streams verifier +- [MockVerifierProxy](/chainlink-local/api-reference/v0.2.5/mock-verifier-proxy) - Mock Data Streams verifier proxy +- [MockReportGenerator](/chainlink-local/api-reference/v0.2.5/mock-report-generator) - Signed report generator for every report schema +- [MockFeeManager](/chainlink-local/api-reference/v0.2.5/mock-fee-manager) - Mock verifier fee manager +- [MockRewardManager](/chainlink-local/api-reference/v0.2.5/mock-reward-manager) - Mock reward manager +- [ReportVersions](/chainlink-local/api-reference/v0.2.5/report-versions) - Data Streams report schemas +- [Register (Data Streams)](/chainlink-local/api-reference/v0.2.5/data-streams-register) - Data Streams network configuration registry + +## Data Feeds + +Contracts for simulating Chainlink Data Feeds: + +- [AggregatorInterface](/chainlink-local/api-reference/v0.2.5/aggregator-interface) - Basic price feed interface +- [AggregatorV2V3Interface](/chainlink-local/api-reference/v0.2.5/aggregator-v2-v3-interface) - Combined V2/V3 price feed interface +- [AggregatorV3Interface](/chainlink-local/api-reference/v0.2.5/aggregator-v3-interface) - Extended price feed interface +- [MockOffchainAggregator](/chainlink-local/api-reference/v0.2.5/mock-offchain-aggregator) - Mock implementation of off-chain aggregator +- [MockV3Aggregator](/chainlink-local/api-reference/v0.2.5/mock-v3-aggregator) - Mock implementation of V3 aggregator + +## Token Contracts + +Standard token implementations for testing: + +- [BurnMintERC677Helper](/chainlink-local/api-reference/v0.2.5/burn-mint-erc677-helper) - Helper contract for ERC677 token operations +- [LinkToken](/chainlink-local/api-reference/v0.2.5/link-token) - LINK token implementation +- [WETH9](/chainlink-local/api-reference/v0.2.5/weth9) - Wrapped Ether implementation diff --git a/src/content/chainlink-local/api-reference/v0.2.5/link-token.mdx b/src/content/chainlink-local/api-reference/v0.2.5/link-token.mdx new file mode 100644 index 00000000000..cf5dcfba961 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.5/link-token.mdx @@ -0,0 +1,44 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "LinkToken v0.2.5 API Reference" +metadata: + description: "API documentation for LinkToken in Solidity, version v0.2.5." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## LinkToken + +LINK token implementation. + +[LinkToken](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/shared/LinkToken.sol) + +## Functions + +### \_onCreate + +```solidity +function _onCreate() internal virtual +``` + +Hook that is called when this contract is created. + +_Useful to override constructor behaviour in child contracts (e.g., LINK bridge +tokens). The default implementation mints 10\*\*27 tokens to the contract +deployer._ + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the LinkToken contract with a fixed total supply, +name, and symbol. + +_Calls the ERC677 constructor with the name and symbol, and then mints the total +supply to the contract deployer._ diff --git a/src/content/chainlink-local/api-reference/v0.2.5/mock-fee-manager.mdx b/src/content/chainlink-local/api-reference/v0.2.5/mock-fee-manager.mdx new file mode 100644 index 00000000000..a016d17ccfc --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.5/mock-fee-manager.mdx @@ -0,0 +1,174 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockFeeManager v0.2.5 API Reference" +metadata: + description: "API documentation for MockFeeManager in Solidity, version v0.2.5." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockFeeManager + +Mock verifier fee manager. + +[MockFeeManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-streams/MockFeeManager.sol) + +## Structs + +### Asset + +```solidity +struct Asset { + address assetAddress; + uint256 amount; +} +``` + +## Variables + +### i_linkAddress + +```solidity +address i_linkAddress +``` + +### i_nativeAddress + +```solidity +address i_nativeAddress +``` + +### i_proxyAddress + +```solidity +address i_proxyAddress +``` + +### i_rewardManager + +```solidity +contract IRewardManager i_rewardManager +``` + +### s_mockDiscounts + +```solidity +mapping(address => uint256) s_mockDiscounts +``` + +### s_nativeSurcharge + +```solidity +uint256 s_nativeSurcharge +``` + +## Errors + +### ExpiredReport + +```solidity +error ExpiredReport() +``` + +### InvalidAddress + +```solidity +error InvalidAddress() +``` + +### InvalidDeposit + +```solidity +error InvalidDeposit() +``` + +### InvalidDiscount + +```solidity +error InvalidDiscount() +``` + +### InvalidQuote + +```solidity +error InvalidQuote() +``` + +### InvalidSurcharge + +```solidity +error InvalidSurcharge() +``` + +### Unauthorized + +```solidity +error Unauthorized() +``` + +## Functions + +### \_processFee + +```solidity +function _processFee(bytes payload, bytes parameterPayload, address subscriber) internal +``` + +### constructor + +```solidity +constructor(address linkAddress, address nativeAddress, address proxyAddress, address rewardManager) public +``` + +### getFeeAndReward + +```solidity +function getFeeAndReward(address subscriber, bytes report, address quoteAddress) public view returns (struct Common.Asset, struct Common.Asset, uint256) +``` + +### getMockDiscount + +```solidity +function getMockDiscount(address subscriber) external view returns (uint256) +``` + +### processFee + +```solidity +function processFee(bytes payload, bytes parameterPayload, address subscriber) external payable +``` + +### processFeeBulk + +```solidity +function processFeeBulk(bytes[] payloads, bytes parameterPayload, address subscriber) external payable +``` + +### setMockDiscount + +```solidity +function setMockDiscount(address subscriber, uint256 discount) external +``` + +### setNativeSurcharge + +```solidity +function setNativeSurcharge(uint64 surcharge) external +``` + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) external pure returns (bool) +``` + +\_Returns true if this contract implements the interface defined by +`interfaceId`. See the corresponding +https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP +section] to learn more about how these ids are created. + +This function call must use less than 30 000 gas.\_ diff --git a/src/content/chainlink-local/api-reference/v0.2.5/mock-offchain-aggregator.mdx b/src/content/chainlink-local/api-reference/v0.2.5/mock-offchain-aggregator.mdx new file mode 100644 index 00000000000..75d2ef3c0b2 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.5/mock-offchain-aggregator.mdx @@ -0,0 +1,190 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockOffchainAggregator v0.2.5 API Reference" +metadata: + description: "API documentation for MockOffchainAggregator in Solidity, version v0.2.5." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockOffchainAggregator + +Mock implementation of off-chain aggregator. + +[MockOffchainAggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-feeds/MockOffchainAggregator.sol) + +## Variables + +### decimals + +```solidity +uint8 decimals +``` + +The number of decimals used by the aggregator. + +### getAnswer + +```solidity +mapping(uint256 => int256) getAnswer +``` + +Mapping to get the answer for a specific round ID. + +### getTimestamp + +```solidity +mapping(uint256 => uint256) getTimestamp +``` + +Mapping to get the timestamp for a specific round ID. + +### latestAnswer + +```solidity +int256 latestAnswer +``` + +The latest answer reported by the aggregator. + +### latestRound + +```solidity +uint256 latestRound +``` + +The latest round ID. + +### latestTimestamp + +```solidity +uint256 latestTimestamp +``` + +The timestamp of the latest answer. + +### maxAnswer + +```solidity +int192 maxAnswer +``` + +The maximum answer the aggregator is allowed to report. + +### minAnswer + +```solidity +int192 minAnswer +``` + +The minimum answer the aggregator is allowed to report. + +## Functions + +### constructor + +```solidity +constructor(uint8 _decimals, int256 _initialAnswer) public +``` + +Constructor to initialize the MockOffchainAggregator contract with initial +parameters. + +#### Parameters + +| Name | Type | Description | +| --------------- | ------ | ------------------------------------------------------ | +| \_decimals | uint8 | - The number of decimals for the aggregator. | +| \_initialAnswer | int256 | - The initial answer to be set in the mock aggregator. | + +### getRoundData + +```solidity +function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the round data for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| --------- | ------ | ----------------------------------- | +| \_roundId | uint80 | - The round ID to get the data for. | + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------ | +| roundId | uint80 | - The round ID. | +| answer | int256 | - The answer for the round. | +| startedAt | uint256 | - The timestamp when the round started. | +| updatedAt | uint256 | - The timestamp when the round was updated. | +| answeredInRound | uint80 | - The round ID in which the answer was computed. | + +### latestRoundData + +```solidity +function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the latest round data. + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------------- | +| roundId | uint80 | - The latest round ID. | +| answer | int256 | - The latest answer. | +| startedAt | uint256 | - The timestamp when the latest round started. | +| updatedAt | uint256 | - The timestamp when the latest round was updated. | +| answeredInRound | uint80 | - The round ID in which the latest answer was computed. | + +### updateAnswer + +```solidity +function updateAnswer(int256 _answer) public +``` + +Updates the answer in the mock aggregator. + +#### Parameters + +| Name | Type | Description | +| -------- | ------ | --------------------------- | +| \_answer | int256 | - The new answer to be set. | + +### updateMinAndMaxAnswers + +```solidity +function updateMinAndMaxAnswers(int192 _minAnswer, int192 _maxAnswer) external +``` + +Updates the minimum and maximum answers the aggregator can report. + +#### Parameters + +| Name | Type | Description | +| ----------- | ------ | ------------------------- | +| \_minAnswer | int192 | - The new minimum answer. | +| \_maxAnswer | int192 | - The new maximum answer. | + +### updateRoundData + +```solidity +function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public +``` + +Updates the round data in the mock aggregator. + +#### Parameters + +| Name | Type | Description | +| ----------- | ------- | --------------------------------------- | +| \_roundId | uint80 | - The round ID to be updated. | +| \_answer | int256 | - The new answer to be set. | +| \_timestamp | uint256 | - The timestamp to be set. | +| \_startedAt | uint256 | - The timestamp when the round started. | diff --git a/src/content/chainlink-local/api-reference/v0.2.5/mock-report-generator.mdx b/src/content/chainlink-local/api-reference/v0.2.5/mock-report-generator.mdx new file mode 100644 index 00000000000..3294ad190f1 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.5/mock-report-generator.mdx @@ -0,0 +1,192 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockReportGenerator v0.2.5 API Reference" +metadata: + description: "API documentation for MockReportGenerator in Solidity, version v0.2.5." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockReportGenerator + +Signed report generator for every report schema. + +[MockReportGenerator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-streams/MockReportGenerator.sol) + +## Variables + +### i_donAddress + +```solidity +address i_donAddress +``` + +### i_donDigest + +```solidity +uint256 i_donDigest +``` + +### i_reportV2MockFeedId + +```solidity +bytes32 i_reportV2MockFeedId +``` + +### i_reportV3MockFeedId + +```solidity +bytes32 i_reportV3MockFeedId +``` + +### i_reportV4MockFeedId + +```solidity +bytes32 i_reportV4MockFeedId +``` + +### s_ask + +```solidity +int192 s_ask +``` + +### s_bid + +```solidity +int192 s_bid +``` + +### s_expiresPeriod + +```solidity +uint32 s_expiresPeriod +``` + +### s_linkFee + +```solidity +uint192 s_linkFee +``` + +### s_marketStatus + +```solidity +uint32 s_marketStatus +``` + +### s_nativeFee + +```solidity +uint192 s_nativeFee +``` + +### s_price + +```solidity +int192 s_price +``` + +## Errors + +### MockReportGenerator\_\_CastOverflow + +```solidity +error MockReportGenerator__CastOverflow() +``` + +### MockReportGenerator\_\_InvalidAsk + +```solidity +error MockReportGenerator__InvalidAsk() +``` + +### MockReportGenerator\_\_InvalidBid + +```solidity +error MockReportGenerator__InvalidBid() +``` + +## Functions + +### constructor + +```solidity +constructor(int192 initialPrice) public +``` + +### generateReport + +```solidity +function generateReport(struct ReportVersions.ReportV2 report) external returns (bytes signedReport) +``` + +### generateReport + +```solidity +function generateReport(struct ReportVersions.ReportV3 report) external returns (bytes signedReport) +``` + +### generateReport + +```solidity +function generateReport(struct ReportVersions.ReportV4 report) external returns (bytes signedReport) +``` + +### generateReportV2 + +```solidity +function generateReportV2() external returns (bytes signedReport, struct ReportVersions.ReportV2 report) +``` + +### generateReportV3 + +```solidity +function generateReportV3() external returns (bytes signedReport, struct ReportVersions.ReportV3 report) +``` + +### generateReportV4 + +```solidity +function generateReportV4() external returns (bytes signedReport, struct ReportVersions.ReportV4 report) +``` + +### getMockDonAddress + +```solidity +function getMockDonAddress() external view returns (address) +``` + +### updateExpiresPeriod + +```solidity +function updateExpiresPeriod(uint32 period) external +``` + +### updateFees + +```solidity +function updateFees(uint192 nativeFee, uint192 linkFee) external +``` + +### updateMarketStatus + +```solidity +function updateMarketStatus(uint32 status) external +``` + +### updatePrice + +```solidity +function updatePrice(int192 price) public +``` + +### updatePriceBidAndAsk + +```solidity +function updatePriceBidAndAsk(int192 price, int192 bid, int192 ask) external +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.5/mock-reward-manager.mdx b/src/content/chainlink-local/api-reference/v0.2.5/mock-reward-manager.mdx new file mode 100644 index 00000000000..0b7b6054bbb --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.5/mock-reward-manager.mdx @@ -0,0 +1,87 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockRewardManager v0.2.5 API Reference" +metadata: + description: "API documentation for MockRewardManager in Solidity, version v0.2.5." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockRewardManager + +Mock reward manager. + +[MockRewardManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-streams/MockRewardManager.sol) + +## Variables + +### i_linkAddress + +```solidity +address i_linkAddress +``` + +### s_feeManagerAddress + +```solidity +address s_feeManagerAddress +``` + +## Errors + +### Unauthorized + +```solidity +error Unauthorized() +``` + +## Events + +### FeePaid + +```solidity +event FeePaid(struct IRewardManager.FeePayment[] payments, address payer) +``` + +## Functions + +### claimRewards + +```solidity +function claimRewards(bytes32[]) external pure +``` + +### constructor + +```solidity +constructor(address linkAddress) public +``` + +### onFeePaid + +```solidity +function onFeePaid(struct IRewardManager.FeePayment[] payments, address payer) external +``` + +### setFeeManager + +```solidity +function setFeeManager(address newFeeManager) external +``` + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) external pure returns (bool) +``` + +\_Returns true if this contract implements the interface defined by +`interfaceId`. See the corresponding +https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP +section] to learn more about how these ids are created. + +This function call must use less than 30 000 gas.\_ diff --git a/src/content/chainlink-local/api-reference/v0.2.5/mock-v3-aggregator.mdx b/src/content/chainlink-local/api-reference/v0.2.5/mock-v3-aggregator.mdx new file mode 100644 index 00000000000..1df6714b053 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.5/mock-v3-aggregator.mdx @@ -0,0 +1,277 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockV3Aggregator v0.2.5 API Reference" +metadata: + description: "API documentation for MockV3Aggregator in Solidity, version v0.2.5." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockV3Aggregator + +Mock implementation of V3 aggregator. + +[MockV3Aggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-feeds/MockV3Aggregator.sol) + +## Variables + +### aggregator + +```solidity +address aggregator +``` + +The address of the current aggregator. + +### proposedAggregator + +```solidity +address proposedAggregator +``` + +The address of the proposed aggregator. + +### version + +```solidity +uint256 version +``` + +The version of the aggregator. + +## Functions + +### confirmAggregator + +```solidity +function confirmAggregator(address _aggregator) external +``` + +Confirms the proposed aggregator. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ----------------------------------------- | +| \_aggregator | address | - The address of the proposed aggregator. | + +### constructor + +```solidity +constructor(uint8 _decimals, int256 _initialAnswer) public +``` + +Constructor to initialize the MockV3Aggregator contract with initial parameters. + +#### Parameters + +| Name | Type | Description | +| --------------- | ------ | ------------------------------------------------------ | +| \_decimals | uint8 | - The number of decimals for the aggregator. | +| \_initialAnswer | int256 | - The initial answer to be set in the mock aggregator. | + +### decimals + +```solidity +function decimals() external view returns (uint8) +``` + +Gets the number of decimals used by the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ----- | ------------------------------- | +| [0] | uint8 | uint8 - The number of decimals. | + +### description + +```solidity +function description() external pure returns (string) +``` + +Gets the description of the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------ | -------------------------------------------------- | +| [0] | string | string memory - The description of the aggregator. | + +### getAnswer + +```solidity +function getAnswer(uint256 roundId) external view returns (int256) +``` + +Gets the answer for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------- | +| roundId | uint256 | - The round ID to get the answer for. | + +#### Returns + +| Name | Type | Description | +| ---- | ------ | ------------------------------------------- | +| [0] | int256 | int256 - The answer for the given round ID. | + +### getRoundData + +```solidity +function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the round data for a specific round ID. + +_This function should raise "No data present" if no data is available for the +given round ID._ + +#### Parameters + +| Name | Type | Description | +| --------- | ------ | ----------------------------------- | +| \_roundId | uint80 | - The round ID to get the data for. | + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------ | +| roundId | uint80 | - The round ID. | +| answer | int256 | - The answer for the round. | +| startedAt | uint256 | - The timestamp when the round started. | +| updatedAt | uint256 | - The timestamp when the round was updated. | +| answeredInRound | uint80 | - The round ID in which the answer was computed. | + +### getTimestamp + +```solidity +function getTimestamp(uint256 roundId) external view returns (uint256) +``` + +Gets the timestamp for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ---------------------------------------- | +| roundId | uint256 | - The round ID to get the timestamp for. | + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ----------------------------------------------- | +| [0] | uint256 | uint256 - The timestamp for the given round ID. | + +### latestAnswer + +```solidity +function latestAnswer() external view returns (int256) +``` + +Gets the latest answer from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------ | --------------------------- | +| [0] | int256 | int256 - The latest answer. | + +### latestRound + +```solidity +function latestRound() external view returns (uint256) +``` + +Gets the latest round ID from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ------------------------------ | +| [0] | uint256 | uint256 - The latest round ID. | + +### latestRoundData + +```solidity +function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the latest round data. + +_This function should raise "No data present" if no data is available._ + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------------- | +| roundId | uint80 | - The latest round ID. | +| answer | int256 | - The latest answer. | +| startedAt | uint256 | - The timestamp when the latest round started. | +| updatedAt | uint256 | - The timestamp when the latest round was updated. | +| answeredInRound | uint80 | - The round ID in which the latest answer was computed. | + +### latestTimestamp + +```solidity +function latestTimestamp() external view returns (uint256) +``` + +Gets the timestamp of the latest answer from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | --------------------------------------------- | +| [0] | uint256 | uint256 - The timestamp of the latest answer. | + +### proposeAggregator + +```solidity +function proposeAggregator(contract AggregatorV2V3Interface _aggregator) external +``` + +Proposes a new aggregator. + +#### Parameters + +| Name | Type | Description | +| ------------ | -------------------------------- | ----------------------------------------- | +| \_aggregator | contract AggregatorV2V3Interface | - The address of the proposed aggregator. | + +### updateAnswer + +```solidity +function updateAnswer(int256 _answer) public +``` + +Updates the answer in the mock aggregator. + +#### Parameters + +| Name | Type | Description | +| -------- | ------ | --------------------------- | +| \_answer | int256 | - The new answer to be set. | + +### updateRoundData + +```solidity +function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public +``` + +Updates the round data in the mock aggregator. + +#### Parameters + +| Name | Type | Description | +| ----------- | ------- | --------------------------------------- | +| \_roundId | uint80 | - The round ID to be updated. | +| \_answer | int256 | - The new answer to be set. | +| \_timestamp | uint256 | - The timestamp to be set. | +| \_startedAt | uint256 | - The timestamp when the round started. | diff --git a/src/content/chainlink-local/api-reference/v0.2.5/mock-verifier-proxy.mdx b/src/content/chainlink-local/api-reference/v0.2.5/mock-verifier-proxy.mdx new file mode 100644 index 00000000000..d80d948156e --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.5/mock-verifier-proxy.mdx @@ -0,0 +1,98 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockVerifierProxy v0.2.5 API Reference" +metadata: + description: "API documentation for MockVerifierProxy in Solidity, version v0.2.5." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockVerifierProxy + +Mock Data Streams verifier proxy. + +[MockVerifierProxy](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-streams/MockVerifierProxy.sol) + +## Variables + +### s_feeManager + +```solidity +contract IVerifierFeeManager s_feeManager +``` + +### s_verifier + +```solidity +address s_verifier +``` + +## Errors + +### VerifierInvalid + +```solidity +error VerifierInvalid() +``` + +### VerifierNotFound + +```solidity +error VerifierNotFound() +``` + +### ZeroAddress + +```solidity +error ZeroAddress() +``` + +## Events + +### VerifierInitialized + +```solidity +event VerifierInitialized(address verifierAddress) +``` + +## Functions + +### \_verify + +```solidity +function _verify(bytes payload) internal returns (bytes) +``` + +### getVerifier + +```solidity +function getVerifier(bytes32) external view returns (address) +``` + +### initializeVerifier + +```solidity +function initializeVerifier(address verifierAddress) external +``` + +### setFeeManager + +```solidity +function setFeeManager(contract IVerifierFeeManager feeManager) external +``` + +### verify + +```solidity +function verify(bytes payload, bytes parameterPayload) external payable returns (bytes) +``` + +### verifyBulk + +```solidity +function verifyBulk(bytes[] payloads, bytes parameterPayload) external payable returns (bytes[] verifiedReports) +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.5/mock-verifier.mdx b/src/content/chainlink-local/api-reference/v0.2.5/mock-verifier.mdx new file mode 100644 index 00000000000..f6ad09ea08d --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.5/mock-verifier.mdx @@ -0,0 +1,165 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockVerifier v0.2.5 API Reference" +metadata: + description: "API documentation for MockVerifier in Solidity, version v0.2.5." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockVerifier + +Mock Data Streams verifier. + +[MockVerifier](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-streams/MockVerifier.sol) + +## Variables + +### i_verifierProxy + +```solidity +address i_verifierProxy +``` + +### MOCK_DATA_STREAM_DON_ADDRESS + +```solidity +address MOCK_DATA_STREAM_DON_ADDRESS +``` + +### N_2 + +```solidity +uint256 N_2 +``` + +### s_inactiveDigests + +```solidity +mapping(bytes32 => mapping(bytes32 => bool)) s_inactiveDigests +``` + +### s_inactiveFeeds + +```solidity +mapping(bytes32 => bool) s_inactiveFeeds +``` + +### s_verifiedSignatures + +```solidity +mapping(bytes => bool) s_verifiedSignatures +``` + +## Errors + +### AccessForbidden + +```solidity +error AccessForbidden() +``` + +### AlreadyUsedSignature + +```solidity +error AlreadyUsedSignature() +``` + +### BadVerification + +```solidity +error BadVerification() +``` + +### DigestInactive + +```solidity +error DigestInactive(bytes32 feedId, bytes32 configDigest) +``` + +### InactiveFeed + +```solidity +error InactiveFeed(bytes32 feedId) +``` + +### InvalidS + +```solidity +error InvalidS() +``` + +### InvalidSignatureLength + +```solidity +error InvalidSignatureLength() +``` + +### InvalidV + +```solidity +error InvalidV() +``` + +## Events + +### ReportVerified + +```solidity +event ReportVerified(bytes32 feedId, address sender) +``` + +## Functions + +### activateConfig + +```solidity +function activateConfig(bytes32 feedId, bytes32 configDigest) external +``` + +### activateFeed + +```solidity +function activateFeed(bytes32 feedId) external +``` + +### constructor + +```solidity +constructor(address verifierProxy) public +``` + +### deactivateConfig + +```solidity +function deactivateConfig(bytes32 feedId, bytes32 configDigest) external +``` + +### deactivateFeed + +```solidity +function deactivateFeed(bytes32 feedId) external +``` + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) external pure returns (bool) +``` + +\_Returns true if this contract implements the interface defined by +`interfaceId`. See the corresponding +https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP +section] to learn more about how these ids are created. + +This function call must use less than 30 000 gas.\_ + +### verify + +```solidity +function verify(bytes signedReport, address sender) external returns (bytes verifierResponse) +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.5/register.mdx b/src/content/chainlink-local/api-reference/v0.2.5/register.mdx new file mode 100644 index 00000000000..ddabd29f41d --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.5/register.mdx @@ -0,0 +1,91 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Register v0.2.5 API Reference" +metadata: + description: "API documentation for Register in Solidity, version v0.2.5." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## Register + +CCIP network configuration registry. + +[Register](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/ccip/Register.sol) + +## Structs + +### NetworkDetails + +```solidity +struct NetworkDetails { + uint64 chainSelector; + address routerAddress; + address linkAddress; + address wrappedNativeAddress; + address ccipBnMAddress; + address ccipLnMAddress; + address rmnProxyAddress; + address registryModuleOwnerCustomAddress; + address tokenAdminRegistryAddress; +} +``` + +## Variables + +### s_networkDetails + +```solidity +mapping(uint256 => struct Register.NetworkDetails) s_networkDetails +``` + +Mapping to store network details based on chain ID. + +## Functions + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the network details for various chains. + +### getNetworkDetails + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails networkDetails) +``` + +Retrieves network details for a given chain ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | --------------------------------------------- | +| chainId | uint256 | - The ID of the chain to get the details for. | + +#### Returns + +| Name | Type | Description | +| -------------- | ------------------------------ | ------------------------------------------------- | +| networkDetails | struct Register.NetworkDetails | - The network details for the specified chain ID. | + +### setNetworkDetails + +```solidity +function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external +``` + +Sets the network details for a given chain ID. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------------------------------ | -------------------------------------------------------- | +| chainId | uint256 | - The ID of the chain to set the details for. | +| networkDetails | struct Register.NetworkDetails | - The network details to set for the specified chain ID. | diff --git a/src/content/chainlink-local/api-reference/v0.2.5/report-versions.mdx b/src/content/chainlink-local/api-reference/v0.2.5/report-versions.mdx new file mode 100644 index 00000000000..9baa52941ed --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.5/report-versions.mdx @@ -0,0 +1,84 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "ReportVersions v0.2.5 API Reference" +metadata: + description: "API documentation for ReportVersions in Solidity, version v0.2.5." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## ReportVersions + +Data Streams report schemas. + +[ReportVersions](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/data-streams/ReportVersions.sol) + +## Structs + +### ReportV2 + +_Represents a data report from a Data Streams stream for v2 schema (crypto +streams). The `price` value is carried to either 8 or 18 decimal places, +depending on the stream. For more information, see +https://docs.chain.link/data-streams/crypto-streams and +https://docs.chain.link/data-streams/reference/report-schema_ + +```solidity +struct ReportV2 { + bytes32 feedId; + uint32 validFromTimestamp; + uint32 observationsTimestamp; + uint192 nativeFee; + uint192 linkFee; + uint32 expiresAt; + int192 benchmarkPrice; +} +``` + +### ReportV3 + +_Represents a data report from a Data Streams stream for v3 schema (crypto +streams). The `price`, `bid`, and `ask` values are carried to either 8 or 18 +decimal places, depending on the stream. For more information, see +https://docs.chain.link/data-streams/crypto-streams and +https://docs.chain.link/data-streams/reference/report-schema_ + +```solidity +struct ReportV3 { + bytes32 feedId; + uint32 validFromTimestamp; + uint32 observationsTimestamp; + uint192 nativeFee; + uint192 linkFee; + uint32 expiresAt; + int192 price; + int192 bid; + int192 ask; +} +``` + +### ReportV4 + +_Represents a data report from a Data Streams stream for v4 schema (RWA stream). +The `price` value is carried to either 8 or 18 decimal places, depending on the +stream. The `marketStatus` indicates whether the market is currently open. +Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). For more +information, see https://docs.chain.link/data-streams/rwa-streams and +https://docs.chain.link/data-streams/reference/report-schema-v4_ + +```solidity +struct ReportV4 { + bytes32 feedId; + uint32 validFromTimestamp; + uint32 observationsTimestamp; + uint192 nativeFee; + uint192 linkFee; + uint32 expiresAt; + int192 price; + uint32 marketStatus; +} +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.5/weth9.mdx b/src/content/chainlink-local/api-reference/v0.2.5/weth9.mdx new file mode 100644 index 00000000000..9250dce3753 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.5/weth9.mdx @@ -0,0 +1,126 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "WETH9 v0.2.5 API Reference" +metadata: + description: "API documentation for WETH9 in Solidity, version v0.2.5." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## WETH9 + +Wrapped Ether implementation. + +[WETH9](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/src/shared/WETH9.sol) + +## Variables + +### allowance + +```solidity +mapping(address => mapping(address => uint256)) allowance +``` + +### balanceOf + +```solidity +mapping(address => uint256) balanceOf +``` + +### decimals + +```solidity +uint8 decimals +``` + +### name + +```solidity +string name +``` + +### symbol + +```solidity +string symbol +``` + +## Events + +### Approval + +```solidity +event Approval(address src, address guy, uint256 wad) +``` + +### Deposit + +```solidity +event Deposit(address dst, uint256 wad) +``` + +### Transfer + +```solidity +event Transfer(address src, address dst, uint256 wad) +``` + +### Withdrawal + +```solidity +event Withdrawal(address src, uint256 wad) +``` + +## Functions + +### \_deposit + +```solidity +function _deposit() internal +``` + +### approve + +```solidity +function approve(address guy, uint256 wad) public returns (bool) +``` + +### deposit + +```solidity +function deposit() external payable +``` + +### receive + +```solidity +receive() external payable +``` + +### totalSupply + +```solidity +function totalSupply() public view returns (uint256) +``` + +### transfer + +```solidity +function transfer(address dst, uint256 wad) public returns (bool) +``` + +### transferFrom + +```solidity +function transferFrom(address src, address dst, uint256 wad) public returns (bool) +``` + +### withdraw + +```solidity +function withdraw(uint256 wad) external +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.6/aggregator-interface.mdx b/src/content/chainlink-local/api-reference/v0.2.6/aggregator-interface.mdx new file mode 100644 index 00000000000..740191eda4c --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.6/aggregator-interface.mdx @@ -0,0 +1,136 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "AggregatorInterface v0.2.6 API Reference" +metadata: + description: "API documentation for AggregatorInterface in Solidity, version v0.2.6." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## AggregatorInterface + +Basic price feed interface. + +[AggregatorInterface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-feeds/interfaces/AggregatorInterface.sol) + +## Events + +### AnswerUpdated + +```solidity +event AnswerUpdated(int256 current, uint256 roundId, uint256 updatedAt) +``` + +Emitted when the answer is updated. + +#### Parameters + +| Name | Type | Description | +| --------- | ------- | ------------------------------------------------ | +| current | int256 | - The updated answer. | +| roundId | uint256 | - The round ID for which the answer was updated. | +| updatedAt | uint256 | - The timestamp when the answer was updated. | + +### NewRound + +```solidity +event NewRound(uint256 roundId, address startedBy, uint256 startedAt) +``` + +Emitted when a new round is started. + +#### Parameters + +| Name | Type | Description | +| --------- | ------- | ---------------------------------------------------- | +| roundId | uint256 | - The round ID of the new round. | +| startedBy | address | - The address of the account that started the round. | +| startedAt | uint256 | - The timestamp when the round was started. | + +## Functions + +### getAnswer + +```solidity +function getAnswer(uint256 roundId) external view returns (int256) +``` + +Gets the answer for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------- | +| roundId | uint256 | - The round ID to get the answer for. | + +#### Returns + +| Name | Type | Description | +| ---- | ------ | ------------------------------------------- | +| [0] | int256 | int256 - The answer for the given round ID. | + +### getTimestamp + +```solidity +function getTimestamp(uint256 roundId) external view returns (uint256) +``` + +Gets the timestamp for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ---------------------------------------- | +| roundId | uint256 | - The round ID to get the timestamp for. | + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ----------------------------------------------- | +| [0] | uint256 | uint256 - The timestamp for the given round ID. | + +### latestAnswer + +```solidity +function latestAnswer() external view returns (int256) +``` + +Gets the latest answer from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------ | --------------------------- | +| [0] | int256 | int256 - The latest answer. | + +### latestRound + +```solidity +function latestRound() external view returns (uint256) +``` + +Gets the latest round ID from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ------------------------------ | +| [0] | uint256 | uint256 - The latest round ID. | + +### latestTimestamp + +```solidity +function latestTimestamp() external view returns (uint256) +``` + +Gets the timestamp of the latest answer from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | --------------------------------------------- | +| [0] | uint256 | uint256 - The timestamp of the latest answer. | diff --git a/src/content/chainlink-local/api-reference/v0.2.6/aggregator-v2-v3-interface.mdx b/src/content/chainlink-local/api-reference/v0.2.6/aggregator-v2-v3-interface.mdx new file mode 100644 index 00000000000..85120fad02d --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.6/aggregator-v2-v3-interface.mdx @@ -0,0 +1,18 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "AggregatorV2V3Interface v0.2.6 API Reference" +metadata: + description: "API documentation for AggregatorV2V3Interface in Solidity, version v0.2.6." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## AggregatorV2V3Interface + +Combined V2/V3 price feed interface. + +[AggregatorV2V3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-feeds/interfaces/AggregatorV2V3Interface.sol) diff --git a/src/content/chainlink-local/api-reference/v0.2.6/aggregator-v3-interface.mdx b/src/content/chainlink-local/api-reference/v0.2.6/aggregator-v3-interface.mdx new file mode 100644 index 00000000000..9d395f70506 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.6/aggregator-v3-interface.mdx @@ -0,0 +1,109 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "AggregatorV3Interface v0.2.6 API Reference" +metadata: + description: "API documentation for AggregatorV3Interface in Solidity, version v0.2.6." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## AggregatorV3Interface + +Extended price feed interface. + +[AggregatorV3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-feeds/interfaces/AggregatorV3Interface.sol) + +## Functions + +### decimals + +```solidity +function decimals() external view returns (uint8) +``` + +Gets the number of decimals used by the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ----- | ------------------------------- | +| [0] | uint8 | uint8 - The number of decimals. | + +### description + +```solidity +function description() external view returns (string) +``` + +Gets the description of the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------ | -------------------------------------------------- | +| [0] | string | string memory - The description of the aggregator. | + +### getRoundData + +```solidity +function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the round data for a specific round ID. + +_This function should raise "No data present" if no data is available for the +given round ID._ + +#### Parameters + +| Name | Type | Description | +| --------- | ------ | ----------------------------------- | +| \_roundId | uint80 | - The round ID to get the data for. | + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------ | +| roundId | uint80 | - The round ID. | +| answer | int256 | - The answer for the round. | +| startedAt | uint256 | - The timestamp when the round started. | +| updatedAt | uint256 | - The timestamp when the round was updated. | +| answeredInRound | uint80 | - The round ID in which the answer was computed. | + +### latestRoundData + +```solidity +function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the latest round data. + +_This function should raise "No data present" if no data is available._ + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------------- | +| roundId | uint80 | - The latest round ID. | +| answer | int256 | - The latest answer. | +| startedAt | uint256 | - The timestamp when the latest round started. | +| updatedAt | uint256 | - The timestamp when the latest round was updated. | +| answeredInRound | uint80 | - The round ID in which the latest answer was computed. | + +### version + +```solidity +function version() external view returns (uint256) +``` + +Gets the version of the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ---------------------------------------- | +| [0] | uint256 | uint256 - The version of the aggregator. | diff --git a/src/content/chainlink-local/api-reference/v0.2.6/burn-mint-erc677-helper.mdx b/src/content/chainlink-local/api-reference/v0.2.6/burn-mint-erc677-helper.mdx new file mode 100644 index 00000000000..2cd449e6dd7 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.6/burn-mint-erc677-helper.mdx @@ -0,0 +1,55 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "BurnMintERC677Helper v0.2.6 API Reference" +metadata: + description: "API documentation for BurnMintERC677Helper in Solidity, version v0.2.6." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## BurnMintERC677Helper + +Helper contract for ERC677 token operations. + +[BurnMintERC677Helper](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/ccip/BurnMintERC677Helper.sol) + +## Functions + +### constructor + +```solidity +constructor(string name, string symbol) public +``` + +Constructor to initialize the BurnMintERC677Helper contract with a name and +symbol. + +_Calls the parent constructor of BurnMintERC677 with fixed decimals (18) and +initial supply (0)._ + +#### Parameters + +| Name | Type | Description | +| ------ | ------ | -------------------------- | +| name | string | - The name of the token. | +| symbol | string | - The symbol of the token. | + +### drip + +```solidity +function drip(address to) external +``` + +Mints one full token (1e18) to the specified address. + +_Calls the internal `_mint` function from the BurnMintERC677 contract._ + +#### Parameters + +| Name | Type | Description | +| ---- | ------- | ------------------------------------------ | +| to | address | - The address to receive the minted token. | diff --git a/src/content/chainlink-local/api-reference/v0.2.6/ccip-local-simulator-fork-js.mdx b/src/content/chainlink-local/api-reference/v0.2.6/ccip-local-simulator-fork-js.mdx new file mode 100644 index 00000000000..187f3ef9a36 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.6/ccip-local-simulator-fork-js.mdx @@ -0,0 +1,97 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalSimulatorFork JS v0.2.6 API Reference" +metadata: + description: "API documentation for the CCIPLocalSimulatorFork JS JavaScript helpers, version v0.2.6." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalSimulatorFork JS + +Hardhat 2 JavaScript helpers for fork routing. + +[CCIPLocalSimulatorFork JS](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/scripts/CCIPLocalSimulatorFork.js) + +## Types + +### Evm2EvmMessage : `Object` + +**Properties** + +| Name | Type | +| ------------------- | ------------------------------------------ | +| sourceChainSelector | `bigint` | +| sender | `string` | +| receiver | `string` | +| sequenceNumber | `bigint` | +| gasLimit | `bigint` | +| strict | `boolean` | +| nonce | `bigint` | +| feeToken | `string` | +| feeTokenAmount | `bigint` | +| data | `string` | +| tokenAmounts | `Array.<\{token: string, amount: bigint}>` | +| sourceTokenData | `Array.` | +| messageId | `string` | + +## Functions + +### requestLinkFromTheFaucet(linkAddress, to, amount) ⇒ `Promise.` + +Requests LINK tokens from the faucet and returns the transaction hash + +**Returns**: `Promise.` - Promise resolving to the +transaction hash of the fund transfer + +| Param | Type | Description | +| ----------- | -------- | ------------------------------------------------------- | +| linkAddress | `string` | The address of the LINK contract on the current network | +| to | `string` | The address to send LINK to | +| amount | `bigint` | The amount of LINK to request | + +### getEvm2EvmMessage(receipt) ⇒ `Evm2EvmMessage` | `null` + +Parses a transaction receipt to extract the sent message Scans through +transaction logs to find a `CCIPSendRequested` event and then decodes it to an +object + +**Returns**: `Evm2EvmMessage` | +`null` - Returns either the sent message or null if provided receipt +does not contain `CCIPSendRequested` log + +| Param | Type | Description | +| ------- | -------- | ------------------------------------------------ | +| receipt | `object` | The transaction receipt from the `ccipSend` call | + +### getEvm2AnyRampMessage(receipt) ⇒ `object` | `null` + +Parses a transaction receipt to extract the sent message from CCIPMessageSent + +**Returns**: `object` | `null` - Returns \{ +destChainSelector, sequenceNumber, EVM2AnyRampMessage message \} or null + +| Param | Type | Description | +| ------- | -------- | ------------------------------------------ | +| receipt | `object` | – The tx receipt from the on-ramp contract | + +### routeMessage(routerAddress, evm2EvmMessage) ⇒ `Promise.` + +Routes the sent message from the source network on the destination (current) +network + +**Returns**: `Promise.` - Either resolves with no value +if the message is successfully routed, or reverts +**Throws**: + +- `Error` Fails if no off-ramp matches the message's source chain + selector or if calling `router.getOffRamps()` + +| Param | Type | Description | +| -------------- | ---------------- | --------------------------------- | +| routerAddress | `string` | Address of the destination Router | +| evm2EvmMessage | `Evm2EvmMessage` | Sent cross-chain message | diff --git a/src/content/chainlink-local/api-reference/v0.2.6/ccip-local-simulator-fork.mdx b/src/content/chainlink-local/api-reference/v0.2.6/ccip-local-simulator-fork.mdx new file mode 100644 index 00000000000..f392f00b112 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.6/ccip-local-simulator-fork.mdx @@ -0,0 +1,311 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalSimulatorFork v0.2.6 API Reference" +metadata: + description: "API documentation for CCIPLocalSimulatorFork in Solidity, version v0.2.6." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalSimulatorFork + +CCIP simulator for forked networks. + +[CCIPLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/ccip/CCIPLocalSimulatorFork.sol) + +## Structs + +### EVM2EVMMessage + +```solidity +struct EVM2EVMMessage { + uint64 sourceChainSelector; + address sender; + address receiver; + uint64 sequenceNumber; + uint256 gasLimit; + bool strict; + uint64 nonce; + address feeToken; + uint256 feeTokenAmount; + bytes data; + struct Client.EVMTokenAmount[] tokenAmounts; + bytes[] sourceTokenData; + bytes32 messageId; +} +``` + +### OffRamp + +Structure representing an offRamp configuration + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | + +```solidity +struct OffRamp { + uint64 sourceChainSelector; + address offRamp; +} +``` + +## Variables + +### DEFAULT_GAS_LIMIT + +```solidity +uint32 DEFAULT_GAS_LIMIT +``` + +### i_register + +```solidity +contract Register i_register +``` + +The immutable register instance + +### LINK_FAUCET + +```solidity +address LINK_FAUCET +``` + +The address of the LINK faucet + +### s_processedMessages + +```solidity +mapping(bytes32 => bool) s_processedMessages +``` + +Mapping to track processed messages + +## Errors + +### InvalidExtraArgsTag + +```solidity +error InvalidExtraArgsTag() +``` + +## Events + +### CCIPMessageSent + +```solidity +event CCIPMessageSent(uint64 destChainSelector, uint64 sequenceNumber, struct Internal.EVM2AnyRampMessage message) +``` + +### CCIPSendRequested + +```solidity +event CCIPSendRequested(struct InternalPreV1dot6.EVM2EVMMessage message) +``` + +Events emitted when a CCIP send request is made + +## Functions + +### \_fromBytes + +```solidity +function _fromBytes(bytes extraArgs) internal pure returns (struct Client.GenericExtraArgsV2) +``` + +Internal helper function to decode extraArgs bytes to GenericExtraArgsV2 struct. +Supports decoding of both GenericExtraArgsV2 and EVMExtraArgsV1 structs. + +#### Parameters + +| Name | Type | Description | +| --------- | ----- | --------------------------------------------- | +| extraArgs | bytes | - The bytes representing the extra arguments. | + +#### Returns + +| Name | Type | Description | +| ---- | -------------------------------- | --------------------------------------------------------- | +| [0] | struct Client.GenericExtraArgsV2 | genericExtraArgs - The decoded GenericExtraArgsV2 struct. | + +### \_routeCapturedMessages + +```solidity +function _routeCapturedMessages(uint256[] forkIds, uint256 sourceForkId, address sourceRouterAddress) internal +``` + +Internal function to route captured messages to their respective destination +forks. + +#### Parameters + +| Name | Type | Description | +| ------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| forkIds | uint256[] | - The IDs of the destination network forks. These are the returned values of `createFork()` or `createSelectFork()`, not chainIds. | +| sourceForkId | uint256 | - The ID of the source network fork. This is the returned value of `createFork()` or `createSelectFork()`, not chainId. | +| sourceRouterAddress | address | - The address of the Router on the source chain. | + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the contract + +### executeSingleMessage + +```solidity +function executeSingleMessage(struct Internal.Any2EVMRampMessage message, bytes[] offchainTokenData, uint32[] tokenGasOverrides) external +``` + +Executes a single CCIP message on the offRamp + +#### Parameters + +| Name | Type | Description | +| ----------------- | ---------------------------------- | --------------------------------- | +| message | struct Internal.Any2EVMRampMessage | - The CCIP message to be executed | +| offchainTokenData | bytes[] | - Additional offchain token data | +| tokenGasOverrides | uint32[] | | + +### executeSingleMessage + +```solidity +function executeSingleMessage(struct InternalPreV1dot6.EVM2EVMMessage message, bytes[] offchainTokenData, uint32[] tokenGasOverrides) external +``` + +Works with Foundry only + +### getNetworkDetails + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) +``` + +Returns the default values for currently CCIP supported networks. If network is +not present or some of the values are changed, user can manually add new network +details using the `setNetworkDetails` function. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------------------------------------------------------------------------ | +| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | + +#### Returns + +| Name | Type | Description | +| ---- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | + +### getOffRamps + +```solidity +function getOffRamps() external view returns (struct IRouterFork.OffRamp[]) +``` + +Gets the list of offRamps + +#### Returns + +| Name | Type | Description | +| ---- | ---------------------------- | ----------------------------------- | +| [0] | struct IRouterFork.OffRamp[] | offRamps - Array of OffRamp structs | + +### getOnRamp + +```solidity +function getOnRamp(uint64 destChainSelector) external view returns (address) +``` + +Return the configured onramp for specific a destination chain. @param +destChainSelector The destination chain Id to get the onRamp for. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | -------------------------- | +| [0] | address | The address of the onRamp. | + +### requestLinkFromFaucet + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------- | +| to | address | - The address to which LINK tokens are to be sent. | +| amount | uint256 | - The amount of LINK tokens to send. | + +#### Returns + +| Name | Type | Description | +| ------- | ---- | ----------------------------------------------------------------------------- | +| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | + +### setNetworkDetails + +```solidity +function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external +``` + +If network details are not present or some of the values are changed, user can +manually add new network details using the `setNetworkDetails` function. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | +| networkDetails | struct Register.NetworkDetails | - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | + +### switchChainAndRouteMessage + +```solidity +function switchChainAndRouteMessage(uint256 forkId) external +``` + +To be called after the sending of the cross-chain message (`ccipSend`). Goes +through the list of past logs and looks for the `CCIPSendRequested` and +`CCIPMessageSent` events. Switches to a destination network fork. Routes the +sent cross-chain message on the destination network. If you sent more than one +message, it will try to route all of them to `forkId`. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------------------------------------------------------------------- | +| forkId | uint256 | - The ID of the destination network fork. This is the returned value of `createFork()` or `createSelectFork()` | + +### switchChainAndRouteMessage + +```solidity +function switchChainAndRouteMessage(uint256[] forkIds) external +``` + +To be called after the sending of the cross-chain message (`ccipSend`). Override +variant of the `switchChainAndRouteMessage(uint256 forkId)` function in case of +multiple destination forks. Goes through the list of past logs and looks for the +`CCIPSendRequested` and `CCIPMessageSent` events. Loops through provided +`forkIds` and tries to route the message to correct destination. If you haven't +provide correct `forkId`, the message will get lost. If you sent more than one +message, it will try to route all of them to correct destinations. + +#### Parameters + +| Name | Type | Description | +| ------- | --------- | ------------------------------------------------------------------------------------------------------------------- | +| forkIds | uint256[] | - The IDs of the destination network forks. These are the returned values of `createFork()` or `createSelectFork()` | diff --git a/src/content/chainlink-local/api-reference/v0.2.6/ccip-local-simulator.mdx b/src/content/chainlink-local/api-reference/v0.2.6/ccip-local-simulator.mdx new file mode 100644 index 00000000000..d917ce8ea96 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.6/ccip-local-simulator.mdx @@ -0,0 +1,233 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalSimulator v0.2.6 API Reference" +metadata: + description: "API documentation for CCIPLocalSimulator in Solidity, version v0.2.6." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalSimulator + +Local CCIP simulator (no-fork mode). + +[CCIPLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/ccip/CCIPLocalSimulator.sol) + +## Variables + +### CHAIN_SELECTOR + +```solidity +uint64 CHAIN_SELECTOR +``` + +The unique CCIP Chain Selector constant + +### i_ccipBnM + +```solidity +contract BurnMintERC677Helper i_ccipBnM +``` + +The BurnMintERC677Helper instance for CCIP-BnM token + +### i_ccipLnM + +```solidity +contract BurnMintERC677Helper i_ccipLnM +``` + +The BurnMintERC677Helper instance for CCIP-LnM token + +### i_linkToken + +```solidity +contract LinkToken i_linkToken +``` + +The LINK token instance + +### i_mockRouter + +```solidity +contract MockCCIPRouter i_mockRouter +``` + +The mock CCIP router instance + +### i_wrappedNative + +```solidity +contract WETH9 i_wrappedNative +``` + +The wrapped native token instance + +### s_supportedTokens + +```solidity +address[] s_supportedTokens +``` + +The list of supported token addresses + +## Errors + +### CCIPLocalSimulator\_\_MsgSenderIsNotTokenOwner + +```solidity +error CCIPLocalSimulator__MsgSenderIsNotTokenOwner() +``` + +### CCIPLocalSimulator\_\_RequiredRoleNotFound + +```solidity +error CCIPLocalSimulator__RequiredRoleNotFound(address account, bytes32 role, address token) +``` + +## Functions + +### configuration + +```solidity +function configuration() public view returns (uint64 chainSelector_, contract IRouterClient sourceRouter_, contract IRouterClient destinationRouter_, contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract BurnMintERC677Helper ccipBnM_, contract BurnMintERC677Helper ccipLnM_) +``` + +Returns configuration details for pre-deployed contracts and services needed for +local CCIP simulations. + +#### Returns + +| Name | Type | Description | +| ------------------- | ----------------------------- | ----------------------------------------------------------- | +| chainSelector\_ | uint64 | - The unique CCIP Chain Selector. | +| sourceRouter\_ | contract IRouterClient | - The source chain Router contract. | +| destinationRouter\_ | contract IRouterClient | - The destination chain Router contract. | +| wrappedNative\_ | contract WETH9 | - The wrapped native token which can be used for CCIP fees. | +| linkToken\_ | contract LinkToken | - The LINK token. | +| ccipBnM\_ | contract BurnMintERC677Helper | - The ccipBnM token. | +| ccipLnM\_ | contract BurnMintERC677Helper | - The ccipLnM token. | + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the contract and pre-deployed token instances + +### getSupportedTokens + +```solidity +function getSupportedTokens(uint64 chainSelector) external view returns (address[] tokens) +``` + +Gets a list of token addresses that are supported for cross-chain transfers by +the simulator. + +#### Parameters + +| Name | Type | Description | +| ------------- | ------ | --------------------------------- | +| chainSelector | uint64 | - The unique CCIP Chain Selector. | + +#### Returns + +| Name | Type | Description | +| ------ | --------- | -------------------------------------------------------------------------------------------------- | +| tokens | address[] | - Returns a list of token addresses that are supported for cross-chain transfers by the simulator. | + +### isChainSupported + +```solidity +function isChainSupported(uint64 chainSelector) public pure returns (bool supported) +``` + +Checks whether the provided `chainSelector` is supported by the simulator. + +#### Parameters + +| Name | Type | Description | +| ------------- | ------ | --------------------------------- | +| chainSelector | uint64 | - The unique CCIP Chain Selector. | + +#### Returns + +| Name | Type | Description | +| --------- | ---- | ---------------------------------------------------------------- | +| supported | bool | - Returns true if `chainSelector` is supported by the simulator. | + +### requestLinkFromFaucet + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------- | +| to | address | - The address to which LINK tokens are to be sent. | +| amount | uint256 | - The amount of LINK tokens to send. | + +#### Returns + +| Name | Type | Description | +| ------- | ---- | ----------------------------------------------------------------------------- | +| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | + +### supportNewTokenViaAccessControlDefaultAdmin + +```solidity +function supportNewTokenViaAccessControlDefaultAdmin(address tokenAddress) external +``` + +Allows user to support any new token, besides CCIP BnM and CCIP LnM, for +cross-chain transfers. The caller must have the DEFAULT_ADMIN_ROLE as defined by +the contract itself. Reverts if the caller is not the admin of the token using +OZ's AccessControl DEFAULT_ADMIN_ROLE. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ------------------------------------------------------------------ | +| tokenAddress | address | - The address of the token to add to the list of supported tokens. | + +### supportNewTokenViaGetCCIPAdmin + +```solidity +function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external +``` + +Allows user to support any new token, besides CCIP BnM and CCIP LnM, for +cross-chain transfers. Reverts if token does not implement getCCIPAdmin() +function. Reverts if the caller is not the token CCIPAdmin. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ------------------------------------------------------------------ | +| tokenAddress | address | - The address of the token to add to the list of supported tokens. | + +### supportNewTokenViaOwner + +```solidity +function supportNewTokenViaOwner(address tokenAddress) external +``` + +Allows user to support any new token, besides CCIP BnM and CCIP LnM, for +cross-chain transfers. Reverts if token does not implement owner() function. +Reverts if the caller is not the token owner. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ------------------------------------------------------------------ | +| tokenAddress | address | - The address of the token to add to the list of supported tokens. | diff --git a/src/content/chainlink-local/api-reference/v0.2.6/data-streams-local-simulator-fork.mdx b/src/content/chainlink-local/api-reference/v0.2.6/data-streams-local-simulator-fork.mdx new file mode 100644 index 00000000000..6b1b2a230bf --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.6/data-streams-local-simulator-fork.mdx @@ -0,0 +1,121 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "DataStreamsLocalSimulatorFork v0.2.6 API Reference" +metadata: + description: "API documentation for DataStreamsLocalSimulatorFork in Solidity, version v0.2.6." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## DataStreamsLocalSimulatorFork + +Data Streams simulator for forked networks. + +[DataStreamsLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-streams/DataStreamsLocalSimulatorFork.sol) + +## Variables + +### i_register + +```solidity +contract Register i_register +``` + +The immutable register instance + +### LINK_FAUCET + +```solidity +address LINK_FAUCET +``` + +The address of the LINK faucet + +## Functions + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the contract + +### getNetworkDetails + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) +``` + +Returns the default values for currently Data Streams supported networks. If +network is not present or some of the values are changed, user can manually add +new network details using the `setNetworkDetails` function. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ----------------------------------------------------------------------------- | +| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | + +#### Returns + +| Name | Type | Description | +| ---- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | + +### requestLinkFromFaucet + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------- | +| to | address | - The address to which LINK tokens are to be sent. | +| amount | uint256 | - The amount of LINK tokens to send. | + +#### Returns + +| Name | Type | Description | +| ------- | ---- | ----------------------------------------------------------------------------- | +| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | + +### requestNativeFromFaucet + +```solidity +function requestNativeFromFaucet(address to, uint256 amount) external +``` + +Requests native coints from the faucet. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | --------------------------------------------------- | +| to | address | - The address to which native coins are to be sent. | +| amount | uint256 | - The amount of native coins to send. | + +### setNetworkDetails + +```solidity +function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external +``` + +If network details are not present or some of the values are changed, user can +manually add new network details using the `setNetworkDetails` function. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- | +| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | +| networkDetails | struct Register.NetworkDetails | - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | diff --git a/src/content/chainlink-local/api-reference/v0.2.6/data-streams-local-simulator.mdx b/src/content/chainlink-local/api-reference/v0.2.6/data-streams-local-simulator.mdx new file mode 100644 index 00000000000..dc751cb1599 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.6/data-streams-local-simulator.mdx @@ -0,0 +1,110 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "DataStreamsLocalSimulator v0.2.6 API Reference" +metadata: + description: "API documentation for DataStreamsLocalSimulator in Solidity, version v0.2.6." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## DataStreamsLocalSimulator + +Local Data Streams simulator (no-fork mode). + +[DataStreamsLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-streams/DataStreamsLocalSimulator.sol) + +## Variables + +### i_linkToken + +```solidity +contract LinkToken i_linkToken +``` + +The LINK token instance + +### i_wrappedNative + +```solidity +contract WETH9 i_wrappedNative +``` + +The wrapped native token instance + +### s_mockFeeManager + +```solidity +contract MockFeeManager s_mockFeeManager +``` + +### s_mockRewardManager + +```solidity +contract MockRewardManager s_mockRewardManager +``` + +### s_mockVerifier + +```solidity +contract MockVerifier s_mockVerifier +``` + +### s_mockVerifierProxy + +```solidity +contract MockVerifierProxy s_mockVerifierProxy +``` + +## Functions + +### configuration + +```solidity +function configuration() public view returns (contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract MockVerifier mockVerifier_, contract MockVerifierProxy mockVerifierProxy_, contract MockFeeManager mockFeeManager_, contract MockRewardManager mockRewardManager_) +``` + +@notice Returns configuration details for pre-deployed contracts and services +needed for local Data Streams simulations. + +#### Returns + +| Name | Type | Description | +| ------------------- | -------------------------- | ----------------------------------- | +| wrappedNative\_ | contract WETH9 | - The wrapped native token. | +| linkToken\_ | contract LinkToken | - The LINK token. | +| mockVerifier\_ | contract MockVerifier | - The mock verifier contract. | +| mockVerifierProxy\_ | contract MockVerifierProxy | - The mock verifier proxy contract. | +| mockFeeManager\_ | contract MockFeeManager | - The mock fee manager contract. | +| mockRewardManager\_ | contract MockRewardManager | - The mock reward manager contract. | + +### constructor + +```solidity +constructor() public +``` + +### requestLinkFromFaucet + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------- | +| to | address | - The address to which LINK tokens are to be sent. | +| amount | uint256 | - The amount of LINK tokens to send. | + +#### Returns + +| Name | Type | Description | +| ------- | ---- | ----------------------------------------------------------------------------- | +| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | diff --git a/src/content/chainlink-local/api-reference/v0.2.6/data-streams-register.mdx b/src/content/chainlink-local/api-reference/v0.2.6/data-streams-register.mdx new file mode 100644 index 00000000000..79ec28a9a49 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.6/data-streams-register.mdx @@ -0,0 +1,84 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Register (Data Streams) v0.2.6 API Reference" +metadata: + description: "API documentation for Register (Data Streams) in Solidity, version v0.2.6." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## Register (Data Streams) + +Data Streams network configuration registry. + +[Register (Data Streams)](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-streams/Register.sol) + +## Structs + +### NetworkDetails + +```solidity +struct NetworkDetails { + address verifierProxyAddress; + address linkAddress; +} +``` + +## Variables + +### s_networkDetails + +```solidity +mapping(uint256 => struct Register.NetworkDetails) s_networkDetails +``` + +Mapping to store network details based on chain ID. + +## Functions + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the network details for various chains. + +### getNetworkDetails + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails networkDetails) +``` + +Retrieves network details for a given chain ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | --------------------------------------------- | +| chainId | uint256 | - The ID of the chain to get the details for. | + +#### Returns + +| Name | Type | Description | +| -------------- | ------------------------------ | ------------------------------------------------- | +| networkDetails | struct Register.NetworkDetails | - The network details for the specified chain ID. | + +### setNetworkDetails + +```solidity +function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external +``` + +Sets the network details for a given chain ID. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------------------------------ | -------------------------------------------------------- | +| chainId | uint256 | - The ID of the chain to set the details for. | +| networkDetails | struct Register.NetworkDetails | - The network details to set for the specified chain ID. | diff --git a/src/content/chainlink-local/api-reference/v0.2.6/index.mdx b/src/content/chainlink-local/api-reference/v0.2.6/index.mdx new file mode 100644 index 00000000000..effc9b8fc48 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.6/index.mdx @@ -0,0 +1,56 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Chainlink Local v0.2.6 API Reference" +metadata: + description: "API reference documentation for Chainlink Local v0.2.6" +isIndex: true +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +Chainlink Local v0.2.6 adds `CCIPLocalSimulatorFork.switchChainAndRouteMessage(uint256[] memory chainIds)` for routing multiple CCIP messages to multiple chains in a single call, and refactors the fork simulator so it routes every message sent from a loop, not just the first one. + +## CCIP + +These contracts provide Cross-Chain Interoperability Protocol (CCIP) functionality in a local testing environment: + +- [CCIPLocalSimulator](/chainlink-local/api-reference/v0.2.6/ccip-local-simulator) - Local CCIP simulator (no-fork mode) +- [CCIPLocalSimulatorFork](/chainlink-local/api-reference/v0.2.6/ccip-local-simulator-fork) - CCIP simulator for forked networks +- [CCIPLocalSimulatorFork JS](/chainlink-local/api-reference/v0.2.6/ccip-local-simulator-fork-js) - JavaScript helpers for fork routing +- [Register](/chainlink-local/api-reference/v0.2.6/register) - CCIP network configuration registry + +## Data Streams + +Contracts for simulating Chainlink Data Streams: + +- [DataStreamsLocalSimulator](/chainlink-local/api-reference/v0.2.6/data-streams-local-simulator) - Local Data Streams simulator (no-fork mode) +- [DataStreamsLocalSimulatorFork](/chainlink-local/api-reference/v0.2.6/data-streams-local-simulator-fork) - Data Streams simulator for forked networks +- [MockVerifier](/chainlink-local/api-reference/v0.2.6/mock-verifier) - Mock Data Streams verifier +- [MockVerifierProxy](/chainlink-local/api-reference/v0.2.6/mock-verifier-proxy) - Mock Data Streams verifier proxy +- [MockReportGenerator](/chainlink-local/api-reference/v0.2.6/mock-report-generator) - Signed report generator for every report schema +- [MockFeeManager](/chainlink-local/api-reference/v0.2.6/mock-fee-manager) - Mock verifier fee manager +- [MockRewardManager](/chainlink-local/api-reference/v0.2.6/mock-reward-manager) - Mock reward manager +- [ReportVersions](/chainlink-local/api-reference/v0.2.6/report-versions) - Data Streams report schemas +- [Register (Data Streams)](/chainlink-local/api-reference/v0.2.6/data-streams-register) - Data Streams network configuration registry + +## Data Feeds + +Contracts for simulating Chainlink Data Feeds: + +- [AggregatorInterface](/chainlink-local/api-reference/v0.2.6/aggregator-interface) - Basic price feed interface +- [AggregatorV2V3Interface](/chainlink-local/api-reference/v0.2.6/aggregator-v2-v3-interface) - Combined V2/V3 price feed interface +- [AggregatorV3Interface](/chainlink-local/api-reference/v0.2.6/aggregator-v3-interface) - Extended price feed interface +- [MockOffchainAggregator](/chainlink-local/api-reference/v0.2.6/mock-offchain-aggregator) - Mock implementation of off-chain aggregator +- [MockV3Aggregator](/chainlink-local/api-reference/v0.2.6/mock-v3-aggregator) - Mock implementation of V3 aggregator + +## Token Contracts + +Standard token implementations for testing: + +- [BurnMintERC677Helper](/chainlink-local/api-reference/v0.2.6/burn-mint-erc677-helper) - Helper contract for ERC677 token operations +- [LinkToken](/chainlink-local/api-reference/v0.2.6/link-token) - LINK token implementation +- [WETH9](/chainlink-local/api-reference/v0.2.6/weth9) - Wrapped Ether implementation diff --git a/src/content/chainlink-local/api-reference/v0.2.6/link-token.mdx b/src/content/chainlink-local/api-reference/v0.2.6/link-token.mdx new file mode 100644 index 00000000000..f852c470da0 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.6/link-token.mdx @@ -0,0 +1,44 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "LinkToken v0.2.6 API Reference" +metadata: + description: "API documentation for LinkToken in Solidity, version v0.2.6." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## LinkToken + +LINK token implementation. + +[LinkToken](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/shared/LinkToken.sol) + +## Functions + +### \_onCreate + +```solidity +function _onCreate() internal virtual +``` + +Hook that is called when this contract is created. + +_Useful to override constructor behaviour in child contracts (e.g., LINK bridge +tokens). The default implementation mints 10\*\*27 tokens to the contract +deployer._ + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the LinkToken contract with a fixed total supply, +name, and symbol. + +_Calls the ERC677 constructor with the name and symbol, and then mints the total +supply to the contract deployer._ diff --git a/src/content/chainlink-local/api-reference/v0.2.6/mock-fee-manager.mdx b/src/content/chainlink-local/api-reference/v0.2.6/mock-fee-manager.mdx new file mode 100644 index 00000000000..78aa3b770f6 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.6/mock-fee-manager.mdx @@ -0,0 +1,174 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockFeeManager v0.2.6 API Reference" +metadata: + description: "API documentation for MockFeeManager in Solidity, version v0.2.6." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockFeeManager + +Mock verifier fee manager. + +[MockFeeManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-streams/MockFeeManager.sol) + +## Structs + +### Asset + +```solidity +struct Asset { + address assetAddress; + uint256 amount; +} +``` + +## Variables + +### i_linkAddress + +```solidity +address i_linkAddress +``` + +### i_nativeAddress + +```solidity +address i_nativeAddress +``` + +### i_proxyAddress + +```solidity +address i_proxyAddress +``` + +### i_rewardManager + +```solidity +contract IRewardManager i_rewardManager +``` + +### s_mockDiscounts + +```solidity +mapping(address => uint256) s_mockDiscounts +``` + +### s_nativeSurcharge + +```solidity +uint256 s_nativeSurcharge +``` + +## Errors + +### ExpiredReport + +```solidity +error ExpiredReport() +``` + +### InvalidAddress + +```solidity +error InvalidAddress() +``` + +### InvalidDeposit + +```solidity +error InvalidDeposit() +``` + +### InvalidDiscount + +```solidity +error InvalidDiscount() +``` + +### InvalidQuote + +```solidity +error InvalidQuote() +``` + +### InvalidSurcharge + +```solidity +error InvalidSurcharge() +``` + +### Unauthorized + +```solidity +error Unauthorized() +``` + +## Functions + +### \_processFee + +```solidity +function _processFee(bytes payload, bytes parameterPayload, address subscriber) internal +``` + +### constructor + +```solidity +constructor(address linkAddress, address nativeAddress, address proxyAddress, address rewardManager) public +``` + +### getFeeAndReward + +```solidity +function getFeeAndReward(address subscriber, bytes report, address quoteAddress) public view returns (struct Common.Asset, struct Common.Asset, uint256) +``` + +### getMockDiscount + +```solidity +function getMockDiscount(address subscriber) external view returns (uint256) +``` + +### processFee + +```solidity +function processFee(bytes payload, bytes parameterPayload, address subscriber) external payable +``` + +### processFeeBulk + +```solidity +function processFeeBulk(bytes[] payloads, bytes parameterPayload, address subscriber) external payable +``` + +### setMockDiscount + +```solidity +function setMockDiscount(address subscriber, uint256 discount) external +``` + +### setNativeSurcharge + +```solidity +function setNativeSurcharge(uint64 surcharge) external +``` + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) external pure returns (bool) +``` + +\_Returns true if this contract implements the interface defined by +`interfaceId`. See the corresponding +https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP +section] to learn more about how these ids are created. + +This function call must use less than 30 000 gas.\_ diff --git a/src/content/chainlink-local/api-reference/v0.2.6/mock-offchain-aggregator.mdx b/src/content/chainlink-local/api-reference/v0.2.6/mock-offchain-aggregator.mdx new file mode 100644 index 00000000000..919e0a71a9f --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.6/mock-offchain-aggregator.mdx @@ -0,0 +1,190 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockOffchainAggregator v0.2.6 API Reference" +metadata: + description: "API documentation for MockOffchainAggregator in Solidity, version v0.2.6." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockOffchainAggregator + +Mock implementation of off-chain aggregator. + +[MockOffchainAggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-feeds/MockOffchainAggregator.sol) + +## Variables + +### decimals + +```solidity +uint8 decimals +``` + +The number of decimals used by the aggregator. + +### getAnswer + +```solidity +mapping(uint256 => int256) getAnswer +``` + +Mapping to get the answer for a specific round ID. + +### getTimestamp + +```solidity +mapping(uint256 => uint256) getTimestamp +``` + +Mapping to get the timestamp for a specific round ID. + +### latestAnswer + +```solidity +int256 latestAnswer +``` + +The latest answer reported by the aggregator. + +### latestRound + +```solidity +uint256 latestRound +``` + +The latest round ID. + +### latestTimestamp + +```solidity +uint256 latestTimestamp +``` + +The timestamp of the latest answer. + +### maxAnswer + +```solidity +int192 maxAnswer +``` + +The maximum answer the aggregator is allowed to report. + +### minAnswer + +```solidity +int192 minAnswer +``` + +The minimum answer the aggregator is allowed to report. + +## Functions + +### constructor + +```solidity +constructor(uint8 _decimals, int256 _initialAnswer) public +``` + +Constructor to initialize the MockOffchainAggregator contract with initial +parameters. + +#### Parameters + +| Name | Type | Description | +| --------------- | ------ | ------------------------------------------------------ | +| \_decimals | uint8 | - The number of decimals for the aggregator. | +| \_initialAnswer | int256 | - The initial answer to be set in the mock aggregator. | + +### getRoundData + +```solidity +function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the round data for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| --------- | ------ | ----------------------------------- | +| \_roundId | uint80 | - The round ID to get the data for. | + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------ | +| roundId | uint80 | - The round ID. | +| answer | int256 | - The answer for the round. | +| startedAt | uint256 | - The timestamp when the round started. | +| updatedAt | uint256 | - The timestamp when the round was updated. | +| answeredInRound | uint80 | - The round ID in which the answer was computed. | + +### latestRoundData + +```solidity +function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the latest round data. + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------------- | +| roundId | uint80 | - The latest round ID. | +| answer | int256 | - The latest answer. | +| startedAt | uint256 | - The timestamp when the latest round started. | +| updatedAt | uint256 | - The timestamp when the latest round was updated. | +| answeredInRound | uint80 | - The round ID in which the latest answer was computed. | + +### updateAnswer + +```solidity +function updateAnswer(int256 _answer) public +``` + +Updates the answer in the mock aggregator. + +#### Parameters + +| Name | Type | Description | +| -------- | ------ | --------------------------- | +| \_answer | int256 | - The new answer to be set. | + +### updateMinAndMaxAnswers + +```solidity +function updateMinAndMaxAnswers(int192 _minAnswer, int192 _maxAnswer) external +``` + +Updates the minimum and maximum answers the aggregator can report. + +#### Parameters + +| Name | Type | Description | +| ----------- | ------ | ------------------------- | +| \_minAnswer | int192 | - The new minimum answer. | +| \_maxAnswer | int192 | - The new maximum answer. | + +### updateRoundData + +```solidity +function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public +``` + +Updates the round data in the mock aggregator. + +#### Parameters + +| Name | Type | Description | +| ----------- | ------- | --------------------------------------- | +| \_roundId | uint80 | - The round ID to be updated. | +| \_answer | int256 | - The new answer to be set. | +| \_timestamp | uint256 | - The timestamp to be set. | +| \_startedAt | uint256 | - The timestamp when the round started. | diff --git a/src/content/chainlink-local/api-reference/v0.2.6/mock-report-generator.mdx b/src/content/chainlink-local/api-reference/v0.2.6/mock-report-generator.mdx new file mode 100644 index 00000000000..350346a4e68 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.6/mock-report-generator.mdx @@ -0,0 +1,192 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockReportGenerator v0.2.6 API Reference" +metadata: + description: "API documentation for MockReportGenerator in Solidity, version v0.2.6." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockReportGenerator + +Signed report generator for every report schema. + +[MockReportGenerator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-streams/MockReportGenerator.sol) + +## Variables + +### i_donAddress + +```solidity +address i_donAddress +``` + +### i_donDigest + +```solidity +uint256 i_donDigest +``` + +### i_reportV2MockFeedId + +```solidity +bytes32 i_reportV2MockFeedId +``` + +### i_reportV3MockFeedId + +```solidity +bytes32 i_reportV3MockFeedId +``` + +### i_reportV4MockFeedId + +```solidity +bytes32 i_reportV4MockFeedId +``` + +### s_ask + +```solidity +int192 s_ask +``` + +### s_bid + +```solidity +int192 s_bid +``` + +### s_expiresPeriod + +```solidity +uint32 s_expiresPeriod +``` + +### s_linkFee + +```solidity +uint192 s_linkFee +``` + +### s_marketStatus + +```solidity +uint32 s_marketStatus +``` + +### s_nativeFee + +```solidity +uint192 s_nativeFee +``` + +### s_price + +```solidity +int192 s_price +``` + +## Errors + +### MockReportGenerator\_\_CastOverflow + +```solidity +error MockReportGenerator__CastOverflow() +``` + +### MockReportGenerator\_\_InvalidAsk + +```solidity +error MockReportGenerator__InvalidAsk() +``` + +### MockReportGenerator\_\_InvalidBid + +```solidity +error MockReportGenerator__InvalidBid() +``` + +## Functions + +### constructor + +```solidity +constructor(int192 initialPrice) public +``` + +### generateReport + +```solidity +function generateReport(struct ReportVersions.ReportV2 report) external returns (bytes signedReport) +``` + +### generateReport + +```solidity +function generateReport(struct ReportVersions.ReportV3 report) external returns (bytes signedReport) +``` + +### generateReport + +```solidity +function generateReport(struct ReportVersions.ReportV4 report) external returns (bytes signedReport) +``` + +### generateReportV2 + +```solidity +function generateReportV2() external returns (bytes signedReport, struct ReportVersions.ReportV2 report) +``` + +### generateReportV3 + +```solidity +function generateReportV3() external returns (bytes signedReport, struct ReportVersions.ReportV3 report) +``` + +### generateReportV4 + +```solidity +function generateReportV4() external returns (bytes signedReport, struct ReportVersions.ReportV4 report) +``` + +### getMockDonAddress + +```solidity +function getMockDonAddress() external view returns (address) +``` + +### updateExpiresPeriod + +```solidity +function updateExpiresPeriod(uint32 period) external +``` + +### updateFees + +```solidity +function updateFees(uint192 nativeFee, uint192 linkFee) external +``` + +### updateMarketStatus + +```solidity +function updateMarketStatus(uint32 status) external +``` + +### updatePrice + +```solidity +function updatePrice(int192 price) public +``` + +### updatePriceBidAndAsk + +```solidity +function updatePriceBidAndAsk(int192 price, int192 bid, int192 ask) external +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.6/mock-reward-manager.mdx b/src/content/chainlink-local/api-reference/v0.2.6/mock-reward-manager.mdx new file mode 100644 index 00000000000..9f0622aece4 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.6/mock-reward-manager.mdx @@ -0,0 +1,87 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockRewardManager v0.2.6 API Reference" +metadata: + description: "API documentation for MockRewardManager in Solidity, version v0.2.6." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockRewardManager + +Mock reward manager. + +[MockRewardManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-streams/MockRewardManager.sol) + +## Variables + +### i_linkAddress + +```solidity +address i_linkAddress +``` + +### s_feeManagerAddress + +```solidity +address s_feeManagerAddress +``` + +## Errors + +### Unauthorized + +```solidity +error Unauthorized() +``` + +## Events + +### FeePaid + +```solidity +event FeePaid(struct IRewardManager.FeePayment[] payments, address payer) +``` + +## Functions + +### claimRewards + +```solidity +function claimRewards(bytes32[]) external pure +``` + +### constructor + +```solidity +constructor(address linkAddress) public +``` + +### onFeePaid + +```solidity +function onFeePaid(struct IRewardManager.FeePayment[] payments, address payer) external +``` + +### setFeeManager + +```solidity +function setFeeManager(address newFeeManager) external +``` + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) external pure returns (bool) +``` + +\_Returns true if this contract implements the interface defined by +`interfaceId`. See the corresponding +https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP +section] to learn more about how these ids are created. + +This function call must use less than 30 000 gas.\_ diff --git a/src/content/chainlink-local/api-reference/v0.2.6/mock-v3-aggregator.mdx b/src/content/chainlink-local/api-reference/v0.2.6/mock-v3-aggregator.mdx new file mode 100644 index 00000000000..acceccb41fd --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.6/mock-v3-aggregator.mdx @@ -0,0 +1,277 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockV3Aggregator v0.2.6 API Reference" +metadata: + description: "API documentation for MockV3Aggregator in Solidity, version v0.2.6." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockV3Aggregator + +Mock implementation of V3 aggregator. + +[MockV3Aggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-feeds/MockV3Aggregator.sol) + +## Variables + +### aggregator + +```solidity +address aggregator +``` + +The address of the current aggregator. + +### proposedAggregator + +```solidity +address proposedAggregator +``` + +The address of the proposed aggregator. + +### version + +```solidity +uint256 version +``` + +The version of the aggregator. + +## Functions + +### confirmAggregator + +```solidity +function confirmAggregator(address _aggregator) external +``` + +Confirms the proposed aggregator. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ----------------------------------------- | +| \_aggregator | address | - The address of the proposed aggregator. | + +### constructor + +```solidity +constructor(uint8 _decimals, int256 _initialAnswer) public +``` + +Constructor to initialize the MockV3Aggregator contract with initial parameters. + +#### Parameters + +| Name | Type | Description | +| --------------- | ------ | ------------------------------------------------------ | +| \_decimals | uint8 | - The number of decimals for the aggregator. | +| \_initialAnswer | int256 | - The initial answer to be set in the mock aggregator. | + +### decimals + +```solidity +function decimals() external view returns (uint8) +``` + +Gets the number of decimals used by the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ----- | ------------------------------- | +| [0] | uint8 | uint8 - The number of decimals. | + +### description + +```solidity +function description() external pure returns (string) +``` + +Gets the description of the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------ | -------------------------------------------------- | +| [0] | string | string memory - The description of the aggregator. | + +### getAnswer + +```solidity +function getAnswer(uint256 roundId) external view returns (int256) +``` + +Gets the answer for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------- | +| roundId | uint256 | - The round ID to get the answer for. | + +#### Returns + +| Name | Type | Description | +| ---- | ------ | ------------------------------------------- | +| [0] | int256 | int256 - The answer for the given round ID. | + +### getRoundData + +```solidity +function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the round data for a specific round ID. + +_This function should raise "No data present" if no data is available for the +given round ID._ + +#### Parameters + +| Name | Type | Description | +| --------- | ------ | ----------------------------------- | +| \_roundId | uint80 | - The round ID to get the data for. | + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------ | +| roundId | uint80 | - The round ID. | +| answer | int256 | - The answer for the round. | +| startedAt | uint256 | - The timestamp when the round started. | +| updatedAt | uint256 | - The timestamp when the round was updated. | +| answeredInRound | uint80 | - The round ID in which the answer was computed. | + +### getTimestamp + +```solidity +function getTimestamp(uint256 roundId) external view returns (uint256) +``` + +Gets the timestamp for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ---------------------------------------- | +| roundId | uint256 | - The round ID to get the timestamp for. | + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ----------------------------------------------- | +| [0] | uint256 | uint256 - The timestamp for the given round ID. | + +### latestAnswer + +```solidity +function latestAnswer() external view returns (int256) +``` + +Gets the latest answer from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------ | --------------------------- | +| [0] | int256 | int256 - The latest answer. | + +### latestRound + +```solidity +function latestRound() external view returns (uint256) +``` + +Gets the latest round ID from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ------------------------------ | +| [0] | uint256 | uint256 - The latest round ID. | + +### latestRoundData + +```solidity +function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the latest round data. + +_This function should raise "No data present" if no data is available._ + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------------- | +| roundId | uint80 | - The latest round ID. | +| answer | int256 | - The latest answer. | +| startedAt | uint256 | - The timestamp when the latest round started. | +| updatedAt | uint256 | - The timestamp when the latest round was updated. | +| answeredInRound | uint80 | - The round ID in which the latest answer was computed. | + +### latestTimestamp + +```solidity +function latestTimestamp() external view returns (uint256) +``` + +Gets the timestamp of the latest answer from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | --------------------------------------------- | +| [0] | uint256 | uint256 - The timestamp of the latest answer. | + +### proposeAggregator + +```solidity +function proposeAggregator(contract AggregatorV2V3Interface _aggregator) external +``` + +Proposes a new aggregator. + +#### Parameters + +| Name | Type | Description | +| ------------ | -------------------------------- | ----------------------------------------- | +| \_aggregator | contract AggregatorV2V3Interface | - The address of the proposed aggregator. | + +### updateAnswer + +```solidity +function updateAnswer(int256 _answer) public +``` + +Updates the answer in the mock aggregator. + +#### Parameters + +| Name | Type | Description | +| -------- | ------ | --------------------------- | +| \_answer | int256 | - The new answer to be set. | + +### updateRoundData + +```solidity +function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public +``` + +Updates the round data in the mock aggregator. + +#### Parameters + +| Name | Type | Description | +| ----------- | ------- | --------------------------------------- | +| \_roundId | uint80 | - The round ID to be updated. | +| \_answer | int256 | - The new answer to be set. | +| \_timestamp | uint256 | - The timestamp to be set. | +| \_startedAt | uint256 | - The timestamp when the round started. | diff --git a/src/content/chainlink-local/api-reference/v0.2.6/mock-verifier-proxy.mdx b/src/content/chainlink-local/api-reference/v0.2.6/mock-verifier-proxy.mdx new file mode 100644 index 00000000000..c47522f850e --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.6/mock-verifier-proxy.mdx @@ -0,0 +1,98 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockVerifierProxy v0.2.6 API Reference" +metadata: + description: "API documentation for MockVerifierProxy in Solidity, version v0.2.6." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockVerifierProxy + +Mock Data Streams verifier proxy. + +[MockVerifierProxy](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-streams/MockVerifierProxy.sol) + +## Variables + +### s_feeManager + +```solidity +contract IVerifierFeeManager s_feeManager +``` + +### s_verifier + +```solidity +address s_verifier +``` + +## Errors + +### VerifierInvalid + +```solidity +error VerifierInvalid() +``` + +### VerifierNotFound + +```solidity +error VerifierNotFound() +``` + +### ZeroAddress + +```solidity +error ZeroAddress() +``` + +## Events + +### VerifierInitialized + +```solidity +event VerifierInitialized(address verifierAddress) +``` + +## Functions + +### \_verify + +```solidity +function _verify(bytes payload) internal returns (bytes) +``` + +### getVerifier + +```solidity +function getVerifier(bytes32) external view returns (address) +``` + +### initializeVerifier + +```solidity +function initializeVerifier(address verifierAddress) external +``` + +### setFeeManager + +```solidity +function setFeeManager(contract IVerifierFeeManager feeManager) external +``` + +### verify + +```solidity +function verify(bytes payload, bytes parameterPayload) external payable returns (bytes) +``` + +### verifyBulk + +```solidity +function verifyBulk(bytes[] payloads, bytes parameterPayload) external payable returns (bytes[] verifiedReports) +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.6/mock-verifier.mdx b/src/content/chainlink-local/api-reference/v0.2.6/mock-verifier.mdx new file mode 100644 index 00000000000..c95f5b78925 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.6/mock-verifier.mdx @@ -0,0 +1,165 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockVerifier v0.2.6 API Reference" +metadata: + description: "API documentation for MockVerifier in Solidity, version v0.2.6." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockVerifier + +Mock Data Streams verifier. + +[MockVerifier](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-streams/MockVerifier.sol) + +## Variables + +### i_verifierProxy + +```solidity +address i_verifierProxy +``` + +### MOCK_DATA_STREAM_DON_ADDRESS + +```solidity +address MOCK_DATA_STREAM_DON_ADDRESS +``` + +### N_2 + +```solidity +uint256 N_2 +``` + +### s_inactiveDigests + +```solidity +mapping(bytes32 => mapping(bytes32 => bool)) s_inactiveDigests +``` + +### s_inactiveFeeds + +```solidity +mapping(bytes32 => bool) s_inactiveFeeds +``` + +### s_verifiedSignatures + +```solidity +mapping(bytes => bool) s_verifiedSignatures +``` + +## Errors + +### AccessForbidden + +```solidity +error AccessForbidden() +``` + +### AlreadyUsedSignature + +```solidity +error AlreadyUsedSignature() +``` + +### BadVerification + +```solidity +error BadVerification() +``` + +### DigestInactive + +```solidity +error DigestInactive(bytes32 feedId, bytes32 configDigest) +``` + +### InactiveFeed + +```solidity +error InactiveFeed(bytes32 feedId) +``` + +### InvalidS + +```solidity +error InvalidS() +``` + +### InvalidSignatureLength + +```solidity +error InvalidSignatureLength() +``` + +### InvalidV + +```solidity +error InvalidV() +``` + +## Events + +### ReportVerified + +```solidity +event ReportVerified(bytes32 feedId, address sender) +``` + +## Functions + +### activateConfig + +```solidity +function activateConfig(bytes32 feedId, bytes32 configDigest) external +``` + +### activateFeed + +```solidity +function activateFeed(bytes32 feedId) external +``` + +### constructor + +```solidity +constructor(address verifierProxy) public +``` + +### deactivateConfig + +```solidity +function deactivateConfig(bytes32 feedId, bytes32 configDigest) external +``` + +### deactivateFeed + +```solidity +function deactivateFeed(bytes32 feedId) external +``` + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) external pure returns (bool) +``` + +\_Returns true if this contract implements the interface defined by +`interfaceId`. See the corresponding +https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP +section] to learn more about how these ids are created. + +This function call must use less than 30 000 gas.\_ + +### verify + +```solidity +function verify(bytes signedReport, address sender) external returns (bytes verifierResponse) +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.6/register.mdx b/src/content/chainlink-local/api-reference/v0.2.6/register.mdx new file mode 100644 index 00000000000..62caed9eeca --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.6/register.mdx @@ -0,0 +1,91 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Register v0.2.6 API Reference" +metadata: + description: "API documentation for Register in Solidity, version v0.2.6." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## Register + +CCIP network configuration registry. + +[Register](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/ccip/Register.sol) + +## Structs + +### NetworkDetails + +```solidity +struct NetworkDetails { + uint64 chainSelector; + address routerAddress; + address linkAddress; + address wrappedNativeAddress; + address ccipBnMAddress; + address ccipLnMAddress; + address rmnProxyAddress; + address registryModuleOwnerCustomAddress; + address tokenAdminRegistryAddress; +} +``` + +## Variables + +### s_networkDetails + +```solidity +mapping(uint256 => struct Register.NetworkDetails) s_networkDetails +``` + +Mapping to store network details based on chain ID. + +## Functions + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the network details for various chains. + +### getNetworkDetails + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails networkDetails) +``` + +Retrieves network details for a given chain ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | --------------------------------------------- | +| chainId | uint256 | - The ID of the chain to get the details for. | + +#### Returns + +| Name | Type | Description | +| -------------- | ------------------------------ | ------------------------------------------------- | +| networkDetails | struct Register.NetworkDetails | - The network details for the specified chain ID. | + +### setNetworkDetails + +```solidity +function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external +``` + +Sets the network details for a given chain ID. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------------------------------ | -------------------------------------------------------- | +| chainId | uint256 | - The ID of the chain to set the details for. | +| networkDetails | struct Register.NetworkDetails | - The network details to set for the specified chain ID. | diff --git a/src/content/chainlink-local/api-reference/v0.2.6/report-versions.mdx b/src/content/chainlink-local/api-reference/v0.2.6/report-versions.mdx new file mode 100644 index 00000000000..af677824321 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.6/report-versions.mdx @@ -0,0 +1,84 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "ReportVersions v0.2.6 API Reference" +metadata: + description: "API documentation for ReportVersions in Solidity, version v0.2.6." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## ReportVersions + +Data Streams report schemas. + +[ReportVersions](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/data-streams/ReportVersions.sol) + +## Structs + +### ReportV2 + +_Represents a data report from a Data Streams stream for v2 schema (crypto +streams). The `price` value is carried to either 8 or 18 decimal places, +depending on the stream. For more information, see +https://docs.chain.link/data-streams/crypto-streams and +https://docs.chain.link/data-streams/reference/report-schema_ + +```solidity +struct ReportV2 { + bytes32 feedId; + uint32 validFromTimestamp; + uint32 observationsTimestamp; + uint192 nativeFee; + uint192 linkFee; + uint32 expiresAt; + int192 benchmarkPrice; +} +``` + +### ReportV3 + +_Represents a data report from a Data Streams stream for v3 schema (crypto +streams). The `price`, `bid`, and `ask` values are carried to either 8 or 18 +decimal places, depending on the stream. For more information, see +https://docs.chain.link/data-streams/crypto-streams and +https://docs.chain.link/data-streams/reference/report-schema_ + +```solidity +struct ReportV3 { + bytes32 feedId; + uint32 validFromTimestamp; + uint32 observationsTimestamp; + uint192 nativeFee; + uint192 linkFee; + uint32 expiresAt; + int192 price; + int192 bid; + int192 ask; +} +``` + +### ReportV4 + +_Represents a data report from a Data Streams stream for v4 schema (RWA stream). +The `price` value is carried to either 8 or 18 decimal places, depending on the +stream. The `marketStatus` indicates whether the market is currently open. +Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). For more +information, see https://docs.chain.link/data-streams/rwa-streams and +https://docs.chain.link/data-streams/reference/report-schema-v4_ + +```solidity +struct ReportV4 { + bytes32 feedId; + uint32 validFromTimestamp; + uint32 observationsTimestamp; + uint192 nativeFee; + uint192 linkFee; + uint32 expiresAt; + int192 price; + uint32 marketStatus; +} +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.6/weth9.mdx b/src/content/chainlink-local/api-reference/v0.2.6/weth9.mdx new file mode 100644 index 00000000000..bf7abe7eedd --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.6/weth9.mdx @@ -0,0 +1,126 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "WETH9 v0.2.6 API Reference" +metadata: + description: "API documentation for WETH9 in Solidity, version v0.2.6." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## WETH9 + +Wrapped Ether implementation. + +[WETH9](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.6/src/shared/WETH9.sol) + +## Variables + +### allowance + +```solidity +mapping(address => mapping(address => uint256)) allowance +``` + +### balanceOf + +```solidity +mapping(address => uint256) balanceOf +``` + +### decimals + +```solidity +uint8 decimals +``` + +### name + +```solidity +string name +``` + +### symbol + +```solidity +string symbol +``` + +## Events + +### Approval + +```solidity +event Approval(address src, address guy, uint256 wad) +``` + +### Deposit + +```solidity +event Deposit(address dst, uint256 wad) +``` + +### Transfer + +```solidity +event Transfer(address src, address dst, uint256 wad) +``` + +### Withdrawal + +```solidity +event Withdrawal(address src, uint256 wad) +``` + +## Functions + +### \_deposit + +```solidity +function _deposit() internal +``` + +### approve + +```solidity +function approve(address guy, uint256 wad) public returns (bool) +``` + +### deposit + +```solidity +function deposit() external payable +``` + +### receive + +```solidity +receive() external payable +``` + +### totalSupply + +```solidity +function totalSupply() public view returns (uint256) +``` + +### transfer + +```solidity +function transfer(address dst, uint256 wad) public returns (bool) +``` + +### transferFrom + +```solidity +function transferFrom(address src, address dst, uint256 wad) public returns (bool) +``` + +### withdraw + +```solidity +function withdraw(uint256 wad) external +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.7/aggregator-interface.mdx b/src/content/chainlink-local/api-reference/v0.2.7/aggregator-interface.mdx new file mode 100644 index 00000000000..dbe9feef673 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.7/aggregator-interface.mdx @@ -0,0 +1,136 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "AggregatorInterface v0.2.7 API Reference" +metadata: + description: "API documentation for AggregatorInterface in Solidity, version v0.2.7." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## AggregatorInterface + +Basic price feed interface. + +[AggregatorInterface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-feeds/interfaces/AggregatorInterface.sol) + +## Events + +### AnswerUpdated + +```solidity +event AnswerUpdated(int256 current, uint256 roundId, uint256 updatedAt) +``` + +Emitted when the answer is updated. + +#### Parameters + +| Name | Type | Description | +| --------- | ------- | ------------------------------------------------ | +| current | int256 | - The updated answer. | +| roundId | uint256 | - The round ID for which the answer was updated. | +| updatedAt | uint256 | - The timestamp when the answer was updated. | + +### NewRound + +```solidity +event NewRound(uint256 roundId, address startedBy, uint256 startedAt) +``` + +Emitted when a new round is started. + +#### Parameters + +| Name | Type | Description | +| --------- | ------- | ---------------------------------------------------- | +| roundId | uint256 | - The round ID of the new round. | +| startedBy | address | - The address of the account that started the round. | +| startedAt | uint256 | - The timestamp when the round was started. | + +## Functions + +### getAnswer + +```solidity +function getAnswer(uint256 roundId) external view returns (int256) +``` + +Gets the answer for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------- | +| roundId | uint256 | - The round ID to get the answer for. | + +#### Returns + +| Name | Type | Description | +| ---- | ------ | ------------------------------------------- | +| [0] | int256 | int256 - The answer for the given round ID. | + +### getTimestamp + +```solidity +function getTimestamp(uint256 roundId) external view returns (uint256) +``` + +Gets the timestamp for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ---------------------------------------- | +| roundId | uint256 | - The round ID to get the timestamp for. | + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ----------------------------------------------- | +| [0] | uint256 | uint256 - The timestamp for the given round ID. | + +### latestAnswer + +```solidity +function latestAnswer() external view returns (int256) +``` + +Gets the latest answer from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------ | --------------------------- | +| [0] | int256 | int256 - The latest answer. | + +### latestRound + +```solidity +function latestRound() external view returns (uint256) +``` + +Gets the latest round ID from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ------------------------------ | +| [0] | uint256 | uint256 - The latest round ID. | + +### latestTimestamp + +```solidity +function latestTimestamp() external view returns (uint256) +``` + +Gets the timestamp of the latest answer from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | --------------------------------------------- | +| [0] | uint256 | uint256 - The timestamp of the latest answer. | diff --git a/src/content/chainlink-local/api-reference/v0.2.7/aggregator-v2-v3-interface.mdx b/src/content/chainlink-local/api-reference/v0.2.7/aggregator-v2-v3-interface.mdx new file mode 100644 index 00000000000..08e2075ad7c --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.7/aggregator-v2-v3-interface.mdx @@ -0,0 +1,18 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "AggregatorV2V3Interface v0.2.7 API Reference" +metadata: + description: "API documentation for AggregatorV2V3Interface in Solidity, version v0.2.7." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## AggregatorV2V3Interface + +Combined V2/V3 price feed interface. + +[AggregatorV2V3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-feeds/interfaces/AggregatorV2V3Interface.sol) diff --git a/src/content/chainlink-local/api-reference/v0.2.7/aggregator-v3-interface.mdx b/src/content/chainlink-local/api-reference/v0.2.7/aggregator-v3-interface.mdx new file mode 100644 index 00000000000..28f211983de --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.7/aggregator-v3-interface.mdx @@ -0,0 +1,109 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "AggregatorV3Interface v0.2.7 API Reference" +metadata: + description: "API documentation for AggregatorV3Interface in Solidity, version v0.2.7." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## AggregatorV3Interface + +Extended price feed interface. + +[AggregatorV3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-feeds/interfaces/AggregatorV3Interface.sol) + +## Functions + +### decimals + +```solidity +function decimals() external view returns (uint8) +``` + +Gets the number of decimals used by the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ----- | ------------------------------- | +| [0] | uint8 | uint8 - The number of decimals. | + +### description + +```solidity +function description() external view returns (string) +``` + +Gets the description of the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------ | -------------------------------------------------- | +| [0] | string | string memory - The description of the aggregator. | + +### getRoundData + +```solidity +function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the round data for a specific round ID. + +_This function should raise "No data present" if no data is available for the +given round ID._ + +#### Parameters + +| Name | Type | Description | +| --------- | ------ | ----------------------------------- | +| \_roundId | uint80 | - The round ID to get the data for. | + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------ | +| roundId | uint80 | - The round ID. | +| answer | int256 | - The answer for the round. | +| startedAt | uint256 | - The timestamp when the round started. | +| updatedAt | uint256 | - The timestamp when the round was updated. | +| answeredInRound | uint80 | - The round ID in which the answer was computed. | + +### latestRoundData + +```solidity +function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the latest round data. + +_This function should raise "No data present" if no data is available._ + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------------- | +| roundId | uint80 | - The latest round ID. | +| answer | int256 | - The latest answer. | +| startedAt | uint256 | - The timestamp when the latest round started. | +| updatedAt | uint256 | - The timestamp when the latest round was updated. | +| answeredInRound | uint80 | - The round ID in which the latest answer was computed. | + +### version + +```solidity +function version() external view returns (uint256) +``` + +Gets the version of the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ---------------------------------------- | +| [0] | uint256 | uint256 - The version of the aggregator. | diff --git a/src/content/chainlink-local/api-reference/v0.2.7/burn-mint-erc677-helper.mdx b/src/content/chainlink-local/api-reference/v0.2.7/burn-mint-erc677-helper.mdx new file mode 100644 index 00000000000..bf5042e68b4 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.7/burn-mint-erc677-helper.mdx @@ -0,0 +1,55 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "BurnMintERC677Helper v0.2.7 API Reference" +metadata: + description: "API documentation for BurnMintERC677Helper in Solidity, version v0.2.7." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## BurnMintERC677Helper + +Helper contract for ERC677 token operations. + +[BurnMintERC677Helper](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/ccip/BurnMintERC677Helper.sol) + +## Functions + +### constructor + +```solidity +constructor(string name, string symbol) public +``` + +Constructor to initialize the BurnMintERC677Helper contract with a name and +symbol. + +_Calls the parent constructor of BurnMintERC677 with fixed decimals (18) and +initial supply (0)._ + +#### Parameters + +| Name | Type | Description | +| ------ | ------ | -------------------------- | +| name | string | - The name of the token. | +| symbol | string | - The symbol of the token. | + +### drip + +```solidity +function drip(address to) external +``` + +Mints one full token (1e18) to the specified address. + +_Calls the internal `_mint` function from the BurnMintERC677 contract._ + +#### Parameters + +| Name | Type | Description | +| ---- | ------- | ------------------------------------------ | +| to | address | - The address to receive the minted token. | diff --git a/src/content/chainlink-local/api-reference/v0.2.7/ccip-local-simulator-fork-js.mdx b/src/content/chainlink-local/api-reference/v0.2.7/ccip-local-simulator-fork-js.mdx new file mode 100644 index 00000000000..a7979466ed1 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.7/ccip-local-simulator-fork-js.mdx @@ -0,0 +1,97 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalSimulatorFork JS v0.2.7 API Reference" +metadata: + description: "API documentation for the CCIPLocalSimulatorFork JS JavaScript helpers, version v0.2.7." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalSimulatorFork JS + +Hardhat 2 JavaScript helpers for fork routing. + +[CCIPLocalSimulatorFork JS](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/scripts/CCIPLocalSimulatorFork.js) + +## Types + +### Evm2EvmMessage : `Object` + +**Properties** + +| Name | Type | +| ------------------- | ------------------------------------------ | +| sourceChainSelector | `bigint` | +| sender | `string` | +| receiver | `string` | +| sequenceNumber | `bigint` | +| gasLimit | `bigint` | +| strict | `boolean` | +| nonce | `bigint` | +| feeToken | `string` | +| feeTokenAmount | `bigint` | +| data | `string` | +| tokenAmounts | `Array.<\{token: string, amount: bigint}>` | +| sourceTokenData | `Array.` | +| messageId | `string` | + +## Functions + +### requestLinkFromTheFaucet(linkAddress, to, amount) ⇒ `Promise.` + +Requests LINK tokens from the faucet and returns the transaction hash + +**Returns**: `Promise.` - Promise resolving to the +transaction hash of the fund transfer + +| Param | Type | Description | +| ----------- | -------- | ------------------------------------------------------- | +| linkAddress | `string` | The address of the LINK contract on the current network | +| to | `string` | The address to send LINK to | +| amount | `bigint` | The amount of LINK to request | + +### getEvm2EvmMessage(receipt) ⇒ `Evm2EvmMessage` | `null` + +Parses a transaction receipt to extract the sent message Scans through +transaction logs to find a `CCIPSendRequested` event and then decodes it to an +object + +**Returns**: `Evm2EvmMessage` | +`null` - Returns either the sent message or null if provided receipt +does not contain `CCIPSendRequested` log + +| Param | Type | Description | +| ------- | -------- | ------------------------------------------------ | +| receipt | `object` | The transaction receipt from the `ccipSend` call | + +### getEvm2AnyRampMessage(receipt) ⇒ `object` | `null` + +Parses a transaction receipt to extract the sent message from CCIPMessageSent + +**Returns**: `object` | `null` - Returns \{ +destChainSelector, sequenceNumber, EVM2AnyRampMessage message \} or null + +| Param | Type | Description | +| ------- | -------- | ------------------------------------------ | +| receipt | `object` | – The tx receipt from the on-ramp contract | + +### routeMessage(routerAddress, evm2EvmMessage) ⇒ `Promise.` + +Routes the sent message from the source network on the destination (current) +network + +**Returns**: `Promise.` - Either resolves with no value +if the message is successfully routed, or reverts +**Throws**: + +- `Error` Fails if no off-ramp matches the message's source chain + selector or if calling `router.getOffRamps()` + +| Param | Type | Description | +| -------------- | ---------------- | --------------------------------- | +| routerAddress | `string` | Address of the destination Router | +| evm2EvmMessage | `Evm2EvmMessage` | Sent cross-chain message | diff --git a/src/content/chainlink-local/api-reference/v0.2.7/ccip-local-simulator-fork.mdx b/src/content/chainlink-local/api-reference/v0.2.7/ccip-local-simulator-fork.mdx new file mode 100644 index 00000000000..4601cea3ebd --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.7/ccip-local-simulator-fork.mdx @@ -0,0 +1,311 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalSimulatorFork v0.2.7 API Reference" +metadata: + description: "API documentation for CCIPLocalSimulatorFork in Solidity, version v0.2.7." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalSimulatorFork + +CCIP simulator for forked networks. + +[CCIPLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/ccip/CCIPLocalSimulatorFork.sol) + +## Structs + +### EVM2EVMMessage + +```solidity +struct EVM2EVMMessage { + uint64 sourceChainSelector; + address sender; + address receiver; + uint64 sequenceNumber; + uint256 gasLimit; + bool strict; + uint64 nonce; + address feeToken; + uint256 feeTokenAmount; + bytes data; + struct Client.EVMTokenAmount[] tokenAmounts; + bytes[] sourceTokenData; + bytes32 messageId; +} +``` + +### OffRamp + +Structure representing an offRamp configuration + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | + +```solidity +struct OffRamp { + uint64 sourceChainSelector; + address offRamp; +} +``` + +## Variables + +### DEFAULT_GAS_LIMIT + +```solidity +uint32 DEFAULT_GAS_LIMIT +``` + +### i_register + +```solidity +contract Register i_register +``` + +The immutable register instance + +### LINK_FAUCET + +```solidity +address LINK_FAUCET +``` + +The address of the LINK faucet + +### s_processedMessages + +```solidity +mapping(bytes32 => bool) s_processedMessages +``` + +Mapping to track processed messages + +## Errors + +### InvalidExtraArgsTag + +```solidity +error InvalidExtraArgsTag() +``` + +## Events + +### CCIPMessageSent + +```solidity +event CCIPMessageSent(uint64 destChainSelector, uint64 sequenceNumber, struct Internal.EVM2AnyRampMessage message) +``` + +### CCIPSendRequested + +```solidity +event CCIPSendRequested(struct InternalPreV1dot6.EVM2EVMMessage message) +``` + +Events emitted when a CCIP send request is made + +## Functions + +### \_fromBytes + +```solidity +function _fromBytes(bytes extraArgs) internal pure returns (struct Client.GenericExtraArgsV2) +``` + +Internal helper function to decode extraArgs bytes to GenericExtraArgsV2 struct. +Supports decoding of both GenericExtraArgsV2 and EVMExtraArgsV1 structs. + +#### Parameters + +| Name | Type | Description | +| --------- | ----- | --------------------------------------------- | +| extraArgs | bytes | - The bytes representing the extra arguments. | + +#### Returns + +| Name | Type | Description | +| ---- | -------------------------------- | --------------------------------------------------------- | +| [0] | struct Client.GenericExtraArgsV2 | genericExtraArgs - The decoded GenericExtraArgsV2 struct. | + +### \_routeCapturedMessages + +```solidity +function _routeCapturedMessages(uint256[] forkIds, uint256 sourceForkId, address sourceRouterAddress) internal +``` + +Internal function to route captured messages to their respective destination +forks. + +#### Parameters + +| Name | Type | Description | +| ------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| forkIds | uint256[] | - The IDs of the destination network forks. These are the returned values of `createFork()` or `createSelectFork()`, not chainIds. | +| sourceForkId | uint256 | - The ID of the source network fork. This is the returned value of `createFork()` or `createSelectFork()`, not chainId. | +| sourceRouterAddress | address | - The address of the Router on the source chain. | + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the contract + +### executeSingleMessage + +```solidity +function executeSingleMessage(struct Internal.Any2EVMRampMessage message, bytes[] offchainTokenData, uint32[] tokenGasOverrides) external +``` + +Executes a single CCIP message on the offRamp + +#### Parameters + +| Name | Type | Description | +| ----------------- | ---------------------------------- | --------------------------------- | +| message | struct Internal.Any2EVMRampMessage | - The CCIP message to be executed | +| offchainTokenData | bytes[] | - Additional offchain token data | +| tokenGasOverrides | uint32[] | | + +### executeSingleMessage + +```solidity +function executeSingleMessage(struct InternalPreV1dot6.EVM2EVMMessage message, bytes[] offchainTokenData, uint32[] tokenGasOverrides) external +``` + +Works with Foundry only + +### getNetworkDetails + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) +``` + +Returns the default values for currently CCIP supported networks. If network is +not present or some of the values are changed, user can manually add new network +details using the `setNetworkDetails` function. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------------------------------------------------------------------------ | +| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | + +#### Returns + +| Name | Type | Description | +| ---- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | + +### getOffRamps + +```solidity +function getOffRamps() external view returns (struct IRouterFork.OffRamp[]) +``` + +Gets the list of offRamps + +#### Returns + +| Name | Type | Description | +| ---- | ---------------------------- | ----------------------------------- | +| [0] | struct IRouterFork.OffRamp[] | offRamps - Array of OffRamp structs | + +### getOnRamp + +```solidity +function getOnRamp(uint64 destChainSelector) external view returns (address) +``` + +Return the configured onramp for specific a destination chain. @param +destChainSelector The destination chain Id to get the onRamp for. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | -------------------------- | +| [0] | address | The address of the onRamp. | + +### requestLinkFromFaucet + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------- | +| to | address | - The address to which LINK tokens are to be sent. | +| amount | uint256 | - The amount of LINK tokens to send. | + +#### Returns + +| Name | Type | Description | +| ------- | ---- | ----------------------------------------------------------------------------- | +| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | + +### setNetworkDetails + +```solidity +function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external +``` + +If network details are not present or some of the values are changed, user can +manually add new network details using the `setNetworkDetails` function. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | +| networkDetails | struct Register.NetworkDetails | - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | + +### switchChainAndRouteMessage + +```solidity +function switchChainAndRouteMessage(uint256 forkId) external +``` + +To be called after the sending of the cross-chain message (`ccipSend`). Goes +through the list of past logs and looks for the `CCIPSendRequested` and +`CCIPMessageSent` events. Switches to a destination network fork. Routes the +sent cross-chain message on the destination network. If you sent more than one +message, it will try to route all of them to `forkId`. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------------------------------------------------------------------- | +| forkId | uint256 | - The ID of the destination network fork. This is the returned value of `createFork()` or `createSelectFork()` | + +### switchChainAndRouteMessage + +```solidity +function switchChainAndRouteMessage(uint256[] forkIds) external +``` + +To be called after the sending of the cross-chain message (`ccipSend`). Override +variant of the `switchChainAndRouteMessage(uint256 forkId)` function in case of +multiple destination forks. Goes through the list of past logs and looks for the +`CCIPSendRequested` and `CCIPMessageSent` events. Loops through provided +`forkIds` and tries to route the message to correct destination. If you haven't +provide correct `forkId`, the message will get lost. If you sent more than one +message, it will try to route all of them to correct destinations. + +#### Parameters + +| Name | Type | Description | +| ------- | --------- | ------------------------------------------------------------------------------------------------------------------- | +| forkIds | uint256[] | - The IDs of the destination network forks. These are the returned values of `createFork()` or `createSelectFork()` | diff --git a/src/content/chainlink-local/api-reference/v0.2.7/ccip-local-simulator.mdx b/src/content/chainlink-local/api-reference/v0.2.7/ccip-local-simulator.mdx new file mode 100644 index 00000000000..f7d37820c6f --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.7/ccip-local-simulator.mdx @@ -0,0 +1,233 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalSimulator v0.2.7 API Reference" +metadata: + description: "API documentation for CCIPLocalSimulator in Solidity, version v0.2.7." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalSimulator + +Local CCIP simulator (no-fork mode). + +[CCIPLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/ccip/CCIPLocalSimulator.sol) + +## Variables + +### CHAIN_SELECTOR + +```solidity +uint64 CHAIN_SELECTOR +``` + +The unique CCIP Chain Selector constant + +### i_ccipBnM + +```solidity +contract BurnMintERC677Helper i_ccipBnM +``` + +The BurnMintERC677Helper instance for CCIP-BnM token + +### i_ccipLnM + +```solidity +contract BurnMintERC677Helper i_ccipLnM +``` + +The BurnMintERC677Helper instance for CCIP-LnM token + +### i_linkToken + +```solidity +contract LinkToken i_linkToken +``` + +The LINK token instance + +### i_mockRouter + +```solidity +contract MockCCIPRouter i_mockRouter +``` + +The mock CCIP router instance + +### i_wrappedNative + +```solidity +contract WETH9 i_wrappedNative +``` + +The wrapped native token instance + +### s_supportedTokens + +```solidity +address[] s_supportedTokens +``` + +The list of supported token addresses + +## Errors + +### CCIPLocalSimulator\_\_MsgSenderIsNotTokenOwner + +```solidity +error CCIPLocalSimulator__MsgSenderIsNotTokenOwner() +``` + +### CCIPLocalSimulator\_\_RequiredRoleNotFound + +```solidity +error CCIPLocalSimulator__RequiredRoleNotFound(address account, bytes32 role, address token) +``` + +## Functions + +### configuration + +```solidity +function configuration() public view returns (uint64 chainSelector_, contract IRouterClient sourceRouter_, contract IRouterClient destinationRouter_, contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract BurnMintERC677Helper ccipBnM_, contract BurnMintERC677Helper ccipLnM_) +``` + +Returns configuration details for pre-deployed contracts and services needed for +local CCIP simulations. + +#### Returns + +| Name | Type | Description | +| ------------------- | ----------------------------- | ----------------------------------------------------------- | +| chainSelector\_ | uint64 | - The unique CCIP Chain Selector. | +| sourceRouter\_ | contract IRouterClient | - The source chain Router contract. | +| destinationRouter\_ | contract IRouterClient | - The destination chain Router contract. | +| wrappedNative\_ | contract WETH9 | - The wrapped native token which can be used for CCIP fees. | +| linkToken\_ | contract LinkToken | - The LINK token. | +| ccipBnM\_ | contract BurnMintERC677Helper | - The ccipBnM token. | +| ccipLnM\_ | contract BurnMintERC677Helper | - The ccipLnM token. | + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the contract and pre-deployed token instances + +### getSupportedTokens + +```solidity +function getSupportedTokens(uint64 chainSelector) external view returns (address[] tokens) +``` + +Gets a list of token addresses that are supported for cross-chain transfers by +the simulator. + +#### Parameters + +| Name | Type | Description | +| ------------- | ------ | --------------------------------- | +| chainSelector | uint64 | - The unique CCIP Chain Selector. | + +#### Returns + +| Name | Type | Description | +| ------ | --------- | -------------------------------------------------------------------------------------------------- | +| tokens | address[] | - Returns a list of token addresses that are supported for cross-chain transfers by the simulator. | + +### isChainSupported + +```solidity +function isChainSupported(uint64 chainSelector) public pure returns (bool supported) +``` + +Checks whether the provided `chainSelector` is supported by the simulator. + +#### Parameters + +| Name | Type | Description | +| ------------- | ------ | --------------------------------- | +| chainSelector | uint64 | - The unique CCIP Chain Selector. | + +#### Returns + +| Name | Type | Description | +| --------- | ---- | ---------------------------------------------------------------- | +| supported | bool | - Returns true if `chainSelector` is supported by the simulator. | + +### requestLinkFromFaucet + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------- | +| to | address | - The address to which LINK tokens are to be sent. | +| amount | uint256 | - The amount of LINK tokens to send. | + +#### Returns + +| Name | Type | Description | +| ------- | ---- | ----------------------------------------------------------------------------- | +| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | + +### supportNewTokenViaAccessControlDefaultAdmin + +```solidity +function supportNewTokenViaAccessControlDefaultAdmin(address tokenAddress) external +``` + +Allows user to support any new token, besides CCIP BnM and CCIP LnM, for +cross-chain transfers. The caller must have the DEFAULT_ADMIN_ROLE as defined by +the contract itself. Reverts if the caller is not the admin of the token using +OZ's AccessControl DEFAULT_ADMIN_ROLE. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ------------------------------------------------------------------ | +| tokenAddress | address | - The address of the token to add to the list of supported tokens. | + +### supportNewTokenViaGetCCIPAdmin + +```solidity +function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external +``` + +Allows user to support any new token, besides CCIP BnM and CCIP LnM, for +cross-chain transfers. Reverts if token does not implement getCCIPAdmin() +function. Reverts if the caller is not the token CCIPAdmin. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ------------------------------------------------------------------ | +| tokenAddress | address | - The address of the token to add to the list of supported tokens. | + +### supportNewTokenViaOwner + +```solidity +function supportNewTokenViaOwner(address tokenAddress) external +``` + +Allows user to support any new token, besides CCIP BnM and CCIP LnM, for +cross-chain transfers. Reverts if token does not implement owner() function. +Reverts if the caller is not the token owner. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ------------------------------------------------------------------ | +| tokenAddress | address | - The address of the token to add to the list of supported tokens. | diff --git a/src/content/chainlink-local/api-reference/v0.2.7/data-streams-local-simulator-fork.mdx b/src/content/chainlink-local/api-reference/v0.2.7/data-streams-local-simulator-fork.mdx new file mode 100644 index 00000000000..a403d0379b0 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.7/data-streams-local-simulator-fork.mdx @@ -0,0 +1,121 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "DataStreamsLocalSimulatorFork v0.2.7 API Reference" +metadata: + description: "API documentation for DataStreamsLocalSimulatorFork in Solidity, version v0.2.7." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## DataStreamsLocalSimulatorFork + +Data Streams simulator for forked networks. + +[DataStreamsLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-streams/DataStreamsLocalSimulatorFork.sol) + +## Variables + +### i_register + +```solidity +contract Register i_register +``` + +The immutable register instance + +### LINK_FAUCET + +```solidity +address LINK_FAUCET +``` + +The address of the LINK faucet + +## Functions + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the contract + +### getNetworkDetails + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) +``` + +Returns the default values for currently Data Streams supported networks. If +network is not present or some of the values are changed, user can manually add +new network details using the `setNetworkDetails` function. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ----------------------------------------------------------------------------- | +| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | + +#### Returns + +| Name | Type | Description | +| ---- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | + +### requestLinkFromFaucet + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------- | +| to | address | - The address to which LINK tokens are to be sent. | +| amount | uint256 | - The amount of LINK tokens to send. | + +#### Returns + +| Name | Type | Description | +| ------- | ---- | ----------------------------------------------------------------------------- | +| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | + +### requestNativeFromFaucet + +```solidity +function requestNativeFromFaucet(address to, uint256 amount) external +``` + +Requests native coints from the faucet. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | --------------------------------------------------- | +| to | address | - The address to which native coins are to be sent. | +| amount | uint256 | - The amount of native coins to send. | + +### setNetworkDetails + +```solidity +function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external +``` + +If network details are not present or some of the values are changed, user can +manually add new network details using the `setNetworkDetails` function. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- | +| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | +| networkDetails | struct Register.NetworkDetails | - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | diff --git a/src/content/chainlink-local/api-reference/v0.2.7/data-streams-local-simulator.mdx b/src/content/chainlink-local/api-reference/v0.2.7/data-streams-local-simulator.mdx new file mode 100644 index 00000000000..fb51da30ce1 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.7/data-streams-local-simulator.mdx @@ -0,0 +1,110 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "DataStreamsLocalSimulator v0.2.7 API Reference" +metadata: + description: "API documentation for DataStreamsLocalSimulator in Solidity, version v0.2.7." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## DataStreamsLocalSimulator + +Local Data Streams simulator (no-fork mode). + +[DataStreamsLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-streams/DataStreamsLocalSimulator.sol) + +## Variables + +### i_linkToken + +```solidity +contract LinkToken i_linkToken +``` + +The LINK token instance + +### i_wrappedNative + +```solidity +contract WETH9 i_wrappedNative +``` + +The wrapped native token instance + +### s_mockFeeManager + +```solidity +contract MockFeeManager s_mockFeeManager +``` + +### s_mockRewardManager + +```solidity +contract MockRewardManager s_mockRewardManager +``` + +### s_mockVerifier + +```solidity +contract MockVerifier s_mockVerifier +``` + +### s_mockVerifierProxy + +```solidity +contract MockVerifierProxy s_mockVerifierProxy +``` + +## Functions + +### configuration + +```solidity +function configuration() public view returns (contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract MockVerifier mockVerifier_, contract MockVerifierProxy mockVerifierProxy_, contract MockFeeManager mockFeeManager_, contract MockRewardManager mockRewardManager_) +``` + +@notice Returns configuration details for pre-deployed contracts and services +needed for local Data Streams simulations. + +#### Returns + +| Name | Type | Description | +| ------------------- | -------------------------- | ----------------------------------- | +| wrappedNative\_ | contract WETH9 | - The wrapped native token. | +| linkToken\_ | contract LinkToken | - The LINK token. | +| mockVerifier\_ | contract MockVerifier | - The mock verifier contract. | +| mockVerifierProxy\_ | contract MockVerifierProxy | - The mock verifier proxy contract. | +| mockFeeManager\_ | contract MockFeeManager | - The mock fee manager contract. | +| mockRewardManager\_ | contract MockRewardManager | - The mock reward manager contract. | + +### constructor + +```solidity +constructor() public +``` + +### requestLinkFromFaucet + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------- | +| to | address | - The address to which LINK tokens are to be sent. | +| amount | uint256 | - The amount of LINK tokens to send. | + +#### Returns + +| Name | Type | Description | +| ------- | ---- | ----------------------------------------------------------------------------- | +| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | diff --git a/src/content/chainlink-local/api-reference/v0.2.7/data-streams-register.mdx b/src/content/chainlink-local/api-reference/v0.2.7/data-streams-register.mdx new file mode 100644 index 00000000000..6fbf7c37c71 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.7/data-streams-register.mdx @@ -0,0 +1,84 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Register (Data Streams) v0.2.7 API Reference" +metadata: + description: "API documentation for Register (Data Streams) in Solidity, version v0.2.7." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## Register (Data Streams) + +Data Streams network configuration registry. + +[Register (Data Streams)](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-streams/Register.sol) + +## Structs + +### NetworkDetails + +```solidity +struct NetworkDetails { + address verifierProxyAddress; + address linkAddress; +} +``` + +## Variables + +### s_networkDetails + +```solidity +mapping(uint256 => struct Register.NetworkDetails) s_networkDetails +``` + +Mapping to store network details based on chain ID. + +## Functions + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the network details for various chains. + +### getNetworkDetails + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails networkDetails) +``` + +Retrieves network details for a given chain ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | --------------------------------------------- | +| chainId | uint256 | - The ID of the chain to get the details for. | + +#### Returns + +| Name | Type | Description | +| -------------- | ------------------------------ | ------------------------------------------------- | +| networkDetails | struct Register.NetworkDetails | - The network details for the specified chain ID. | + +### setNetworkDetails + +```solidity +function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external +``` + +Sets the network details for a given chain ID. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------------------------------ | -------------------------------------------------------- | +| chainId | uint256 | - The ID of the chain to set the details for. | +| networkDetails | struct Register.NetworkDetails | - The network details to set for the specified chain ID. | diff --git a/src/content/chainlink-local/api-reference/v0.2.7/index.mdx b/src/content/chainlink-local/api-reference/v0.2.7/index.mdx new file mode 100644 index 00000000000..c37c1ad11bb --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.7/index.mdx @@ -0,0 +1,56 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Chainlink Local v0.2.7 API Reference" +metadata: + description: "API reference documentation for Chainlink Local v0.2.7" +isIndex: true +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +Chainlink Local v0.2.7 pins `@chainlink/contracts-ccip` 1.6.2 and `@chainlink/contracts` 1.5.0, and adds the Data Streams billing mechanism toggle in `DataStreamsLocalSimulator`. + +## CCIP + +These contracts provide Cross-Chain Interoperability Protocol (CCIP) functionality in a local testing environment: + +- [CCIPLocalSimulator](/chainlink-local/api-reference/v0.2.7/ccip-local-simulator) - Local CCIP simulator (no-fork mode) +- [CCIPLocalSimulatorFork](/chainlink-local/api-reference/v0.2.7/ccip-local-simulator-fork) - CCIP simulator for forked networks +- [CCIPLocalSimulatorFork JS](/chainlink-local/api-reference/v0.2.7/ccip-local-simulator-fork-js) - JavaScript helpers for fork routing +- [Register](/chainlink-local/api-reference/v0.2.7/register) - CCIP network configuration registry + +## Data Streams + +Contracts for simulating Chainlink Data Streams: + +- [DataStreamsLocalSimulator](/chainlink-local/api-reference/v0.2.7/data-streams-local-simulator) - Local Data Streams simulator (no-fork mode) +- [DataStreamsLocalSimulatorFork](/chainlink-local/api-reference/v0.2.7/data-streams-local-simulator-fork) - Data Streams simulator for forked networks +- [MockVerifier](/chainlink-local/api-reference/v0.2.7/mock-verifier) - Mock Data Streams verifier +- [MockVerifierProxy](/chainlink-local/api-reference/v0.2.7/mock-verifier-proxy) - Mock Data Streams verifier proxy +- [MockReportGenerator](/chainlink-local/api-reference/v0.2.7/mock-report-generator) - Signed report generator for every report schema +- [MockFeeManager](/chainlink-local/api-reference/v0.2.7/mock-fee-manager) - Mock verifier fee manager +- [MockRewardManager](/chainlink-local/api-reference/v0.2.7/mock-reward-manager) - Mock reward manager +- [ReportVersions](/chainlink-local/api-reference/v0.2.7/report-versions) - Data Streams report schemas +- [Register (Data Streams)](/chainlink-local/api-reference/v0.2.7/data-streams-register) - Data Streams network configuration registry + +## Data Feeds + +Contracts for simulating Chainlink Data Feeds: + +- [AggregatorInterface](/chainlink-local/api-reference/v0.2.7/aggregator-interface) - Basic price feed interface +- [AggregatorV2V3Interface](/chainlink-local/api-reference/v0.2.7/aggregator-v2-v3-interface) - Combined V2/V3 price feed interface +- [AggregatorV3Interface](/chainlink-local/api-reference/v0.2.7/aggregator-v3-interface) - Extended price feed interface +- [MockOffchainAggregator](/chainlink-local/api-reference/v0.2.7/mock-offchain-aggregator) - Mock implementation of off-chain aggregator +- [MockV3Aggregator](/chainlink-local/api-reference/v0.2.7/mock-v3-aggregator) - Mock implementation of V3 aggregator + +## Token Contracts + +Standard token implementations for testing: + +- [BurnMintERC677Helper](/chainlink-local/api-reference/v0.2.7/burn-mint-erc677-helper) - Helper contract for ERC677 token operations +- [LinkToken](/chainlink-local/api-reference/v0.2.7/link-token) - LINK token implementation +- [WETH9](/chainlink-local/api-reference/v0.2.7/weth9) - Wrapped Ether implementation diff --git a/src/content/chainlink-local/api-reference/v0.2.7/link-token.mdx b/src/content/chainlink-local/api-reference/v0.2.7/link-token.mdx new file mode 100644 index 00000000000..8c0d133d66a --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.7/link-token.mdx @@ -0,0 +1,44 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "LinkToken v0.2.7 API Reference" +metadata: + description: "API documentation for LinkToken in Solidity, version v0.2.7." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## LinkToken + +LINK token implementation. + +[LinkToken](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/shared/LinkToken.sol) + +## Functions + +### \_onCreate + +```solidity +function _onCreate() internal virtual +``` + +Hook that is called when this contract is created. + +_Useful to override constructor behaviour in child contracts (e.g., LINK bridge +tokens). The default implementation mints 10\*\*27 tokens to the contract +deployer._ + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the LinkToken contract with a fixed total supply, +name, and symbol. + +_Calls the ERC677 constructor with the name and symbol, and then mints the total +supply to the contract deployer._ diff --git a/src/content/chainlink-local/api-reference/v0.2.7/mock-fee-manager.mdx b/src/content/chainlink-local/api-reference/v0.2.7/mock-fee-manager.mdx new file mode 100644 index 00000000000..7243d941704 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.7/mock-fee-manager.mdx @@ -0,0 +1,174 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockFeeManager v0.2.7 API Reference" +metadata: + description: "API documentation for MockFeeManager in Solidity, version v0.2.7." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockFeeManager + +Mock verifier fee manager. + +[MockFeeManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-streams/MockFeeManager.sol) + +## Structs + +### Asset + +```solidity +struct Asset { + address assetAddress; + uint256 amount; +} +``` + +## Variables + +### i_linkAddress + +```solidity +address i_linkAddress +``` + +### i_nativeAddress + +```solidity +address i_nativeAddress +``` + +### i_proxyAddress + +```solidity +address i_proxyAddress +``` + +### i_rewardManager + +```solidity +contract IRewardManager i_rewardManager +``` + +### s_mockDiscounts + +```solidity +mapping(address => uint256) s_mockDiscounts +``` + +### s_nativeSurcharge + +```solidity +uint256 s_nativeSurcharge +``` + +## Errors + +### ExpiredReport + +```solidity +error ExpiredReport() +``` + +### InvalidAddress + +```solidity +error InvalidAddress() +``` + +### InvalidDeposit + +```solidity +error InvalidDeposit() +``` + +### InvalidDiscount + +```solidity +error InvalidDiscount() +``` + +### InvalidQuote + +```solidity +error InvalidQuote() +``` + +### InvalidSurcharge + +```solidity +error InvalidSurcharge() +``` + +### Unauthorized + +```solidity +error Unauthorized() +``` + +## Functions + +### \_processFee + +```solidity +function _processFee(bytes payload, bytes parameterPayload, address subscriber) internal +``` + +### constructor + +```solidity +constructor(address linkAddress, address nativeAddress, address proxyAddress, address rewardManager) public +``` + +### getFeeAndReward + +```solidity +function getFeeAndReward(address subscriber, bytes report, address quoteAddress) public view returns (struct Common.Asset, struct Common.Asset, uint256) +``` + +### getMockDiscount + +```solidity +function getMockDiscount(address subscriber) external view returns (uint256) +``` + +### processFee + +```solidity +function processFee(bytes payload, bytes parameterPayload, address subscriber) external payable +``` + +### processFeeBulk + +```solidity +function processFeeBulk(bytes[] payloads, bytes parameterPayload, address subscriber) external payable +``` + +### setMockDiscount + +```solidity +function setMockDiscount(address subscriber, uint256 discount) external +``` + +### setNativeSurcharge + +```solidity +function setNativeSurcharge(uint64 surcharge) external +``` + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) external pure returns (bool) +``` + +\_Returns true if this contract implements the interface defined by +`interfaceId`. See the corresponding +https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP +section] to learn more about how these ids are created. + +This function call must use less than 30 000 gas.\_ diff --git a/src/content/chainlink-local/api-reference/v0.2.7/mock-offchain-aggregator.mdx b/src/content/chainlink-local/api-reference/v0.2.7/mock-offchain-aggregator.mdx new file mode 100644 index 00000000000..235eb11f5ee --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.7/mock-offchain-aggregator.mdx @@ -0,0 +1,190 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockOffchainAggregator v0.2.7 API Reference" +metadata: + description: "API documentation for MockOffchainAggregator in Solidity, version v0.2.7." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockOffchainAggregator + +Mock implementation of off-chain aggregator. + +[MockOffchainAggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-feeds/MockOffchainAggregator.sol) + +## Variables + +### decimals + +```solidity +uint8 decimals +``` + +The number of decimals used by the aggregator. + +### getAnswer + +```solidity +mapping(uint256 => int256) getAnswer +``` + +Mapping to get the answer for a specific round ID. + +### getTimestamp + +```solidity +mapping(uint256 => uint256) getTimestamp +``` + +Mapping to get the timestamp for a specific round ID. + +### latestAnswer + +```solidity +int256 latestAnswer +``` + +The latest answer reported by the aggregator. + +### latestRound + +```solidity +uint256 latestRound +``` + +The latest round ID. + +### latestTimestamp + +```solidity +uint256 latestTimestamp +``` + +The timestamp of the latest answer. + +### maxAnswer + +```solidity +int192 maxAnswer +``` + +The maximum answer the aggregator is allowed to report. + +### minAnswer + +```solidity +int192 minAnswer +``` + +The minimum answer the aggregator is allowed to report. + +## Functions + +### constructor + +```solidity +constructor(uint8 _decimals, int256 _initialAnswer) public +``` + +Constructor to initialize the MockOffchainAggregator contract with initial +parameters. + +#### Parameters + +| Name | Type | Description | +| --------------- | ------ | ------------------------------------------------------ | +| \_decimals | uint8 | - The number of decimals for the aggregator. | +| \_initialAnswer | int256 | - The initial answer to be set in the mock aggregator. | + +### getRoundData + +```solidity +function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the round data for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| --------- | ------ | ----------------------------------- | +| \_roundId | uint80 | - The round ID to get the data for. | + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------ | +| roundId | uint80 | - The round ID. | +| answer | int256 | - The answer for the round. | +| startedAt | uint256 | - The timestamp when the round started. | +| updatedAt | uint256 | - The timestamp when the round was updated. | +| answeredInRound | uint80 | - The round ID in which the answer was computed. | + +### latestRoundData + +```solidity +function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the latest round data. + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------------- | +| roundId | uint80 | - The latest round ID. | +| answer | int256 | - The latest answer. | +| startedAt | uint256 | - The timestamp when the latest round started. | +| updatedAt | uint256 | - The timestamp when the latest round was updated. | +| answeredInRound | uint80 | - The round ID in which the latest answer was computed. | + +### updateAnswer + +```solidity +function updateAnswer(int256 _answer) public +``` + +Updates the answer in the mock aggregator. + +#### Parameters + +| Name | Type | Description | +| -------- | ------ | --------------------------- | +| \_answer | int256 | - The new answer to be set. | + +### updateMinAndMaxAnswers + +```solidity +function updateMinAndMaxAnswers(int192 _minAnswer, int192 _maxAnswer) external +``` + +Updates the minimum and maximum answers the aggregator can report. + +#### Parameters + +| Name | Type | Description | +| ----------- | ------ | ------------------------- | +| \_minAnswer | int192 | - The new minimum answer. | +| \_maxAnswer | int192 | - The new maximum answer. | + +### updateRoundData + +```solidity +function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public +``` + +Updates the round data in the mock aggregator. + +#### Parameters + +| Name | Type | Description | +| ----------- | ------- | --------------------------------------- | +| \_roundId | uint80 | - The round ID to be updated. | +| \_answer | int256 | - The new answer to be set. | +| \_timestamp | uint256 | - The timestamp to be set. | +| \_startedAt | uint256 | - The timestamp when the round started. | diff --git a/src/content/chainlink-local/api-reference/v0.2.7/mock-report-generator.mdx b/src/content/chainlink-local/api-reference/v0.2.7/mock-report-generator.mdx new file mode 100644 index 00000000000..9fba568eebc --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.7/mock-report-generator.mdx @@ -0,0 +1,192 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockReportGenerator v0.2.7 API Reference" +metadata: + description: "API documentation for MockReportGenerator in Solidity, version v0.2.7." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockReportGenerator + +Signed report generator for every report schema. + +[MockReportGenerator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-streams/MockReportGenerator.sol) + +## Variables + +### i_donAddress + +```solidity +address i_donAddress +``` + +### i_donDigest + +```solidity +uint256 i_donDigest +``` + +### i_reportV2MockFeedId + +```solidity +bytes32 i_reportV2MockFeedId +``` + +### i_reportV3MockFeedId + +```solidity +bytes32 i_reportV3MockFeedId +``` + +### i_reportV4MockFeedId + +```solidity +bytes32 i_reportV4MockFeedId +``` + +### s_ask + +```solidity +int192 s_ask +``` + +### s_bid + +```solidity +int192 s_bid +``` + +### s_expiresPeriod + +```solidity +uint32 s_expiresPeriod +``` + +### s_linkFee + +```solidity +uint192 s_linkFee +``` + +### s_marketStatus + +```solidity +uint32 s_marketStatus +``` + +### s_nativeFee + +```solidity +uint192 s_nativeFee +``` + +### s_price + +```solidity +int192 s_price +``` + +## Errors + +### MockReportGenerator\_\_CastOverflow + +```solidity +error MockReportGenerator__CastOverflow() +``` + +### MockReportGenerator\_\_InvalidAsk + +```solidity +error MockReportGenerator__InvalidAsk() +``` + +### MockReportGenerator\_\_InvalidBid + +```solidity +error MockReportGenerator__InvalidBid() +``` + +## Functions + +### constructor + +```solidity +constructor(int192 initialPrice) public +``` + +### generateReport + +```solidity +function generateReport(struct ReportVersions.ReportV2 report) external returns (bytes signedReport) +``` + +### generateReport + +```solidity +function generateReport(struct ReportVersions.ReportV3 report) external returns (bytes signedReport) +``` + +### generateReport + +```solidity +function generateReport(struct ReportVersions.ReportV4 report) external returns (bytes signedReport) +``` + +### generateReportV2 + +```solidity +function generateReportV2() external returns (bytes signedReport, struct ReportVersions.ReportV2 report) +``` + +### generateReportV3 + +```solidity +function generateReportV3() external returns (bytes signedReport, struct ReportVersions.ReportV3 report) +``` + +### generateReportV4 + +```solidity +function generateReportV4() external returns (bytes signedReport, struct ReportVersions.ReportV4 report) +``` + +### getMockDonAddress + +```solidity +function getMockDonAddress() external view returns (address) +``` + +### updateExpiresPeriod + +```solidity +function updateExpiresPeriod(uint32 period) external +``` + +### updateFees + +```solidity +function updateFees(uint192 nativeFee, uint192 linkFee) external +``` + +### updateMarketStatus + +```solidity +function updateMarketStatus(uint32 status) external +``` + +### updatePrice + +```solidity +function updatePrice(int192 price) public +``` + +### updatePriceBidAndAsk + +```solidity +function updatePriceBidAndAsk(int192 price, int192 bid, int192 ask) external +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.7/mock-reward-manager.mdx b/src/content/chainlink-local/api-reference/v0.2.7/mock-reward-manager.mdx new file mode 100644 index 00000000000..18e3eb73c62 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.7/mock-reward-manager.mdx @@ -0,0 +1,87 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockRewardManager v0.2.7 API Reference" +metadata: + description: "API documentation for MockRewardManager in Solidity, version v0.2.7." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockRewardManager + +Mock reward manager. + +[MockRewardManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-streams/MockRewardManager.sol) + +## Variables + +### i_linkAddress + +```solidity +address i_linkAddress +``` + +### s_feeManagerAddress + +```solidity +address s_feeManagerAddress +``` + +## Errors + +### Unauthorized + +```solidity +error Unauthorized() +``` + +## Events + +### FeePaid + +```solidity +event FeePaid(struct IRewardManager.FeePayment[] payments, address payer) +``` + +## Functions + +### claimRewards + +```solidity +function claimRewards(bytes32[]) external pure +``` + +### constructor + +```solidity +constructor(address linkAddress) public +``` + +### onFeePaid + +```solidity +function onFeePaid(struct IRewardManager.FeePayment[] payments, address payer) external +``` + +### setFeeManager + +```solidity +function setFeeManager(address newFeeManager) external +``` + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) external pure returns (bool) +``` + +\_Returns true if this contract implements the interface defined by +`interfaceId`. See the corresponding +https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP +section] to learn more about how these ids are created. + +This function call must use less than 30 000 gas.\_ diff --git a/src/content/chainlink-local/api-reference/v0.2.7/mock-v3-aggregator.mdx b/src/content/chainlink-local/api-reference/v0.2.7/mock-v3-aggregator.mdx new file mode 100644 index 00000000000..69c4ca392b6 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.7/mock-v3-aggregator.mdx @@ -0,0 +1,277 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockV3Aggregator v0.2.7 API Reference" +metadata: + description: "API documentation for MockV3Aggregator in Solidity, version v0.2.7." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockV3Aggregator + +Mock implementation of V3 aggregator. + +[MockV3Aggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-feeds/MockV3Aggregator.sol) + +## Variables + +### aggregator + +```solidity +address aggregator +``` + +The address of the current aggregator. + +### proposedAggregator + +```solidity +address proposedAggregator +``` + +The address of the proposed aggregator. + +### version + +```solidity +uint256 version +``` + +The version of the aggregator. + +## Functions + +### confirmAggregator + +```solidity +function confirmAggregator(address _aggregator) external +``` + +Confirms the proposed aggregator. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ----------------------------------------- | +| \_aggregator | address | - The address of the proposed aggregator. | + +### constructor + +```solidity +constructor(uint8 _decimals, int256 _initialAnswer) public +``` + +Constructor to initialize the MockV3Aggregator contract with initial parameters. + +#### Parameters + +| Name | Type | Description | +| --------------- | ------ | ------------------------------------------------------ | +| \_decimals | uint8 | - The number of decimals for the aggregator. | +| \_initialAnswer | int256 | - The initial answer to be set in the mock aggregator. | + +### decimals + +```solidity +function decimals() external view returns (uint8) +``` + +Gets the number of decimals used by the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ----- | ------------------------------- | +| [0] | uint8 | uint8 - The number of decimals. | + +### description + +```solidity +function description() external pure returns (string) +``` + +Gets the description of the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------ | -------------------------------------------------- | +| [0] | string | string memory - The description of the aggregator. | + +### getAnswer + +```solidity +function getAnswer(uint256 roundId) external view returns (int256) +``` + +Gets the answer for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------- | +| roundId | uint256 | - The round ID to get the answer for. | + +#### Returns + +| Name | Type | Description | +| ---- | ------ | ------------------------------------------- | +| [0] | int256 | int256 - The answer for the given round ID. | + +### getRoundData + +```solidity +function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the round data for a specific round ID. + +_This function should raise "No data present" if no data is available for the +given round ID._ + +#### Parameters + +| Name | Type | Description | +| --------- | ------ | ----------------------------------- | +| \_roundId | uint80 | - The round ID to get the data for. | + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------ | +| roundId | uint80 | - The round ID. | +| answer | int256 | - The answer for the round. | +| startedAt | uint256 | - The timestamp when the round started. | +| updatedAt | uint256 | - The timestamp when the round was updated. | +| answeredInRound | uint80 | - The round ID in which the answer was computed. | + +### getTimestamp + +```solidity +function getTimestamp(uint256 roundId) external view returns (uint256) +``` + +Gets the timestamp for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ---------------------------------------- | +| roundId | uint256 | - The round ID to get the timestamp for. | + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ----------------------------------------------- | +| [0] | uint256 | uint256 - The timestamp for the given round ID. | + +### latestAnswer + +```solidity +function latestAnswer() external view returns (int256) +``` + +Gets the latest answer from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------ | --------------------------- | +| [0] | int256 | int256 - The latest answer. | + +### latestRound + +```solidity +function latestRound() external view returns (uint256) +``` + +Gets the latest round ID from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ------------------------------ | +| [0] | uint256 | uint256 - The latest round ID. | + +### latestRoundData + +```solidity +function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the latest round data. + +_This function should raise "No data present" if no data is available._ + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------------- | +| roundId | uint80 | - The latest round ID. | +| answer | int256 | - The latest answer. | +| startedAt | uint256 | - The timestamp when the latest round started. | +| updatedAt | uint256 | - The timestamp when the latest round was updated. | +| answeredInRound | uint80 | - The round ID in which the latest answer was computed. | + +### latestTimestamp + +```solidity +function latestTimestamp() external view returns (uint256) +``` + +Gets the timestamp of the latest answer from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | --------------------------------------------- | +| [0] | uint256 | uint256 - The timestamp of the latest answer. | + +### proposeAggregator + +```solidity +function proposeAggregator(contract AggregatorV2V3Interface _aggregator) external +``` + +Proposes a new aggregator. + +#### Parameters + +| Name | Type | Description | +| ------------ | -------------------------------- | ----------------------------------------- | +| \_aggregator | contract AggregatorV2V3Interface | - The address of the proposed aggregator. | + +### updateAnswer + +```solidity +function updateAnswer(int256 _answer) public +``` + +Updates the answer in the mock aggregator. + +#### Parameters + +| Name | Type | Description | +| -------- | ------ | --------------------------- | +| \_answer | int256 | - The new answer to be set. | + +### updateRoundData + +```solidity +function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public +``` + +Updates the round data in the mock aggregator. + +#### Parameters + +| Name | Type | Description | +| ----------- | ------- | --------------------------------------- | +| \_roundId | uint80 | - The round ID to be updated. | +| \_answer | int256 | - The new answer to be set. | +| \_timestamp | uint256 | - The timestamp to be set. | +| \_startedAt | uint256 | - The timestamp when the round started. | diff --git a/src/content/chainlink-local/api-reference/v0.2.7/mock-verifier-proxy.mdx b/src/content/chainlink-local/api-reference/v0.2.7/mock-verifier-proxy.mdx new file mode 100644 index 00000000000..edc1711e39b --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.7/mock-verifier-proxy.mdx @@ -0,0 +1,98 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockVerifierProxy v0.2.7 API Reference" +metadata: + description: "API documentation for MockVerifierProxy in Solidity, version v0.2.7." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockVerifierProxy + +Mock Data Streams verifier proxy. + +[MockVerifierProxy](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-streams/MockVerifierProxy.sol) + +## Variables + +### s_feeManager + +```solidity +contract IVerifierFeeManager s_feeManager +``` + +### s_verifier + +```solidity +address s_verifier +``` + +## Errors + +### VerifierInvalid + +```solidity +error VerifierInvalid() +``` + +### VerifierNotFound + +```solidity +error VerifierNotFound() +``` + +### ZeroAddress + +```solidity +error ZeroAddress() +``` + +## Events + +### VerifierInitialized + +```solidity +event VerifierInitialized(address verifierAddress) +``` + +## Functions + +### \_verify + +```solidity +function _verify(bytes payload) internal returns (bytes) +``` + +### getVerifier + +```solidity +function getVerifier(bytes32) external view returns (address) +``` + +### initializeVerifier + +```solidity +function initializeVerifier(address verifierAddress) external +``` + +### setFeeManager + +```solidity +function setFeeManager(contract IVerifierFeeManager feeManager) external +``` + +### verify + +```solidity +function verify(bytes payload, bytes parameterPayload) external payable returns (bytes) +``` + +### verifyBulk + +```solidity +function verifyBulk(bytes[] payloads, bytes parameterPayload) external payable returns (bytes[] verifiedReports) +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.7/mock-verifier.mdx b/src/content/chainlink-local/api-reference/v0.2.7/mock-verifier.mdx new file mode 100644 index 00000000000..663195735e6 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.7/mock-verifier.mdx @@ -0,0 +1,165 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockVerifier v0.2.7 API Reference" +metadata: + description: "API documentation for MockVerifier in Solidity, version v0.2.7." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockVerifier + +Mock Data Streams verifier. + +[MockVerifier](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-streams/MockVerifier.sol) + +## Variables + +### i_verifierProxy + +```solidity +address i_verifierProxy +``` + +### MOCK_DATA_STREAM_DON_ADDRESS + +```solidity +address MOCK_DATA_STREAM_DON_ADDRESS +``` + +### N_2 + +```solidity +uint256 N_2 +``` + +### s_inactiveDigests + +```solidity +mapping(bytes32 => mapping(bytes32 => bool)) s_inactiveDigests +``` + +### s_inactiveFeeds + +```solidity +mapping(bytes32 => bool) s_inactiveFeeds +``` + +### s_verifiedSignatures + +```solidity +mapping(bytes => bool) s_verifiedSignatures +``` + +## Errors + +### AccessForbidden + +```solidity +error AccessForbidden() +``` + +### AlreadyUsedSignature + +```solidity +error AlreadyUsedSignature() +``` + +### BadVerification + +```solidity +error BadVerification() +``` + +### DigestInactive + +```solidity +error DigestInactive(bytes32 feedId, bytes32 configDigest) +``` + +### InactiveFeed + +```solidity +error InactiveFeed(bytes32 feedId) +``` + +### InvalidS + +```solidity +error InvalidS() +``` + +### InvalidSignatureLength + +```solidity +error InvalidSignatureLength() +``` + +### InvalidV + +```solidity +error InvalidV() +``` + +## Events + +### ReportVerified + +```solidity +event ReportVerified(bytes32 feedId, address sender) +``` + +## Functions + +### activateConfig + +```solidity +function activateConfig(bytes32 feedId, bytes32 configDigest) external +``` + +### activateFeed + +```solidity +function activateFeed(bytes32 feedId) external +``` + +### constructor + +```solidity +constructor(address verifierProxy) public +``` + +### deactivateConfig + +```solidity +function deactivateConfig(bytes32 feedId, bytes32 configDigest) external +``` + +### deactivateFeed + +```solidity +function deactivateFeed(bytes32 feedId) external +``` + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) external pure returns (bool) +``` + +\_Returns true if this contract implements the interface defined by +`interfaceId`. See the corresponding +https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP +section] to learn more about how these ids are created. + +This function call must use less than 30 000 gas.\_ + +### verify + +```solidity +function verify(bytes signedReport, address sender) external returns (bytes verifierResponse) +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.7/register.mdx b/src/content/chainlink-local/api-reference/v0.2.7/register.mdx new file mode 100644 index 00000000000..073a0a899d9 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.7/register.mdx @@ -0,0 +1,91 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Register v0.2.7 API Reference" +metadata: + description: "API documentation for Register in Solidity, version v0.2.7." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## Register + +CCIP network configuration registry. + +[Register](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/ccip/Register.sol) + +## Structs + +### NetworkDetails + +```solidity +struct NetworkDetails { + uint64 chainSelector; + address routerAddress; + address linkAddress; + address wrappedNativeAddress; + address ccipBnMAddress; + address ccipLnMAddress; + address rmnProxyAddress; + address registryModuleOwnerCustomAddress; + address tokenAdminRegistryAddress; +} +``` + +## Variables + +### s_networkDetails + +```solidity +mapping(uint256 => struct Register.NetworkDetails) s_networkDetails +``` + +Mapping to store network details based on chain ID. + +## Functions + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the network details for various chains. + +### getNetworkDetails + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails networkDetails) +``` + +Retrieves network details for a given chain ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | --------------------------------------------- | +| chainId | uint256 | - The ID of the chain to get the details for. | + +#### Returns + +| Name | Type | Description | +| -------------- | ------------------------------ | ------------------------------------------------- | +| networkDetails | struct Register.NetworkDetails | - The network details for the specified chain ID. | + +### setNetworkDetails + +```solidity +function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external +``` + +Sets the network details for a given chain ID. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------------------------------ | -------------------------------------------------------- | +| chainId | uint256 | - The ID of the chain to set the details for. | +| networkDetails | struct Register.NetworkDetails | - The network details to set for the specified chain ID. | diff --git a/src/content/chainlink-local/api-reference/v0.2.7/report-versions.mdx b/src/content/chainlink-local/api-reference/v0.2.7/report-versions.mdx new file mode 100644 index 00000000000..11018ffeb1f --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.7/report-versions.mdx @@ -0,0 +1,84 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "ReportVersions v0.2.7 API Reference" +metadata: + description: "API documentation for ReportVersions in Solidity, version v0.2.7." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## ReportVersions + +Data Streams report schemas. + +[ReportVersions](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/data-streams/ReportVersions.sol) + +## Structs + +### ReportV2 + +_Represents a data report from a Data Streams stream for v2 schema (crypto +streams). The `price` value is carried to either 8 or 18 decimal places, +depending on the stream. For more information, see +https://docs.chain.link/data-streams/crypto-streams and +https://docs.chain.link/data-streams/reference/report-schema_ + +```solidity +struct ReportV2 { + bytes32 feedId; + uint32 validFromTimestamp; + uint32 observationsTimestamp; + uint192 nativeFee; + uint192 linkFee; + uint32 expiresAt; + int192 benchmarkPrice; +} +``` + +### ReportV3 + +_Represents a data report from a Data Streams stream for v3 schema (crypto +streams). The `price`, `bid`, and `ask` values are carried to either 8 or 18 +decimal places, depending on the stream. For more information, see +https://docs.chain.link/data-streams/crypto-streams and +https://docs.chain.link/data-streams/reference/report-schema_ + +```solidity +struct ReportV3 { + bytes32 feedId; + uint32 validFromTimestamp; + uint32 observationsTimestamp; + uint192 nativeFee; + uint192 linkFee; + uint32 expiresAt; + int192 price; + int192 bid; + int192 ask; +} +``` + +### ReportV4 + +_Represents a data report from a Data Streams stream for v4 schema (RWA stream). +The `price` value is carried to either 8 or 18 decimal places, depending on the +stream. The `marketStatus` indicates whether the market is currently open. +Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). For more +information, see https://docs.chain.link/data-streams/rwa-streams and +https://docs.chain.link/data-streams/reference/report-schema-v4_ + +```solidity +struct ReportV4 { + bytes32 feedId; + uint32 validFromTimestamp; + uint32 observationsTimestamp; + uint192 nativeFee; + uint192 linkFee; + uint32 expiresAt; + int192 price; + uint32 marketStatus; +} +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.7/weth9.mdx b/src/content/chainlink-local/api-reference/v0.2.7/weth9.mdx new file mode 100644 index 00000000000..d6062473363 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.7/weth9.mdx @@ -0,0 +1,126 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "WETH9 v0.2.7 API Reference" +metadata: + description: "API documentation for WETH9 in Solidity, version v0.2.7." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## WETH9 + +Wrapped Ether implementation. + +[WETH9](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.7/src/shared/WETH9.sol) + +## Variables + +### allowance + +```solidity +mapping(address => mapping(address => uint256)) allowance +``` + +### balanceOf + +```solidity +mapping(address => uint256) balanceOf +``` + +### decimals + +```solidity +uint8 decimals +``` + +### name + +```solidity +string name +``` + +### symbol + +```solidity +string symbol +``` + +## Events + +### Approval + +```solidity +event Approval(address src, address guy, uint256 wad) +``` + +### Deposit + +```solidity +event Deposit(address dst, uint256 wad) +``` + +### Transfer + +```solidity +event Transfer(address src, address dst, uint256 wad) +``` + +### Withdrawal + +```solidity +event Withdrawal(address src, uint256 wad) +``` + +## Functions + +### \_deposit + +```solidity +function _deposit() internal +``` + +### approve + +```solidity +function approve(address guy, uint256 wad) public returns (bool) +``` + +### deposit + +```solidity +function deposit() external payable +``` + +### receive + +```solidity +receive() external payable +``` + +### totalSupply + +```solidity +function totalSupply() public view returns (uint256) +``` + +### transfer + +```solidity +function transfer(address dst, uint256 wad) public returns (bool) +``` + +### transferFrom + +```solidity +function transferFrom(address src, address dst, uint256 wad) public returns (bool) +``` + +### withdraw + +```solidity +function withdraw(uint256 wad) external +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.8/aggregator-interface.mdx b/src/content/chainlink-local/api-reference/v0.2.8/aggregator-interface.mdx new file mode 100644 index 00000000000..e8959035c09 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.8/aggregator-interface.mdx @@ -0,0 +1,136 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "AggregatorInterface v0.2.8 API Reference" +metadata: + description: "API documentation for AggregatorInterface in Solidity, version v0.2.8." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## AggregatorInterface + +Basic price feed interface. + +[AggregatorInterface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-feeds/interfaces/AggregatorInterface.sol) + +## Events + +### AnswerUpdated + +```solidity +event AnswerUpdated(int256 current, uint256 roundId, uint256 updatedAt) +``` + +Emitted when the answer is updated. + +#### Parameters + +| Name | Type | Description | +| --------- | ------- | ------------------------------------------------ | +| current | int256 | - The updated answer. | +| roundId | uint256 | - The round ID for which the answer was updated. | +| updatedAt | uint256 | - The timestamp when the answer was updated. | + +### NewRound + +```solidity +event NewRound(uint256 roundId, address startedBy, uint256 startedAt) +``` + +Emitted when a new round is started. + +#### Parameters + +| Name | Type | Description | +| --------- | ------- | ---------------------------------------------------- | +| roundId | uint256 | - The round ID of the new round. | +| startedBy | address | - The address of the account that started the round. | +| startedAt | uint256 | - The timestamp when the round was started. | + +## Functions + +### getAnswer + +```solidity +function getAnswer(uint256 roundId) external view returns (int256) +``` + +Gets the answer for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------- | +| roundId | uint256 | - The round ID to get the answer for. | + +#### Returns + +| Name | Type | Description | +| ---- | ------ | ------------------------------------------- | +| [0] | int256 | int256 - The answer for the given round ID. | + +### getTimestamp + +```solidity +function getTimestamp(uint256 roundId) external view returns (uint256) +``` + +Gets the timestamp for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ---------------------------------------- | +| roundId | uint256 | - The round ID to get the timestamp for. | + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ----------------------------------------------- | +| [0] | uint256 | uint256 - The timestamp for the given round ID. | + +### latestAnswer + +```solidity +function latestAnswer() external view returns (int256) +``` + +Gets the latest answer from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------ | --------------------------- | +| [0] | int256 | int256 - The latest answer. | + +### latestRound + +```solidity +function latestRound() external view returns (uint256) +``` + +Gets the latest round ID from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ------------------------------ | +| [0] | uint256 | uint256 - The latest round ID. | + +### latestTimestamp + +```solidity +function latestTimestamp() external view returns (uint256) +``` + +Gets the timestamp of the latest answer from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | --------------------------------------------- | +| [0] | uint256 | uint256 - The timestamp of the latest answer. | diff --git a/src/content/chainlink-local/api-reference/v0.2.8/aggregator-v2-v3-interface.mdx b/src/content/chainlink-local/api-reference/v0.2.8/aggregator-v2-v3-interface.mdx new file mode 100644 index 00000000000..4c13890a2c3 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.8/aggregator-v2-v3-interface.mdx @@ -0,0 +1,18 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "AggregatorV2V3Interface v0.2.8 API Reference" +metadata: + description: "API documentation for AggregatorV2V3Interface in Solidity, version v0.2.8." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## AggregatorV2V3Interface + +Combined V2/V3 price feed interface. + +[AggregatorV2V3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-feeds/interfaces/AggregatorV2V3Interface.sol) diff --git a/src/content/chainlink-local/api-reference/v0.2.8/aggregator-v3-interface.mdx b/src/content/chainlink-local/api-reference/v0.2.8/aggregator-v3-interface.mdx new file mode 100644 index 00000000000..359c64f1f55 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.8/aggregator-v3-interface.mdx @@ -0,0 +1,109 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "AggregatorV3Interface v0.2.8 API Reference" +metadata: + description: "API documentation for AggregatorV3Interface in Solidity, version v0.2.8." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## AggregatorV3Interface + +Extended price feed interface. + +[AggregatorV3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-feeds/interfaces/AggregatorV3Interface.sol) + +## Functions + +### decimals + +```solidity +function decimals() external view returns (uint8) +``` + +Gets the number of decimals used by the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ----- | ------------------------------- | +| [0] | uint8 | uint8 - The number of decimals. | + +### description + +```solidity +function description() external view returns (string) +``` + +Gets the description of the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------ | -------------------------------------------------- | +| [0] | string | string memory - The description of the aggregator. | + +### getRoundData + +```solidity +function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the round data for a specific round ID. + +_This function should raise "No data present" if no data is available for the +given round ID._ + +#### Parameters + +| Name | Type | Description | +| --------- | ------ | ----------------------------------- | +| \_roundId | uint80 | - The round ID to get the data for. | + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------ | +| roundId | uint80 | - The round ID. | +| answer | int256 | - The answer for the round. | +| startedAt | uint256 | - The timestamp when the round started. | +| updatedAt | uint256 | - The timestamp when the round was updated. | +| answeredInRound | uint80 | - The round ID in which the answer was computed. | + +### latestRoundData + +```solidity +function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the latest round data. + +_This function should raise "No data present" if no data is available._ + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------------- | +| roundId | uint80 | - The latest round ID. | +| answer | int256 | - The latest answer. | +| startedAt | uint256 | - The timestamp when the latest round started. | +| updatedAt | uint256 | - The timestamp when the latest round was updated. | +| answeredInRound | uint80 | - The round ID in which the latest answer was computed. | + +### version + +```solidity +function version() external view returns (uint256) +``` + +Gets the version of the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ---------------------------------------- | +| [0] | uint256 | uint256 - The version of the aggregator. | diff --git a/src/content/chainlink-local/api-reference/v0.2.8/burn-mint-erc677-helper.mdx b/src/content/chainlink-local/api-reference/v0.2.8/burn-mint-erc677-helper.mdx new file mode 100644 index 00000000000..1dfbd551048 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.8/burn-mint-erc677-helper.mdx @@ -0,0 +1,55 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "BurnMintERC677Helper v0.2.8 API Reference" +metadata: + description: "API documentation for BurnMintERC677Helper in Solidity, version v0.2.8." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## BurnMintERC677Helper + +Helper contract for ERC677 token operations. + +[BurnMintERC677Helper](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/ccip/BurnMintERC677Helper.sol) + +## Functions + +### constructor + +```solidity +constructor(string name, string symbol) public +``` + +Constructor to initialize the BurnMintERC677Helper contract with a name and +symbol. + +_Calls the parent constructor of BurnMintERC677 with fixed decimals (18) and +initial supply (0)._ + +#### Parameters + +| Name | Type | Description | +| ------ | ------ | -------------------------- | +| name | string | - The name of the token. | +| symbol | string | - The symbol of the token. | + +### drip + +```solidity +function drip(address to) external +``` + +Mints one full token (1e18) to the specified address. + +_Calls the internal `_mint` function from the BurnMintERC677 contract._ + +#### Parameters + +| Name | Type | Description | +| ---- | ------- | ------------------------------------------ | +| to | address | - The address to receive the minted token. | diff --git a/src/content/chainlink-local/api-reference/v0.2.8/ccip-local-simulator-fork-js.mdx b/src/content/chainlink-local/api-reference/v0.2.8/ccip-local-simulator-fork-js.mdx new file mode 100644 index 00000000000..f0f83447344 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.8/ccip-local-simulator-fork-js.mdx @@ -0,0 +1,97 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalSimulatorFork JS v0.2.8 API Reference" +metadata: + description: "API documentation for the CCIPLocalSimulatorFork JS JavaScript helpers, version v0.2.8." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalSimulatorFork JS + +Hardhat 2 JavaScript helpers for fork routing. + +[CCIPLocalSimulatorFork JS](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/scripts/CCIPLocalSimulatorFork.js) + +## Types + +### Evm2EvmMessage : `Object` + +**Properties** + +| Name | Type | +| ------------------- | ------------------------------------------ | +| sourceChainSelector | `bigint` | +| sender | `string` | +| receiver | `string` | +| sequenceNumber | `bigint` | +| gasLimit | `bigint` | +| strict | `boolean` | +| nonce | `bigint` | +| feeToken | `string` | +| feeTokenAmount | `bigint` | +| data | `string` | +| tokenAmounts | `Array.<\{token: string, amount: bigint}>` | +| sourceTokenData | `Array.` | +| messageId | `string` | + +## Functions + +### requestLinkFromTheFaucet(linkAddress, to, amount) ⇒ `Promise.` + +Requests LINK tokens from the faucet and returns the transaction hash + +**Returns**: `Promise.` - Promise resolving to the +transaction hash of the fund transfer + +| Param | Type | Description | +| ----------- | -------- | ------------------------------------------------------- | +| linkAddress | `string` | The address of the LINK contract on the current network | +| to | `string` | The address to send LINK to | +| amount | `bigint` | The amount of LINK to request | + +### getEvm2EvmMessage(receipt) ⇒ `Evm2EvmMessage` | `null` + +Parses a transaction receipt to extract the sent message Scans through +transaction logs to find a `CCIPSendRequested` event and then decodes it to an +object + +**Returns**: `Evm2EvmMessage` | +`null` - Returns either the sent message or null if provided receipt +does not contain `CCIPSendRequested` log + +| Param | Type | Description | +| ------- | -------- | ------------------------------------------------ | +| receipt | `object` | The transaction receipt from the `ccipSend` call | + +### getEvm2AnyRampMessage(receipt) ⇒ `object` | `null` + +Parses a transaction receipt to extract the sent message from CCIPMessageSent + +**Returns**: `object` | `null` - Returns \{ +destChainSelector, sequenceNumber, EVM2AnyRampMessage message \} or null + +| Param | Type | Description | +| ------- | -------- | ------------------------------------------ | +| receipt | `object` | – The tx receipt from the on-ramp contract | + +### routeMessage(routerAddress, evm2EvmMessage) ⇒ `Promise.` + +Routes the sent message from the source network on the destination (current) +network + +**Returns**: `Promise.` - Either resolves with no value +if the message is successfully routed, or reverts +**Throws**: + +- `Error` Fails if no off-ramp matches the message's source chain + selector or if calling `router.getOffRamps()` + +| Param | Type | Description | +| -------------- | ---------------- | --------------------------------- | +| routerAddress | `string` | Address of the destination Router | +| evm2EvmMessage | `Evm2EvmMessage` | Sent cross-chain message | diff --git a/src/content/chainlink-local/api-reference/v0.2.8/ccip-local-simulator-fork.mdx b/src/content/chainlink-local/api-reference/v0.2.8/ccip-local-simulator-fork.mdx new file mode 100644 index 00000000000..9018674717b --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.8/ccip-local-simulator-fork.mdx @@ -0,0 +1,311 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalSimulatorFork v0.2.8 API Reference" +metadata: + description: "API documentation for CCIPLocalSimulatorFork in Solidity, version v0.2.8." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalSimulatorFork + +CCIP simulator for forked networks. + +[CCIPLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/ccip/CCIPLocalSimulatorFork.sol) + +## Structs + +### EVM2EVMMessage + +```solidity +struct EVM2EVMMessage { + uint64 sourceChainSelector; + address sender; + address receiver; + uint64 sequenceNumber; + uint256 gasLimit; + bool strict; + uint64 nonce; + address feeToken; + uint256 feeTokenAmount; + bytes data; + struct Client.EVMTokenAmount[] tokenAmounts; + bytes[] sourceTokenData; + bytes32 messageId; +} +``` + +### OffRamp + +Structure representing an offRamp configuration + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | + +```solidity +struct OffRamp { + uint64 sourceChainSelector; + address offRamp; +} +``` + +## Variables + +### DEFAULT_GAS_LIMIT + +```solidity +uint32 DEFAULT_GAS_LIMIT +``` + +### i_register + +```solidity +contract Register i_register +``` + +The immutable register instance + +### LINK_FAUCET + +```solidity +address LINK_FAUCET +``` + +The address of the LINK faucet + +### s_processedMessages + +```solidity +mapping(bytes32 => bool) s_processedMessages +``` + +Mapping to track processed messages + +## Errors + +### InvalidExtraArgsTag + +```solidity +error InvalidExtraArgsTag() +``` + +## Events + +### CCIPMessageSent + +```solidity +event CCIPMessageSent(uint64 destChainSelector, uint64 sequenceNumber, struct Internal.EVM2AnyRampMessage message) +``` + +### CCIPSendRequested + +```solidity +event CCIPSendRequested(struct InternalPreV1dot6.EVM2EVMMessage message) +``` + +Events emitted when a CCIP send request is made + +## Functions + +### \_fromBytes + +```solidity +function _fromBytes(bytes extraArgs) internal pure returns (struct Client.GenericExtraArgsV2) +``` + +Internal helper function to decode extraArgs bytes to GenericExtraArgsV2 struct. +Supports decoding of both GenericExtraArgsV2 and EVMExtraArgsV1 structs. + +#### Parameters + +| Name | Type | Description | +| --------- | ----- | --------------------------------------------- | +| extraArgs | bytes | - The bytes representing the extra arguments. | + +#### Returns + +| Name | Type | Description | +| ---- | -------------------------------- | --------------------------------------------------------- | +| [0] | struct Client.GenericExtraArgsV2 | genericExtraArgs - The decoded GenericExtraArgsV2 struct. | + +### \_routeCapturedMessages + +```solidity +function _routeCapturedMessages(uint256[] forkIds, uint256 sourceForkId, address sourceRouterAddress) internal +``` + +Internal function to route captured messages to their respective destination +forks. + +#### Parameters + +| Name | Type | Description | +| ------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| forkIds | uint256[] | - The IDs of the destination network forks. These are the returned values of `createFork()` or `createSelectFork()`, not chainIds. | +| sourceForkId | uint256 | - The ID of the source network fork. This is the returned value of `createFork()` or `createSelectFork()`, not chainId. | +| sourceRouterAddress | address | - The address of the Router on the source chain. | + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the contract + +### executeSingleMessage + +```solidity +function executeSingleMessage(struct Internal.Any2EVMRampMessage message, bytes[] offchainTokenData, uint32[] tokenGasOverrides) external +``` + +Executes a single CCIP message on the offRamp + +#### Parameters + +| Name | Type | Description | +| ----------------- | ---------------------------------- | --------------------------------- | +| message | struct Internal.Any2EVMRampMessage | - The CCIP message to be executed | +| offchainTokenData | bytes[] | - Additional offchain token data | +| tokenGasOverrides | uint32[] | | + +### executeSingleMessage + +```solidity +function executeSingleMessage(struct InternalPreV1dot6.EVM2EVMMessage message, bytes[] offchainTokenData, uint32[] tokenGasOverrides) external +``` + +Works with Foundry only + +### getNetworkDetails + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) +``` + +Returns the default values for currently CCIP supported networks. If network is +not present or some of the values are changed, user can manually add new network +details using the `setNetworkDetails` function. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------------------------------------------------------------------------ | +| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | + +#### Returns + +| Name | Type | Description | +| ---- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | + +### getOffRamps + +```solidity +function getOffRamps() external view returns (struct IRouterFork.OffRamp[]) +``` + +Gets the list of offRamps + +#### Returns + +| Name | Type | Description | +| ---- | ---------------------------- | ----------------------------------- | +| [0] | struct IRouterFork.OffRamp[] | offRamps - Array of OffRamp structs | + +### getOnRamp + +```solidity +function getOnRamp(uint64 destChainSelector) external view returns (address) +``` + +Return the configured onramp for specific a destination chain. @param +destChainSelector The destination chain Id to get the onRamp for. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | -------------------------- | +| [0] | address | The address of the onRamp. | + +### requestLinkFromFaucet + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------- | +| to | address | - The address to which LINK tokens are to be sent. | +| amount | uint256 | - The amount of LINK tokens to send. | + +#### Returns + +| Name | Type | Description | +| ------- | ---- | ----------------------------------------------------------------------------- | +| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | + +### setNetworkDetails + +```solidity +function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external +``` + +If network details are not present or some of the values are changed, user can +manually add new network details using the `setNetworkDetails` function. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | +| networkDetails | struct Register.NetworkDetails | - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | + +### switchChainAndRouteMessage + +```solidity +function switchChainAndRouteMessage(uint256 forkId) external +``` + +To be called after the sending of the cross-chain message (`ccipSend`). Goes +through the list of past logs and looks for the `CCIPSendRequested` and +`CCIPMessageSent` events. Switches to a destination network fork. Routes the +sent cross-chain message on the destination network. If you sent more than one +message, it will try to route all of them to `forkId`. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------------------------------------------------------------------- | +| forkId | uint256 | - The ID of the destination network fork. This is the returned value of `createFork()` or `createSelectFork()` | + +### switchChainAndRouteMessage + +```solidity +function switchChainAndRouteMessage(uint256[] forkIds) external +``` + +To be called after the sending of the cross-chain message (`ccipSend`). Override +variant of the `switchChainAndRouteMessage(uint256 forkId)` function in case of +multiple destination forks. Goes through the list of past logs and looks for the +`CCIPSendRequested` and `CCIPMessageSent` events. Loops through provided +`forkIds` and tries to route the message to correct destination. If you haven't +provide correct `forkId`, the message will get lost. If you sent more than one +message, it will try to route all of them to correct destinations. + +#### Parameters + +| Name | Type | Description | +| ------- | --------- | ------------------------------------------------------------------------------------------------------------------- | +| forkIds | uint256[] | - The IDs of the destination network forks. These are the returned values of `createFork()` or `createSelectFork()` | diff --git a/src/content/chainlink-local/api-reference/v0.2.8/ccip-local-simulator.mdx b/src/content/chainlink-local/api-reference/v0.2.8/ccip-local-simulator.mdx new file mode 100644 index 00000000000..e137104b97e --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.8/ccip-local-simulator.mdx @@ -0,0 +1,233 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalSimulator v0.2.8 API Reference" +metadata: + description: "API documentation for CCIPLocalSimulator in Solidity, version v0.2.8." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalSimulator + +Local CCIP simulator (no-fork mode). + +[CCIPLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/ccip/CCIPLocalSimulator.sol) + +## Variables + +### CHAIN_SELECTOR + +```solidity +uint64 CHAIN_SELECTOR +``` + +The unique CCIP Chain Selector constant + +### i_ccipBnM + +```solidity +contract BurnMintERC677Helper i_ccipBnM +``` + +The BurnMintERC677Helper instance for CCIP-BnM token + +### i_ccipLnM + +```solidity +contract BurnMintERC677Helper i_ccipLnM +``` + +The BurnMintERC677Helper instance for CCIP-LnM token + +### i_linkToken + +```solidity +contract LinkToken i_linkToken +``` + +The LINK token instance + +### i_mockRouter + +```solidity +contract MockCCIPRouter i_mockRouter +``` + +The mock CCIP router instance + +### i_wrappedNative + +```solidity +contract WETH9 i_wrappedNative +``` + +The wrapped native token instance + +### s_supportedTokens + +```solidity +address[] s_supportedTokens +``` + +The list of supported token addresses + +## Errors + +### CCIPLocalSimulator\_\_MsgSenderIsNotTokenOwner + +```solidity +error CCIPLocalSimulator__MsgSenderIsNotTokenOwner() +``` + +### CCIPLocalSimulator\_\_RequiredRoleNotFound + +```solidity +error CCIPLocalSimulator__RequiredRoleNotFound(address account, bytes32 role, address token) +``` + +## Functions + +### configuration + +```solidity +function configuration() public view returns (uint64 chainSelector_, contract IRouterClient sourceRouter_, contract IRouterClient destinationRouter_, contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract BurnMintERC677Helper ccipBnM_, contract BurnMintERC677Helper ccipLnM_) +``` + +Returns configuration details for pre-deployed contracts and services needed for +local CCIP simulations. + +#### Returns + +| Name | Type | Description | +| ------------------- | ----------------------------- | ----------------------------------------------------------- | +| chainSelector\_ | uint64 | - The unique CCIP Chain Selector. | +| sourceRouter\_ | contract IRouterClient | - The source chain Router contract. | +| destinationRouter\_ | contract IRouterClient | - The destination chain Router contract. | +| wrappedNative\_ | contract WETH9 | - The wrapped native token which can be used for CCIP fees. | +| linkToken\_ | contract LinkToken | - The LINK token. | +| ccipBnM\_ | contract BurnMintERC677Helper | - The ccipBnM token. | +| ccipLnM\_ | contract BurnMintERC677Helper | - The ccipLnM token. | + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the contract and pre-deployed token instances + +### getSupportedTokens + +```solidity +function getSupportedTokens(uint64 chainSelector) external view returns (address[] tokens) +``` + +Gets a list of token addresses that are supported for cross-chain transfers by +the simulator. + +#### Parameters + +| Name | Type | Description | +| ------------- | ------ | --------------------------------- | +| chainSelector | uint64 | - The unique CCIP Chain Selector. | + +#### Returns + +| Name | Type | Description | +| ------ | --------- | -------------------------------------------------------------------------------------------------- | +| tokens | address[] | - Returns a list of token addresses that are supported for cross-chain transfers by the simulator. | + +### isChainSupported + +```solidity +function isChainSupported(uint64 chainSelector) public pure returns (bool supported) +``` + +Checks whether the provided `chainSelector` is supported by the simulator. + +#### Parameters + +| Name | Type | Description | +| ------------- | ------ | --------------------------------- | +| chainSelector | uint64 | - The unique CCIP Chain Selector. | + +#### Returns + +| Name | Type | Description | +| --------- | ---- | ---------------------------------------------------------------- | +| supported | bool | - Returns true if `chainSelector` is supported by the simulator. | + +### requestLinkFromFaucet + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------- | +| to | address | - The address to which LINK tokens are to be sent. | +| amount | uint256 | - The amount of LINK tokens to send. | + +#### Returns + +| Name | Type | Description | +| ------- | ---- | ----------------------------------------------------------------------------- | +| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | + +### supportNewTokenViaAccessControlDefaultAdmin + +```solidity +function supportNewTokenViaAccessControlDefaultAdmin(address tokenAddress) external +``` + +Allows user to support any new token, besides CCIP BnM and CCIP LnM, for +cross-chain transfers. The caller must have the DEFAULT_ADMIN_ROLE as defined by +the contract itself. Reverts if the caller is not the admin of the token using +OZ's AccessControl DEFAULT_ADMIN_ROLE. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ------------------------------------------------------------------ | +| tokenAddress | address | - The address of the token to add to the list of supported tokens. | + +### supportNewTokenViaGetCCIPAdmin + +```solidity +function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external +``` + +Allows user to support any new token, besides CCIP BnM and CCIP LnM, for +cross-chain transfers. Reverts if token does not implement getCCIPAdmin() +function. Reverts if the caller is not the token CCIPAdmin. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ------------------------------------------------------------------ | +| tokenAddress | address | - The address of the token to add to the list of supported tokens. | + +### supportNewTokenViaOwner + +```solidity +function supportNewTokenViaOwner(address tokenAddress) external +``` + +Allows user to support any new token, besides CCIP BnM and CCIP LnM, for +cross-chain transfers. Reverts if token does not implement owner() function. +Reverts if the caller is not the token owner. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ------------------------------------------------------------------ | +| tokenAddress | address | - The address of the token to add to the list of supported tokens. | diff --git a/src/content/chainlink-local/api-reference/v0.2.8/data-streams-local-simulator-fork.mdx b/src/content/chainlink-local/api-reference/v0.2.8/data-streams-local-simulator-fork.mdx new file mode 100644 index 00000000000..00de4592146 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.8/data-streams-local-simulator-fork.mdx @@ -0,0 +1,121 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "DataStreamsLocalSimulatorFork v0.2.8 API Reference" +metadata: + description: "API documentation for DataStreamsLocalSimulatorFork in Solidity, version v0.2.8." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## DataStreamsLocalSimulatorFork + +Data Streams simulator for forked networks. + +[DataStreamsLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-streams/DataStreamsLocalSimulatorFork.sol) + +## Variables + +### i_register + +```solidity +contract Register i_register +``` + +The immutable register instance + +### LINK_FAUCET + +```solidity +address LINK_FAUCET +``` + +The address of the LINK faucet + +## Functions + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the contract + +### getNetworkDetails + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) +``` + +Returns the default values for currently Data Streams supported networks. If +network is not present or some of the values are changed, user can manually add +new network details using the `setNetworkDetails` function. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ----------------------------------------------------------------------------- | +| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | + +#### Returns + +| Name | Type | Description | +| ---- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | + +### requestLinkFromFaucet + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------- | +| to | address | - The address to which LINK tokens are to be sent. | +| amount | uint256 | - The amount of LINK tokens to send. | + +#### Returns + +| Name | Type | Description | +| ------- | ---- | ----------------------------------------------------------------------------- | +| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | + +### requestNativeFromFaucet + +```solidity +function requestNativeFromFaucet(address to, uint256 amount) external +``` + +Requests native coints from the faucet. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | --------------------------------------------------- | +| to | address | - The address to which native coins are to be sent. | +| amount | uint256 | - The amount of native coins to send. | + +### setNetworkDetails + +```solidity +function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external +``` + +If network details are not present or some of the values are changed, user can +manually add new network details using the `setNetworkDetails` function. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- | +| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | +| networkDetails | struct Register.NetworkDetails | - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | diff --git a/src/content/chainlink-local/api-reference/v0.2.8/data-streams-local-simulator.mdx b/src/content/chainlink-local/api-reference/v0.2.8/data-streams-local-simulator.mdx new file mode 100644 index 00000000000..0f46965eca0 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.8/data-streams-local-simulator.mdx @@ -0,0 +1,110 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "DataStreamsLocalSimulator v0.2.8 API Reference" +metadata: + description: "API documentation for DataStreamsLocalSimulator in Solidity, version v0.2.8." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## DataStreamsLocalSimulator + +Local Data Streams simulator (no-fork mode). + +[DataStreamsLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-streams/DataStreamsLocalSimulator.sol) + +## Variables + +### i_linkToken + +```solidity +contract LinkToken i_linkToken +``` + +The LINK token instance + +### i_wrappedNative + +```solidity +contract WETH9 i_wrappedNative +``` + +The wrapped native token instance + +### s_mockFeeManager + +```solidity +contract MockFeeManager s_mockFeeManager +``` + +### s_mockRewardManager + +```solidity +contract MockRewardManager s_mockRewardManager +``` + +### s_mockVerifier + +```solidity +contract MockVerifier s_mockVerifier +``` + +### s_mockVerifierProxy + +```solidity +contract MockVerifierProxy s_mockVerifierProxy +``` + +## Functions + +### configuration + +```solidity +function configuration() public view returns (contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract MockVerifier mockVerifier_, contract MockVerifierProxy mockVerifierProxy_, contract MockFeeManager mockFeeManager_, contract MockRewardManager mockRewardManager_) +``` + +@notice Returns configuration details for pre-deployed contracts and services +needed for local Data Streams simulations. + +#### Returns + +| Name | Type | Description | +| ------------------- | -------------------------- | ----------------------------------- | +| wrappedNative\_ | contract WETH9 | - The wrapped native token. | +| linkToken\_ | contract LinkToken | - The LINK token. | +| mockVerifier\_ | contract MockVerifier | - The mock verifier contract. | +| mockVerifierProxy\_ | contract MockVerifierProxy | - The mock verifier proxy contract. | +| mockFeeManager\_ | contract MockFeeManager | - The mock fee manager contract. | +| mockRewardManager\_ | contract MockRewardManager | - The mock reward manager contract. | + +### constructor + +```solidity +constructor() public +``` + +### requestLinkFromFaucet + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------- | +| to | address | - The address to which LINK tokens are to be sent. | +| amount | uint256 | - The amount of LINK tokens to send. | + +#### Returns + +| Name | Type | Description | +| ------- | ---- | ----------------------------------------------------------------------------- | +| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | diff --git a/src/content/chainlink-local/api-reference/v0.2.8/data-streams-register.mdx b/src/content/chainlink-local/api-reference/v0.2.8/data-streams-register.mdx new file mode 100644 index 00000000000..4788c553878 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.8/data-streams-register.mdx @@ -0,0 +1,84 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Register (Data Streams) v0.2.8 API Reference" +metadata: + description: "API documentation for Register (Data Streams) in Solidity, version v0.2.8." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## Register (Data Streams) + +Data Streams network configuration registry. + +[Register (Data Streams)](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-streams/Register.sol) + +## Structs + +### NetworkDetails + +```solidity +struct NetworkDetails { + address verifierProxyAddress; + address linkAddress; +} +``` + +## Variables + +### s_networkDetails + +```solidity +mapping(uint256 => struct Register.NetworkDetails) s_networkDetails +``` + +Mapping to store network details based on chain ID. + +## Functions + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the network details for various chains. + +### getNetworkDetails + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails networkDetails) +``` + +Retrieves network details for a given chain ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | --------------------------------------------- | +| chainId | uint256 | - The ID of the chain to get the details for. | + +#### Returns + +| Name | Type | Description | +| -------------- | ------------------------------ | ------------------------------------------------- | +| networkDetails | struct Register.NetworkDetails | - The network details for the specified chain ID. | + +### setNetworkDetails + +```solidity +function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external +``` + +Sets the network details for a given chain ID. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------------------------------ | -------------------------------------------------------- | +| chainId | uint256 | - The ID of the chain to set the details for. | +| networkDetails | struct Register.NetworkDetails | - The network details to set for the specified chain ID. | diff --git a/src/content/chainlink-local/api-reference/v0.2.8/index.mdx b/src/content/chainlink-local/api-reference/v0.2.8/index.mdx new file mode 100644 index 00000000000..efa9ab17373 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.8/index.mdx @@ -0,0 +1,56 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Chainlink Local v0.2.8 API Reference" +metadata: + description: "API reference documentation for Chainlink Local v0.2.8" +isIndex: true +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +Chainlink Local v0.2.8 adds Data Streams report versions V1 and V5-V13 to `ReportVersions`, and expands the built-in `Register` network details to 145 chains, mainnets included, via the new CCIP network details update script. + +## CCIP + +These contracts provide Cross-Chain Interoperability Protocol (CCIP) functionality in a local testing environment: + +- [CCIPLocalSimulator](/chainlink-local/api-reference/v0.2.8/ccip-local-simulator) - Local CCIP simulator (no-fork mode) +- [CCIPLocalSimulatorFork](/chainlink-local/api-reference/v0.2.8/ccip-local-simulator-fork) - CCIP simulator for forked networks +- [CCIPLocalSimulatorFork JS](/chainlink-local/api-reference/v0.2.8/ccip-local-simulator-fork-js) - JavaScript helpers for fork routing +- [Register](/chainlink-local/api-reference/v0.2.8/register) - CCIP network configuration registry + +## Data Streams + +Contracts for simulating Chainlink Data Streams: + +- [DataStreamsLocalSimulator](/chainlink-local/api-reference/v0.2.8/data-streams-local-simulator) - Local Data Streams simulator (no-fork mode) +- [DataStreamsLocalSimulatorFork](/chainlink-local/api-reference/v0.2.8/data-streams-local-simulator-fork) - Data Streams simulator for forked networks +- [MockVerifier](/chainlink-local/api-reference/v0.2.8/mock-verifier) - Mock Data Streams verifier +- [MockVerifierProxy](/chainlink-local/api-reference/v0.2.8/mock-verifier-proxy) - Mock Data Streams verifier proxy +- [MockReportGenerator](/chainlink-local/api-reference/v0.2.8/mock-report-generator) - Signed report generator for every report schema +- [MockFeeManager](/chainlink-local/api-reference/v0.2.8/mock-fee-manager) - Mock verifier fee manager +- [MockRewardManager](/chainlink-local/api-reference/v0.2.8/mock-reward-manager) - Mock reward manager +- [ReportVersions](/chainlink-local/api-reference/v0.2.8/report-versions) - Data Streams report schemas +- [Register (Data Streams)](/chainlink-local/api-reference/v0.2.8/data-streams-register) - Data Streams network configuration registry + +## Data Feeds + +Contracts for simulating Chainlink Data Feeds: + +- [AggregatorInterface](/chainlink-local/api-reference/v0.2.8/aggregator-interface) - Basic price feed interface +- [AggregatorV2V3Interface](/chainlink-local/api-reference/v0.2.8/aggregator-v2-v3-interface) - Combined V2/V3 price feed interface +- [AggregatorV3Interface](/chainlink-local/api-reference/v0.2.8/aggregator-v3-interface) - Extended price feed interface +- [MockOffchainAggregator](/chainlink-local/api-reference/v0.2.8/mock-offchain-aggregator) - Mock implementation of off-chain aggregator +- [MockV3Aggregator](/chainlink-local/api-reference/v0.2.8/mock-v3-aggregator) - Mock implementation of V3 aggregator + +## Token Contracts + +Standard token implementations for testing: + +- [BurnMintERC677Helper](/chainlink-local/api-reference/v0.2.8/burn-mint-erc677-helper) - Helper contract for ERC677 token operations +- [LinkToken](/chainlink-local/api-reference/v0.2.8/link-token) - LINK token implementation +- [WETH9](/chainlink-local/api-reference/v0.2.8/weth9) - Wrapped Ether implementation diff --git a/src/content/chainlink-local/api-reference/v0.2.8/link-token.mdx b/src/content/chainlink-local/api-reference/v0.2.8/link-token.mdx new file mode 100644 index 00000000000..afc01264162 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.8/link-token.mdx @@ -0,0 +1,44 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "LinkToken v0.2.8 API Reference" +metadata: + description: "API documentation for LinkToken in Solidity, version v0.2.8." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## LinkToken + +LINK token implementation. + +[LinkToken](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/shared/LinkToken.sol) + +## Functions + +### \_onCreate + +```solidity +function _onCreate() internal virtual +``` + +Hook that is called when this contract is created. + +_Useful to override constructor behaviour in child contracts (e.g., LINK bridge +tokens). The default implementation mints 10\*\*27 tokens to the contract +deployer._ + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the LinkToken contract with a fixed total supply, +name, and symbol. + +_Calls the ERC677 constructor with the name and symbol, and then mints the total +supply to the contract deployer._ diff --git a/src/content/chainlink-local/api-reference/v0.2.8/mock-fee-manager.mdx b/src/content/chainlink-local/api-reference/v0.2.8/mock-fee-manager.mdx new file mode 100644 index 00000000000..0f05b705bc2 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.8/mock-fee-manager.mdx @@ -0,0 +1,174 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockFeeManager v0.2.8 API Reference" +metadata: + description: "API documentation for MockFeeManager in Solidity, version v0.2.8." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockFeeManager + +Mock verifier fee manager. + +[MockFeeManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-streams/MockFeeManager.sol) + +## Structs + +### Asset + +```solidity +struct Asset { + address assetAddress; + uint256 amount; +} +``` + +## Variables + +### i_linkAddress + +```solidity +address i_linkAddress +``` + +### i_nativeAddress + +```solidity +address i_nativeAddress +``` + +### i_proxyAddress + +```solidity +address i_proxyAddress +``` + +### i_rewardManager + +```solidity +contract IRewardManager i_rewardManager +``` + +### s_mockDiscounts + +```solidity +mapping(address => uint256) s_mockDiscounts +``` + +### s_nativeSurcharge + +```solidity +uint256 s_nativeSurcharge +``` + +## Errors + +### ExpiredReport + +```solidity +error ExpiredReport() +``` + +### InvalidAddress + +```solidity +error InvalidAddress() +``` + +### InvalidDeposit + +```solidity +error InvalidDeposit() +``` + +### InvalidDiscount + +```solidity +error InvalidDiscount() +``` + +### InvalidQuote + +```solidity +error InvalidQuote() +``` + +### InvalidSurcharge + +```solidity +error InvalidSurcharge() +``` + +### Unauthorized + +```solidity +error Unauthorized() +``` + +## Functions + +### \_processFee + +```solidity +function _processFee(bytes payload, bytes parameterPayload, address subscriber) internal +``` + +### constructor + +```solidity +constructor(address linkAddress, address nativeAddress, address proxyAddress, address rewardManager) public +``` + +### getFeeAndReward + +```solidity +function getFeeAndReward(address subscriber, bytes report, address quoteAddress) public view returns (struct Common.Asset, struct Common.Asset, uint256) +``` + +### getMockDiscount + +```solidity +function getMockDiscount(address subscriber) external view returns (uint256) +``` + +### processFee + +```solidity +function processFee(bytes payload, bytes parameterPayload, address subscriber) external payable +``` + +### processFeeBulk + +```solidity +function processFeeBulk(bytes[] payloads, bytes parameterPayload, address subscriber) external payable +``` + +### setMockDiscount + +```solidity +function setMockDiscount(address subscriber, uint256 discount) external +``` + +### setNativeSurcharge + +```solidity +function setNativeSurcharge(uint64 surcharge) external +``` + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) external pure returns (bool) +``` + +\_Returns true if this contract implements the interface defined by +`interfaceId`. See the corresponding +https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP +section] to learn more about how these ids are created. + +This function call must use less than 30 000 gas.\_ diff --git a/src/content/chainlink-local/api-reference/v0.2.8/mock-offchain-aggregator.mdx b/src/content/chainlink-local/api-reference/v0.2.8/mock-offchain-aggregator.mdx new file mode 100644 index 00000000000..95777163dd8 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.8/mock-offchain-aggregator.mdx @@ -0,0 +1,190 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockOffchainAggregator v0.2.8 API Reference" +metadata: + description: "API documentation for MockOffchainAggregator in Solidity, version v0.2.8." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockOffchainAggregator + +Mock implementation of off-chain aggregator. + +[MockOffchainAggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-feeds/MockOffchainAggregator.sol) + +## Variables + +### decimals + +```solidity +uint8 decimals +``` + +The number of decimals used by the aggregator. + +### getAnswer + +```solidity +mapping(uint256 => int256) getAnswer +``` + +Mapping to get the answer for a specific round ID. + +### getTimestamp + +```solidity +mapping(uint256 => uint256) getTimestamp +``` + +Mapping to get the timestamp for a specific round ID. + +### latestAnswer + +```solidity +int256 latestAnswer +``` + +The latest answer reported by the aggregator. + +### latestRound + +```solidity +uint256 latestRound +``` + +The latest round ID. + +### latestTimestamp + +```solidity +uint256 latestTimestamp +``` + +The timestamp of the latest answer. + +### maxAnswer + +```solidity +int192 maxAnswer +``` + +The maximum answer the aggregator is allowed to report. + +### minAnswer + +```solidity +int192 minAnswer +``` + +The minimum answer the aggregator is allowed to report. + +## Functions + +### constructor + +```solidity +constructor(uint8 _decimals, int256 _initialAnswer) public +``` + +Constructor to initialize the MockOffchainAggregator contract with initial +parameters. + +#### Parameters + +| Name | Type | Description | +| --------------- | ------ | ------------------------------------------------------ | +| \_decimals | uint8 | - The number of decimals for the aggregator. | +| \_initialAnswer | int256 | - The initial answer to be set in the mock aggregator. | + +### getRoundData + +```solidity +function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the round data for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| --------- | ------ | ----------------------------------- | +| \_roundId | uint80 | - The round ID to get the data for. | + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------ | +| roundId | uint80 | - The round ID. | +| answer | int256 | - The answer for the round. | +| startedAt | uint256 | - The timestamp when the round started. | +| updatedAt | uint256 | - The timestamp when the round was updated. | +| answeredInRound | uint80 | - The round ID in which the answer was computed. | + +### latestRoundData + +```solidity +function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the latest round data. + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------------- | +| roundId | uint80 | - The latest round ID. | +| answer | int256 | - The latest answer. | +| startedAt | uint256 | - The timestamp when the latest round started. | +| updatedAt | uint256 | - The timestamp when the latest round was updated. | +| answeredInRound | uint80 | - The round ID in which the latest answer was computed. | + +### updateAnswer + +```solidity +function updateAnswer(int256 _answer) public +``` + +Updates the answer in the mock aggregator. + +#### Parameters + +| Name | Type | Description | +| -------- | ------ | --------------------------- | +| \_answer | int256 | - The new answer to be set. | + +### updateMinAndMaxAnswers + +```solidity +function updateMinAndMaxAnswers(int192 _minAnswer, int192 _maxAnswer) external +``` + +Updates the minimum and maximum answers the aggregator can report. + +#### Parameters + +| Name | Type | Description | +| ----------- | ------ | ------------------------- | +| \_minAnswer | int192 | - The new minimum answer. | +| \_maxAnswer | int192 | - The new maximum answer. | + +### updateRoundData + +```solidity +function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public +``` + +Updates the round data in the mock aggregator. + +#### Parameters + +| Name | Type | Description | +| ----------- | ------- | --------------------------------------- | +| \_roundId | uint80 | - The round ID to be updated. | +| \_answer | int256 | - The new answer to be set. | +| \_timestamp | uint256 | - The timestamp to be set. | +| \_startedAt | uint256 | - The timestamp when the round started. | diff --git a/src/content/chainlink-local/api-reference/v0.2.8/mock-report-generator.mdx b/src/content/chainlink-local/api-reference/v0.2.8/mock-report-generator.mdx new file mode 100644 index 00000000000..77d4e67a6cf --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.8/mock-report-generator.mdx @@ -0,0 +1,192 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockReportGenerator v0.2.8 API Reference" +metadata: + description: "API documentation for MockReportGenerator in Solidity, version v0.2.8." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockReportGenerator + +Signed report generator for every report schema. + +[MockReportGenerator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-streams/MockReportGenerator.sol) + +## Variables + +### i_donAddress + +```solidity +address i_donAddress +``` + +### i_donDigest + +```solidity +uint256 i_donDigest +``` + +### i_reportV2MockFeedId + +```solidity +bytes32 i_reportV2MockFeedId +``` + +### i_reportV3MockFeedId + +```solidity +bytes32 i_reportV3MockFeedId +``` + +### i_reportV4MockFeedId + +```solidity +bytes32 i_reportV4MockFeedId +``` + +### s_ask + +```solidity +int192 s_ask +``` + +### s_bid + +```solidity +int192 s_bid +``` + +### s_expiresPeriod + +```solidity +uint32 s_expiresPeriod +``` + +### s_linkFee + +```solidity +uint192 s_linkFee +``` + +### s_marketStatus + +```solidity +uint32 s_marketStatus +``` + +### s_nativeFee + +```solidity +uint192 s_nativeFee +``` + +### s_price + +```solidity +int192 s_price +``` + +## Errors + +### MockReportGenerator\_\_CastOverflow + +```solidity +error MockReportGenerator__CastOverflow() +``` + +### MockReportGenerator\_\_InvalidAsk + +```solidity +error MockReportGenerator__InvalidAsk() +``` + +### MockReportGenerator\_\_InvalidBid + +```solidity +error MockReportGenerator__InvalidBid() +``` + +## Functions + +### constructor + +```solidity +constructor(int192 initialPrice) public +``` + +### generateReport + +```solidity +function generateReport(struct ReportVersions.ReportV2 report) external returns (bytes signedReport) +``` + +### generateReport + +```solidity +function generateReport(struct ReportVersions.ReportV3 report) external returns (bytes signedReport) +``` + +### generateReport + +```solidity +function generateReport(struct ReportVersions.ReportV4 report) external returns (bytes signedReport) +``` + +### generateReportV2 + +```solidity +function generateReportV2() external returns (bytes signedReport, struct ReportVersions.ReportV2 report) +``` + +### generateReportV3 + +```solidity +function generateReportV3() external returns (bytes signedReport, struct ReportVersions.ReportV3 report) +``` + +### generateReportV4 + +```solidity +function generateReportV4() external returns (bytes signedReport, struct ReportVersions.ReportV4 report) +``` + +### getMockDonAddress + +```solidity +function getMockDonAddress() external view returns (address) +``` + +### updateExpiresPeriod + +```solidity +function updateExpiresPeriod(uint32 period) external +``` + +### updateFees + +```solidity +function updateFees(uint192 nativeFee, uint192 linkFee) external +``` + +### updateMarketStatus + +```solidity +function updateMarketStatus(uint32 status) external +``` + +### updatePrice + +```solidity +function updatePrice(int192 price) public +``` + +### updatePriceBidAndAsk + +```solidity +function updatePriceBidAndAsk(int192 price, int192 bid, int192 ask) external +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.8/mock-reward-manager.mdx b/src/content/chainlink-local/api-reference/v0.2.8/mock-reward-manager.mdx new file mode 100644 index 00000000000..36957c0ad11 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.8/mock-reward-manager.mdx @@ -0,0 +1,87 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockRewardManager v0.2.8 API Reference" +metadata: + description: "API documentation for MockRewardManager in Solidity, version v0.2.8." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockRewardManager + +Mock reward manager. + +[MockRewardManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-streams/MockRewardManager.sol) + +## Variables + +### i_linkAddress + +```solidity +address i_linkAddress +``` + +### s_feeManagerAddress + +```solidity +address s_feeManagerAddress +``` + +## Errors + +### Unauthorized + +```solidity +error Unauthorized() +``` + +## Events + +### FeePaid + +```solidity +event FeePaid(struct IRewardManager.FeePayment[] payments, address payer) +``` + +## Functions + +### claimRewards + +```solidity +function claimRewards(bytes32[]) external pure +``` + +### constructor + +```solidity +constructor(address linkAddress) public +``` + +### onFeePaid + +```solidity +function onFeePaid(struct IRewardManager.FeePayment[] payments, address payer) external +``` + +### setFeeManager + +```solidity +function setFeeManager(address newFeeManager) external +``` + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) external pure returns (bool) +``` + +\_Returns true if this contract implements the interface defined by +`interfaceId`. See the corresponding +https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP +section] to learn more about how these ids are created. + +This function call must use less than 30 000 gas.\_ diff --git a/src/content/chainlink-local/api-reference/v0.2.8/mock-v3-aggregator.mdx b/src/content/chainlink-local/api-reference/v0.2.8/mock-v3-aggregator.mdx new file mode 100644 index 00000000000..3d62e10b5d1 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.8/mock-v3-aggregator.mdx @@ -0,0 +1,277 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockV3Aggregator v0.2.8 API Reference" +metadata: + description: "API documentation for MockV3Aggregator in Solidity, version v0.2.8." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockV3Aggregator + +Mock implementation of V3 aggregator. + +[MockV3Aggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-feeds/MockV3Aggregator.sol) + +## Variables + +### aggregator + +```solidity +address aggregator +``` + +The address of the current aggregator. + +### proposedAggregator + +```solidity +address proposedAggregator +``` + +The address of the proposed aggregator. + +### version + +```solidity +uint256 version +``` + +The version of the aggregator. + +## Functions + +### confirmAggregator + +```solidity +function confirmAggregator(address _aggregator) external +``` + +Confirms the proposed aggregator. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ----------------------------------------- | +| \_aggregator | address | - The address of the proposed aggregator. | + +### constructor + +```solidity +constructor(uint8 _decimals, int256 _initialAnswer) public +``` + +Constructor to initialize the MockV3Aggregator contract with initial parameters. + +#### Parameters + +| Name | Type | Description | +| --------------- | ------ | ------------------------------------------------------ | +| \_decimals | uint8 | - The number of decimals for the aggregator. | +| \_initialAnswer | int256 | - The initial answer to be set in the mock aggregator. | + +### decimals + +```solidity +function decimals() external view returns (uint8) +``` + +Gets the number of decimals used by the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ----- | ------------------------------- | +| [0] | uint8 | uint8 - The number of decimals. | + +### description + +```solidity +function description() external pure returns (string) +``` + +Gets the description of the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------ | -------------------------------------------------- | +| [0] | string | string memory - The description of the aggregator. | + +### getAnswer + +```solidity +function getAnswer(uint256 roundId) external view returns (int256) +``` + +Gets the answer for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------- | +| roundId | uint256 | - The round ID to get the answer for. | + +#### Returns + +| Name | Type | Description | +| ---- | ------ | ------------------------------------------- | +| [0] | int256 | int256 - The answer for the given round ID. | + +### getRoundData + +```solidity +function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the round data for a specific round ID. + +_This function should raise "No data present" if no data is available for the +given round ID._ + +#### Parameters + +| Name | Type | Description | +| --------- | ------ | ----------------------------------- | +| \_roundId | uint80 | - The round ID to get the data for. | + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------ | +| roundId | uint80 | - The round ID. | +| answer | int256 | - The answer for the round. | +| startedAt | uint256 | - The timestamp when the round started. | +| updatedAt | uint256 | - The timestamp when the round was updated. | +| answeredInRound | uint80 | - The round ID in which the answer was computed. | + +### getTimestamp + +```solidity +function getTimestamp(uint256 roundId) external view returns (uint256) +``` + +Gets the timestamp for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ---------------------------------------- | +| roundId | uint256 | - The round ID to get the timestamp for. | + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ----------------------------------------------- | +| [0] | uint256 | uint256 - The timestamp for the given round ID. | + +### latestAnswer + +```solidity +function latestAnswer() external view returns (int256) +``` + +Gets the latest answer from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------ | --------------------------- | +| [0] | int256 | int256 - The latest answer. | + +### latestRound + +```solidity +function latestRound() external view returns (uint256) +``` + +Gets the latest round ID from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ------------------------------ | +| [0] | uint256 | uint256 - The latest round ID. | + +### latestRoundData + +```solidity +function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the latest round data. + +_This function should raise "No data present" if no data is available._ + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------------- | +| roundId | uint80 | - The latest round ID. | +| answer | int256 | - The latest answer. | +| startedAt | uint256 | - The timestamp when the latest round started. | +| updatedAt | uint256 | - The timestamp when the latest round was updated. | +| answeredInRound | uint80 | - The round ID in which the latest answer was computed. | + +### latestTimestamp + +```solidity +function latestTimestamp() external view returns (uint256) +``` + +Gets the timestamp of the latest answer from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | --------------------------------------------- | +| [0] | uint256 | uint256 - The timestamp of the latest answer. | + +### proposeAggregator + +```solidity +function proposeAggregator(contract AggregatorV2V3Interface _aggregator) external +``` + +Proposes a new aggregator. + +#### Parameters + +| Name | Type | Description | +| ------------ | -------------------------------- | ----------------------------------------- | +| \_aggregator | contract AggregatorV2V3Interface | - The address of the proposed aggregator. | + +### updateAnswer + +```solidity +function updateAnswer(int256 _answer) public +``` + +Updates the answer in the mock aggregator. + +#### Parameters + +| Name | Type | Description | +| -------- | ------ | --------------------------- | +| \_answer | int256 | - The new answer to be set. | + +### updateRoundData + +```solidity +function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public +``` + +Updates the round data in the mock aggregator. + +#### Parameters + +| Name | Type | Description | +| ----------- | ------- | --------------------------------------- | +| \_roundId | uint80 | - The round ID to be updated. | +| \_answer | int256 | - The new answer to be set. | +| \_timestamp | uint256 | - The timestamp to be set. | +| \_startedAt | uint256 | - The timestamp when the round started. | diff --git a/src/content/chainlink-local/api-reference/v0.2.8/mock-verifier-proxy.mdx b/src/content/chainlink-local/api-reference/v0.2.8/mock-verifier-proxy.mdx new file mode 100644 index 00000000000..0aaadbd532c --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.8/mock-verifier-proxy.mdx @@ -0,0 +1,98 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockVerifierProxy v0.2.8 API Reference" +metadata: + description: "API documentation for MockVerifierProxy in Solidity, version v0.2.8." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockVerifierProxy + +Mock Data Streams verifier proxy. + +[MockVerifierProxy](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-streams/MockVerifierProxy.sol) + +## Variables + +### s_feeManager + +```solidity +contract IVerifierFeeManager s_feeManager +``` + +### s_verifier + +```solidity +address s_verifier +``` + +## Errors + +### VerifierInvalid + +```solidity +error VerifierInvalid() +``` + +### VerifierNotFound + +```solidity +error VerifierNotFound() +``` + +### ZeroAddress + +```solidity +error ZeroAddress() +``` + +## Events + +### VerifierInitialized + +```solidity +event VerifierInitialized(address verifierAddress) +``` + +## Functions + +### \_verify + +```solidity +function _verify(bytes payload) internal returns (bytes) +``` + +### getVerifier + +```solidity +function getVerifier(bytes32) external view returns (address) +``` + +### initializeVerifier + +```solidity +function initializeVerifier(address verifierAddress) external +``` + +### setFeeManager + +```solidity +function setFeeManager(contract IVerifierFeeManager feeManager) external +``` + +### verify + +```solidity +function verify(bytes payload, bytes parameterPayload) external payable returns (bytes) +``` + +### verifyBulk + +```solidity +function verifyBulk(bytes[] payloads, bytes parameterPayload) external payable returns (bytes[] verifiedReports) +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.8/mock-verifier.mdx b/src/content/chainlink-local/api-reference/v0.2.8/mock-verifier.mdx new file mode 100644 index 00000000000..a877650e387 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.8/mock-verifier.mdx @@ -0,0 +1,165 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockVerifier v0.2.8 API Reference" +metadata: + description: "API documentation for MockVerifier in Solidity, version v0.2.8." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockVerifier + +Mock Data Streams verifier. + +[MockVerifier](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-streams/MockVerifier.sol) + +## Variables + +### i_verifierProxy + +```solidity +address i_verifierProxy +``` + +### MOCK_DATA_STREAM_DON_ADDRESS + +```solidity +address MOCK_DATA_STREAM_DON_ADDRESS +``` + +### N_2 + +```solidity +uint256 N_2 +``` + +### s_inactiveDigests + +```solidity +mapping(bytes32 => mapping(bytes32 => bool)) s_inactiveDigests +``` + +### s_inactiveFeeds + +```solidity +mapping(bytes32 => bool) s_inactiveFeeds +``` + +### s_verifiedSignatures + +```solidity +mapping(bytes => bool) s_verifiedSignatures +``` + +## Errors + +### AccessForbidden + +```solidity +error AccessForbidden() +``` + +### AlreadyUsedSignature + +```solidity +error AlreadyUsedSignature() +``` + +### BadVerification + +```solidity +error BadVerification() +``` + +### DigestInactive + +```solidity +error DigestInactive(bytes32 feedId, bytes32 configDigest) +``` + +### InactiveFeed + +```solidity +error InactiveFeed(bytes32 feedId) +``` + +### InvalidS + +```solidity +error InvalidS() +``` + +### InvalidSignatureLength + +```solidity +error InvalidSignatureLength() +``` + +### InvalidV + +```solidity +error InvalidV() +``` + +## Events + +### ReportVerified + +```solidity +event ReportVerified(bytes32 feedId, address sender) +``` + +## Functions + +### activateConfig + +```solidity +function activateConfig(bytes32 feedId, bytes32 configDigest) external +``` + +### activateFeed + +```solidity +function activateFeed(bytes32 feedId) external +``` + +### constructor + +```solidity +constructor(address verifierProxy) public +``` + +### deactivateConfig + +```solidity +function deactivateConfig(bytes32 feedId, bytes32 configDigest) external +``` + +### deactivateFeed + +```solidity +function deactivateFeed(bytes32 feedId) external +``` + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) external pure returns (bool) +``` + +\_Returns true if this contract implements the interface defined by +`interfaceId`. See the corresponding +https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP +section] to learn more about how these ids are created. + +This function call must use less than 30 000 gas.\_ + +### verify + +```solidity +function verify(bytes signedReport, address sender) external returns (bytes verifierResponse) +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.8/register.mdx b/src/content/chainlink-local/api-reference/v0.2.8/register.mdx new file mode 100644 index 00000000000..6cd118a5695 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.8/register.mdx @@ -0,0 +1,91 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Register v0.2.8 API Reference" +metadata: + description: "API documentation for Register in Solidity, version v0.2.8." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## Register + +CCIP network configuration registry. + +[Register](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/ccip/Register.sol) + +## Structs + +### NetworkDetails + +```solidity +struct NetworkDetails { + uint64 chainSelector; + address routerAddress; + address linkAddress; + address wrappedNativeAddress; + address ccipBnMAddress; + address ccipLnMAddress; + address rmnProxyAddress; + address registryModuleOwnerCustomAddress; + address tokenAdminRegistryAddress; +} +``` + +## Variables + +### s_networkDetails + +```solidity +mapping(uint256 => struct Register.NetworkDetails) s_networkDetails +``` + +Mapping to store network details based on chain ID. + +## Functions + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the network details for various chains. + +### getNetworkDetails + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails networkDetails) +``` + +Retrieves network details for a given chain ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | --------------------------------------------- | +| chainId | uint256 | - The ID of the chain to get the details for. | + +#### Returns + +| Name | Type | Description | +| -------------- | ------------------------------ | ------------------------------------------------- | +| networkDetails | struct Register.NetworkDetails | - The network details for the specified chain ID. | + +### setNetworkDetails + +```solidity +function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external +``` + +Sets the network details for a given chain ID. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------------------------------ | -------------------------------------------------------- | +| chainId | uint256 | - The ID of the chain to set the details for. | +| networkDetails | struct Register.NetworkDetails | - The network details to set for the specified chain ID. | diff --git a/src/content/chainlink-local/api-reference/v0.2.8/report-versions.mdx b/src/content/chainlink-local/api-reference/v0.2.8/report-versions.mdx new file mode 100644 index 00000000000..45cc2b16fe6 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.8/report-versions.mdx @@ -0,0 +1,84 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "ReportVersions v0.2.8 API Reference" +metadata: + description: "API documentation for ReportVersions in Solidity, version v0.2.8." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## ReportVersions + +Data Streams report schemas. + +[ReportVersions](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/data-streams/ReportVersions.sol) + +## Structs + +### ReportV2 + +_Represents a data report from a Data Streams stream for v2 schema (crypto +streams). The `price` value is carried to either 8 or 18 decimal places, +depending on the stream. For more information, see +https://docs.chain.link/data-streams/crypto-streams and +https://docs.chain.link/data-streams/reference/report-schema_ + +```solidity +struct ReportV2 { + bytes32 feedId; + uint32 validFromTimestamp; + uint32 observationsTimestamp; + uint192 nativeFee; + uint192 linkFee; + uint32 expiresAt; + int192 benchmarkPrice; +} +``` + +### ReportV3 + +_Represents a data report from a Data Streams stream for v3 schema (crypto +streams). The `price`, `bid`, and `ask` values are carried to either 8 or 18 +decimal places, depending on the stream. For more information, see +https://docs.chain.link/data-streams/crypto-streams and +https://docs.chain.link/data-streams/reference/report-schema_ + +```solidity +struct ReportV3 { + bytes32 feedId; + uint32 validFromTimestamp; + uint32 observationsTimestamp; + uint192 nativeFee; + uint192 linkFee; + uint32 expiresAt; + int192 price; + int192 bid; + int192 ask; +} +``` + +### ReportV4 + +_Represents a data report from a Data Streams stream for v4 schema (RWA stream). +The `price` value is carried to either 8 or 18 decimal places, depending on the +stream. The `marketStatus` indicates whether the market is currently open. +Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). For more +information, see https://docs.chain.link/data-streams/rwa-streams and +https://docs.chain.link/data-streams/reference/report-schema-v4_ + +```solidity +struct ReportV4 { + bytes32 feedId; + uint32 validFromTimestamp; + uint32 observationsTimestamp; + uint192 nativeFee; + uint192 linkFee; + uint32 expiresAt; + int192 price; + uint32 marketStatus; +} +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.8/weth9.mdx b/src/content/chainlink-local/api-reference/v0.2.8/weth9.mdx new file mode 100644 index 00000000000..948f22c5153 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.8/weth9.mdx @@ -0,0 +1,126 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "WETH9 v0.2.8 API Reference" +metadata: + description: "API documentation for WETH9 in Solidity, version v0.2.8." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## WETH9 + +Wrapped Ether implementation. + +[WETH9](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.8/src/shared/WETH9.sol) + +## Variables + +### allowance + +```solidity +mapping(address => mapping(address => uint256)) allowance +``` + +### balanceOf + +```solidity +mapping(address => uint256) balanceOf +``` + +### decimals + +```solidity +uint8 decimals +``` + +### name + +```solidity +string name +``` + +### symbol + +```solidity +string symbol +``` + +## Events + +### Approval + +```solidity +event Approval(address src, address guy, uint256 wad) +``` + +### Deposit + +```solidity +event Deposit(address dst, uint256 wad) +``` + +### Transfer + +```solidity +event Transfer(address src, address dst, uint256 wad) +``` + +### Withdrawal + +```solidity +event Withdrawal(address src, uint256 wad) +``` + +## Functions + +### \_deposit + +```solidity +function _deposit() internal +``` + +### approve + +```solidity +function approve(address guy, uint256 wad) public returns (bool) +``` + +### deposit + +```solidity +function deposit() external payable +``` + +### receive + +```solidity +receive() external payable +``` + +### totalSupply + +```solidity +function totalSupply() public view returns (uint256) +``` + +### transfer + +```solidity +function transfer(address dst, uint256 wad) public returns (bool) +``` + +### transferFrom + +```solidity +function transferFrom(address src, address dst, uint256 wad) public returns (bool) +``` + +### withdraw + +```solidity +function withdraw(uint256 wad) external +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.9/aggregator-interface.mdx b/src/content/chainlink-local/api-reference/v0.2.9/aggregator-interface.mdx new file mode 100644 index 00000000000..a844f22118b --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.9/aggregator-interface.mdx @@ -0,0 +1,136 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "AggregatorInterface v0.2.9 API Reference" +metadata: + description: "API documentation for AggregatorInterface in Solidity, version v0.2.9." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## AggregatorInterface + +Basic price feed interface. + +[AggregatorInterface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-feeds/interfaces/AggregatorInterface.sol) + +## Events + +### AnswerUpdated + +```solidity +event AnswerUpdated(int256 current, uint256 roundId, uint256 updatedAt) +``` + +Emitted when the answer is updated. + +#### Parameters + +| Name | Type | Description | +| --------- | ------- | ------------------------------------------------ | +| current | int256 | - The updated answer. | +| roundId | uint256 | - The round ID for which the answer was updated. | +| updatedAt | uint256 | - The timestamp when the answer was updated. | + +### NewRound + +```solidity +event NewRound(uint256 roundId, address startedBy, uint256 startedAt) +``` + +Emitted when a new round is started. + +#### Parameters + +| Name | Type | Description | +| --------- | ------- | ---------------------------------------------------- | +| roundId | uint256 | - The round ID of the new round. | +| startedBy | address | - The address of the account that started the round. | +| startedAt | uint256 | - The timestamp when the round was started. | + +## Functions + +### getAnswer + +```solidity +function getAnswer(uint256 roundId) external view returns (int256) +``` + +Gets the answer for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------- | +| roundId | uint256 | - The round ID to get the answer for. | + +#### Returns + +| Name | Type | Description | +| ---- | ------ | ------------------------------------------- | +| [0] | int256 | int256 - The answer for the given round ID. | + +### getTimestamp + +```solidity +function getTimestamp(uint256 roundId) external view returns (uint256) +``` + +Gets the timestamp for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ---------------------------------------- | +| roundId | uint256 | - The round ID to get the timestamp for. | + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ----------------------------------------------- | +| [0] | uint256 | uint256 - The timestamp for the given round ID. | + +### latestAnswer + +```solidity +function latestAnswer() external view returns (int256) +``` + +Gets the latest answer from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------ | --------------------------- | +| [0] | int256 | int256 - The latest answer. | + +### latestRound + +```solidity +function latestRound() external view returns (uint256) +``` + +Gets the latest round ID from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ------------------------------ | +| [0] | uint256 | uint256 - The latest round ID. | + +### latestTimestamp + +```solidity +function latestTimestamp() external view returns (uint256) +``` + +Gets the timestamp of the latest answer from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | --------------------------------------------- | +| [0] | uint256 | uint256 - The timestamp of the latest answer. | diff --git a/src/content/chainlink-local/api-reference/v0.2.9/aggregator-v2-v3-interface.mdx b/src/content/chainlink-local/api-reference/v0.2.9/aggregator-v2-v3-interface.mdx new file mode 100644 index 00000000000..a963b5fe746 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.9/aggregator-v2-v3-interface.mdx @@ -0,0 +1,18 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "AggregatorV2V3Interface v0.2.9 API Reference" +metadata: + description: "API documentation for AggregatorV2V3Interface in Solidity, version v0.2.9." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## AggregatorV2V3Interface + +Combined V2/V3 price feed interface. + +[AggregatorV2V3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-feeds/interfaces/AggregatorV2V3Interface.sol) diff --git a/src/content/chainlink-local/api-reference/v0.2.9/aggregator-v3-interface.mdx b/src/content/chainlink-local/api-reference/v0.2.9/aggregator-v3-interface.mdx new file mode 100644 index 00000000000..02cd6de5220 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.9/aggregator-v3-interface.mdx @@ -0,0 +1,109 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "AggregatorV3Interface v0.2.9 API Reference" +metadata: + description: "API documentation for AggregatorV3Interface in Solidity, version v0.2.9." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## AggregatorV3Interface + +Extended price feed interface. + +[AggregatorV3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-feeds/interfaces/AggregatorV3Interface.sol) + +## Functions + +### decimals + +```solidity +function decimals() external view returns (uint8) +``` + +Gets the number of decimals used by the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ----- | ------------------------------- | +| [0] | uint8 | uint8 - The number of decimals. | + +### description + +```solidity +function description() external view returns (string) +``` + +Gets the description of the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------ | -------------------------------------------------- | +| [0] | string | string memory - The description of the aggregator. | + +### getRoundData + +```solidity +function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the round data for a specific round ID. + +_This function should raise "No data present" if no data is available for the +given round ID._ + +#### Parameters + +| Name | Type | Description | +| --------- | ------ | ----------------------------------- | +| \_roundId | uint80 | - The round ID to get the data for. | + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------ | +| roundId | uint80 | - The round ID. | +| answer | int256 | - The answer for the round. | +| startedAt | uint256 | - The timestamp when the round started. | +| updatedAt | uint256 | - The timestamp when the round was updated. | +| answeredInRound | uint80 | - The round ID in which the answer was computed. | + +### latestRoundData + +```solidity +function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the latest round data. + +_This function should raise "No data present" if no data is available._ + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------------- | +| roundId | uint80 | - The latest round ID. | +| answer | int256 | - The latest answer. | +| startedAt | uint256 | - The timestamp when the latest round started. | +| updatedAt | uint256 | - The timestamp when the latest round was updated. | +| answeredInRound | uint80 | - The round ID in which the latest answer was computed. | + +### version + +```solidity +function version() external view returns (uint256) +``` + +Gets the version of the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ---------------------------------------- | +| [0] | uint256 | uint256 - The version of the aggregator. | diff --git a/src/content/chainlink-local/api-reference/v0.2.9/burn-mint-erc677-helper.mdx b/src/content/chainlink-local/api-reference/v0.2.9/burn-mint-erc677-helper.mdx new file mode 100644 index 00000000000..8fbce8427e7 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.9/burn-mint-erc677-helper.mdx @@ -0,0 +1,55 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "BurnMintERC677Helper v0.2.9 API Reference" +metadata: + description: "API documentation for BurnMintERC677Helper in Solidity, version v0.2.9." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## BurnMintERC677Helper + +Helper contract for ERC677 token operations. + +[BurnMintERC677Helper](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/ccip/BurnMintERC677Helper.sol) + +## Functions + +### constructor + +```solidity +constructor(string name, string symbol) public +``` + +Constructor to initialize the BurnMintERC677Helper contract with a name and +symbol. + +_Calls the parent constructor of BurnMintERC677 with fixed decimals (18) and +initial supply (0)._ + +#### Parameters + +| Name | Type | Description | +| ------ | ------ | -------------------------- | +| name | string | - The name of the token. | +| symbol | string | - The symbol of the token. | + +### drip + +```solidity +function drip(address to) external +``` + +Mints one full token (1e18) to the specified address. + +_Calls the internal `_mint` function from the BurnMintERC677 contract._ + +#### Parameters + +| Name | Type | Description | +| ---- | ------- | ------------------------------------------ | +| to | address | - The address to receive the minted token. | diff --git a/src/content/chainlink-local/api-reference/v0.2.9/ccip-local-simulator-fork-js.mdx b/src/content/chainlink-local/api-reference/v0.2.9/ccip-local-simulator-fork-js.mdx new file mode 100644 index 00000000000..84dad86b09f --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.9/ccip-local-simulator-fork-js.mdx @@ -0,0 +1,97 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalSimulatorFork JS v0.2.9 API Reference" +metadata: + description: "API documentation for the CCIPLocalSimulatorFork JS JavaScript helpers, version v0.2.9." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalSimulatorFork JS + +Hardhat 2 JavaScript helpers for fork routing. + +[CCIPLocalSimulatorFork JS](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/scripts/CCIPLocalSimulatorFork.js) + +## Types + +### Evm2EvmMessage : `Object` + +**Properties** + +| Name | Type | +| ------------------- | ------------------------------------------ | +| sourceChainSelector | `bigint` | +| sender | `string` | +| receiver | `string` | +| sequenceNumber | `bigint` | +| gasLimit | `bigint` | +| strict | `boolean` | +| nonce | `bigint` | +| feeToken | `string` | +| feeTokenAmount | `bigint` | +| data | `string` | +| tokenAmounts | `Array.<\{token: string, amount: bigint}>` | +| sourceTokenData | `Array.` | +| messageId | `string` | + +## Functions + +### requestLinkFromTheFaucet(linkAddress, to, amount) ⇒ `Promise.` + +Requests LINK tokens from the faucet and returns the transaction hash + +**Returns**: `Promise.` - Promise resolving to the +transaction hash of the fund transfer + +| Param | Type | Description | +| ----------- | -------- | ------------------------------------------------------- | +| linkAddress | `string` | The address of the LINK contract on the current network | +| to | `string` | The address to send LINK to | +| amount | `bigint` | The amount of LINK to request | + +### getEvm2EvmMessage(receipt) ⇒ `Evm2EvmMessage` | `null` + +Parses a transaction receipt to extract the sent message Scans through +transaction logs to find a `CCIPSendRequested` event and then decodes it to an +object + +**Returns**: `Evm2EvmMessage` | +`null` - Returns either the sent message or null if provided receipt +does not contain `CCIPSendRequested` log + +| Param | Type | Description | +| ------- | -------- | ------------------------------------------------ | +| receipt | `object` | The transaction receipt from the `ccipSend` call | + +### getEvm2AnyRampMessage(receipt) ⇒ `object` | `null` + +Parses a transaction receipt to extract the sent message from CCIPMessageSent + +**Returns**: `object` | `null` - Returns \{ +destChainSelector, sequenceNumber, EVM2AnyRampMessage message \} or null + +| Param | Type | Description | +| ------- | -------- | ------------------------------------------ | +| receipt | `object` | – The tx receipt from the on-ramp contract | + +### routeMessage(routerAddress, evm2EvmMessage) ⇒ `Promise.` + +Routes the sent message from the source network on the destination (current) +network + +**Returns**: `Promise.` - Either resolves with no value +if the message is successfully routed, or reverts +**Throws**: + +- `Error` Fails if no off-ramp matches the message's source chain + selector or if calling `router.getOffRamps()` + +| Param | Type | Description | +| -------------- | ---------------- | --------------------------------- | +| routerAddress | `string` | Address of the destination Router | +| evm2EvmMessage | `Evm2EvmMessage` | Sent cross-chain message | diff --git a/src/content/chainlink-local/api-reference/v0.2.9/ccip-local-simulator-fork.mdx b/src/content/chainlink-local/api-reference/v0.2.9/ccip-local-simulator-fork.mdx new file mode 100644 index 00000000000..98a549f7306 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.9/ccip-local-simulator-fork.mdx @@ -0,0 +1,311 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalSimulatorFork v0.2.9 API Reference" +metadata: + description: "API documentation for CCIPLocalSimulatorFork in Solidity, version v0.2.9." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalSimulatorFork + +CCIP simulator for forked networks. + +[CCIPLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/ccip/CCIPLocalSimulatorFork.sol) + +## Structs + +### EVM2EVMMessage + +```solidity +struct EVM2EVMMessage { + uint64 sourceChainSelector; + address sender; + address receiver; + uint64 sequenceNumber; + uint256 gasLimit; + bool strict; + uint64 nonce; + address feeToken; + uint256 feeTokenAmount; + bytes data; + struct Client.EVMTokenAmount[] tokenAmounts; + bytes[] sourceTokenData; + bytes32 messageId; +} +``` + +### OffRamp + +Structure representing an offRamp configuration + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | + +```solidity +struct OffRamp { + uint64 sourceChainSelector; + address offRamp; +} +``` + +## Variables + +### DEFAULT_GAS_LIMIT + +```solidity +uint32 DEFAULT_GAS_LIMIT +``` + +### i_register + +```solidity +contract Register i_register +``` + +The immutable register instance + +### LINK_FAUCET + +```solidity +address LINK_FAUCET +``` + +The address of the LINK faucet + +### s_processedMessages + +```solidity +mapping(bytes32 => bool) s_processedMessages +``` + +Mapping to track processed messages + +## Errors + +### InvalidExtraArgsTag + +```solidity +error InvalidExtraArgsTag() +``` + +## Events + +### CCIPMessageSent + +```solidity +event CCIPMessageSent(uint64 destChainSelector, uint64 sequenceNumber, struct Internal.EVM2AnyRampMessage message) +``` + +### CCIPSendRequested + +```solidity +event CCIPSendRequested(struct InternalPreV1dot6.EVM2EVMMessage message) +``` + +Events emitted when a CCIP send request is made + +## Functions + +### \_fromBytes + +```solidity +function _fromBytes(bytes extraArgs) internal pure returns (struct Client.GenericExtraArgsV2) +``` + +Internal helper function to decode extraArgs bytes to GenericExtraArgsV2 struct. +Supports decoding of both GenericExtraArgsV2 and EVMExtraArgsV1 structs. + +#### Parameters + +| Name | Type | Description | +| --------- | ----- | --------------------------------------------- | +| extraArgs | bytes | - The bytes representing the extra arguments. | + +#### Returns + +| Name | Type | Description | +| ---- | -------------------------------- | --------------------------------------------------------- | +| [0] | struct Client.GenericExtraArgsV2 | genericExtraArgs - The decoded GenericExtraArgsV2 struct. | + +### \_routeCapturedMessages + +```solidity +function _routeCapturedMessages(uint256[] forkIds, uint256 sourceForkId, address sourceRouterAddress) internal +``` + +Internal function to route captured messages to their respective destination +forks. + +#### Parameters + +| Name | Type | Description | +| ------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| forkIds | uint256[] | - The IDs of the destination network forks. These are the returned values of `createFork()` or `createSelectFork()`, not chainIds. | +| sourceForkId | uint256 | - The ID of the source network fork. This is the returned value of `createFork()` or `createSelectFork()`, not chainId. | +| sourceRouterAddress | address | - The address of the Router on the source chain. | + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the contract + +### executeSingleMessage + +```solidity +function executeSingleMessage(struct Internal.Any2EVMRampMessage message, bytes[] offchainTokenData, uint32[] tokenGasOverrides) external +``` + +Executes a single CCIP message on the offRamp + +#### Parameters + +| Name | Type | Description | +| ----------------- | ---------------------------------- | --------------------------------- | +| message | struct Internal.Any2EVMRampMessage | - The CCIP message to be executed | +| offchainTokenData | bytes[] | - Additional offchain token data | +| tokenGasOverrides | uint32[] | | + +### executeSingleMessage + +```solidity +function executeSingleMessage(struct InternalPreV1dot6.EVM2EVMMessage message, bytes[] offchainTokenData, uint32[] tokenGasOverrides) external +``` + +Works with Foundry only + +### getNetworkDetails + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) +``` + +Returns the default values for currently CCIP supported networks. If network is +not present or some of the values are changed, user can manually add new network +details using the `setNetworkDetails` function. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------------------------------------------------------------------------ | +| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | + +#### Returns + +| Name | Type | Description | +| ---- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | + +### getOffRamps + +```solidity +function getOffRamps() external view returns (struct IRouterFork.OffRamp[]) +``` + +Gets the list of offRamps + +#### Returns + +| Name | Type | Description | +| ---- | ---------------------------- | ----------------------------------- | +| [0] | struct IRouterFork.OffRamp[] | offRamps - Array of OffRamp structs | + +### getOnRamp + +```solidity +function getOnRamp(uint64 destChainSelector) external view returns (address) +``` + +Return the configured onramp for specific a destination chain. @param +destChainSelector The destination chain Id to get the onRamp for. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | -------------------------- | +| [0] | address | The address of the onRamp. | + +### requestLinkFromFaucet + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------- | +| to | address | - The address to which LINK tokens are to be sent. | +| amount | uint256 | - The amount of LINK tokens to send. | + +#### Returns + +| Name | Type | Description | +| ------- | ---- | ----------------------------------------------------------------------------- | +| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | + +### setNetworkDetails + +```solidity +function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external +``` + +If network details are not present or some of the values are changed, user can +manually add new network details using the `setNetworkDetails` function. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector. | +| networkDetails | struct Register.NetworkDetails | - The tuple containing: chainSelector - The unique CCIP Chain Selector. routerAddress - The address of the CCIP Router contract. linkAddress - The address of the LINK token. wrappedNativeAddress - The address of the wrapped native token that can be used for CCIP fees. ccipBnMAddress - The address of the CCIP BnM token. ccipLnMAddress - The address of the CCIP LnM token. | + +### switchChainAndRouteMessage + +```solidity +function switchChainAndRouteMessage(uint256 forkId) external +``` + +To be called after the sending of the cross-chain message (`ccipSend`). Goes +through the list of past logs and looks for the `CCIPSendRequested` and +`CCIPMessageSent` events. Switches to a destination network fork. Routes the +sent cross-chain message on the destination network. If you sent more than one +message, it will try to route all of them to `forkId`. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------------------------------------------------------------------- | +| forkId | uint256 | - The ID of the destination network fork. This is the returned value of `createFork()` or `createSelectFork()` | + +### switchChainAndRouteMessage + +```solidity +function switchChainAndRouteMessage(uint256[] forkIds) external +``` + +To be called after the sending of the cross-chain message (`ccipSend`). Override +variant of the `switchChainAndRouteMessage(uint256 forkId)` function in case of +multiple destination forks. Goes through the list of past logs and looks for the +`CCIPSendRequested` and `CCIPMessageSent` events. Loops through provided +`forkIds` and tries to route the message to correct destination. If you haven't +provide correct `forkId`, the message will get lost. If you sent more than one +message, it will try to route all of them to correct destinations. + +#### Parameters + +| Name | Type | Description | +| ------- | --------- | ------------------------------------------------------------------------------------------------------------------- | +| forkIds | uint256[] | - The IDs of the destination network forks. These are the returned values of `createFork()` or `createSelectFork()` | diff --git a/src/content/chainlink-local/api-reference/v0.2.9/ccip-local-simulator.mdx b/src/content/chainlink-local/api-reference/v0.2.9/ccip-local-simulator.mdx new file mode 100644 index 00000000000..f99ce377270 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.9/ccip-local-simulator.mdx @@ -0,0 +1,233 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalSimulator v0.2.9 API Reference" +metadata: + description: "API documentation for CCIPLocalSimulator in Solidity, version v0.2.9." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalSimulator + +Local CCIP simulator (no-fork mode). + +[CCIPLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/ccip/CCIPLocalSimulator.sol) + +## Variables + +### CHAIN_SELECTOR + +```solidity +uint64 CHAIN_SELECTOR +``` + +The unique CCIP Chain Selector constant + +### i_ccipBnM + +```solidity +contract BurnMintERC677Helper i_ccipBnM +``` + +The BurnMintERC677Helper instance for CCIP-BnM token + +### i_ccipLnM + +```solidity +contract BurnMintERC677Helper i_ccipLnM +``` + +The BurnMintERC677Helper instance for CCIP-LnM token + +### i_linkToken + +```solidity +contract LinkToken i_linkToken +``` + +The LINK token instance + +### i_mockRouter + +```solidity +contract MockCCIPRouter i_mockRouter +``` + +The mock CCIP router instance + +### i_wrappedNative + +```solidity +contract WETH9 i_wrappedNative +``` + +The wrapped native token instance + +### s_supportedTokens + +```solidity +address[] s_supportedTokens +``` + +The list of supported token addresses + +## Errors + +### CCIPLocalSimulator\_\_MsgSenderIsNotTokenOwner + +```solidity +error CCIPLocalSimulator__MsgSenderIsNotTokenOwner() +``` + +### CCIPLocalSimulator\_\_RequiredRoleNotFound + +```solidity +error CCIPLocalSimulator__RequiredRoleNotFound(address account, bytes32 role, address token) +``` + +## Functions + +### configuration + +```solidity +function configuration() public view returns (uint64 chainSelector_, contract IRouterClient sourceRouter_, contract IRouterClient destinationRouter_, contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract BurnMintERC677Helper ccipBnM_, contract BurnMintERC677Helper ccipLnM_) +``` + +Returns configuration details for pre-deployed contracts and services needed for +local CCIP simulations. + +#### Returns + +| Name | Type | Description | +| ------------------- | ----------------------------- | ----------------------------------------------------------- | +| chainSelector\_ | uint64 | - The unique CCIP Chain Selector. | +| sourceRouter\_ | contract IRouterClient | - The source chain Router contract. | +| destinationRouter\_ | contract IRouterClient | - The destination chain Router contract. | +| wrappedNative\_ | contract WETH9 | - The wrapped native token which can be used for CCIP fees. | +| linkToken\_ | contract LinkToken | - The LINK token. | +| ccipBnM\_ | contract BurnMintERC677Helper | - The ccipBnM token. | +| ccipLnM\_ | contract BurnMintERC677Helper | - The ccipLnM token. | + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the contract and pre-deployed token instances + +### getSupportedTokens + +```solidity +function getSupportedTokens(uint64 chainSelector) external view returns (address[] tokens) +``` + +Gets a list of token addresses that are supported for cross-chain transfers by +the simulator. + +#### Parameters + +| Name | Type | Description | +| ------------- | ------ | --------------------------------- | +| chainSelector | uint64 | - The unique CCIP Chain Selector. | + +#### Returns + +| Name | Type | Description | +| ------ | --------- | -------------------------------------------------------------------------------------------------- | +| tokens | address[] | - Returns a list of token addresses that are supported for cross-chain transfers by the simulator. | + +### isChainSupported + +```solidity +function isChainSupported(uint64 chainSelector) public pure returns (bool supported) +``` + +Checks whether the provided `chainSelector` is supported by the simulator. + +#### Parameters + +| Name | Type | Description | +| ------------- | ------ | --------------------------------- | +| chainSelector | uint64 | - The unique CCIP Chain Selector. | + +#### Returns + +| Name | Type | Description | +| --------- | ---- | ---------------------------------------------------------------- | +| supported | bool | - Returns true if `chainSelector` is supported by the simulator. | + +### requestLinkFromFaucet + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------- | +| to | address | - The address to which LINK tokens are to be sent. | +| amount | uint256 | - The amount of LINK tokens to send. | + +#### Returns + +| Name | Type | Description | +| ------- | ---- | ----------------------------------------------------------------------------- | +| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | + +### supportNewTokenViaAccessControlDefaultAdmin + +```solidity +function supportNewTokenViaAccessControlDefaultAdmin(address tokenAddress) external +``` + +Allows user to support any new token, besides CCIP BnM and CCIP LnM, for +cross-chain transfers. The caller must have the DEFAULT_ADMIN_ROLE as defined by +the contract itself. Reverts if the caller is not the admin of the token using +OZ's AccessControl DEFAULT_ADMIN_ROLE. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ------------------------------------------------------------------ | +| tokenAddress | address | - The address of the token to add to the list of supported tokens. | + +### supportNewTokenViaGetCCIPAdmin + +```solidity +function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external +``` + +Allows user to support any new token, besides CCIP BnM and CCIP LnM, for +cross-chain transfers. Reverts if token does not implement getCCIPAdmin() +function. Reverts if the caller is not the token CCIPAdmin. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ------------------------------------------------------------------ | +| tokenAddress | address | - The address of the token to add to the list of supported tokens. | + +### supportNewTokenViaOwner + +```solidity +function supportNewTokenViaOwner(address tokenAddress) external +``` + +Allows user to support any new token, besides CCIP BnM and CCIP LnM, for +cross-chain transfers. Reverts if token does not implement owner() function. +Reverts if the caller is not the token owner. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ------------------------------------------------------------------ | +| tokenAddress | address | - The address of the token to add to the list of supported tokens. | diff --git a/src/content/chainlink-local/api-reference/v0.2.9/data-streams-local-simulator-fork.mdx b/src/content/chainlink-local/api-reference/v0.2.9/data-streams-local-simulator-fork.mdx new file mode 100644 index 00000000000..909ca47f9d3 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.9/data-streams-local-simulator-fork.mdx @@ -0,0 +1,121 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "DataStreamsLocalSimulatorFork v0.2.9 API Reference" +metadata: + description: "API documentation for DataStreamsLocalSimulatorFork in Solidity, version v0.2.9." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## DataStreamsLocalSimulatorFork + +Data Streams simulator for forked networks. + +[DataStreamsLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-streams/DataStreamsLocalSimulatorFork.sol) + +## Variables + +### i_register + +```solidity +contract Register i_register +``` + +The immutable register instance + +### LINK_FAUCET + +```solidity +address LINK_FAUCET +``` + +The address of the LINK faucet + +## Functions + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the contract + +### getNetworkDetails + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails) +``` + +Returns the default values for currently Data Streams supported networks. If +network is not present or some of the values are changed, user can manually add +new network details using the `setNetworkDetails` function. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ----------------------------------------------------------------------------- | +| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | + +#### Returns + +| Name | Type | Description | +| ---- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [0] | struct Register.NetworkDetails | networkDetails - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | + +### requestLinkFromFaucet + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------- | +| to | address | - The address to which LINK tokens are to be sent. | +| amount | uint256 | - The amount of LINK tokens to send. | + +#### Returns + +| Name | Type | Description | +| ------- | ---- | ----------------------------------------------------------------------------- | +| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | + +### requestNativeFromFaucet + +```solidity +function requestNativeFromFaucet(address to, uint256 amount) external +``` + +Requests native coints from the faucet. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | --------------------------------------------------- | +| to | address | - The address to which native coins are to be sent. | +| amount | uint256 | - The amount of native coins to send. | + +### setNetworkDetails + +```solidity +function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external +``` + +If network details are not present or some of the values are changed, user can +manually add new network details using the `setNetworkDetails` function. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- | +| chainId | uint256 | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | +| networkDetails | struct Register.NetworkDetails | - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | diff --git a/src/content/chainlink-local/api-reference/v0.2.9/data-streams-local-simulator.mdx b/src/content/chainlink-local/api-reference/v0.2.9/data-streams-local-simulator.mdx new file mode 100644 index 00000000000..302a6522775 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.9/data-streams-local-simulator.mdx @@ -0,0 +1,110 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "DataStreamsLocalSimulator v0.2.9 API Reference" +metadata: + description: "API documentation for DataStreamsLocalSimulator in Solidity, version v0.2.9." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## DataStreamsLocalSimulator + +Local Data Streams simulator (no-fork mode). + +[DataStreamsLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-streams/DataStreamsLocalSimulator.sol) + +## Variables + +### i_linkToken + +```solidity +contract LinkToken i_linkToken +``` + +The LINK token instance + +### i_wrappedNative + +```solidity +contract WETH9 i_wrappedNative +``` + +The wrapped native token instance + +### s_mockFeeManager + +```solidity +contract MockFeeManager s_mockFeeManager +``` + +### s_mockRewardManager + +```solidity +contract MockRewardManager s_mockRewardManager +``` + +### s_mockVerifier + +```solidity +contract MockVerifier s_mockVerifier +``` + +### s_mockVerifierProxy + +```solidity +contract MockVerifierProxy s_mockVerifierProxy +``` + +## Functions + +### configuration + +```solidity +function configuration() public view returns (contract WETH9 wrappedNative_, contract LinkToken linkToken_, contract MockVerifier mockVerifier_, contract MockVerifierProxy mockVerifierProxy_, contract MockFeeManager mockFeeManager_, contract MockRewardManager mockRewardManager_) +``` + +@notice Returns configuration details for pre-deployed contracts and services +needed for local Data Streams simulations. + +#### Returns + +| Name | Type | Description | +| ------------------- | -------------------------- | ----------------------------------- | +| wrappedNative\_ | contract WETH9 | - The wrapped native token. | +| linkToken\_ | contract LinkToken | - The LINK token. | +| mockVerifier\_ | contract MockVerifier | - The mock verifier contract. | +| mockVerifierProxy\_ | contract MockVerifierProxy | - The mock verifier proxy contract. | +| mockFeeManager\_ | contract MockFeeManager | - The mock fee manager contract. | +| mockRewardManager\_ | contract MockRewardManager | - The mock reward manager contract. | + +### constructor + +```solidity +constructor() public +``` + +### requestLinkFromFaucet + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------------------- | +| to | address | - The address to which LINK tokens are to be sent. | +| amount | uint256 | - The amount of LINK tokens to send. | + +#### Returns + +| Name | Type | Description | +| ------- | ---- | ----------------------------------------------------------------------------- | +| success | bool | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | diff --git a/src/content/chainlink-local/api-reference/v0.2.9/data-streams-register.mdx b/src/content/chainlink-local/api-reference/v0.2.9/data-streams-register.mdx new file mode 100644 index 00000000000..a4603ab7bd9 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.9/data-streams-register.mdx @@ -0,0 +1,84 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Register (Data Streams) v0.2.9 API Reference" +metadata: + description: "API documentation for Register (Data Streams) in Solidity, version v0.2.9." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## Register (Data Streams) + +Data Streams network configuration registry. + +[Register (Data Streams)](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-streams/Register.sol) + +## Structs + +### NetworkDetails + +```solidity +struct NetworkDetails { + address verifierProxyAddress; + address linkAddress; +} +``` + +## Variables + +### s_networkDetails + +```solidity +mapping(uint256 => struct Register.NetworkDetails) s_networkDetails +``` + +Mapping to store network details based on chain ID. + +## Functions + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the network details for various chains. + +### getNetworkDetails + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails networkDetails) +``` + +Retrieves network details for a given chain ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | --------------------------------------------- | +| chainId | uint256 | - The ID of the chain to get the details for. | + +#### Returns + +| Name | Type | Description | +| -------------- | ------------------------------ | ------------------------------------------------- | +| networkDetails | struct Register.NetworkDetails | - The network details for the specified chain ID. | + +### setNetworkDetails + +```solidity +function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external +``` + +Sets the network details for a given chain ID. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------------------------------ | -------------------------------------------------------- | +| chainId | uint256 | - The ID of the chain to set the details for. | +| networkDetails | struct Register.NetworkDetails | - The network details to set for the specified chain ID. | diff --git a/src/content/chainlink-local/api-reference/v0.2.9/index.mdx b/src/content/chainlink-local/api-reference/v0.2.9/index.mdx new file mode 100644 index 00000000000..71ee8905662 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.9/index.mdx @@ -0,0 +1,56 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Chainlink Local v0.2.9 API Reference" +metadata: + description: "API reference documentation for Chainlink Local v0.2.9" +isIndex: true +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +Chainlink Local v0.2.9 fixes `CCIPLocalSimulatorFork.switchChainAndRouteMessage` to pair the destination OffRamp with the source OnRamp by reading `getSourceChainConfig` (v1.6+) and `getStaticConfig` (pre-v1.6), with a fallback to other OffRamps with the same `sourceChainSelector`. This is the last release of the `0.2.x` line and the one Hardhat 2 users stay on. + +## CCIP + +These contracts provide Cross-Chain Interoperability Protocol (CCIP) functionality in a local testing environment: + +- [CCIPLocalSimulator](/chainlink-local/api-reference/v0.2.9/ccip-local-simulator) - Local CCIP simulator (no-fork mode) +- [CCIPLocalSimulatorFork](/chainlink-local/api-reference/v0.2.9/ccip-local-simulator-fork) - CCIP simulator for forked networks +- [CCIPLocalSimulatorFork JS](/chainlink-local/api-reference/v0.2.9/ccip-local-simulator-fork-js) - JavaScript helpers for fork routing +- [Register](/chainlink-local/api-reference/v0.2.9/register) - CCIP network configuration registry + +## Data Streams + +Contracts for simulating Chainlink Data Streams: + +- [DataStreamsLocalSimulator](/chainlink-local/api-reference/v0.2.9/data-streams-local-simulator) - Local Data Streams simulator (no-fork mode) +- [DataStreamsLocalSimulatorFork](/chainlink-local/api-reference/v0.2.9/data-streams-local-simulator-fork) - Data Streams simulator for forked networks +- [MockVerifier](/chainlink-local/api-reference/v0.2.9/mock-verifier) - Mock Data Streams verifier +- [MockVerifierProxy](/chainlink-local/api-reference/v0.2.9/mock-verifier-proxy) - Mock Data Streams verifier proxy +- [MockReportGenerator](/chainlink-local/api-reference/v0.2.9/mock-report-generator) - Signed report generator for every report schema +- [MockFeeManager](/chainlink-local/api-reference/v0.2.9/mock-fee-manager) - Mock verifier fee manager +- [MockRewardManager](/chainlink-local/api-reference/v0.2.9/mock-reward-manager) - Mock reward manager +- [ReportVersions](/chainlink-local/api-reference/v0.2.9/report-versions) - Data Streams report schemas +- [Register (Data Streams)](/chainlink-local/api-reference/v0.2.9/data-streams-register) - Data Streams network configuration registry + +## Data Feeds + +Contracts for simulating Chainlink Data Feeds: + +- [AggregatorInterface](/chainlink-local/api-reference/v0.2.9/aggregator-interface) - Basic price feed interface +- [AggregatorV2V3Interface](/chainlink-local/api-reference/v0.2.9/aggregator-v2-v3-interface) - Combined V2/V3 price feed interface +- [AggregatorV3Interface](/chainlink-local/api-reference/v0.2.9/aggregator-v3-interface) - Extended price feed interface +- [MockOffchainAggregator](/chainlink-local/api-reference/v0.2.9/mock-offchain-aggregator) - Mock implementation of off-chain aggregator +- [MockV3Aggregator](/chainlink-local/api-reference/v0.2.9/mock-v3-aggregator) - Mock implementation of V3 aggregator + +## Token Contracts + +Standard token implementations for testing: + +- [BurnMintERC677Helper](/chainlink-local/api-reference/v0.2.9/burn-mint-erc677-helper) - Helper contract for ERC677 token operations +- [LinkToken](/chainlink-local/api-reference/v0.2.9/link-token) - LINK token implementation +- [WETH9](/chainlink-local/api-reference/v0.2.9/weth9) - Wrapped Ether implementation diff --git a/src/content/chainlink-local/api-reference/v0.2.9/link-token.mdx b/src/content/chainlink-local/api-reference/v0.2.9/link-token.mdx new file mode 100644 index 00000000000..9959049e9ee --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.9/link-token.mdx @@ -0,0 +1,44 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "LinkToken v0.2.9 API Reference" +metadata: + description: "API documentation for LinkToken in Solidity, version v0.2.9." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## LinkToken + +LINK token implementation. + +[LinkToken](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/shared/LinkToken.sol) + +## Functions + +### \_onCreate + +```solidity +function _onCreate() internal virtual +``` + +Hook that is called when this contract is created. + +_Useful to override constructor behaviour in child contracts (e.g., LINK bridge +tokens). The default implementation mints 10\*\*27 tokens to the contract +deployer._ + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the LinkToken contract with a fixed total supply, +name, and symbol. + +_Calls the ERC677 constructor with the name and symbol, and then mints the total +supply to the contract deployer._ diff --git a/src/content/chainlink-local/api-reference/v0.2.9/mock-fee-manager.mdx b/src/content/chainlink-local/api-reference/v0.2.9/mock-fee-manager.mdx new file mode 100644 index 00000000000..7613684f13f --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.9/mock-fee-manager.mdx @@ -0,0 +1,174 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockFeeManager v0.2.9 API Reference" +metadata: + description: "API documentation for MockFeeManager in Solidity, version v0.2.9." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockFeeManager + +Mock verifier fee manager. + +[MockFeeManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-streams/MockFeeManager.sol) + +## Structs + +### Asset + +```solidity +struct Asset { + address assetAddress; + uint256 amount; +} +``` + +## Variables + +### i_linkAddress + +```solidity +address i_linkAddress +``` + +### i_nativeAddress + +```solidity +address i_nativeAddress +``` + +### i_proxyAddress + +```solidity +address i_proxyAddress +``` + +### i_rewardManager + +```solidity +contract IRewardManager i_rewardManager +``` + +### s_mockDiscounts + +```solidity +mapping(address => uint256) s_mockDiscounts +``` + +### s_nativeSurcharge + +```solidity +uint256 s_nativeSurcharge +``` + +## Errors + +### ExpiredReport + +```solidity +error ExpiredReport() +``` + +### InvalidAddress + +```solidity +error InvalidAddress() +``` + +### InvalidDeposit + +```solidity +error InvalidDeposit() +``` + +### InvalidDiscount + +```solidity +error InvalidDiscount() +``` + +### InvalidQuote + +```solidity +error InvalidQuote() +``` + +### InvalidSurcharge + +```solidity +error InvalidSurcharge() +``` + +### Unauthorized + +```solidity +error Unauthorized() +``` + +## Functions + +### \_processFee + +```solidity +function _processFee(bytes payload, bytes parameterPayload, address subscriber) internal +``` + +### constructor + +```solidity +constructor(address linkAddress, address nativeAddress, address proxyAddress, address rewardManager) public +``` + +### getFeeAndReward + +```solidity +function getFeeAndReward(address subscriber, bytes report, address quoteAddress) public view returns (struct Common.Asset, struct Common.Asset, uint256) +``` + +### getMockDiscount + +```solidity +function getMockDiscount(address subscriber) external view returns (uint256) +``` + +### processFee + +```solidity +function processFee(bytes payload, bytes parameterPayload, address subscriber) external payable +``` + +### processFeeBulk + +```solidity +function processFeeBulk(bytes[] payloads, bytes parameterPayload, address subscriber) external payable +``` + +### setMockDiscount + +```solidity +function setMockDiscount(address subscriber, uint256 discount) external +``` + +### setNativeSurcharge + +```solidity +function setNativeSurcharge(uint64 surcharge) external +``` + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) external pure returns (bool) +``` + +\_Returns true if this contract implements the interface defined by +`interfaceId`. See the corresponding +https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP +section] to learn more about how these ids are created. + +This function call must use less than 30 000 gas.\_ diff --git a/src/content/chainlink-local/api-reference/v0.2.9/mock-offchain-aggregator.mdx b/src/content/chainlink-local/api-reference/v0.2.9/mock-offchain-aggregator.mdx new file mode 100644 index 00000000000..1b8897552f1 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.9/mock-offchain-aggregator.mdx @@ -0,0 +1,190 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockOffchainAggregator v0.2.9 API Reference" +metadata: + description: "API documentation for MockOffchainAggregator in Solidity, version v0.2.9." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockOffchainAggregator + +Mock implementation of off-chain aggregator. + +[MockOffchainAggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-feeds/MockOffchainAggregator.sol) + +## Variables + +### decimals + +```solidity +uint8 decimals +``` + +The number of decimals used by the aggregator. + +### getAnswer + +```solidity +mapping(uint256 => int256) getAnswer +``` + +Mapping to get the answer for a specific round ID. + +### getTimestamp + +```solidity +mapping(uint256 => uint256) getTimestamp +``` + +Mapping to get the timestamp for a specific round ID. + +### latestAnswer + +```solidity +int256 latestAnswer +``` + +The latest answer reported by the aggregator. + +### latestRound + +```solidity +uint256 latestRound +``` + +The latest round ID. + +### latestTimestamp + +```solidity +uint256 latestTimestamp +``` + +The timestamp of the latest answer. + +### maxAnswer + +```solidity +int192 maxAnswer +``` + +The maximum answer the aggregator is allowed to report. + +### minAnswer + +```solidity +int192 minAnswer +``` + +The minimum answer the aggregator is allowed to report. + +## Functions + +### constructor + +```solidity +constructor(uint8 _decimals, int256 _initialAnswer) public +``` + +Constructor to initialize the MockOffchainAggregator contract with initial +parameters. + +#### Parameters + +| Name | Type | Description | +| --------------- | ------ | ------------------------------------------------------ | +| \_decimals | uint8 | - The number of decimals for the aggregator. | +| \_initialAnswer | int256 | - The initial answer to be set in the mock aggregator. | + +### getRoundData + +```solidity +function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the round data for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| --------- | ------ | ----------------------------------- | +| \_roundId | uint80 | - The round ID to get the data for. | + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------ | +| roundId | uint80 | - The round ID. | +| answer | int256 | - The answer for the round. | +| startedAt | uint256 | - The timestamp when the round started. | +| updatedAt | uint256 | - The timestamp when the round was updated. | +| answeredInRound | uint80 | - The round ID in which the answer was computed. | + +### latestRoundData + +```solidity +function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the latest round data. + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------------- | +| roundId | uint80 | - The latest round ID. | +| answer | int256 | - The latest answer. | +| startedAt | uint256 | - The timestamp when the latest round started. | +| updatedAt | uint256 | - The timestamp when the latest round was updated. | +| answeredInRound | uint80 | - The round ID in which the latest answer was computed. | + +### updateAnswer + +```solidity +function updateAnswer(int256 _answer) public +``` + +Updates the answer in the mock aggregator. + +#### Parameters + +| Name | Type | Description | +| -------- | ------ | --------------------------- | +| \_answer | int256 | - The new answer to be set. | + +### updateMinAndMaxAnswers + +```solidity +function updateMinAndMaxAnswers(int192 _minAnswer, int192 _maxAnswer) external +``` + +Updates the minimum and maximum answers the aggregator can report. + +#### Parameters + +| Name | Type | Description | +| ----------- | ------ | ------------------------- | +| \_minAnswer | int192 | - The new minimum answer. | +| \_maxAnswer | int192 | - The new maximum answer. | + +### updateRoundData + +```solidity +function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public +``` + +Updates the round data in the mock aggregator. + +#### Parameters + +| Name | Type | Description | +| ----------- | ------- | --------------------------------------- | +| \_roundId | uint80 | - The round ID to be updated. | +| \_answer | int256 | - The new answer to be set. | +| \_timestamp | uint256 | - The timestamp to be set. | +| \_startedAt | uint256 | - The timestamp when the round started. | diff --git a/src/content/chainlink-local/api-reference/v0.2.9/mock-report-generator.mdx b/src/content/chainlink-local/api-reference/v0.2.9/mock-report-generator.mdx new file mode 100644 index 00000000000..5b50411c4e1 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.9/mock-report-generator.mdx @@ -0,0 +1,192 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockReportGenerator v0.2.9 API Reference" +metadata: + description: "API documentation for MockReportGenerator in Solidity, version v0.2.9." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockReportGenerator + +Signed report generator for every report schema. + +[MockReportGenerator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-streams/MockReportGenerator.sol) + +## Variables + +### i_donAddress + +```solidity +address i_donAddress +``` + +### i_donDigest + +```solidity +uint256 i_donDigest +``` + +### i_reportV2MockFeedId + +```solidity +bytes32 i_reportV2MockFeedId +``` + +### i_reportV3MockFeedId + +```solidity +bytes32 i_reportV3MockFeedId +``` + +### i_reportV4MockFeedId + +```solidity +bytes32 i_reportV4MockFeedId +``` + +### s_ask + +```solidity +int192 s_ask +``` + +### s_bid + +```solidity +int192 s_bid +``` + +### s_expiresPeriod + +```solidity +uint32 s_expiresPeriod +``` + +### s_linkFee + +```solidity +uint192 s_linkFee +``` + +### s_marketStatus + +```solidity +uint32 s_marketStatus +``` + +### s_nativeFee + +```solidity +uint192 s_nativeFee +``` + +### s_price + +```solidity +int192 s_price +``` + +## Errors + +### MockReportGenerator\_\_CastOverflow + +```solidity +error MockReportGenerator__CastOverflow() +``` + +### MockReportGenerator\_\_InvalidAsk + +```solidity +error MockReportGenerator__InvalidAsk() +``` + +### MockReportGenerator\_\_InvalidBid + +```solidity +error MockReportGenerator__InvalidBid() +``` + +## Functions + +### constructor + +```solidity +constructor(int192 initialPrice) public +``` + +### generateReport + +```solidity +function generateReport(struct ReportVersions.ReportV2 report) external returns (bytes signedReport) +``` + +### generateReport + +```solidity +function generateReport(struct ReportVersions.ReportV3 report) external returns (bytes signedReport) +``` + +### generateReport + +```solidity +function generateReport(struct ReportVersions.ReportV4 report) external returns (bytes signedReport) +``` + +### generateReportV2 + +```solidity +function generateReportV2() external returns (bytes signedReport, struct ReportVersions.ReportV2 report) +``` + +### generateReportV3 + +```solidity +function generateReportV3() external returns (bytes signedReport, struct ReportVersions.ReportV3 report) +``` + +### generateReportV4 + +```solidity +function generateReportV4() external returns (bytes signedReport, struct ReportVersions.ReportV4 report) +``` + +### getMockDonAddress + +```solidity +function getMockDonAddress() external view returns (address) +``` + +### updateExpiresPeriod + +```solidity +function updateExpiresPeriod(uint32 period) external +``` + +### updateFees + +```solidity +function updateFees(uint192 nativeFee, uint192 linkFee) external +``` + +### updateMarketStatus + +```solidity +function updateMarketStatus(uint32 status) external +``` + +### updatePrice + +```solidity +function updatePrice(int192 price) public +``` + +### updatePriceBidAndAsk + +```solidity +function updatePriceBidAndAsk(int192 price, int192 bid, int192 ask) external +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.9/mock-reward-manager.mdx b/src/content/chainlink-local/api-reference/v0.2.9/mock-reward-manager.mdx new file mode 100644 index 00000000000..193c6ffb6e2 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.9/mock-reward-manager.mdx @@ -0,0 +1,87 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockRewardManager v0.2.9 API Reference" +metadata: + description: "API documentation for MockRewardManager in Solidity, version v0.2.9." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockRewardManager + +Mock reward manager. + +[MockRewardManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-streams/MockRewardManager.sol) + +## Variables + +### i_linkAddress + +```solidity +address i_linkAddress +``` + +### s_feeManagerAddress + +```solidity +address s_feeManagerAddress +``` + +## Errors + +### Unauthorized + +```solidity +error Unauthorized() +``` + +## Events + +### FeePaid + +```solidity +event FeePaid(struct IRewardManager.FeePayment[] payments, address payer) +``` + +## Functions + +### claimRewards + +```solidity +function claimRewards(bytes32[]) external pure +``` + +### constructor + +```solidity +constructor(address linkAddress) public +``` + +### onFeePaid + +```solidity +function onFeePaid(struct IRewardManager.FeePayment[] payments, address payer) external +``` + +### setFeeManager + +```solidity +function setFeeManager(address newFeeManager) external +``` + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) external pure returns (bool) +``` + +\_Returns true if this contract implements the interface defined by +`interfaceId`. See the corresponding +https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP +section] to learn more about how these ids are created. + +This function call must use less than 30 000 gas.\_ diff --git a/src/content/chainlink-local/api-reference/v0.2.9/mock-v3-aggregator.mdx b/src/content/chainlink-local/api-reference/v0.2.9/mock-v3-aggregator.mdx new file mode 100644 index 00000000000..de5e19b61d3 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.9/mock-v3-aggregator.mdx @@ -0,0 +1,277 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockV3Aggregator v0.2.9 API Reference" +metadata: + description: "API documentation for MockV3Aggregator in Solidity, version v0.2.9." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockV3Aggregator + +Mock implementation of V3 aggregator. + +[MockV3Aggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-feeds/MockV3Aggregator.sol) + +## Variables + +### aggregator + +```solidity +address aggregator +``` + +The address of the current aggregator. + +### proposedAggregator + +```solidity +address proposedAggregator +``` + +The address of the proposed aggregator. + +### version + +```solidity +uint256 version +``` + +The version of the aggregator. + +## Functions + +### confirmAggregator + +```solidity +function confirmAggregator(address _aggregator) external +``` + +Confirms the proposed aggregator. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ----------------------------------------- | +| \_aggregator | address | - The address of the proposed aggregator. | + +### constructor + +```solidity +constructor(uint8 _decimals, int256 _initialAnswer) public +``` + +Constructor to initialize the MockV3Aggregator contract with initial parameters. + +#### Parameters + +| Name | Type | Description | +| --------------- | ------ | ------------------------------------------------------ | +| \_decimals | uint8 | - The number of decimals for the aggregator. | +| \_initialAnswer | int256 | - The initial answer to be set in the mock aggregator. | + +### decimals + +```solidity +function decimals() external view returns (uint8) +``` + +Gets the number of decimals used by the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ----- | ------------------------------- | +| [0] | uint8 | uint8 - The number of decimals. | + +### description + +```solidity +function description() external pure returns (string) +``` + +Gets the description of the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------ | -------------------------------------------------- | +| [0] | string | string memory - The description of the aggregator. | + +### getAnswer + +```solidity +function getAnswer(uint256 roundId) external view returns (int256) +``` + +Gets the answer for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------- | +| roundId | uint256 | - The round ID to get the answer for. | + +#### Returns + +| Name | Type | Description | +| ---- | ------ | ------------------------------------------- | +| [0] | int256 | int256 - The answer for the given round ID. | + +### getRoundData + +```solidity +function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the round data for a specific round ID. + +_This function should raise "No data present" if no data is available for the +given round ID._ + +#### Parameters + +| Name | Type | Description | +| --------- | ------ | ----------------------------------- | +| \_roundId | uint80 | - The round ID to get the data for. | + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------ | +| roundId | uint80 | - The round ID. | +| answer | int256 | - The answer for the round. | +| startedAt | uint256 | - The timestamp when the round started. | +| updatedAt | uint256 | - The timestamp when the round was updated. | +| answeredInRound | uint80 | - The round ID in which the answer was computed. | + +### getTimestamp + +```solidity +function getTimestamp(uint256 roundId) external view returns (uint256) +``` + +Gets the timestamp for a specific round ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ---------------------------------------- | +| roundId | uint256 | - The round ID to get the timestamp for. | + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ----------------------------------------------- | +| [0] | uint256 | uint256 - The timestamp for the given round ID. | + +### latestAnswer + +```solidity +function latestAnswer() external view returns (int256) +``` + +Gets the latest answer from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------ | --------------------------- | +| [0] | int256 | int256 - The latest answer. | + +### latestRound + +```solidity +function latestRound() external view returns (uint256) +``` + +Gets the latest round ID from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | ------------------------------ | +| [0] | uint256 | uint256 - The latest round ID. | + +### latestRoundData + +```solidity +function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) +``` + +Gets the latest round data. + +_This function should raise "No data present" if no data is available._ + +#### Returns + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------------- | +| roundId | uint80 | - The latest round ID. | +| answer | int256 | - The latest answer. | +| startedAt | uint256 | - The timestamp when the latest round started. | +| updatedAt | uint256 | - The timestamp when the latest round was updated. | +| answeredInRound | uint80 | - The round ID in which the latest answer was computed. | + +### latestTimestamp + +```solidity +function latestTimestamp() external view returns (uint256) +``` + +Gets the timestamp of the latest answer from the aggregator. + +#### Returns + +| Name | Type | Description | +| ---- | ------- | --------------------------------------------- | +| [0] | uint256 | uint256 - The timestamp of the latest answer. | + +### proposeAggregator + +```solidity +function proposeAggregator(contract AggregatorV2V3Interface _aggregator) external +``` + +Proposes a new aggregator. + +#### Parameters + +| Name | Type | Description | +| ------------ | -------------------------------- | ----------------------------------------- | +| \_aggregator | contract AggregatorV2V3Interface | - The address of the proposed aggregator. | + +### updateAnswer + +```solidity +function updateAnswer(int256 _answer) public +``` + +Updates the answer in the mock aggregator. + +#### Parameters + +| Name | Type | Description | +| -------- | ------ | --------------------------- | +| \_answer | int256 | - The new answer to be set. | + +### updateRoundData + +```solidity +function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public +``` + +Updates the round data in the mock aggregator. + +#### Parameters + +| Name | Type | Description | +| ----------- | ------- | --------------------------------------- | +| \_roundId | uint80 | - The round ID to be updated. | +| \_answer | int256 | - The new answer to be set. | +| \_timestamp | uint256 | - The timestamp to be set. | +| \_startedAt | uint256 | - The timestamp when the round started. | diff --git a/src/content/chainlink-local/api-reference/v0.2.9/mock-verifier-proxy.mdx b/src/content/chainlink-local/api-reference/v0.2.9/mock-verifier-proxy.mdx new file mode 100644 index 00000000000..8d4a3ddd404 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.9/mock-verifier-proxy.mdx @@ -0,0 +1,98 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockVerifierProxy v0.2.9 API Reference" +metadata: + description: "API documentation for MockVerifierProxy in Solidity, version v0.2.9." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockVerifierProxy + +Mock Data Streams verifier proxy. + +[MockVerifierProxy](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-streams/MockVerifierProxy.sol) + +## Variables + +### s_feeManager + +```solidity +contract IVerifierFeeManager s_feeManager +``` + +### s_verifier + +```solidity +address s_verifier +``` + +## Errors + +### VerifierInvalid + +```solidity +error VerifierInvalid() +``` + +### VerifierNotFound + +```solidity +error VerifierNotFound() +``` + +### ZeroAddress + +```solidity +error ZeroAddress() +``` + +## Events + +### VerifierInitialized + +```solidity +event VerifierInitialized(address verifierAddress) +``` + +## Functions + +### \_verify + +```solidity +function _verify(bytes payload) internal returns (bytes) +``` + +### getVerifier + +```solidity +function getVerifier(bytes32) external view returns (address) +``` + +### initializeVerifier + +```solidity +function initializeVerifier(address verifierAddress) external +``` + +### setFeeManager + +```solidity +function setFeeManager(contract IVerifierFeeManager feeManager) external +``` + +### verify + +```solidity +function verify(bytes payload, bytes parameterPayload) external payable returns (bytes) +``` + +### verifyBulk + +```solidity +function verifyBulk(bytes[] payloads, bytes parameterPayload) external payable returns (bytes[] verifiedReports) +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.9/mock-verifier.mdx b/src/content/chainlink-local/api-reference/v0.2.9/mock-verifier.mdx new file mode 100644 index 00000000000..dc6584553cd --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.9/mock-verifier.mdx @@ -0,0 +1,165 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockVerifier v0.2.9 API Reference" +metadata: + description: "API documentation for MockVerifier in Solidity, version v0.2.9." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockVerifier + +Mock Data Streams verifier. + +[MockVerifier](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-streams/MockVerifier.sol) + +## Variables + +### i_verifierProxy + +```solidity +address i_verifierProxy +``` + +### MOCK_DATA_STREAM_DON_ADDRESS + +```solidity +address MOCK_DATA_STREAM_DON_ADDRESS +``` + +### N_2 + +```solidity +uint256 N_2 +``` + +### s_inactiveDigests + +```solidity +mapping(bytes32 => mapping(bytes32 => bool)) s_inactiveDigests +``` + +### s_inactiveFeeds + +```solidity +mapping(bytes32 => bool) s_inactiveFeeds +``` + +### s_verifiedSignatures + +```solidity +mapping(bytes => bool) s_verifiedSignatures +``` + +## Errors + +### AccessForbidden + +```solidity +error AccessForbidden() +``` + +### AlreadyUsedSignature + +```solidity +error AlreadyUsedSignature() +``` + +### BadVerification + +```solidity +error BadVerification() +``` + +### DigestInactive + +```solidity +error DigestInactive(bytes32 feedId, bytes32 configDigest) +``` + +### InactiveFeed + +```solidity +error InactiveFeed(bytes32 feedId) +``` + +### InvalidS + +```solidity +error InvalidS() +``` + +### InvalidSignatureLength + +```solidity +error InvalidSignatureLength() +``` + +### InvalidV + +```solidity +error InvalidV() +``` + +## Events + +### ReportVerified + +```solidity +event ReportVerified(bytes32 feedId, address sender) +``` + +## Functions + +### activateConfig + +```solidity +function activateConfig(bytes32 feedId, bytes32 configDigest) external +``` + +### activateFeed + +```solidity +function activateFeed(bytes32 feedId) external +``` + +### constructor + +```solidity +constructor(address verifierProxy) public +``` + +### deactivateConfig + +```solidity +function deactivateConfig(bytes32 feedId, bytes32 configDigest) external +``` + +### deactivateFeed + +```solidity +function deactivateFeed(bytes32 feedId) external +``` + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) external pure returns (bool) +``` + +\_Returns true if this contract implements the interface defined by +`interfaceId`. See the corresponding +https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP +section] to learn more about how these ids are created. + +This function call must use less than 30 000 gas.\_ + +### verify + +```solidity +function verify(bytes signedReport, address sender) external returns (bytes verifierResponse) +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.9/register.mdx b/src/content/chainlink-local/api-reference/v0.2.9/register.mdx new file mode 100644 index 00000000000..7abc29cd2d5 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.9/register.mdx @@ -0,0 +1,91 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Register v0.2.9 API Reference" +metadata: + description: "API documentation for Register in Solidity, version v0.2.9." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## Register + +CCIP network configuration registry. + +[Register](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/ccip/Register.sol) + +## Structs + +### NetworkDetails + +```solidity +struct NetworkDetails { + uint64 chainSelector; + address routerAddress; + address linkAddress; + address wrappedNativeAddress; + address ccipBnMAddress; + address ccipLnMAddress; + address rmnProxyAddress; + address registryModuleOwnerCustomAddress; + address tokenAdminRegistryAddress; +} +``` + +## Variables + +### s_networkDetails + +```solidity +mapping(uint256 => struct Register.NetworkDetails) s_networkDetails +``` + +Mapping to store network details based on chain ID. + +## Functions + +### constructor + +```solidity +constructor() public +``` + +Constructor to initialize the network details for various chains. + +### getNetworkDetails + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (struct Register.NetworkDetails networkDetails) +``` + +Retrieves network details for a given chain ID. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | --------------------------------------------- | +| chainId | uint256 | - The ID of the chain to get the details for. | + +#### Returns + +| Name | Type | Description | +| -------------- | ------------------------------ | ------------------------------------------------- | +| networkDetails | struct Register.NetworkDetails | - The network details for the specified chain ID. | + +### setNetworkDetails + +```solidity +function setNetworkDetails(uint256 chainId, struct Register.NetworkDetails networkDetails) external +``` + +Sets the network details for a given chain ID. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------------------------------ | -------------------------------------------------------- | +| chainId | uint256 | - The ID of the chain to set the details for. | +| networkDetails | struct Register.NetworkDetails | - The network details to set for the specified chain ID. | diff --git a/src/content/chainlink-local/api-reference/v0.2.9/report-versions.mdx b/src/content/chainlink-local/api-reference/v0.2.9/report-versions.mdx new file mode 100644 index 00000000000..db90779a053 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.9/report-versions.mdx @@ -0,0 +1,84 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "ReportVersions v0.2.9 API Reference" +metadata: + description: "API documentation for ReportVersions in Solidity, version v0.2.9." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## ReportVersions + +Data Streams report schemas. + +[ReportVersions](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/data-streams/ReportVersions.sol) + +## Structs + +### ReportV2 + +_Represents a data report from a Data Streams stream for v2 schema (crypto +streams). The `price` value is carried to either 8 or 18 decimal places, +depending on the stream. For more information, see +https://docs.chain.link/data-streams/crypto-streams and +https://docs.chain.link/data-streams/reference/report-schema_ + +```solidity +struct ReportV2 { + bytes32 feedId; + uint32 validFromTimestamp; + uint32 observationsTimestamp; + uint192 nativeFee; + uint192 linkFee; + uint32 expiresAt; + int192 benchmarkPrice; +} +``` + +### ReportV3 + +_Represents a data report from a Data Streams stream for v3 schema (crypto +streams). The `price`, `bid`, and `ask` values are carried to either 8 or 18 +decimal places, depending on the stream. For more information, see +https://docs.chain.link/data-streams/crypto-streams and +https://docs.chain.link/data-streams/reference/report-schema_ + +```solidity +struct ReportV3 { + bytes32 feedId; + uint32 validFromTimestamp; + uint32 observationsTimestamp; + uint192 nativeFee; + uint192 linkFee; + uint32 expiresAt; + int192 price; + int192 bid; + int192 ask; +} +``` + +### ReportV4 + +_Represents a data report from a Data Streams stream for v4 schema (RWA stream). +The `price` value is carried to either 8 or 18 decimal places, depending on the +stream. The `marketStatus` indicates whether the market is currently open. +Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). For more +information, see https://docs.chain.link/data-streams/rwa-streams and +https://docs.chain.link/data-streams/reference/report-schema-v4_ + +```solidity +struct ReportV4 { + bytes32 feedId; + uint32 validFromTimestamp; + uint32 observationsTimestamp; + uint192 nativeFee; + uint192 linkFee; + uint32 expiresAt; + int192 price; + uint32 marketStatus; +} +``` diff --git a/src/content/chainlink-local/api-reference/v0.2.9/weth9.mdx b/src/content/chainlink-local/api-reference/v0.2.9/weth9.mdx new file mode 100644 index 00000000000..ebce8e69810 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.2.9/weth9.mdx @@ -0,0 +1,126 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "WETH9 v0.2.9 API Reference" +metadata: + description: "API documentation for WETH9 in Solidity, version v0.2.9." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## WETH9 + +Wrapped Ether implementation. + +[WETH9](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.9/src/shared/WETH9.sol) + +## Variables + +### allowance + +```solidity +mapping(address => mapping(address => uint256)) allowance +``` + +### balanceOf + +```solidity +mapping(address => uint256) balanceOf +``` + +### decimals + +```solidity +uint8 decimals +``` + +### name + +```solidity +string name +``` + +### symbol + +```solidity +string symbol +``` + +## Events + +### Approval + +```solidity +event Approval(address src, address guy, uint256 wad) +``` + +### Deposit + +```solidity +event Deposit(address dst, uint256 wad) +``` + +### Transfer + +```solidity +event Transfer(address src, address dst, uint256 wad) +``` + +### Withdrawal + +```solidity +event Withdrawal(address src, uint256 wad) +``` + +## Functions + +### \_deposit + +```solidity +function _deposit() internal +``` + +### approve + +```solidity +function approve(address guy, uint256 wad) public returns (bool) +``` + +### deposit + +```solidity +function deposit() external payable +``` + +### receive + +```solidity +receive() external payable +``` + +### totalSupply + +```solidity +function totalSupply() public view returns (uint256) +``` + +### transfer + +```solidity +function transfer(address dst, uint256 wad) public returns (bool) +``` + +### transferFrom + +```solidity +function transferFrom(address src, address dst, uint256 wad) public returns (bool) +``` + +### withdraw + +```solidity +function withdraw(uint256 wad) external +``` diff --git a/src/content/chainlink-local/api-reference/v0.3.0/aggregator-interface.mdx b/src/content/chainlink-local/api-reference/v0.3.0/aggregator-interface.mdx new file mode 100644 index 00000000000..3dfd075eac3 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.0/aggregator-interface.mdx @@ -0,0 +1,136 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "AggregatorInterface v0.3.0 API Reference" +metadata: + description: "API documentation for AggregatorInterface in Solidity, version v0.3.0." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## AggregatorInterface + +Basic price feed interface. + +[AggregatorInterface](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-feeds/interfaces/AggregatorInterface.sol) + +## Events + +### AnswerUpdated + +Emitted when the answer is updated. + +```solidity +event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt); +``` + +**Parameters** + +| Name | Type | Description | +| ----------- | --------- | ------------------------------------------------ | +| `current` | `int256` | - The updated answer. | +| `roundId` | `uint256` | - The round ID for which the answer was updated. | +| `updatedAt` | `uint256` | - The timestamp when the answer was updated. | + +### NewRound + +Emitted when a new round is started. + +```solidity +event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt); +``` + +**Parameters** + +| Name | Type | Description | +| ----------- | --------- | ---------------------------------------------------- | +| `roundId` | `uint256` | - The round ID of the new round. | +| `startedBy` | `address` | - The address of the account that started the round. | +| `startedAt` | `uint256` | - The timestamp when the round was started. | + +## Functions + +### getAnswer + +Gets the answer for a specific round ID. + +```solidity +function getAnswer(uint256 roundId) external view returns (int256); +``` + +**Parameters** + +| Name | Type | Description | +| --------- | --------- | ------------------------------------- | +| `roundId` | `uint256` | - The round ID to get the answer for. | + +**Returns** + +| Name | Type | Description | +| -------- | -------- | ------------------------------------------- | +| `` | `int256` | int256 - The answer for the given round ID. | + +### getTimestamp + +Gets the timestamp for a specific round ID. + +```solidity +function getTimestamp(uint256 roundId) external view returns (uint256); +``` + +**Parameters** + +| Name | Type | Description | +| --------- | --------- | ---------------------------------------- | +| `roundId` | `uint256` | - The round ID to get the timestamp for. | + +**Returns** + +| Name | Type | Description | +| -------- | --------- | ----------------------------------------------- | +| `` | `uint256` | uint256 - The timestamp for the given round ID. | + +### latestAnswer + +Gets the latest answer from the aggregator. + +```solidity +function latestAnswer() external view returns (int256); +``` + +**Returns** + +| Name | Type | Description | +| -------- | -------- | --------------------------- | +| `` | `int256` | int256 - The latest answer. | + +### latestRound + +Gets the latest round ID from the aggregator. + +```solidity +function latestRound() external view returns (uint256); +``` + +**Returns** + +| Name | Type | Description | +| -------- | --------- | ------------------------------ | +| `` | `uint256` | uint256 - The latest round ID. | + +### latestTimestamp + +Gets the timestamp of the latest answer from the aggregator. + +```solidity +function latestTimestamp() external view returns (uint256); +``` + +**Returns** + +| Name | Type | Description | +| -------- | --------- | --------------------------------------------- | +| `` | `uint256` | uint256 - The timestamp of the latest answer. | diff --git a/src/content/chainlink-local/api-reference/v0.3.0/aggregator-v2-v3-interface.mdx b/src/content/chainlink-local/api-reference/v0.3.0/aggregator-v2-v3-interface.mdx new file mode 100644 index 00000000000..59a965fae48 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.0/aggregator-v2-v3-interface.mdx @@ -0,0 +1,18 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "AggregatorV2V3Interface v0.3.0 API Reference" +metadata: + description: "API documentation for AggregatorV2V3Interface in Solidity, version v0.3.0." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## AggregatorV2V3Interface + +Combined V2/V3 price feed interface. + +[AggregatorV2V3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-feeds/interfaces/AggregatorV2V3Interface.sol) diff --git a/src/content/chainlink-local/api-reference/v0.3.0/aggregator-v3-interface.mdx b/src/content/chainlink-local/api-reference/v0.3.0/aggregator-v3-interface.mdx new file mode 100644 index 00000000000..030e54c8d26 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.0/aggregator-v3-interface.mdx @@ -0,0 +1,115 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "AggregatorV3Interface v0.3.0 API Reference" +metadata: + description: "API documentation for AggregatorV3Interface in Solidity, version v0.3.0." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## AggregatorV3Interface + +Extended price feed interface. + +[AggregatorV3Interface](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-feeds/interfaces/AggregatorV3Interface.sol) + +## Functions + +### decimals + +Gets the number of decimals used by the aggregator. + +```solidity +function decimals() external view returns (uint8); +``` + +**Returns** + +| Name | Type | Description | +| -------- | ------- | ------------------------------- | +| `` | `uint8` | uint8 - The number of decimals. | + +### description + +Gets the description of the aggregator. + +```solidity +function description() external view returns (string memory); +``` + +**Returns** + +| Name | Type | Description | +| -------- | -------- | -------------------------------------------------- | +| `` | `string` | string memory - The description of the aggregator. | + +### getRoundData + +Gets the round data for a specific round ID. + +This function should raise "No data present" if no data is available for the +given round ID. + +```solidity +function getRoundData(uint80 _roundId) + external + view + returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); +``` + +**Parameters** + +| Name | Type | Description | +| ---------- | -------- | ----------------------------------- | +| `_roundId` | `uint80` | - The round ID to get the data for. | + +**Returns** + +| Name | Type | Description | +| ----------------- | --------- | ------------------------------------------------ | +| `roundId` | `uint80` | - The round ID. | +| `answer` | `int256` | - The answer for the round. | +| `startedAt` | `uint256` | - The timestamp when the round started. | +| `updatedAt` | `uint256` | - The timestamp when the round was updated. | +| `answeredInRound` | `uint80` | - The round ID in which the answer was computed. | + +### latestRoundData + +Gets the latest round data. + +This function should raise "No data present" if no data is available. + +```solidity +function latestRoundData() + external + view + returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); +``` + +**Returns** + +| Name | Type | Description | +| ----------------- | --------- | ------------------------------------------------------- | +| `roundId` | `uint80` | - The latest round ID. | +| `answer` | `int256` | - The latest answer. | +| `startedAt` | `uint256` | - The timestamp when the latest round started. | +| `updatedAt` | `uint256` | - The timestamp when the latest round was updated. | +| `answeredInRound` | `uint80` | - The round ID in which the latest answer was computed. | + +### version + +Gets the version of the aggregator. + +```solidity +function version() external view returns (uint256); +``` + +**Returns** + +| Name | Type | Description | +| -------- | --------- | ---------------------------------------- | +| `` | `uint256` | uint256 - The version of the aggregator. | diff --git a/src/content/chainlink-local/api-reference/v0.3.0/burn-mint-erc677-helper.mdx b/src/content/chainlink-local/api-reference/v0.3.0/burn-mint-erc677-helper.mdx new file mode 100644 index 00000000000..05efb3d65a1 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.0/burn-mint-erc677-helper.mdx @@ -0,0 +1,55 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "BurnMintERC677Helper v0.3.0 API Reference" +metadata: + description: "API documentation for BurnMintERC677Helper in Solidity, version v0.3.0." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## BurnMintERC677Helper + +Helper contract for ERC677 token operations. + +[BurnMintERC677Helper](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/ccip/BurnMintERC677Helper.sol) + +## Functions + +### constructor + +Constructor to initialize the BurnMintERC677Helper contract with a name and +symbol. + +Calls the parent constructor of BurnMintERC677 with fixed decimals (18) and +initial supply (0). + +```solidity +constructor(string memory name, string memory symbol) BurnMintERC677(name, symbol, 18, 0); +``` + +**Parameters** + +| Name | Type | Description | +| -------- | -------- | -------------------------- | +| `name` | `string` | - The name of the token. | +| `symbol` | `string` | - The symbol of the token. | + +### drip + +Mints one full token (1e18) to the specified address. + +Calls the internal `_mint` function from the BurnMintERC677 contract. + +```solidity +function drip(address to) external; +``` + +**Parameters** + +| Name | Type | Description | +| ---- | --------- | ------------------------------------------ | +| `to` | `address` | - The address to receive the minted token. | diff --git a/src/content/chainlink-local/api-reference/v0.3.0/ccip-local-router.mdx b/src/content/chainlink-local/api-reference/v0.3.0/ccip-local-router.mdx new file mode 100644 index 00000000000..e24aece5520 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.0/ccip-local-router.mdx @@ -0,0 +1,307 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalRouter v0.3.0 API Reference" +metadata: + description: "API documentation for CCIPLocalRouter in Solidity, version v0.3.0." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalRouter + +The local-mode router with CCIP 2.0 message rules. + +[CCIPLocalRouter](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/ccip/CCIPLocalRouter.sol) + +## Variables + +### DEFAULT_GAS_LIMIT + +```solidity +uint32 public constant DEFAULT_GAS_LIMIT = 200_000 +``` + +### GAS_FOR_CALL_EXACT_CHECK + +```solidity +uint16 public constant GAS_FOR_CALL_EXACT_CHECK = 5_000 +``` + +### s_mockFeeTokenAmount + +```solidity +uint256 internal s_mockFeeTokenAmount +``` + +### s_nonce + +Nonce used to guarantee a unique messageId per send, see `ccipSend`. + +```solidity +uint256 internal s_nonce +``` + +### SOURCE_CHAIN_SELECTOR + +Source chain selector stamped on local messages (Ethereum Sepolia), as in +`MockCCIPRouter`. + +```solidity +uint64 internal constant SOURCE_CHAIN_SELECTOR = 16015286601757825753 +``` + +## Errors + +### CannotSendZeroTokens + +Mirrors `OnRamp.CannotSendZeroTokens`. + +```solidity +error CannotSendZeroTokens(); +``` + +### CanOnlySendOneTokenPerMessage + +Mirrors `OnRamp.CanOnlySendOneTokenPerMessage`. + +```solidity +error CanOnlySendOneTokenPerMessage(); +``` + +### InvalidAddress + +```solidity +error InvalidAddress(bytes encodedAddress); +``` + +### InvalidExtraArgsTag + +```solidity +error InvalidExtraArgsTag(); +``` + +### InvalidOptionalThreshold + +Mirrors `OffRamp.InvalidOptionalThreshold`. + +```solidity +error InvalidOptionalThreshold(uint8 wanted, uint256 got); +``` + +### MessageGasLimitTooHigh + +Mirrors `FeeQuoter.MessageGasLimitTooHigh`. + +```solidity +error MessageGasLimitTooHigh(); +``` + +### ReceiverError + +```solidity +error ReceiverError(bytes err); +``` + +### TokenReceiverNotAllowed + +Mirrors `OnRamp.TokenReceiverNotAllowed`: `GenericExtraArgsV3.tokenReceiver` is +rejected on all EVM lanes (`DestChainConfig.tokenReceiverAllowed` is always +false for EVM per its NatSpec). + +```solidity +error TokenReceiverNotAllowed(uint64 destChainSelector); +``` + +## Events + +### MessageExecuted + +```solidity +event MessageExecuted(bytes32 messageId, uint64 sourceChainSelector, address offRamp, bytes32 calldataHash); +``` + +### MsgExecuted + +```solidity +event MsgExecuted(bool success, bytes retData, uint256 gasUsed); +``` + +## Functions + +### \_ensureReceiverAllowsFinality + +Mirrors OffRamp 2.0 `_getCCVsFromReceiver`, which is called for every message +that is not a token-only transfer regardless of requested finality (including +fully finalized messages, not only Faster-Than- Finality ones). Token-only +transfers skip it entirely, as the pool enforces finality for them in production +(pools are not simulated in local mode). + +Local mode has no CCV verifiers to query for quorum, so this only reproduces the +validation and finality parts of `_getCCVsFromReceiver`: duplicate +required/optional CCVs and `optionalThreshold > optionalCCVs.length` are +rejected the same way, and the receiver's allowed finality is enforced. + +If `getCCVsAndFinalityConfig` reverts, that revert is bubbled as-is (not wrapped +in `ReceiverError`). In production the OffRamp does not distinguish this from +any other revert during message execution: it simply records +`ExecutionStateChanged(..., FAILURE, returnData)` with the getter's raw revert +data. `ReceiverError` is reserved for the narrower case of the receiver's own +`ccipReceive` call failing (see `_routeMessage`/`OffRamp._callReceiver`), so +bubbling here (rather than wrapping) keeps that error meaning precise while +still failing the local send, consistent with this contract's "fails in +production" -> "ccipSend reverts locally" mapping. + +```solidity +function _ensureReceiverAllowsFinality( + address receiver, + Client.Any2EVMMessage memory message, + uint256 gasLimit, + bytes4 requestedFinality +) internal view; +``` + +### \_isTokenOnlyTransfer + +Same token-only rule as OffRamp 2.0 `_isTokenOnlyTransfer`, which also decides +whether the receiver is called. + +```solidity +function _isTokenOnlyTransfer(uint256 dataLength, uint256 gasLimit, address receiver) internal view returns (bool); +``` + +### \_legacyGasLimit + +FeeQuoter compares the full uint256 V1/V2 gas limit against the lane's uint32 +`maxPerMsgGasLimit` and reverts `MessageGasLimitTooHigh`, so a value above +uint32 is rejected everywhere; the upstream mock truncated it. Local mode has no +lane config, so lower lane caps are not enforced. + +```solidity +function _legacyGasLimit(uint256 gasLimit) internal pure returns (uint256); +``` + +### \_parseExtraArgs + +```solidity +function _parseExtraArgs(uint64 destinationChainSelector, bytes calldata extraArgs) + internal + pure + returns (uint256 gasLimit, bytes4 requestedFinality); +``` + +**Parameters** + +| Name | Type | Description | +| -------------------------- | -------- | ------------------------------------------------------------------------------ | +| `destinationChainSelector` | `uint64` | Destination chain selector, used only for the `TokenReceiverNotAllowed` error. | +| `extraArgs` | `bytes` | | + +**Returns** + +| Name | Type | Description | +| ------------------- | --------- | ---------------------------------------------------------------------------------- | +| `gasLimit` | `uint256` | Callback gas limit. | +| `requestedFinality` | `bytes4` | `GenericExtraArgsV3.requestedFinalityConfig`, or WAIT_FOR_FINALITY for older tags. | + +### \_routeMessage + +```solidity +function _routeMessage( + Client.Any2EVMMessage memory message, + uint16 gasForCallExactCheck, + uint256 gasLimit, + address receiver +) internal returns (bool success, bytes memory retData, uint256 gasUsed); +``` + +### ccipSend + +Sends the tx locally to the receiver instead of on the destination chain. + +Ignores destinationChainSelector + +Returns a mock message ID, which is not calculated from the message contents in +the same way as the real message ID. + +```solidity +function ccipSend(uint64 destinationChainSelector, Client.EVM2AnyMessage calldata message) + external + payable + returns (bytes32); +``` + +### getFee + +Returns 0 as the fee is not supported in this mock contract. + +```solidity +function getFee(uint64, Client.EVM2AnyMessage memory) public view returns (uint256); +``` + +### getOnRamp + +Always returns address(1234567890) + +```solidity +function getOnRamp( + uint64 /* destChainSelector */ +) + external + pure + returns (address onRampAddress); +``` + +### getSupportedTokens + +Returns an empty array. + +```solidity +function getSupportedTokens(uint64) external pure returns (address[] memory tokens); +``` + +### isChainSupported + +Always returns true to make sure this check can be performed on any chain. + +```solidity +function isChainSupported(uint64) external pure returns (bool supported); +``` + +### isOffRamp + +Always returns true + +```solidity +function isOffRamp( + uint64, + /* sourceChainSelector */ + address /* offRamp */ +) + external + pure + returns (bool); +``` + +### routeMessage + +```solidity +function routeMessage( + Client.Any2EVMMessage calldata message, + uint16 gasForCallExactCheck, + uint256 gasLimit, + address receiver +) external returns (bool success, bytes memory retData, uint256 gasUsed); +``` + +### setFee + +Sets the fees returned by getFee but is only checked when using native fee +tokens + +```solidity +function setFee(uint256 feeAmount) external; +``` diff --git a/src/content/chainlink-local/api-reference/v0.3.0/ccip-local-simulator-fork-js.mdx b/src/content/chainlink-local/api-reference/v0.3.0/ccip-local-simulator-fork-js.mdx new file mode 100644 index 00000000000..eb2199067bf --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.0/ccip-local-simulator-fork-js.mdx @@ -0,0 +1,118 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalSimulatorFork JS v0.3.0 API Reference" +metadata: + description: "API documentation for the CCIPLocalSimulatorFork JS JavaScript helpers, version v0.3.0." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalSimulatorFork JS + +Hardhat 3 JavaScript helpers for fork routing. + +[CCIPLocalSimulatorFork JS](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/scripts/CCIPLocalSimulatorFork.js) + +## Types + +### CCIPSentMessage : `Object` + +**Properties** + +| Name | Type | Description | +| ------------------- | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ---------------- | --------------------------------------------------------- | +| era | `"PRE_V1_6"` | `"V1_6"` | `"V2"` | CCIP protocol version of the lane the message was sent on | +| onRamp | `string` | Source OnRamp that emitted the message | +| messageId | `string` | | +| sourceChainSelector | `bigint` | | +| destChainSelector | `bigint` | | +| message | `object` | Era-specific payload: the pre-1.6 `EVM2EVMMessage`, the 1.6 `EVM2AnyRampMessage`, or for CCIP 2.0 `{ encodedMessage, receipts }` | + +## Functions + +### LINK_FAUCET_ADDRESS + +Hardhat 3 helpers for routing CCIP messages between forked networks (the +JavaScript counterpart of the Solidity `CCIPLocalSimulatorFork`). Supports +pre-1.6 (`EVM2EVMOnRamp`), 1.6 and CCIP 2.0 (CCV-based) lanes. + +Every function takes the `NetworkConnection` returned by `network.connect()` and +requires the `@nomicfoundation/hardhat-ethers` plugin (it uses +`connection.ethers`). Messages are sent on the source connection, then routed on +the destination connection: + +const source = await network.connect(\{ network: "sepoliaFork" \}); const +destination = await network.connect(\{ network: "arbitrumSepoliaFork" \}); const +receipt = await (await router.ccipSend(destChainSelector, message, \{ value: fee +\})).wait(); const [sent] = getCCIPMessages(source, receipt); await +routeMessage(destination, destinationRouterAddress, sent); + +**Kind**: global constant + +### CCIP_V2_ROUTERS + +Dedicated CCIP 2.0 routers deployed next to the default router, keyed by chain +id (verified on-chain, Sep 2026). + +**Kind**: global constant + +### requestLinkFromTheFaucet(connection, linkAddress, to, amount) ⇒ `Promise.` + +Requests LINK tokens from the testnet faucet by impersonating it, and returns +the transaction hash. + +**Returns**: `Promise.` - The transaction hash of the +transfer + +| Param | Type | Description | +| ----------- | -------- | --------------------------------------------------------- | +| connection | `object` | Network connection from `network.connect()` | +| linkAddress | `string` | The address of the LINK contract on the connected network | +| to | `string` | The address to send LINK to | +| amount | `bigint` | The amount of LINK to request | + +### getCCIPMessages(connection, receipt) ⇒ `Array.` + +Extracts every CCIP message sent in a transaction, for all supported protocol +versions. + +**Returns**: `Array.` - +The sent messages, in log order (empty if none) + +| Param | Type | Description | +| ---------- | -------- | ------------------------------------------ | +| connection | `object` | Network connection of the source chain | +| receipt | `object` | Transaction receipt of the `ccipSend` call | + +### routeMessage(connection, routerAddresses, sent, [options]) ⇒ `Promise.` + +Routes a sent message on the destination (connected) network, as the destination +OffRamp would execute it. + +- pre-1.6 and 1.6: impersonates the lane's OffRamp and calls + `executeSingleMessage`. +- CCIP 2.0: the OffRamp selects the CCVs (`getCCVsForMessage`), CCVs that are + owner-configurable verifier resolvers are pointed at a synthetic no-op + verifier, and the raw encoded message is executed through the permissionless + `execute`. A message is only delivered if the OffRamp reports SUCCESS. + +**Returns**: `Promise.` - +`{ offRamp, executed, reason }`: `executed` is false only for a CCIP 2.0 +NO_EXECUTION message routed without `forceExecution` (`reason` is then +`"NO_EXECUTION_ADDRESS"`) +**Throws**: + +- `Error` If no OffRamp serves the lane, or if execution fails + (receiver revert, finality or CCV rejection) + +| Param | Type | Default | Description | +| ------------------------ | ----------------- | ---------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | +| connection | `object` | | Network connection of the destination chain | +| routerAddresses | `string` | `Array.` | | Destination router address(es) whose OffRamps are searched, e.g. the default router and `CCIP_V2_ROUTERS[chainId]` | +| sent | `CCIPSentMessage` | | A message returned by `getCCIPMessages` | +| [options] | `Object` | | | +| [options.forceExecution] | `boolean` | `false` | Execute CCIP 2.0 messages whose executor is `NO_EXECUTION_ADDRESS` (manual execution) | diff --git a/src/content/chainlink-local/api-reference/v0.3.0/ccip-local-simulator-fork.mdx b/src/content/chainlink-local/api-reference/v0.3.0/ccip-local-simulator-fork.mdx new file mode 100644 index 00000000000..06b2221072b --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.0/ccip-local-simulator-fork.mdx @@ -0,0 +1,1012 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalSimulatorFork v0.3.0 API Reference" +metadata: + description: "API documentation for CCIPLocalSimulatorFork in Solidity, version v0.3.0." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalSimulatorFork + +CCIP simulator for forked networks. + +[CCIPLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/ccip/CCIPLocalSimulatorFork.sol) + +## Enums + +### CCIPEra + +```solidity +enum CCIPEra { + UNKNOWN, + PRE_V1_DOT_6, + V1_DOT_6, + V2 +} +``` + +### MessageStatus + +Outcome of a captured CCIP message (see `getMessageStatus`). + +NOT_FOUND: never captured by this simulator. QUEUED: a CCIP 2.0 +`NO_EXECUTION_ADDRESS` message waiting for `executePendingV2Message`, or a 1.6 / +2.0 message whose destination fork was not passed to +`switchChainAndRouteMessage` yet (a later call that includes it routes the +message; the reason says so). FAILED: not routed, or execution did not succeed +(the reason is recorded). + +```solidity +enum MessageStatus { + NOT_FOUND, + QUEUED, + FAILED, + SUCCESS +} +``` + +### V2ExecutionMode + +```solidity +enum V2ExecutionMode { + AUTO, + RESPECT_NO_EXEC, + MANUAL_ONLY +} +``` + +### V2VerificationMode + +```solidity +enum V2VerificationMode { + STRICT, + HYBRID, + SYNTHETIC_ONLY, + /// @notice Derives the CCV selection from the destination OffRamp's + /// `getCCVsForMessage(encodedMessage)` and executes the raw encoded message through + /// the permissionless `execute` entrypoint, so routing does not depend on the local + /// `MessageV1` codec. Fork-only. + OFFRAMP_DERIVED +} +``` + +## Structs + +### AwaitingDestinationMessage + +A captured 1.6 / 2.0 message whose destination fork was not in `forkIds`, kept +for a later routing call. + +```solidity +struct AwaitingDestinationMessage { + uint256 sourceForkId; + uint64 sourceChainSelector; + address emitter; + bytes32[] topics; + bytes data; +} +``` + +### MessageOutcome + +```solidity +struct MessageOutcome { + MessageStatus status; + bytes reason; +} +``` + +### PendingV2Message + +```solidity +struct PendingV2Message { + bool exists; + uint64 sourceChainSelector; + address emitter; + bytes32[] topics; + bytes data; +} +``` + +## Variables + +### i_messageV1Decoder + +Helper to decode MessageV1 from memory bytes. + +```solidity +MessageV1CodecDecoder immutable i_messageV1Decoder +``` + +### i_register + +The immutable register instance + +```solidity +Register immutable i_register +``` + +### INBOUND_IMPLEMENTATION_NOT_FOUND_SELECTOR + +```solidity +bytes4 private constant INBOUND_IMPLEMENTATION_NOT_FOUND_SELECTOR = + bytes4(keccak256("InboundImplementationNotFound(address,bytes)")) +``` + +### INVALID_VERIFIER_RESULTS_LENGTH_SELECTOR + +```solidity +bytes4 private constant INVALID_VERIFIER_RESULTS_LENGTH_SELECTOR = + bytes4(keccak256("InvalidVerifierResultsLength()")) +``` + +### INVALID_VERIFIER_RESULTS_SELECTOR + +```solidity +bytes4 private constant INVALID_VERIFIER_RESULTS_SELECTOR = bytes4(keccak256("InvalidVerifierResults()")) +``` + +### LINK_FAUCET + +The address of the LINK faucet + +```solidity +address constant LINK_FAUCET = 0x4281eCF07378Ee595C564a59048801330f3084eE +``` + +### NO_STATE_PROGRESS_MADE_SELECTOR + +OffRamp 2.0 `NoStateProgressMade(bytes32 messageId, bytes err)`: a retry of a +FAILURE message reverts with it. + +```solidity +bytes4 private constant NO_STATE_PROGRESS_MADE_SELECTOR = bytes4(keccak256("NoStateProgressMade(bytes32,bytes)")) +``` + +### s_awaitingDestination + +Captured messages waiting for their destination fork, in send order. + +```solidity +AwaitingDestinationMessage[] internal s_awaitingDestination +``` + +### s_ccipV2Routers + +CCIP 2.0 routers deployed next to the Register router (which `getNetworkDetails` +returns). + +Hand-maintained: `Register` is generated from the CCIP docs API and only carries +one router per chain. + +```solidity +mapping(uint256 chainId => address router) internal s_ccipV2Routers +``` + +### s_messageOutcomes + +Outcome of every captured message, see `getMessageStatus`. + +```solidity +mapping(bytes32 messageId => MessageOutcome outcome) internal s_messageOutcomes +``` + +### s_pendingV2MessageIdsByScope + +```solidity +mapping(uint256 routeScope => bytes32[] messageIds) internal s_pendingV2MessageIdsByScope +``` + +### s_pendingV2MessagesByScope + +```solidity +mapping(uint256 routeScope => mapping(bytes32 messageId => PendingV2Message pendingMessage)) internal + s_pendingV2MessagesByScope +``` + +### s_processedMessages + +Mapping to track processed messages + +```solidity +mapping(bytes32 messageId => bool isProcessed) internal s_processedMessages +``` + +### s_strictRouting + +When true (the default), routing reverts on a message that is not routed or does +not execute successfully. + +```solidity +bool internal s_strictRouting +``` + +### s_syntheticV2VerifierByScope + +```solidity +mapping(uint256 routeScope => address verifier) internal s_syntheticV2VerifierByScope +``` + +### s_v2ExecutionMode + +```solidity +V2ExecutionMode internal s_v2ExecutionMode +``` + +### s_v2VerificationMode + +```solidity +V2VerificationMode internal s_v2VerificationMode +``` + +### SYNTHETIC_V2_VERIFIER_VERSION + +```solidity +bytes4 private constant SYNTHETIC_V2_VERIFIER_VERSION = 0x464f524b +``` + +### V2_EXECUTION_STATE_SUCCESS + +`Internal.MessageExecutionState.SUCCESS`. + +```solidity +uint256 private constant V2_EXECUTION_STATE_SUCCESS = 2 +``` + +## Errors + +### CCIPLocalSimulatorFork\_\_MessageExecutionFailed + +Strict routing: a routed message did not execute successfully. `reason` is the +revert data of the execution (for CCIP 2.0, the OffRamp's recorded failure). + +```solidity +error CCIPLocalSimulatorFork__MessageExecutionFailed(bytes32 messageId, bytes reason); +``` + +### CCIPLocalSimulatorFork\_\_MessageNotRouted + +Strict routing: a captured CCIP message was not routed to any destination fork. + +```solidity +error CCIPLocalSimulatorFork__MessageNotRouted(bytes32 messageId, string reason); +``` + +## Functions + +### \_awaitDestination + +Not a failure, even in strict mode: routing one destination fork per call is the +documented usage. + +```solidity +function _awaitDestination(bytes32 messageId, Vm.Log memory entry, uint256 sourceForkId, uint64 sourceChainSelector) + internal; +``` + +### \_buildSyntheticV2VerificationInputs + +```solidity +function _buildSyntheticV2VerificationInputs( + address offRamp, + bytes memory encodedMessage, + bytes[] memory existingVerifierResults +) internal returns (address[] memory ccvs, bytes[] memory verifierResults); +``` + +### \_configureResolverForSyntheticV2Verification + +```solidity +function _configureResolverForSyntheticV2Verification(address resolver, address syntheticVerifier) + internal + returns (bool configured); +``` + +### \_decodeAddressWord + +Decodes an ABI-encoded address word without reverting: +`abi.decode(data, (address))` reverts in the calling frame (not catchable) when +the word has non-zero high bits, e.g. a non-EVM OnRamp address. + +```solidity +function _decodeAddressWord(bytes memory data) internal pure returns (bool isAddress, address decoded); +``` + +### \_dequeuePendingV2Message + +```solidity +function _dequeuePendingV2Message(uint256 routeScope, bytes32 messageId) internal; +``` + +### \_deriveV2CCVSelection + +```solidity +function _deriveV2CCVSelection(address offRamp, bytes memory encodedMessage) + internal + view + returns (address[] memory ccvs); +``` + +### \_deriveV2VerificationInputs + +```solidity +function _deriveV2VerificationInputs(address offRamp, CCIPForkAdapterV2.DecodedMessage memory decodedMessage) + internal + returns (address[] memory ccvs, bytes[] memory verifierResults, bool usedSyntheticInputs); +``` + +### \_detectEraFromLog + +```solidity +function _detectEraFromLog(Vm.Log memory entry) internal pure returns (CCIPEra era); +``` + +### \_detectOffRampEra + +```solidity +function _detectOffRampEra(address offRamp) internal view returns (bool isReadable, CCIPEra era); +``` + +**Returns** + +| Name | Type | Description | +| ------------ | --------- | ---------------------------------------------------------------------- | +| `isReadable` | `bool` | False when `typeAndVersion` is missing or does not decode to a string. | +| `era` | `CCIPEra` | The OffRamp era, or UNKNOWN for an unrecognised type or version. | + +### \_enqueuePendingV2Message + +```solidity +function _enqueuePendingV2Message(bytes32 messageId, Vm.Log memory entry, uint64 sourceChainSelector) internal; +``` + +### \_findOffRampForOnRamp + +Returns the destination OffRamp whose lane is configured for `sourceOnRamp`, if +discoverable. + +The router lists OffRamps of several protocol versions for the same source chain +(e.g. 1.6 and 2.0 side by side during a lane migration). Their getters share +selectors but not return shapes, and a mismatched return payload fails to decode +in the calling frame, which Solidity `try/catch` cannot catch. So every +candidate is probed with low-level calls and decoded through an external +self-call, and a candidate of unknown shape is skipped instead of reverting the +routing flow. + +```solidity +function _findOffRampForOnRamp( + CCIPForkAdapterTypes.RouterOffRamp[] memory offRamps, + uint64 sourceChainSelector, + address sourceOnRamp +) internal view returns (address offRampAddress); +``` + +### \_findOffRampOnCurrentFork + +Returns the destination OffRamp for the lane of `sourceOnRamp`, searching the +OffRamps of the Register router and then of the CCIP 2.0 router on the current +fork. + +```solidity +function _findOffRampOnCurrentFork(uint64 sourceChainSelector, address sourceOnRamp) + internal + view + returns (address offRampAddress); +``` + +### \_findSourceOnRamp + +Returns the OnRamp on the current (source) fork that emitted `emitter`'s log +towards `destChainSelector`, checking the Register router and then the CCIP 2.0 +router. address(0) if neither. + +```solidity +function _findSourceOnRamp(uint64 destChainSelector, address emitter) internal view returns (address onRamp); +``` + +### \_getOrCreateSyntheticV2Verifier + +```solidity +function _getOrCreateSyntheticV2Verifier() internal returns (address verifier); +``` + +### \_isNoExecV2Message + +```solidity +function _isNoExecV2Message(CCIPForkAdapterTypes.V2Receipt[] memory receipts) internal pure returns (bool); +``` + +### \_isRecoverableV2VerificationFailure + +```solidity +function _isRecoverableV2VerificationFailure(bytes memory returnData) internal pure returns (bool); +``` + +### \_isV2ExecutionSuccess + +Reads `getExecutionState(messageId)` from an OffRamp 2.0 without trusting the +return shape. + +```solidity +function _isV2ExecutionSuccess(address offRamp, bytes32 messageId) internal view returns (bool); +``` + +### \_logDestinationChainSelector + +```solidity +function _logDestinationChainSelector(Vm.Log memory entry, CCIPEra logEra) + internal + pure + returns (bool hasDestination, uint64 destinationChainSelector); +``` + +**Returns** + +| Name | Type | Description | +| -------------------------- | -------- | ---------------------------------------------------------------------------- | +| `hasDestination` | `bool` | Whether the log names its destination chain (1.6 and 2.0 `CCIPMessageSent`). | +| `destinationChainSelector` | `uint64` | The destination chain selector (`topics[1]`). | + +### \_messageIdFromLog + +```solidity +function _messageIdFromLog(Vm.Log memory entry, CCIPEra logEra) + internal + view + returns (bool isCCIPMessage, bytes32 messageId); +``` + +**Returns** + +| Name | Type | Description | +| --------------- | --------- | ------------------------------------------------------------------------------------ | +| `isCCIPMessage` | `bool` | False when the log has a CCIP event signature but does not decode as a CCIP message. | +| `messageId` | `bytes32` | The CCIP message ID. | + +### \_offRampServesOnRamp + +```solidity +function _offRampServesOnRamp(address offRamp, uint64 sourceChainSelector, address sourceOnRamp) + internal + view + returns (bool); +``` + +### \_pendingV2MessageToLog + +```solidity +function _pendingV2MessageToLog(PendingV2Message storage pending) internal view returns (Vm.Log memory entry); +``` + +### \_preV1dot6LaneMatches + +```solidity +function _preV1dot6LaneMatches(address offRamp, uint64 sourceChainSelector, address sourceOnRamp) + internal + view + returns (bool); +``` + +### \_recordExecutionFailure + +```solidity +function _recordExecutionFailure(bytes32 messageId, bytes memory reason) internal; +``` + +### \_recordNotRouted + +```solidity +function _recordNotRouted(bytes32 messageId, string memory reason) internal; +``` + +### \_recordQueued + +```solidity +function _recordQueued(bytes32 messageId) internal; +``` + +### \_recordSuccess + +```solidity +function _recordSuccess(bytes32 messageId) internal; +``` + +### \_resolvesSyntheticVersionTo + +```solidity +function _resolvesSyntheticVersionTo(address resolver, address syntheticVerifier) internal view returns (bool); +``` + +### \_routeCapturedMessage + +```solidity +function _routeCapturedMessage( + Vm.Log memory entry, + uint256[] memory forkIds, + uint256 sourceForkId, + uint64 sourceChainSelector +) internal; +``` + +### \_routeCapturedMessages + +Internal function to route captured messages to their respective destination +forks. + +```solidity +function _routeCapturedMessages(uint256[] memory forkIds, uint256 sourceForkId) internal; +``` + +**Parameters** + +| Name | Type | Description | +| -------------- | ----------- | ----------------------- | +| `forkIds` | `uint256[]` | - Destination fork IDs. | +| `sourceForkId` | `uint256` | - Source fork ID. | + +### \_routeMessageForEra + +```solidity +function _routeMessageForEra( + Vm.Log memory entry, + CCIPEra routingEra, + address sourceOnRamp, + uint64 sourceChainSelector +) internal returns (bool attempted); +``` + +### \_routePreV1dot6Message + +```solidity +function _routePreV1dot6Message(Vm.Log memory entry, address sourceOnRamp) internal returns (bool attempted); +``` + +### \_routersOnCurrentChain + +```solidity +function _routersOnCurrentChain() internal view returns (address[2] memory routers); +``` + +**Returns** + +| Name | Type | Description | +| --------- | ------------ | --------------------------------------------------------------------------------------------- | +| `routers` | `address[2]` | The Register router and the CCIP 2.0 router (address(0) if unset or identical) of this chain. | + +### \_routeScope + +```solidity +function _routeScope() internal view returns (uint256 routeScope); +``` + +### \_routeV1dot6Message + +```solidity +function _routeV1dot6Message(Vm.Log memory entry, address sourceOnRamp) internal returns (bool attempted); +``` + +### \_routeV2Message + +Routes a CCIP 2.0 message on the current (destination) fork. + +```solidity +function _routeV2Message(Vm.Log memory entry, uint64 sourceChainSelector, bool forceExecution) + internal + returns (bool attempted); +``` + +**Parameters** + +| Name | Type | Description | +| --------------------- | -------- | -------------------------------------------------------------- | +| `entry` | `Vm.Log` | | +| `sourceChainSelector` | `uint64` | Chain selector of the source chain the message was sent from. | +| `forceExecution` | `bool` | Execute even if the V2 execution mode would queue the message. | + +### \_routeV2MessageOffRampDerived + +Routes a CCIP 2.0 message without decoding it locally: the destination OffRamp's +`getCCVsForMessage` selects the CCVs and the permissionless `execute` entrypoint +consumes the raw encoded message, so routing keeps working when the on-chain +`MessageV1` wire format moves ahead of the pinned codec. + +`execute` does not revert when the inner execution fails on a first attempt (it +records `FAILURE`), so the message is marked processed only when the OffRamp +reports `SUCCESS`. + +```solidity +function _routeV2MessageOffRampDerived(Vm.Log memory entry, uint64 sourceChainSelector, bool forceExecution) + internal + returns (bool attempted); +``` + +### \_routeV2MessageWithLocalCodec + +```solidity +function _routeV2MessageWithLocalCodec(Vm.Log memory entry, bool forceExecution) internal returns (bool attempted); +``` + +### \_setLaneDefaultCCVs + +```solidity +function _setLaneDefaultCCVs(address offRamp, uint64 sourceChainSelector, address ccv) internal; +``` + +### \_shouldQueueV2Message + +```solidity +function _shouldQueueV2Message(CCIPForkAdapterTypes.V2Receipt[] memory receipts) internal view returns (bool); +``` + +### \_stampedV2OffRamp + +Reads `offRampAddress` from a MessageV1 wire encoding: a 69-byte fixed header, +then `onRampAddress` and `offRampAddress`, each prefixed with a 1-byte length +(see `MessageV1Codec`). address(0) when malformed or not a 20-byte EVM address. + +```solidity +function _stampedV2OffRamp(bytes memory encodedMessage) internal pure returns (address offRamp); +``` + +### \_startsWith + +```solidity +function _startsWith(bytes memory value, bytes memory prefix) internal pure returns (bool); +``` + +### \_v1dot6LaneMatches + +```solidity +function _v1dot6LaneMatches(address offRamp, uint64 sourceChainSelector, address sourceOnRamp) + internal + view + returns (bool); +``` + +### \_v2FailureReason + +OffRamp 2.0 `execute` records FAILURE without reverting, and does not return the +reason. A second attempt of a FAILURE message reverts +`NoStateProgressMade(messageId, err)` with the original failure, and a reverted +call leaves no state behind, so the retry recovers the reason without side +effects. + +```solidity +function _v2FailureReason( + address offRamp, + bytes memory encodedMessage, + address[] memory ccvs, + bytes[] memory verifierResults +) internal returns (bytes memory reason); +``` + +### \_v2LaneMatches + +```solidity +function _v2LaneMatches(address offRamp, uint64 sourceChainSelector, address sourceOnRamp) + internal + view + returns (bool); +``` + +### constructor + +Constructor to initialize the contract + +```solidity +constructor() ; +``` + +### decodeCCVsForMessage + +External decode helper for `getCCVsForMessage` return data. Do not call +directly. + +```solidity +function decodeCCVsForMessage(bytes calldata data) + external + pure + returns (address[] memory requiredCCVs, address[] memory optionalCCVs, uint8 threshold); +``` + +### decodeMessageId + +External decode helper for pre-1.6 and 1.6 message IDs. Do not call directly. + +Decoding runs in an external self-call so a mis-shaped log fails inside +`try/catch`. + +```solidity +function decodeMessageId(uint8 logEra, bytes calldata data) external pure returns (bytes32); +``` + +### decodeNoStateProgressMade + +External decode helper for `NoStateProgressMade(bytes32,bytes)` revert data. Do +not call directly. + +```solidity +function decodeNoStateProgressMade(bytes calldata revertData) external pure returns (bytes memory innerErr); +``` + +### decodeRouterOffRamps + +External decode helper for router `getOffRamps` return data. Do not call +directly. + +```solidity +function decodeRouterOffRamps(bytes calldata data) + external + pure + returns (CCIPForkAdapterTypes.RouterOffRamp[] memory); +``` + +### decodeSourceChainConfigV1dot6 + +External decode helper for the OffRamp lookup. Do not call directly. + +```solidity +function decodeSourceChainConfigV1dot6(bytes calldata data) + external + pure + returns (IOffRampSourceConfigFork.SourceChainConfig memory); +``` + +### decodeSourceChainConfigV2 + +External decode helper for the OffRamp lookup. Do not call directly. + +```solidity +function decodeSourceChainConfigV2(bytes calldata data) + external + pure + returns (IOffRampSourceConfigV2Fork.SourceChainConfig memory); +``` + +### decodeStaticConfigPreV1dot6 + +External decode helper for the OffRamp lookup. Do not call directly. + +```solidity +function decodeStaticConfigPreV1dot6(bytes calldata data) + external + pure + returns (IEVM2EVMOffRampStaticConfigFork.StaticConfig memory); +``` + +### decodeTypeAndVersion + +External decode helper for the OffRamp lookup. Do not call directly. + +Decoding runs in an external self-call so a mismatched payload fails inside +`try/catch`. + +```solidity +function decodeTypeAndVersion(bytes calldata data) external pure returns (string memory); +``` + +### deriveV2VerificationInputs + +```solidity +function deriveV2VerificationInputs(address offRamp, CCIPForkAdapterV2.DecodedMessage calldata decodedMessage) + external + view + returns (address[] memory ccvs, bytes[] memory verifierResults); +``` + +### executePendingV2Message + +```solidity +function executePendingV2Message(bytes32 messageId) external returns (bool attempted); +``` + +### getCCIPV2RouterAddress + +Returns the CCIP 2.0 router deployed next to the Register router on `chainId`, +or address(0) if none is known. Send through this router (and point receivers at +it) to use its CCIP 2.0 lanes; messages sent through either router are routed by +`switchChainAndRouteMessage`. + +```solidity +function getCCIPV2RouterAddress(uint256 chainId) external view returns (address); +``` + +### getMessageStatus + +Returns the outcome of a captured CCIP message. + +```solidity +function getMessageStatus(bytes32 messageId) external view returns (MessageStatus status, bytes memory reason); +``` + +**Parameters** + +| Name | Type | Description | +| ----------- | --------- | ---------------------- | +| `messageId` | `bytes32` | - The CCIP message ID. | + +**Returns** + +| Name | Type | Description | +| -------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------- | +| `status` | `MessageStatus` | - NOT_FOUND, QUEUED, FAILED or SUCCESS. | +| `reason` | `bytes` | - For FAILED: the revert data of the execution, or an `Error(string)` explaining why the message was not routed. Empty otherwise. | + +### getNetworkDetails + +Returns the default values for currently CCIP supported networks. + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (Register.NetworkDetails memory); +``` + +### getOffRampForLane + +Returns the destination OffRamp configured for `sourceOnRamp` on the given fork, +if discoverable. Useful to configure CCIP 2.0 lane CCVs before routing a +message. + +```solidity +function getOffRampForLane(uint256 forkId, uint64 sourceChainSelector, address sourceOnRamp) + external + returns (address offRamp); +``` + +**Parameters** + +| Name | Type | Description | +| --------------------- | --------- | ------------------------------------------------ | +| `forkId` | `uint256` | - The ID of the destination network fork. | +| `sourceChainSelector` | `uint64` | - The chain selector of the source chain. | +| `sourceOnRamp` | `address` | - The address of the OnRamp on the source chain. | + +**Returns** + +| Name | Type | Description | +| --------- | --------- | ------------------------------------------------------------- | +| `offRamp` | `address` | - The matching OffRamp address, or address(0) when not found. | + +### getPendingV2MessageIds + +```solidity +function getPendingV2MessageIds() external view returns (bytes32[] memory messageIds); +``` + +### getStrictRouting + +```solidity +function getStrictRouting() external view returns (bool strict); +``` + +### getV2ExecutionMode + +```solidity +function getV2ExecutionMode() external view returns (V2ExecutionMode mode); +``` + +### getV2VerificationMode + +```solidity +function getV2VerificationMode() external view returns (V2VerificationMode mode); +``` + +### isPendingV2Message + +```solidity +function isPendingV2Message(bytes32 messageId) external view returns (bool isPending); +``` + +### requestLinkFromFaucet + +Requests LINK tokens from the faucet. + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success); +``` + +### setCCIPV2RouterAddress + +Manually sets the CCIP 2.0 router for `chainId`. Use address(0) to route through +the Register router only. + +```solidity +function setCCIPV2RouterAddress(uint256 chainId, address router) external; +``` + +### setLaneDefaultCCVs + +Points a destination lane's default CCVs at `ccv` by impersonating the OffRamp +owner. Fork-only testing helper for CCIP 2.0 lanes: the mocked CCV must be +configured on the destination lane before a captured message can be routed +through the permissionless execution path. Router, enabled flag, OnRamp bindings +and lane-mandated CCVs are preserved. + +```solidity +function setLaneDefaultCCVs(uint256 forkId, address offRamp, uint64 sourceChainSelector, address ccv) external; +``` + +**Parameters** + +| Name | Type | Description | +| --------------------- | --------- | ----------------------------------------------------- | +| `forkId` | `uint256` | - The ID of the destination network fork. | +| `offRamp` | `address` | - The destination OffRamp that holds the lane config. | +| `sourceChainSelector` | `uint64` | - The chain selector of the source chain. | +| `ccv` | `address` | - The CCV address to set as the lane default. | + +### setNetworkDetails + +Manually sets network details. + +```solidity +function setNetworkDetails(uint256 chainId, Register.NetworkDetails memory networkDetails) external; +``` + +### setStrictRouting + +Enables or disables strict routing (enabled by default). When enabled, +`switchChainAndRouteMessage` and `executePendingV2Message` revert with +`CCIPLocalSimulatorFork__MessageNotRouted` when a captured CCIP message cannot +be routed to any of the given forks, and with +`CCIPLocalSimulatorFork__MessageExecutionFailed` when a routed message does not +execute successfully. When disabled, failures are logged and recorded (see +`getMessageStatus`) and routing continues. + +```solidity +function setStrictRouting(bool strict) external; +``` + +### setV2ExecutionMode + +```solidity +function setV2ExecutionMode(V2ExecutionMode mode) external; +``` + +### setV2VerificationMode + +```solidity +function setV2VerificationMode(V2VerificationMode mode) external; +``` + +### switchChainAndRouteMessage + +To be called after the sending of the cross-chain message (`ccipSend`). Goes +through the list of past logs and looks for the supported CCIP send events. +Switches to a destination network fork. Routes the sent cross-chain message on +the destination network. If you sent more than one message, it will try to route +all of them to `forkId`. A 1.6 or 2.0 message to another chain is kept (status +QUEUED) and routed by a later call that includes its destination fork. `forkId` +is the active fork when the call returns. + +```solidity +function switchChainAndRouteMessage(uint256 forkId) external; +``` + +**Parameters** + +| Name | Type | Description | +| -------- | --------- | -------------------------------------------------------------------------------------------------------------- | +| `forkId` | `uint256` | - The ID of the destination network fork. This is the returned value of `createFork()` or `createSelectFork()` | + +### switchChainAndRouteMessage + +To be called after the sending of the cross-chain message (`ccipSend`). Override +variant of the `switchChainAndRouteMessage(uint256 forkId)` function in case of +multiple destination forks. Goes through provided `forkIds` and tries to route +messages to the matching destination. A 1.6 or 2.0 message to a chain that is +not in `forkIds` is kept (status QUEUED) for a later call. + +```solidity +function switchChainAndRouteMessage(uint256[] memory forkIds) external; +``` + +**Parameters** + +| Name | Type | Description | +| --------- | ----------- | ------------------------------------------------------------------------------------------------------------------- | +| `forkIds` | `uint256[]` | - The IDs of the destination network forks. These are the returned values of `createFork()` or `createSelectFork()` | diff --git a/src/content/chainlink-local/api-reference/v0.3.0/ccip-local-simulator.mdx b/src/content/chainlink-local/api-reference/v0.3.0/ccip-local-simulator.mdx new file mode 100644 index 00000000000..acc47b6300e --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.0/ccip-local-simulator.mdx @@ -0,0 +1,244 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalSimulator v0.3.0 API Reference" +metadata: + description: "API documentation for CCIPLocalSimulator in Solidity, version v0.3.0." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalSimulator + +Local CCIP simulator (no-fork mode). + +[CCIPLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/ccip/CCIPLocalSimulator.sol) + +## Variables + +### CHAIN_SELECTOR + +The unique CCIP Chain Selector constant + +```solidity +uint64 constant CHAIN_SELECTOR = 16015286601757825753 +``` + +### i_ccipBnM + +The BurnMintERC677Helper instance for CCIP-BnM token + +```solidity +BurnMintERC677Helper internal immutable i_ccipBnM +``` + +### i_ccipLnM + +The BurnMintERC677Helper instance for CCIP-LnM token + +```solidity +BurnMintERC677Helper internal immutable i_ccipLnM +``` + +### i_linkToken + +The LINK token instance + +```solidity +LinkToken internal immutable i_linkToken +``` + +### i_mockRouter + +The mock CCIP router instance + +```solidity +CCIPLocalRouter internal immutable i_mockRouter +``` + +### i_wrappedNative + +The wrapped native token instance + +```solidity +WETH9 internal immutable i_wrappedNative +``` + +### s_supportedTokens + +The list of supported token addresses + +```solidity +address[] internal s_supportedTokens +``` + +## Errors + +### CCIPLocalSimulator\_\_MsgSenderIsNotTokenOwner + +```solidity +error CCIPLocalSimulator__MsgSenderIsNotTokenOwner(); +``` + +### CCIPLocalSimulator\_\_RequiredRoleNotFound + +```solidity +error CCIPLocalSimulator__RequiredRoleNotFound(address account, bytes32 role, address token); +``` + +## Functions + +### configuration + +Returns configuration details for pre-deployed contracts and services needed for +local CCIP simulations. + +```solidity +function configuration() + public + view + returns ( + uint64 chainSelector_, + IRouterClient sourceRouter_, + IRouterClient destinationRouter_, + WETH9 wrappedNative_, + LinkToken linkToken_, + BurnMintERC677Helper ccipBnM_, + BurnMintERC677Helper ccipLnM_ + ); +``` + +**Returns** + +| Name | Type | Description | +| -------------------- | ---------------------- | ----------------------------------------------------------- | +| `chainSelector_` | `uint64` | - The unique CCIP Chain Selector. | +| `sourceRouter_` | `IRouterClient` | - The source chain Router contract. | +| `destinationRouter_` | `IRouterClient` | - The destination chain Router contract. | +| `wrappedNative_` | `WETH9` | - The wrapped native token which can be used for CCIP fees. | +| `linkToken_` | `LinkToken` | - The LINK token. | +| `ccipBnM_` | `BurnMintERC677Helper` | - The ccipBnM token. | +| `ccipLnM_` | `BurnMintERC677Helper` | - The ccipLnM token. | + +### constructor + +Constructor to initialize the contract and pre-deployed token instances + +```solidity +constructor() ; +``` + +### getSupportedTokens + +Gets a list of token addresses that are supported for cross-chain transfers by +the simulator. + +```solidity +function getSupportedTokens(uint64 chainSelector) external view returns (address[] memory tokens); +``` + +**Parameters** + +| Name | Type | Description | +| --------------- | -------- | --------------------------------- | +| `chainSelector` | `uint64` | - The unique CCIP Chain Selector. | + +**Returns** + +| Name | Type | Description | +| -------- | ----------- | -------------------------------------------------------------------------------------------------- | +| `tokens` | `address[]` | - Returns a list of token addresses that are supported for cross-chain transfers by the simulator. | + +### isChainSupported + +Checks whether the provided `chainSelector` is supported by the simulator. + +```solidity +function isChainSupported(uint64 chainSelector) public pure returns (bool supported); +``` + +**Parameters** + +| Name | Type | Description | +| --------------- | -------- | --------------------------------- | +| `chainSelector` | `uint64` | - The unique CCIP Chain Selector. | + +**Returns** + +| Name | Type | Description | +| ----------- | ------ | ---------------------------------------------------------------- | +| `supported` | `bool` | - Returns true if `chainSelector` is supported by the simulator. | + +### requestLinkFromFaucet + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success); +``` + +**Parameters** + +| Name | Type | Description | +| -------- | --------- | -------------------------------------------------- | +| `to` | `address` | - The address to which LINK tokens are to be sent. | +| `amount` | `uint256` | - The amount of LINK tokens to send. | + +**Returns** + +| Name | Type | Description | +| --------- | ------ | ----------------------------------------------------------------------------- | +| `success` | `bool` | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | + +### supportNewTokenViaAccessControlDefaultAdmin + +Allows user to support any new token, besides CCIP BnM and CCIP LnM, for +cross-chain transfers. The caller must have the DEFAULT_ADMIN_ROLE as defined by +the contract itself. Reverts if the caller is not the admin of the token using +OZ's AccessControl DEFAULT_ADMIN_ROLE. + +```solidity +function supportNewTokenViaAccessControlDefaultAdmin(address tokenAddress) external; +``` + +**Parameters** + +| Name | Type | Description | +| -------------- | --------- | ------------------------------------------------------------------ | +| `tokenAddress` | `address` | - The address of the token to add to the list of supported tokens. | + +### supportNewTokenViaGetCCIPAdmin + +Allows user to support any new token, besides CCIP BnM and CCIP LnM, for +cross-chain transfers. Reverts if token does not implement getCCIPAdmin() +function. Reverts if the caller is not the token CCIPAdmin. + +```solidity +function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external; +``` + +**Parameters** + +| Name | Type | Description | +| -------------- | --------- | ------------------------------------------------------------------ | +| `tokenAddress` | `address` | - The address of the token to add to the list of supported tokens. | + +### supportNewTokenViaOwner + +Allows user to support any new token, besides CCIP BnM and CCIP LnM, for +cross-chain transfers. Reverts if token does not implement owner() function. +Reverts if the caller is not the token owner. + +```solidity +function supportNewTokenViaOwner(address tokenAddress) external; +``` + +**Parameters** + +| Name | Type | Description | +| -------------- | --------- | ------------------------------------------------------------------ | +| `tokenAddress` | `address` | - The address of the token to add to the list of supported tokens. | diff --git a/src/content/chainlink-local/api-reference/v0.3.0/data-streams-local-simulator-fork.mdx b/src/content/chainlink-local/api-reference/v0.3.0/data-streams-local-simulator-fork.mdx new file mode 100644 index 00000000000..93779ade936 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.0/data-streams-local-simulator-fork.mdx @@ -0,0 +1,121 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "DataStreamsLocalSimulatorFork v0.3.0 API Reference" +metadata: + description: "API documentation for DataStreamsLocalSimulatorFork in Solidity, version v0.3.0." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## DataStreamsLocalSimulatorFork + +Data Streams simulator for forked networks. + +[DataStreamsLocalSimulatorFork](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-streams/DataStreamsLocalSimulatorFork.sol) + +## Variables + +### i_register + +The immutable register instance + +```solidity +Register immutable i_register +``` + +### LINK_FAUCET + +The address of the LINK faucet + +```solidity +address constant LINK_FAUCET = 0x4281eCF07378Ee595C564a59048801330f3084eE +``` + +## Functions + +### constructor + +Constructor to initialize the contract + +```solidity +constructor() ; +``` + +### getNetworkDetails + +Returns the default values for currently Data Streams supported networks. If +network is not present or some of the values are changed, user can manually add +new network details using the `setNetworkDetails` function. + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (Register.NetworkDetails memory); +``` + +**Parameters** + +| Name | Type | Description | +| --------- | --------- | ----------------------------------------------------------------------------- | +| `chainId` | `uint256` | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | + +**Returns** + +| Name | Type | Description | +| -------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `` | `Register.NetworkDetails` | networkDetails - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | + +### requestLinkFromFaucet + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success); +``` + +**Parameters** + +| Name | Type | Description | +| -------- | --------- | -------------------------------------------------- | +| `to` | `address` | - The address to which LINK tokens are to be sent. | +| `amount` | `uint256` | - The amount of LINK tokens to send. | + +**Returns** + +| Name | Type | Description | +| --------- | ------ | ----------------------------------------------------------------------------- | +| `success` | `bool` | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | + +### requestNativeFromFaucet + +Requests native coints from the faucet. + +```solidity +function requestNativeFromFaucet(address to, uint256 amount) external; +``` + +**Parameters** + +| Name | Type | Description | +| -------- | --------- | --------------------------------------------------- | +| `to` | `address` | - The address to which native coins are to be sent. | +| `amount` | `uint256` | - The amount of native coins to send. | + +### setNetworkDetails + +If network details are not present or some of the values are changed, user can +manually add new network details using the `setNetworkDetails` function. + +```solidity +function setNetworkDetails(uint256 chainId, Register.NetworkDetails memory networkDetails) external; +``` + +**Parameters** + +| Name | Type | Description | +| ---------------- | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | +| `chainId` | `uint256` | - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. | +| `networkDetails` | `Register.NetworkDetails` | - The tuple containing: verifierProxyAddress - The address of the Verifier Proxy smart contract. linkAddress - The address of the LINK token. | diff --git a/src/content/chainlink-local/api-reference/v0.3.0/data-streams-local-simulator.mdx b/src/content/chainlink-local/api-reference/v0.3.0/data-streams-local-simulator.mdx new file mode 100644 index 00000000000..ee4b523627b --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.0/data-streams-local-simulator.mdx @@ -0,0 +1,170 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "DataStreamsLocalSimulator v0.3.0 API Reference" +metadata: + description: "API documentation for DataStreamsLocalSimulator in Solidity, version v0.3.0." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## DataStreamsLocalSimulator + +Local Data Streams simulator (no-fork mode). + +[DataStreamsLocalSimulator](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-streams/DataStreamsLocalSimulator.sol) + +## Variables + +### feeManagerEnabled + +Whether fee manager is enabled (can be toggled after deployment) + +```solidity +bool public feeManagerEnabled +``` + +### i_linkToken + +The LINK token instance + +```solidity +LinkToken internal immutable i_linkToken +``` + +### i_wrappedNative + +The wrapped native token instance + +```solidity +WETH9 internal immutable i_wrappedNative +``` + +### s_mockFeeManager + +```solidity +MockFeeManager internal s_mockFeeManager +``` + +### s_mockRewardManager + +```solidity +MockRewardManager internal s_mockRewardManager +``` + +### s_mockVerifier + +```solidity +MockVerifier internal s_mockVerifier +``` + +### s_mockVerifierProxy + +```solidity +MockVerifierProxy internal s_mockVerifierProxy +``` + +## Functions + +### \_deployFeeManager + +Internal function to deploy fee manager and reward manager + +```solidity +function _deployFeeManager() private; +``` + +### configuration + +Returns configuration details for pre-deployed contracts and services needed for +local Data Streams simulations. + +```solidity +function configuration() + public + view + returns ( + WETH9 wrappedNative_, + LinkToken linkToken_, + MockVerifier mockVerifier_, + MockVerifierProxy mockVerifierProxy_, + MockFeeManager mockFeeManager_, + MockRewardManager mockRewardManager_ + ); +``` + +**Returns** + +| Name | Type | Description | +| -------------------- | ------------------- | --------------------------------------------------------------------------------- | +| `wrappedNative_` | `WETH9` | - The wrapped native token. | +| `linkToken_` | `LinkToken` | - The LINK token. | +| `mockVerifier_` | `MockVerifier` | - The mock verifier contract. | +| `mockVerifierProxy_` | `MockVerifierProxy` | - The mock verifier proxy contract. | +| `mockFeeManager_` | `MockFeeManager` | - The mock fee manager contract (returns what's currently set on verifier proxy). | +| `mockRewardManager_` | `MockRewardManager` | - The mock reward manager contract (address(0) if fee manager is disabled). | + +### constructor + +```solidity +constructor() ; +``` + +### enableOffChainBilling + +Enables off-chain billing mechanism by removing fee manager + +This simulates chains that don't have FeeManager contracts deployed + +```solidity +function enableOffChainBilling() external; +``` + +### enableOnChainBilling + +Enables on-chain billing mechanism by deploying/setting fee manager + +This simulates chains that have FeeManager contracts deployed + +```solidity +function enableOnChainBilling() external; +``` + +### getBillingMechanism + +Returns the current billing mechanism type + +```solidity +function getBillingMechanism() external view returns (string memory billingType); +``` + +**Returns** + +| Name | Type | Description | +| ------------- | -------- | ------------------------------------------------------------- | +| `billingType` | `string` | "on-chain" if fee manager is enabled, "off-chain" if disabled | + +### requestLinkFromFaucet + +Requests LINK tokens from the faucet. The provided amount of tokens are +transferred to provided destination address. + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success); +``` + +**Parameters** + +| Name | Type | Description | +| -------- | --------- | -------------------------------------------------- | +| `to` | `address` | - The address to which LINK tokens are to be sent. | +| `amount` | `uint256` | - The amount of LINK tokens to send. | + +**Returns** + +| Name | Type | Description | +| --------- | ------ | ----------------------------------------------------------------------------- | +| `success` | `bool` | - Returns `true` if the transfer of tokens was successful, otherwise `false`. | diff --git a/src/content/chainlink-local/api-reference/v0.3.0/data-streams-register.mdx b/src/content/chainlink-local/api-reference/v0.3.0/data-streams-register.mdx new file mode 100644 index 00000000000..95cc971c694 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.0/data-streams-register.mdx @@ -0,0 +1,84 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Register (Data Streams) v0.3.0 API Reference" +metadata: + description: "API documentation for Register (Data Streams) in Solidity, version v0.3.0." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## Register (Data Streams) + +Data Streams network configuration registry. + +[Register (Data Streams)](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-streams/Register.sol) + +## Structs + +### NetworkDetails + +```solidity +struct NetworkDetails { + address verifierProxyAddress; + address linkAddress; +} +``` + +## Variables + +### s_networkDetails + +Mapping to store network details based on chain ID. + +```solidity +mapping(uint256 chainId => NetworkDetails) internal s_networkDetails +``` + +## Functions + +### constructor + +Constructor to initialize the network details for various chains. + +```solidity +constructor() ; +``` + +### getNetworkDetails + +Retrieves network details for a given chain ID. + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (NetworkDetails memory networkDetails); +``` + +**Parameters** + +| Name | Type | Description | +| --------- | --------- | --------------------------------------------- | +| `chainId` | `uint256` | - The ID of the chain to get the details for. | + +**Returns** + +| Name | Type | Description | +| ---------------- | ---------------- | ------------------------------------------------- | +| `networkDetails` | `NetworkDetails` | - The network details for the specified chain ID. | + +### setNetworkDetails + +Sets the network details for a given chain ID. + +```solidity +function setNetworkDetails(uint256 chainId, NetworkDetails memory networkDetails) external; +``` + +**Parameters** + +| Name | Type | Description | +| ---------------- | ---------------- | -------------------------------------------------------- | +| `chainId` | `uint256` | - The ID of the chain to set the details for. | +| `networkDetails` | `NetworkDetails` | - The network details to set for the specified chain ID. | diff --git a/src/content/chainlink-local/api-reference/v0.3.0/index.mdx b/src/content/chainlink-local/api-reference/v0.3.0/index.mdx new file mode 100644 index 00000000000..bdf0b1e1989 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.0/index.mdx @@ -0,0 +1,57 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Chainlink Local v0.3.0 API Reference" +metadata: + description: "API reference documentation for Chainlink Local v0.3.0" +isIndex: true +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +Chainlink Local v0.3.0 (V3) targets CCIP 2.0: `CCIPLocalSimulatorFork` and the Hardhat 3 JavaScript fork helper support CCIP 2.0 (CCV-based) lanes, the local router applies the CCIP 2.0 message rules, and the built-in `Register` network details are split into generated data shards so every generated contract stays under the EIP-170 runtime limit. This is a **breaking** release; Hardhat 2 is not supported in `0.3.x` (see [the release notes](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/CHANGELOG.md)). + +## CCIP + +These contracts provide Cross-Chain Interoperability Protocol (CCIP) functionality in a local testing environment: + +- [CCIPLocalSimulator](/chainlink-local/api-reference/v0.3.0/ccip-local-simulator) - Local CCIP simulator (no-fork mode) +- [CCIPLocalSimulatorFork](/chainlink-local/api-reference/v0.3.0/ccip-local-simulator-fork) - CCIP simulator for forked networks +- [CCIPLocalSimulatorFork JS](/chainlink-local/api-reference/v0.3.0/ccip-local-simulator-fork-js) - JavaScript helpers for fork routing +- [Register](/chainlink-local/api-reference/v0.3.0/register) - CCIP network configuration registry +- [CCIPLocalRouter](/chainlink-local/api-reference/v0.3.0/ccip-local-router) - The local-mode router with CCIP 2.0 message rules + +## Data Streams + +Contracts for simulating Chainlink Data Streams: + +- [DataStreamsLocalSimulator](/chainlink-local/api-reference/v0.3.0/data-streams-local-simulator) - Local Data Streams simulator (no-fork mode) +- [DataStreamsLocalSimulatorFork](/chainlink-local/api-reference/v0.3.0/data-streams-local-simulator-fork) - Data Streams simulator for forked networks +- [MockVerifier](/chainlink-local/api-reference/v0.3.0/mock-verifier) - Mock Data Streams verifier +- [MockVerifierProxy](/chainlink-local/api-reference/v0.3.0/mock-verifier-proxy) - Mock Data Streams verifier proxy +- [MockReportGenerator](/chainlink-local/api-reference/v0.3.0/mock-report-generator) - Signed report generator for every report schema +- [MockFeeManager](/chainlink-local/api-reference/v0.3.0/mock-fee-manager) - Mock verifier fee manager +- [MockRewardManager](/chainlink-local/api-reference/v0.3.0/mock-reward-manager) - Mock reward manager +- [ReportVersions](/chainlink-local/api-reference/v0.3.0/report-versions) - Data Streams report schemas +- [Register (Data Streams)](/chainlink-local/api-reference/v0.3.0/data-streams-register) - Data Streams network configuration registry + +## Data Feeds + +Contracts for simulating Chainlink Data Feeds: + +- [AggregatorInterface](/chainlink-local/api-reference/v0.3.0/aggregator-interface) - Basic price feed interface +- [AggregatorV2V3Interface](/chainlink-local/api-reference/v0.3.0/aggregator-v2-v3-interface) - Combined V2/V3 price feed interface +- [AggregatorV3Interface](/chainlink-local/api-reference/v0.3.0/aggregator-v3-interface) - Extended price feed interface +- [MockOffchainAggregator](/chainlink-local/api-reference/v0.3.0/mock-offchain-aggregator) - Mock implementation of off-chain aggregator +- [MockV3Aggregator](/chainlink-local/api-reference/v0.3.0/mock-v3-aggregator) - Mock implementation of V3 aggregator + +## Token Contracts + +Standard token implementations for testing: + +- [BurnMintERC677Helper](/chainlink-local/api-reference/v0.3.0/burn-mint-erc677-helper) - Helper contract for ERC677 token operations +- [LinkToken](/chainlink-local/api-reference/v0.3.0/link-token) - LINK token implementation +- [WETH9](/chainlink-local/api-reference/v0.3.0/weth9) - Wrapped Ether implementation diff --git a/src/content/chainlink-local/api-reference/v0.3.0/link-token.mdx b/src/content/chainlink-local/api-reference/v0.3.0/link-token.mdx new file mode 100644 index 00000000000..2542e4ba9e1 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.0/link-token.mdx @@ -0,0 +1,70 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "LinkToken v0.3.0 API Reference" +metadata: + description: "API documentation for LinkToken in Solidity, version v0.3.0." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## LinkToken + +LINK token implementation. + +[LinkToken](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/shared/LinkToken.sol) + +## Variables + +### NAME + +The name of the LINK token. + +```solidity +string private constant NAME = "ChainLink Token" +``` + +### SYMBOL + +The symbol of the LINK token. + +```solidity +string private constant SYMBOL = "LINK" +``` + +### TOTAL_SUPPLY + +The total supply of LINK tokens. + +```solidity +uint256 private constant TOTAL_SUPPLY = 10 ** 27 +``` + +## Functions + +### \_onCreate + +Hook that is called when this contract is created. + +Useful to override constructor behaviour in child contracts (e.g., LINK bridge +tokens). The default implementation mints 10\*\*27 tokens to the contract +deployer. + +```solidity +function _onCreate() internal virtual; +``` + +### constructor + +Constructor to initialize the LinkToken contract with a fixed total supply, +name, and symbol. + +Calls the ERC677 constructor with the name and symbol, and then mints the total +supply to the contract deployer. + +```solidity +constructor() ERC677(NAME, SYMBOL); +``` diff --git a/src/content/chainlink-local/api-reference/v0.3.0/mock-fee-manager.mdx b/src/content/chainlink-local/api-reference/v0.3.0/mock-fee-manager.mdx new file mode 100644 index 00000000000..271f95bfc04 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.0/mock-fee-manager.mdx @@ -0,0 +1,175 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockFeeManager v0.3.0 API Reference" +metadata: + description: "API documentation for MockFeeManager in Solidity, version v0.3.0." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockFeeManager + +Mock verifier fee manager. + +[MockFeeManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-streams/MockFeeManager.sol) + +## Variables + +### i_linkAddress + +```solidity +address public immutable i_linkAddress +``` + +### i_nativeAddress + +```solidity +address public immutable i_nativeAddress +``` + +### i_proxyAddress + +```solidity +address public immutable i_proxyAddress +``` + +### i_rewardManager + +```solidity +IRewardManager public immutable i_rewardManager +``` + +### PERCENTAGE_SCALAR + +the total discount that can be applied to a fee, 1e18 = 100% discount + +```solidity +uint64 private constant PERCENTAGE_SCALAR = 1e18 +``` + +### s_mockDiscounts + +```solidity +mapping(address => uint256) public s_mockDiscounts +``` + +### s_nativeSurcharge + +```solidity +uint256 public s_nativeSurcharge +``` + +## Errors + +### ExpiredReport + +```solidity +error ExpiredReport(); +``` + +### InvalidAddress + +```solidity +error InvalidAddress(); +``` + +### InvalidDeposit + +```solidity +error InvalidDeposit(); +``` + +### InvalidDiscount + +```solidity +error InvalidDiscount(); +``` + +### InvalidQuote + +```solidity +error InvalidQuote(); +``` + +### InvalidSurcharge + +```solidity +error InvalidSurcharge(); +``` + +### Unauthorized + +```solidity +error Unauthorized(); +``` + +## Functions + +### \_processFee + +```solidity +function _processFee(bytes calldata payload, bytes calldata parameterPayload, address subscriber) internal; +``` + +### constructor + +```solidity +constructor(address linkAddress, address nativeAddress, address proxyAddress, address rewardManager) ; +``` + +### getFeeAndReward + +```solidity +function getFeeAndReward(address subscriber, bytes memory report, address quoteAddress) + public + view + returns (Common.Asset memory, Common.Asset memory, uint256); +``` + +### getMockDiscount + +```solidity +function getMockDiscount(address subscriber) external view returns (uint256); +``` + +### processFee + +```solidity +function processFee(bytes calldata payload, bytes calldata parameterPayload, address subscriber) + external + payable + override + onlyProxy; +``` + +### processFeeBulk + +```solidity +function processFeeBulk(bytes[] calldata payloads, bytes calldata parameterPayload, address subscriber) + external + payable + override + onlyProxy; +``` + +### setMockDiscount + +```solidity +function setMockDiscount(address subscriber, uint256 discount) external; +``` + +### setNativeSurcharge + +```solidity +function setNativeSurcharge(uint64 surcharge) external; +``` + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) external pure override returns (bool); +``` diff --git a/src/content/chainlink-local/api-reference/v0.3.0/mock-offchain-aggregator.mdx b/src/content/chainlink-local/api-reference/v0.3.0/mock-offchain-aggregator.mdx new file mode 100644 index 00000000000..3685911287e --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.0/mock-offchain-aggregator.mdx @@ -0,0 +1,220 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockOffchainAggregator v0.3.0 API Reference" +metadata: + description: "API documentation for MockOffchainAggregator in Solidity, version v0.3.0." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockOffchainAggregator + +Mock implementation of off-chain aggregator. + +[MockOffchainAggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-feeds/MockOffchainAggregator.sol) + +## Variables + +### decimals + +The number of decimals used by the aggregator. + +```solidity +uint8 public decimals +``` + +### getAnswer + +Mapping to get the answer for a specific round ID. + +```solidity +mapping(uint256 => int256) public getAnswer +``` + +### getStartedAt + +Mapping to get the start time for a specific round ID. + +```solidity +mapping(uint256 => uint256) private getStartedAt +``` + +### getTimestamp + +Mapping to get the timestamp for a specific round ID. + +```solidity +mapping(uint256 => uint256) public getTimestamp +``` + +### latestAnswer + +The latest answer reported by the aggregator. + +```solidity +int256 public latestAnswer +``` + +### latestRound + +The latest round ID. + +```solidity +uint256 public latestRound +``` + +### latestTimestamp + +The timestamp of the latest answer. + +```solidity +uint256 public latestTimestamp +``` + +### MAX_ANSWER_POSSIBLE + +The maximum possible answer the aggregator can report. + +```solidity +int192 private constant MAX_ANSWER_POSSIBLE = 95780971304118053647396689196894323976171195136475135 +``` + +### maxAnswer + +The maximum answer the aggregator is allowed to report. + +```solidity +int192 public maxAnswer +``` + +### MIN_ANSWER_POSSIBLE + +The minimum possible answer the aggregator can report. + +```solidity +int192 private constant MIN_ANSWER_POSSIBLE = 1 +``` + +### minAnswer + +The minimum answer the aggregator is allowed to report. + +```solidity +int192 public minAnswer +``` + +## Functions + +### constructor + +Constructor to initialize the MockOffchainAggregator contract with initial +parameters. + +```solidity +constructor(uint8 _decimals, int256 _initialAnswer) ; +``` + +**Parameters** + +| Name | Type | Description | +| ---------------- | -------- | ------------------------------------------------------ | +| `_decimals` | `uint8` | - The number of decimals for the aggregator. | +| `_initialAnswer` | `int256` | - The initial answer to be set in the mock aggregator. | + +### getRoundData + +Gets the round data for a specific round ID. + +```solidity +function getRoundData(uint80 _roundId) + external + view + returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); +``` + +**Parameters** + +| Name | Type | Description | +| ---------- | -------- | ----------------------------------- | +| `_roundId` | `uint80` | - The round ID to get the data for. | + +**Returns** + +| Name | Type | Description | +| ----------------- | --------- | ------------------------------------------------ | +| `roundId` | `uint80` | - The round ID. | +| `answer` | `int256` | - The answer for the round. | +| `startedAt` | `uint256` | - The timestamp when the round started. | +| `updatedAt` | `uint256` | - The timestamp when the round was updated. | +| `answeredInRound` | `uint80` | - The round ID in which the answer was computed. | + +### latestRoundData + +Gets the latest round data. + +```solidity +function latestRoundData() + external + view + returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); +``` + +**Returns** + +| Name | Type | Description | +| ----------------- | --------- | ------------------------------------------------------- | +| `roundId` | `uint80` | - The latest round ID. | +| `answer` | `int256` | - The latest answer. | +| `startedAt` | `uint256` | - The timestamp when the latest round started. | +| `updatedAt` | `uint256` | - The timestamp when the latest round was updated. | +| `answeredInRound` | `uint80` | - The round ID in which the latest answer was computed. | + +### updateAnswer + +Updates the answer in the mock aggregator. + +```solidity +function updateAnswer(int256 _answer) public; +``` + +**Parameters** + +| Name | Type | Description | +| --------- | -------- | --------------------------- | +| `_answer` | `int256` | - The new answer to be set. | + +### updateMinAndMaxAnswers + +Updates the minimum and maximum answers the aggregator can report. + +```solidity +function updateMinAndMaxAnswers(int192 _minAnswer, int192 _maxAnswer) external; +``` + +**Parameters** + +| Name | Type | Description | +| ------------ | -------- | ------------------------- | +| `_minAnswer` | `int192` | - The new minimum answer. | +| `_maxAnswer` | `int192` | - The new maximum answer. | + +### updateRoundData + +Updates the round data in the mock aggregator. + +```solidity +function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public; +``` + +**Parameters** + +| Name | Type | Description | +| ------------ | --------- | --------------------------------------- | +| `_roundId` | `uint80` | - The round ID to be updated. | +| `_answer` | `int256` | - The new answer to be set. | +| `_timestamp` | `uint256` | - The timestamp to be set. | +| `_startedAt` | `uint256` | - The timestamp when the round started. | diff --git a/src/content/chainlink-local/api-reference/v0.3.0/mock-report-generator.mdx b/src/content/chainlink-local/api-reference/v0.3.0/mock-report-generator.mdx new file mode 100644 index 00000000000..20a93ff2946 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.0/mock-report-generator.mdx @@ -0,0 +1,403 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockReportGenerator v0.3.0 API Reference" +metadata: + description: "API documentation for MockReportGenerator in Solidity, version v0.3.0." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockReportGenerator + +Signed report generator for every report schema. + +[MockReportGenerator](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-streams/MockReportGenerator.sol) + +## Variables + +### i_donAddress + +```solidity +address internal immutable i_donAddress +``` + +### i_donDigest + +```solidity +uint256 internal immutable i_donDigest +``` + +### i_reportV10MockFeedId + +```solidity +bytes32 internal immutable i_reportV10MockFeedId = + hex"000a777777777777777777777777777777777777777777777777777777777777" +``` + +### i_reportV11MockFeedId + +```solidity +bytes32 internal immutable i_reportV11MockFeedId = + hex"000b777777777777777777777777777777777777777777777777777777777777" +``` + +### i_reportV12MockFeedId + +```solidity +bytes32 internal immutable i_reportV12MockFeedId = + hex"000c777777777777777777777777777777777777777777777777777777777777" +``` + +### i_reportV13MockFeedId + +```solidity +bytes32 internal immutable i_reportV13MockFeedId = + hex"000d777777777777777777777777777777777777777777777777777777777777" +``` + +### i_reportV1MockFeedId + +```solidity +bytes32 internal immutable i_reportV1MockFeedId = + hex"0001777777777777777777777777777777777777777777777777777777777777" +``` + +### i_reportV2MockFeedId + +```solidity +bytes32 internal immutable i_reportV2MockFeedId = + hex"0002777777777777777777777777777777777777777777777777777777777777" +``` + +### i_reportV3MockFeedId + +```solidity +bytes32 internal immutable i_reportV3MockFeedId = + hex"0003777777777777777777777777777777777777777777777777777777777777" +``` + +### i_reportV4MockFeedId + +```solidity +bytes32 internal immutable i_reportV4MockFeedId = + hex"0004777777777777777777777777777777777777777777777777777777777777" +``` + +### i_reportV5MockFeedId + +```solidity +bytes32 internal immutable i_reportV5MockFeedId = + hex"0005777777777777777777777777777777777777777777777777777777777777" +``` + +### i_reportV6MockFeedId + +```solidity +bytes32 internal immutable i_reportV6MockFeedId = + hex"0006777777777777777777777777777777777777777777777777777777777777" +``` + +### i_reportV7MockFeedId + +```solidity +bytes32 internal immutable i_reportV7MockFeedId = + hex"0007777777777777777777777777777777777777777777777777777777777777" +``` + +### i_reportV8MockFeedId + +```solidity +bytes32 internal immutable i_reportV8MockFeedId = + hex"0008777777777777777777777777777777777777777777777777777777777777" +``` + +### i_reportV9MockFeedId + +```solidity +bytes32 internal immutable i_reportV9MockFeedId = + hex"0009777777777777777777777777777777777777777777777777777777777777" +``` + +### s_ask + +```solidity +int192 internal s_ask +``` + +### s_bid + +```solidity +int192 internal s_bid +``` + +### s_expiresPeriod + +```solidity +uint32 internal s_expiresPeriod +``` + +### s_linkFee + +```solidity +uint192 internal s_linkFee +``` + +### s_marketStatus + +```solidity +uint32 internal s_marketStatus +``` + +### s_nativeFee + +```solidity +uint192 internal s_nativeFee +``` + +### s_price + +```solidity +int192 internal s_price +``` + +## Errors + +### MockReportGenerator\_\_CastOverflow + +```solidity +error MockReportGenerator__CastOverflow(); +``` + +### MockReportGenerator\_\_InvalidAsk + +```solidity +error MockReportGenerator__InvalidAsk(); +``` + +### MockReportGenerator\_\_InvalidBid + +```solidity +error MockReportGenerator__InvalidBid(); +``` + +## Functions + +### constructor + +```solidity +constructor(int192 initialPrice) ; +``` + +### generateReport + +```solidity +function generateReport(ReportV1 calldata report) external returns (bytes memory signedReport); +``` + +### generateReport + +```solidity +function generateReport(ReportV3 calldata report) external returns (bytes memory signedReport); +``` + +### generateReport + +```solidity +function generateReport(ReportV4 calldata report) external returns (bytes memory signedReport); +``` + +### generateReport + +```solidity +function generateReport(ReportV5 calldata report) external returns (bytes memory signedReport); +``` + +### generateReport + +```solidity +function generateReport(ReportV6 calldata report) external returns (bytes memory signedReport); +``` + +### generateReport + +```solidity +function generateReport(ReportV7 calldata report) external returns (bytes memory signedReport); +``` + +### generateReport + +```solidity +function generateReport(ReportV8 calldata report) external returns (bytes memory signedReport); +``` + +### generateReport + +```solidity +function generateReport(ReportV9 calldata report) external returns (bytes memory signedReport); +``` + +### generateReport + +```solidity +function generateReport(ReportV10 calldata report) external returns (bytes memory signedReport); +``` + +### generateReport + +```solidity +function generateReport(ReportV11 calldata report) external returns (bytes memory signedReport); +``` + +### generateReport + +```solidity +function generateReport(ReportV12 calldata report) external returns (bytes memory signedReport); +``` + +### generateReport + +```solidity +function generateReport(ReportV13 calldata report) external returns (bytes memory signedReport); +``` + +### generateReportV1 + +```solidity +function generateReportV1() external returns (bytes memory signedReport, ReportV1 memory report); +``` + +### generateReportV10 + +```solidity +function generateReportV10() external returns (bytes memory signedReport, ReportV10 memory report); +``` + +### generateReportV11 + +```solidity +function generateReportV11() external returns (bytes memory signedReport, ReportV11 memory report); +``` + +### generateReportV12 + +```solidity +function generateReportV12() external returns (bytes memory signedReport, ReportV12 memory report); +``` + +### generateReportV13 + +```solidity +function generateReportV13() external returns (bytes memory signedReport, ReportV13 memory report); +``` + +### generateReportV2 + +```solidity +function generateReportV2(ReportV2 calldata report) external returns (bytes memory signedReport); +``` + +### generateReportV2 + +```solidity +function generateReportV2() external returns (bytes memory signedReport, ReportV2 memory report); +``` + +### generateReportV3 + +```solidity +function generateReportV3() external returns (bytes memory signedReport, ReportV3 memory report); +``` + +### generateReportV4 + +```solidity +function generateReportV4() external returns (bytes memory signedReport, ReportV4 memory report); +``` + +### generateReportV5 + +```solidity +function generateReportV5() external returns (bytes memory signedReport, ReportV5 memory report); +``` + +### generateReportV6 + +```solidity +function generateReportV6() external returns (bytes memory signedReport, ReportV6 memory report); +``` + +### generateReportV7 + +```solidity +function generateReportV7() external returns (bytes memory signedReport, ReportV7 memory report); +``` + +### generateReportV8 + +```solidity +function generateReportV8() external returns (bytes memory signedReport, ReportV8 memory report); +``` + +### generateReportV9 + +```solidity +function generateReportV9() external returns (bytes memory signedReport, ReportV9 memory report); +``` + +### getMockDonAddress + +```solidity +function getMockDonAddress() external view returns (address); +``` + +### signReport + +```solidity +function signReport(bytes memory reportData) private returns (bytes memory signedReport); +``` + +### toUint32 + +```solidity +function toUint32(uint256 timestamp) private pure returns (uint32); +``` + +### toUint64 + +```solidity +function toUint64(uint256 value) private pure returns (uint64); +``` + +### updateExpiresPeriod + +```solidity +function updateExpiresPeriod(uint32 period) external; +``` + +### updateFees + +```solidity +function updateFees(uint192 nativeFee, uint192 linkFee) external; +``` + +### updateMarketStatus + +```solidity +function updateMarketStatus(uint32 status) external; +``` + +### updatePrice + +```solidity +function updatePrice(int192 price) public; +``` + +### updatePriceBidAndAsk + +```solidity +function updatePriceBidAndAsk(int192 price, int192 bid, int192 ask) external; +``` diff --git a/src/content/chainlink-local/api-reference/v0.3.0/mock-reward-manager.mdx b/src/content/chainlink-local/api-reference/v0.3.0/mock-reward-manager.mdx new file mode 100644 index 00000000000..baabd298702 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.0/mock-reward-manager.mdx @@ -0,0 +1,85 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockRewardManager v0.3.0 API Reference" +metadata: + description: "API documentation for MockRewardManager in Solidity, version v0.3.0." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockRewardManager + +Mock reward manager. + +[MockRewardManager](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-streams/MockRewardManager.sol) + +## Variables + +### i_linkAddress + +```solidity +address public immutable i_linkAddress +``` + +### s_feeManagerAddress + +```solidity +address public s_feeManagerAddress +``` + +## Errors + +### Unauthorized + +```solidity +error Unauthorized(); +``` + +## Events + +### FeePaid + +```solidity +event FeePaid(IRewardManager.FeePayment[] payments, address payer); +``` + +## Functions + +### claimRewards + +```solidity +function claimRewards( + bytes32[] memory /*poolIds*/ +) + external + pure + override; +``` + +### constructor + +```solidity +constructor(address linkAddress) ; +``` + +### onFeePaid + +```solidity +function onFeePaid(FeePayment[] calldata payments, address payer) external override onlyFeeManager; +``` + +### setFeeManager + +```solidity +function setFeeManager(address newFeeManager) external override; +``` + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) external pure override returns (bool); +``` diff --git a/src/content/chainlink-local/api-reference/v0.3.0/mock-v3-aggregator.mdx b/src/content/chainlink-local/api-reference/v0.3.0/mock-v3-aggregator.mdx new file mode 100644 index 00000000000..4d46e7eadb1 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.0/mock-v3-aggregator.mdx @@ -0,0 +1,285 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockV3Aggregator v0.3.0 API Reference" +metadata: + description: "API documentation for MockV3Aggregator in Solidity, version v0.3.0." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockV3Aggregator + +Mock implementation of V3 aggregator. + +[MockV3Aggregator](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-feeds/MockV3Aggregator.sol) + +## Variables + +### aggregator + +The address of the current aggregator. + +```solidity +address public aggregator +``` + +### proposedAggregator + +The address of the proposed aggregator. + +```solidity +address public proposedAggregator +``` + +### version + +The version of the aggregator. + +```solidity +uint256 public constant override version = 0 +``` + +## Functions + +### confirmAggregator + +Confirms the proposed aggregator. + +```solidity +function confirmAggregator(address _aggregator) external; +``` + +**Parameters** + +| Name | Type | Description | +| ------------- | --------- | ----------------------------------------- | +| `_aggregator` | `address` | - The address of the proposed aggregator. | + +### constructor + +Constructor to initialize the MockV3Aggregator contract with initial parameters. + +```solidity +constructor(uint8 _decimals, int256 _initialAnswer) ; +``` + +**Parameters** + +| Name | Type | Description | +| ---------------- | -------- | ------------------------------------------------------ | +| `_decimals` | `uint8` | - The number of decimals for the aggregator. | +| `_initialAnswer` | `int256` | - The initial answer to be set in the mock aggregator. | + +### decimals + +Gets the number of decimals used by the aggregator. + +```solidity +function decimals() external view override returns (uint8); +``` + +**Returns** + +| Name | Type | Description | +| -------- | ------- | ------------------------------- | +| `` | `uint8` | uint8 - The number of decimals. | + +### description + +Gets the description of the aggregator. + +```solidity +function description() external pure override returns (string memory); +``` + +**Returns** + +| Name | Type | Description | +| -------- | -------- | -------------------------------------------------- | +| `` | `string` | string memory - The description of the aggregator. | + +### getAnswer + +Gets the answer for a specific round ID. + +```solidity +function getAnswer(uint256 roundId) external view override returns (int256); +``` + +**Parameters** + +| Name | Type | Description | +| --------- | --------- | ------------------------------------- | +| `roundId` | `uint256` | - The round ID to get the answer for. | + +**Returns** + +| Name | Type | Description | +| -------- | -------- | ------------------------------------------- | +| `` | `int256` | int256 - The answer for the given round ID. | + +### getRoundData + +Gets the round data for a specific round ID. + +This function should raise "No data present" if no data is available for the +given round ID. + +```solidity +function getRoundData(uint80 _roundId) + external + view + override + returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); +``` + +**Parameters** + +| Name | Type | Description | +| ---------- | -------- | ----------------------------------- | +| `_roundId` | `uint80` | - The round ID to get the data for. | + +**Returns** + +| Name | Type | Description | +| ----------------- | --------- | ------------------------------------------------ | +| `roundId` | `uint80` | - The round ID. | +| `answer` | `int256` | - The answer for the round. | +| `startedAt` | `uint256` | - The timestamp when the round started. | +| `updatedAt` | `uint256` | - The timestamp when the round was updated. | +| `answeredInRound` | `uint80` | - The round ID in which the answer was computed. | + +### getTimestamp + +Gets the timestamp for a specific round ID. + +```solidity +function getTimestamp(uint256 roundId) external view override returns (uint256); +``` + +**Parameters** + +| Name | Type | Description | +| --------- | --------- | ---------------------------------------- | +| `roundId` | `uint256` | - The round ID to get the timestamp for. | + +**Returns** + +| Name | Type | Description | +| -------- | --------- | ----------------------------------------------- | +| `` | `uint256` | uint256 - The timestamp for the given round ID. | + +### latestAnswer + +Gets the latest answer from the aggregator. + +```solidity +function latestAnswer() external view override returns (int256); +``` + +**Returns** + +| Name | Type | Description | +| -------- | -------- | --------------------------- | +| `` | `int256` | int256 - The latest answer. | + +### latestRound + +Gets the latest round ID from the aggregator. + +```solidity +function latestRound() external view override returns (uint256); +``` + +**Returns** + +| Name | Type | Description | +| -------- | --------- | ------------------------------ | +| `` | `uint256` | uint256 - The latest round ID. | + +### latestRoundData + +Gets the latest round data. + +This function should raise "No data present" if no data is available. + +```solidity +function latestRoundData() + external + view + override + returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); +``` + +**Returns** + +| Name | Type | Description | +| ----------------- | --------- | ------------------------------------------------------- | +| `roundId` | `uint80` | - The latest round ID. | +| `answer` | `int256` | - The latest answer. | +| `startedAt` | `uint256` | - The timestamp when the latest round started. | +| `updatedAt` | `uint256` | - The timestamp when the latest round was updated. | +| `answeredInRound` | `uint80` | - The round ID in which the latest answer was computed. | + +### latestTimestamp + +Gets the timestamp of the latest answer from the aggregator. + +```solidity +function latestTimestamp() external view override returns (uint256); +``` + +**Returns** + +| Name | Type | Description | +| -------- | --------- | --------------------------------------------- | +| `` | `uint256` | uint256 - The timestamp of the latest answer. | + +### proposeAggregator + +Proposes a new aggregator. + +```solidity +function proposeAggregator(AggregatorV2V3Interface _aggregator) external; +``` + +**Parameters** + +| Name | Type | Description | +| ------------- | ------------------------- | ----------------------------------------- | +| `_aggregator` | `AggregatorV2V3Interface` | - The address of the proposed aggregator. | + +### updateAnswer + +Updates the answer in the mock aggregator. + +```solidity +function updateAnswer(int256 _answer) public; +``` + +**Parameters** + +| Name | Type | Description | +| --------- | -------- | --------------------------- | +| `_answer` | `int256` | - The new answer to be set. | + +### updateRoundData + +Updates the round data in the mock aggregator. + +```solidity +function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public; +``` + +**Parameters** + +| Name | Type | Description | +| ------------ | --------- | --------------------------------------- | +| `_roundId` | `uint80` | - The round ID to be updated. | +| `_answer` | `int256` | - The new answer to be set. | +| `_timestamp` | `uint256` | - The timestamp to be set. | +| `_startedAt` | `uint256` | - The timestamp when the round started. | diff --git a/src/content/chainlink-local/api-reference/v0.3.0/mock-verifier-proxy.mdx b/src/content/chainlink-local/api-reference/v0.3.0/mock-verifier-proxy.mdx new file mode 100644 index 00000000000..debe5edb76e --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.0/mock-verifier-proxy.mdx @@ -0,0 +1,136 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockVerifierProxy v0.3.0 API Reference" +metadata: + description: "API documentation for MockVerifierProxy in Solidity, version v0.3.0." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockVerifierProxy + +Mock Data Streams verifier proxy. + +[MockVerifierProxy](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-streams/MockVerifierProxy.sol) + +## Variables + +### s_feeManager + +```solidity +IVerifierFeeManager public s_feeManager +``` + +### s_verifier + +```solidity +address internal s_verifier +``` + +## Errors + +### FeeManagerNotExpected + +```solidity +error FeeManagerNotExpected(string message); +``` + +### FeeManagerRequired + +```solidity +error FeeManagerRequired(string message); +``` + +### VerifierInvalid + +```solidity +error VerifierInvalid(); +``` + +### VerifierNotFound + +```solidity +error VerifierNotFound(); +``` + +### ZeroAddress + +```solidity +error ZeroAddress(); +``` + +## Events + +### VerifierInitialized + +```solidity +event VerifierInitialized(address indexed verifierAddress); +``` + +## Functions + +### \_validateBillingMechanism + +Validates billing mechanism configuration and provides helpful error messages + +This validation helps developers catch billing mechanism mismatches early in +development + +```solidity +function _validateBillingMechanism(address feeManagerAddress, bytes calldata parameterPayload) internal pure; +``` + +**Parameters** + +| Name | Type | Description | +| ------------------- | --------- | ------------------------------------------------------------- | +| `feeManagerAddress` | `address` | Current fee manager address (address(0) if off-chain billing) | +| `parameterPayload` | `bytes` | The parameter payload from the consumer contract | + +### \_verify + +```solidity +function _verify(bytes calldata payload) internal returns (bytes memory); +``` + +### getVerifier + +```solidity +function getVerifier( + bytes32 /*configDigest*/ +) + external + view + returns (address); +``` + +### initializeVerifier + +```solidity +function initializeVerifier(address verifierAddress) external onlyOwner onlyValidVerifier(verifierAddress); +``` + +### setFeeManager + +```solidity +function setFeeManager(IVerifierFeeManager feeManager) external; +``` + +### verify + +```solidity +function verify(bytes calldata payload, bytes calldata parameterPayload) external payable returns (bytes memory); +``` + +### verifyBulk + +```solidity +function verifyBulk(bytes[] calldata payloads, bytes calldata parameterPayload) + external + payable + returns (bytes[] memory verifiedReports); +``` diff --git a/src/content/chainlink-local/api-reference/v0.3.0/mock-verifier.mdx b/src/content/chainlink-local/api-reference/v0.3.0/mock-verifier.mdx new file mode 100644 index 00000000000..d9990d31277 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.0/mock-verifier.mdx @@ -0,0 +1,158 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockVerifier v0.3.0 API Reference" +metadata: + description: "API documentation for MockVerifier in Solidity, version v0.3.0." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockVerifier + +Mock Data Streams verifier. + +[MockVerifier](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-streams/MockVerifier.sol) + +## Variables + +### i_verifierProxy + +```solidity +address internal immutable i_verifierProxy +``` + +### MOCK_DATA_STREAM_DON_ADDRESS + +```solidity +address constant MOCK_DATA_STREAM_DON_ADDRESS = 0x143f40b47ab222503b787e98940023c59fc29984 +``` + +### N_2 + +```solidity +uint256 constant N_2 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0 +``` + +### s_inactiveDigests + +```solidity +mapping(bytes32 => mapping(bytes32 => bool)) internal s_inactiveDigests +``` + +### s_inactiveFeeds + +```solidity +mapping(bytes32 => bool) internal s_inactiveFeeds +``` + +### s_verifiedSignatures + +```solidity +mapping(bytes => bool) internal s_verifiedSignatures +``` + +## Errors + +### AccessForbidden + +```solidity +error AccessForbidden(); +``` + +### AlreadyUsedSignature + +```solidity +error AlreadyUsedSignature(); +``` + +### BadVerification + +```solidity +error BadVerification(); +``` + +### DigestInactive + +```solidity +error DigestInactive(bytes32 feedId, bytes32 configDigest); +``` + +### InactiveFeed + +```solidity +error InactiveFeed(bytes32 feedId); +``` + +### InvalidS + +```solidity +error InvalidS(); +``` + +### InvalidSignatureLength + +```solidity +error InvalidSignatureLength(); +``` + +### InvalidV + +```solidity +error InvalidV(); +``` + +## Events + +### ReportVerified + +```solidity +event ReportVerified(bytes32 indexed feedId, address indexed sender); +``` + +## Functions + +### activateConfig + +```solidity +function activateConfig(bytes32 feedId, bytes32 configDigest) external; +``` + +### activateFeed + +```solidity +function activateFeed(bytes32 feedId) external; +``` + +### constructor + +```solidity +constructor(address verifierProxy) ; +``` + +### deactivateConfig + +```solidity +function deactivateConfig(bytes32 feedId, bytes32 configDigest) external; +``` + +### deactivateFeed + +```solidity +function deactivateFeed(bytes32 feedId) external; +``` + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) external pure override returns (bool); +``` + +### verify + +```solidity +function verify(bytes calldata signedReport, address sender) external returns (bytes memory verifierResponse); +``` diff --git a/src/content/chainlink-local/api-reference/v0.3.0/register.mdx b/src/content/chainlink-local/api-reference/v0.3.0/register.mdx new file mode 100644 index 00000000000..b86c1483de3 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.0/register.mdx @@ -0,0 +1,121 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Register v0.3.0 API Reference" +metadata: + description: "API documentation for Register in Solidity, version v0.3.0." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## Register + +CCIP network configuration registry. + +[Register](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/ccip/Register.sol) + +## Structs + +### NetworkDetails + +```solidity +struct NetworkDetails { + uint64 chainSelector; + address routerAddress; + address linkAddress; + address wrappedNativeAddress; + address ccipBnMAddress; + address ccipLnMAddress; + address rmnProxyAddress; + address registryModuleOwnerCustomAddress; + address tokenAdminRegistryAddress; +} +``` + +## Variables + +### \_SHARD_COUNT + +Number of generated data shards in RegisterData.sol. + +```solidity +uint256 internal constant _SHARD_COUNT = 4 +``` + +### s_isOverridden + +Whether `setNetworkDetails` was called for a chain ID. + +```solidity +mapping(uint256 chainId => bool isOverridden) internal s_isOverridden +``` + +### s_networkDetails + +Network details set with `setNetworkDetails`, overriding the built-in ones. + +```solidity +mapping(uint256 chainId => NetworkDetails) internal s_networkDetails +``` + +## Functions + +### \_defaultNetworkDetails + +Built-in network details for `chainId`, or an all-zero struct for an unknown +chain. + +Decodes the generated data shards; shard addresses without code are skipped, so +a bare `new Register()` (no shards placed) only serves `setNetworkDetails` +overrides. + +```solidity +function _defaultNetworkDetails(uint256 chainId) internal view returns (NetworkDetails memory); +``` + +### getNetworkDetails + +Retrieves network details for a given chain ID. + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (NetworkDetails memory networkDetails); +``` + +**Parameters** + +| Name | Type | Description | +| --------- | --------- | --------------------------------------------- | +| `chainId` | `uint256` | - The ID of the chain to get the details for. | + +**Returns** + +| Name | Type | Description | +| ---------------- | ---------------- | ------------------------------------------------- | +| `networkDetails` | `NetworkDetails` | - The network details for the specified chain ID. | + +### setNetworkDetails + +Sets the network details for a given chain ID. + +```solidity +function setNetworkDetails(uint256 chainId, NetworkDetails memory networkDetails) external; +``` + +**Parameters** + +| Name | Type | Description | +| ---------------- | ---------------- | -------------------------------------------------------- | +| `chainId` | `uint256` | - The ID of the chain to set the details for. | +| `networkDetails` | `NetworkDetails` | - The network details to set for the specified chain ID. | + +### shardAddress + +Deterministic address of built-in data shard `index`; the simulator places each +shard there. + +```solidity +function shardAddress(uint256 index) public view returns (address); +``` diff --git a/src/content/chainlink-local/api-reference/v0.3.0/report-versions.mdx b/src/content/chainlink-local/api-reference/v0.3.0/report-versions.mdx new file mode 100644 index 00000000000..30ece93d703 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.0/report-versions.mdx @@ -0,0 +1,306 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "ReportVersions v0.3.0 API Reference" +metadata: + description: "API documentation for ReportVersions in Solidity, version v0.3.0." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## ReportVersions + +Data Streams report schemas. + +[ReportVersions](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/data-streams/ReportVersions.sol) + +## Structs + +### ReportV1 + +Represents a data report from a Data Streams stream for v1 schema (early crypto +report with block metadata). + +DEPRECATED: v1 schema is deprecated; only included here for historical reference +and backwards compatibility with legacy streams. For schema overview, see +https://docs.chain.link/data-streams/reference/report-schema-overview + +```solidity +struct ReportV1 { + bytes32 feedId; // The stream ID the report has data for. + uint32 observationsTimestamp; // Observation timestamp in seconds. + int192 benchmarkPrice; // DON consensus median benchmark price. + int192 bid; // Bid-side price estimate. + int192 ask; // Ask-side price estimate. + uint64 currentBlockNum; // Current block number used by the report. + bytes32 currentBlockHash; // Current block hash used by the report. + uint64 validFromBlockNum; // Earliest block number from which the report is valid. + uint64 currentBlockTimestamp; // Current block timestamp in seconds. +} +``` + +### ReportV10 + +Represents a data report from a Data Streams stream for v10 schema +(tokenized-asset stream). The `marketStatus` indicates whether the market is +currently open. Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). +For more information, see +https://docs.chain.link/data-streams/reference/report-schema-v10 + +```solidity +struct ReportV10 { + bytes32 feedId; // The stream ID the report has data for. + uint32 validFromTimestamp; // Earliest timestamp for which the report is applicable. + uint32 observationsTimestamp; // Latest timestamp for which the report is applicable. + uint192 nativeFee; // Base cost to validate a transaction using the report, denominated in the chain's native token (e.g., WETH/ETH). + uint192 linkFee; // Base cost to validate a transaction using the report, denominated in LINK. + uint32 expiresAt; // Latest timestamp where the report can be verified onchain. + uint64 lastUpdateTimestamp; // Timestamp of the last source-side update. + int192 price; // Underlying asset price (8 or 18 decimals). + uint32 marketStatus; // The DON's consensus on whether the market is currently open. + int192 currentMultiplier; // Current underlying-share multiplier. + int192 newMultiplier; // Future multiplier applied after a corporate action. + uint32 activationDateTime; // Corporate-action activation timestamp. + int192 tokenizedPrice; // Tokenized-asset price when available. +} +``` + +### ReportV11 + +Represents a data report from a Data Streams stream for v11 schema (RWA Advanced +stream). The `marketStatus` indicates whether the market is currently open. +Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). For more +information, see +https://docs.chain.link/data-streams/reference/report-schema-v11 + +```solidity +struct ReportV11 { + bytes32 feedId; // The stream ID the report has data for. + uint32 validFromTimestamp; // Earliest timestamp for which the report is applicable. + uint32 observationsTimestamp; // Latest timestamp for which the report is applicable. + uint192 nativeFee; // Base cost to validate a transaction using the report, denominated in the chain's native token (e.g., WETH/ETH). + uint192 linkFee; // Base cost to validate a transaction using the report, denominated in LINK. + uint32 expiresAt; // Latest timestamp where the report can be verified onchain. + int192 mid; // Liquidity-weighted mid price (8 or 18 decimals). + uint64 lastSeenTimestampNs; // Last-seen timestamp from the source, in nanoseconds. + int192 bid; // Consensus bid price (8 or 18 decimals). + int192 bidVolume; // Resting bid-side volume / depth. + int192 ask; // Consensus ask price (8 or 18 decimals). + int192 askVolume; // Resting ask-side volume / depth. + int192 lastTradedPrice; // Most recent traded price (8 or 18 decimals). + uint32 marketStatus; // The DON's consensus on whether the market is currently open. +} +``` + +### ReportV12 + +Represents a data report from a Data Streams stream for v12 schema (NAV report +with next NAV). For schema overview, see +https://docs.chain.link/data-streams/reference/report-schema-overview + +```solidity +struct ReportV12 { + bytes32 feedId; // The stream ID the report has data for. + uint32 validFromTimestamp; // Earliest timestamp for which the report is applicable. + uint32 observationsTimestamp; // Latest timestamp for which the report is applicable. + uint192 nativeFee; // Base cost to validate a transaction using the report, denominated in the chain's native token (e.g., WETH/ETH). + uint192 linkFee; // Base cost to validate a transaction using the report, denominated in LINK. + uint32 expiresAt; // Latest timestamp where the report can be verified onchain. + int192 navPerShare; // Current NAV per share. + int192 nextNavPerShare; // Next NAV per share. + uint64 navDate; // NAV date / timestamp. + uint32 ripcord; // Issuer / source risk flag. +} +``` + +### ReportV13 + +Represents a data report from a Data Streams stream for v13 schema (best bid / +best ask market data report). For schema overview, see +https://docs.chain.link/data-streams/reference/report-schema-overview + +```solidity +struct ReportV13 { + bytes32 feedId; // The stream ID the report has data for. + uint32 validFromTimestamp; // Earliest timestamp for which the report is applicable. + uint32 observationsTimestamp; // Latest timestamp for which the report is applicable. + uint192 nativeFee; // Base cost to validate a transaction using the report, denominated in the chain's native token (e.g., WETH/ETH). + uint192 linkFee; // Base cost to validate a transaction using the report, denominated in LINK. + uint32 expiresAt; // Latest timestamp where the report can be verified onchain. + int192 bestAsk; // Best ask price. + int192 bestBid; // Best bid price. + uint64 askVolume; // Best ask volume. + uint64 bidVolume; // Best bid volume. + int192 lastTradedPrice; // Most recent traded price. +} +``` + +### ReportV2 + +Represents a data report from a Data Streams stream for v2 schema (crypto +streams). The `price` value is carried to either 8 or 18 decimal places, +depending on the stream. For more information, see +https://docs.chain.link/data-streams/crypto-streams and +https://docs.chain.link/data-streams/reference/report-schema + +```solidity +struct ReportV2 { + bytes32 feedId; // The feed ID the report has data for + uint32 validFromTimestamp; // Earliest timestamp for which price is applicable + uint32 observationsTimestamp; // Latest timestamp for which price is applicable + uint192 nativeFee; // Base cost to validate a transaction using the report, denominated in the chain’s native token (WETH/ETH) + uint192 linkFee; // Base cost to validate a transaction using the report, denominated in LINK + uint32 expiresAt; // Latest timestamp where the report can be verified on-chain + int192 benchmarkPrice; // DON consensus median price, carried to 8 decimal places +} +``` + +### ReportV3 + +Represents a data report from a Data Streams stream for v3 schema (crypto +streams). The `price`, `bid`, and `ask` values are carried to either 8 or 18 +decimal places, depending on the stream. For more information, see +https://docs.chain.link/data-streams/crypto-streams and +https://docs.chain.link/data-streams/reference/report-schema + +```solidity +struct ReportV3 { + bytes32 feedId; // The stream ID the report has data for. + uint32 validFromTimestamp; // Earliest timestamp for which price is applicable. + uint32 observationsTimestamp; // Latest timestamp for which price is applicable. + uint192 nativeFee; // Base cost to validate a transaction using the report, denominated in the chain’s native token (e.g., WETH/ETH). + uint192 linkFee; // Base cost to validate a transaction using the report, denominated in LINK. + uint32 expiresAt; // Latest timestamp where the report can be verified onchain. + int192 price; // DON consensus median price (8 or 18 decimals). + int192 bid; // Simulated price impact of a buy order up to the X% depth of liquidity utilisation (8 or 18 decimals). + int192 ask; // Simulated price impact of a sell order up to the X% depth of liquidity utilisation (8 or 18 decimals). +} +``` + +### ReportV4 + +Represents a data report from a Data Streams stream for v4 schema (RWA stream). +The `price` value is carried to either 8 or 18 decimal places, depending on the +stream. The `marketStatus` indicates whether the market is currently open. +Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). For more +information, see https://docs.chain.link/data-streams/rwa-streams and +https://docs.chain.link/data-streams/reference/report-schema-v4 + +```solidity +struct ReportV4 { + bytes32 feedId; // The stream ID the report has data for. + uint32 validFromTimestamp; // Earliest timestamp for which price is applicable. + uint32 observationsTimestamp; // Latest timestamp for which price is applicable. + uint192 nativeFee; // Base cost to validate a transaction using the report, denominated in the chain’s native token (e.g., WETH/ETH). + uint192 linkFee; // Base cost to validate a transaction using the report, denominated in LINK. + uint32 expiresAt; // Latest timestamp where the report can be verified onchain. + int192 price; // DON consensus median benchmark price (8 or 18 decimals). + uint32 marketStatus; // The DON's consensus on whether the market is currently open. +} +``` + +### ReportV5 + +Represents a data report from a Data Streams stream for v5 schema (rate report). +For schema overview, see +https://docs.chain.link/data-streams/reference/report-schema-overview + +```solidity +struct ReportV5 { + bytes32 feedId; // The stream ID the report has data for. + uint32 validFromTimestamp; // Earliest timestamp for which the report is applicable. + uint32 observationsTimestamp; // Latest timestamp for which the report is applicable. + uint192 nativeFee; // Base cost to validate a transaction using the report, denominated in the chain's native token (e.g., WETH/ETH). + uint192 linkFee; // Base cost to validate a transaction using the report, denominated in LINK. + uint32 expiresAt; // Latest timestamp where the report can be verified onchain. + int192 rate; // Reported rate value. + uint32 timestamp; // Rate timestamp in seconds. + uint32 duration; // Duration window in seconds. +} +``` + +### ReportV6 + +Represents a data report from a Data Streams stream for v6 schema (multi-price +report). For schema overview, see +https://docs.chain.link/data-streams/reference/report-schema-overview + +```solidity +struct ReportV6 { + bytes32 feedId; // The stream ID the report has data for. + uint32 validFromTimestamp; // Earliest timestamp for which the report is applicable. + uint32 observationsTimestamp; // Latest timestamp for which the report is applicable. + uint192 nativeFee; // Base cost to validate a transaction using the report, denominated in the chain's native token (e.g., WETH/ETH). + uint192 linkFee; // Base cost to validate a transaction using the report, denominated in LINK. + uint32 expiresAt; // Latest timestamp where the report can be verified onchain. + int192 price; // Primary price value. + int192 price2; // Secondary price value. + int192 price3; // Third price value. + int192 price4; // Fourth price value. + int192 price5; // Fifth price value. +} +``` + +### ReportV7 + +Represents a data report from a Data Streams stream for v7 schema +(redemption-rate stream). The `exchangeRate` value is carried to either 8 or 18 +decimal places, depending on the stream. For more information, see +https://docs.chain.link/data-streams/reference/report-schema-v7 + +```solidity +struct ReportV7 { + bytes32 feedId; // The stream ID the report has data for. + uint32 validFromTimestamp; // Earliest timestamp for which the report is applicable. + uint32 observationsTimestamp; // Latest timestamp for which the report is applicable. + uint192 nativeFee; // Base cost to validate a transaction using the report, denominated in the chain's native token (e.g., WETH/ETH). + uint192 linkFee; // Base cost to validate a transaction using the report, denominated in LINK. + uint32 expiresAt; // Latest timestamp where the report can be verified onchain. + int192 exchangeRate; // Redemption / exchange-rate value (8 or 18 decimals). +} +``` + +### ReportV8 + +Represents a data report from a Data Streams stream for v8 schema (RWA Standard +stream). The `marketStatus` indicates whether the market is currently open. +Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). For more +information, see https://docs.chain.link/data-streams/reference/report-schema-v8 + +```solidity +struct ReportV8 { + bytes32 feedId; // The stream ID the report has data for. + uint32 validFromTimestamp; // Earliest timestamp for which the report is applicable. + uint32 observationsTimestamp; // Latest timestamp for which the report is applicable. + uint192 nativeFee; // Base cost to validate a transaction using the report, denominated in the chain's native token (e.g., WETH/ETH). + uint192 linkFee; // Base cost to validate a transaction using the report, denominated in LINK. + uint32 expiresAt; // Latest timestamp where the report can be verified onchain. + uint64 lastUpdateTimestamp; // Timestamp of the last source-side update. + int192 midPrice; // DON consensus mid price (8 or 18 decimals). + uint32 marketStatus; // The DON's consensus on whether the market is currently open. +} +``` + +### ReportV9 + +Represents a data report from a Data Streams stream for v9 schema (SmartData / +NAV / Proof of Reserve). For more information, see +https://docs.chain.link/data-streams/reference/report-schema-v9 + +```solidity +struct ReportV9 { + bytes32 feedId; // The stream ID the report has data for. + uint32 validFromTimestamp; // Earliest timestamp for which the report is applicable. + uint32 observationsTimestamp; // Latest timestamp for which the report is applicable. + uint192 nativeFee; // Base cost to validate a transaction using the report, denominated in the chain's native token (e.g., WETH/ETH). + uint192 linkFee; // Base cost to validate a transaction using the report, denominated in LINK. + uint32 expiresAt; // Latest timestamp where the report can be verified onchain. + int192 navPerShare; // Net asset value per share. + uint64 navDate; // NAV date / timestamp. + int192 aum; // Assets under management value. + uint32 ripcord; // Issuer / source risk flag; non-zero indicates the value should not be treated as normal market data. +} +``` diff --git a/src/content/chainlink-local/api-reference/v0.3.0/weth9.mdx b/src/content/chainlink-local/api-reference/v0.3.0/weth9.mdx new file mode 100644 index 00000000000..ff2f0ed41b9 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.0/weth9.mdx @@ -0,0 +1,126 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "WETH9 v0.3.0 API Reference" +metadata: + description: "API documentation for WETH9 in Solidity, version v0.3.0." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## WETH9 + +Wrapped Ether implementation. + +[WETH9](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.0/src/shared/WETH9.sol) + +## Variables + +### allowance + +```solidity +mapping(address => mapping(address => uint256)) public allowance +``` + +### balanceOf + +```solidity +mapping(address => uint256) public balanceOf +``` + +### decimals + +```solidity +uint8 public decimals = 18 +``` + +### name + +```solidity +string public name = "Wrapped Ether" +``` + +### symbol + +```solidity +string public symbol = "WETH" +``` + +## Events + +### Approval + +```solidity +event Approval(address indexed src, address indexed guy, uint256 wad); +``` + +### Deposit + +```solidity +event Deposit(address indexed dst, uint256 wad); +``` + +### Transfer + +```solidity +event Transfer(address indexed src, address indexed dst, uint256 wad); +``` + +### Withdrawal + +```solidity +event Withdrawal(address indexed src, uint256 wad); +``` + +## Functions + +### \_deposit + +```solidity +function _deposit() internal; +``` + +### approve + +```solidity +function approve(address guy, uint256 wad) public returns (bool); +``` + +### deposit + +```solidity +function deposit() external payable; +``` + +### receive + +```solidity +receive() external payable; +``` + +### totalSupply + +```solidity +function totalSupply() public view returns (uint256); +``` + +### transfer + +```solidity +function transfer(address dst, uint256 wad) public returns (bool); +``` + +### transferFrom + +```solidity +function transferFrom(address src, address dst, uint256 wad) public returns (bool); +``` + +### withdraw + +```solidity +function withdraw(uint256 wad) external; +``` diff --git a/src/content/chainlink-local/api-reference/v0.3.1/aggregator-interface.mdx b/src/content/chainlink-local/api-reference/v0.3.1/aggregator-interface.mdx new file mode 100644 index 00000000000..99c71f90304 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.1/aggregator-interface.mdx @@ -0,0 +1,148 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "AggregatorInterface v0.3.1 API Reference" +metadata: + description: "API documentation for AggregatorInterface in Solidity, version v0.3.1." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## AggregatorInterface + +Interface for accessing price feed data from an aggregator contract. + +[`AggregatorInterface`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-feeds/interfaces/AggregatorInterface.sol) + + + +## Events + +### AnswerUpdated + +```solidity +event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | --------------------------------------------- | +| current | `int256` | The updated answer | +| roundId | `uint256` | The round ID for which the answer was updated | +| updatedAt | `uint256` | The timestamp when the answer was updated | + +### NewRound + +```solidity +event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | ------------------------------------------------- | +| roundId | `uint256` | The round ID of the new round | +| startedBy | `address` | The address of the account that started the round | +| startedAt | `uint256` | The timestamp when the round was started | + +## Functions + +### getAnswer + +Gets the answer for a specific round ID. + +```solidity +function getAnswer(uint256 roundId) external view returns (int256) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | ---------------------------------- | +| roundId | `uint256` | The round ID to get the answer for | + +#### Returns + +| Parameter | Type | Description | +| --------- | -------- | --------------------------------- | +| (unnamed) | `int256` | The answer for the given round ID | + +### getTimestamp + +Gets the timestamp for a specific round ID. + +```solidity +function getTimestamp(uint256 roundId) external view returns (uint256) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | ------------------------------------- | +| roundId | `uint256` | The round ID to get the timestamp for | + +#### Returns + +| Parameter | Type | Description | +| --------- | --------- | ------------------------------------ | +| (unnamed) | `uint256` | The timestamp for the given round ID | + +### latestAnswer + +Gets the latest answer from the aggregator. + +```solidity +function latestAnswer() external view returns (int256) +``` + + + +#### Returns + +| Parameter | Type | Description | +| --------- | -------- | ----------------- | +| (unnamed) | `int256` | The latest answer | + +### latestRound + +Gets the latest round ID from the aggregator. + +```solidity +function latestRound() external view returns (uint256) +``` + + + +#### Returns + +| Parameter | Type | Description | +| --------- | --------- | ------------------- | +| (unnamed) | `uint256` | The latest round ID | + +### latestTimestamp + +Gets the timestamp of the latest answer from the aggregator. + +```solidity +function latestTimestamp() external view returns (uint256) +``` + + + +#### Returns + +| Parameter | Type | Description | +| --------- | --------- | ---------------------------------- | +| (unnamed) | `uint256` | The timestamp of the latest answer | diff --git a/src/content/chainlink-local/api-reference/v0.3.1/aggregator-v2-v3-interface.mdx b/src/content/chainlink-local/api-reference/v0.3.1/aggregator-v2-v3-interface.mdx new file mode 100644 index 00000000000..6cf238cb7ff --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.1/aggregator-v2-v3-interface.mdx @@ -0,0 +1,26 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "AggregatorV2V3Interface v0.3.1 API Reference" +metadata: + description: "API documentation for AggregatorV2V3Interface in Solidity, version v0.3.1." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## AggregatorV2V3Interface + +Interface that combines functionality from both AggregatorInterface and AggregatorV3Interface. + +[`AggregatorV2V3Interface`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-feeds/interfaces/AggregatorV2V3Interface.sol) + + diff --git a/src/content/chainlink-local/api-reference/v0.3.1/aggregator-v3-interface.mdx b/src/content/chainlink-local/api-reference/v0.3.1/aggregator-v3-interface.mdx new file mode 100644 index 00000000000..df9ff2ec43d --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.1/aggregator-v3-interface.mdx @@ -0,0 +1,140 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "AggregatorV3Interface v0.3.1 API Reference" +metadata: + description: "API documentation for AggregatorV3Interface in Solidity, version v0.3.1." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## AggregatorV3Interface + +Interface for accessing detailed data from an aggregator contract, including round data and metadata. + +[`AggregatorV3Interface`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-feeds/interfaces/AggregatorV3Interface.sol) + + + +## Functions + +### decimals + +Gets the number of decimals used by the aggregator. + +```solidity +function decimals() external view returns (uint8) +``` + + + +#### Returns + +| Parameter | Type | Description | +| --------- | ------- | ---------------------- | +| (unnamed) | `uint8` | The number of decimals | + +### description + +Gets the description of the aggregator. + +```solidity +function description() external view returns (string memory) +``` + + + +#### Returns + +| Parameter | Type | Description | +| --------- | -------- | --------------------------------- | +| (unnamed) | `string` | The description of the aggregator | + +### getRoundData + +Gets the round data for a specific round ID. + +```solidity +function getRoundData(uint80 _roundId) + external + view + returns ( + uint80 roundId, + int256 answer, + uint256 startedAt, + uint256 updatedAt, + uint80 answeredInRound + ) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | -------- | -------------------------------- | +| \_roundId | `uint80` | The round ID to get the data for | + +#### Returns + +| Parameter | Type | Description | +| --------------- | --------- | --------------------------------------------- | +| roundId | `uint80` | The round ID | +| answer | `int256` | The answer for the round | +| startedAt | `uint256` | The timestamp when the round started | +| updatedAt | `uint256` | The timestamp when the round was updated | +| answeredInRound | `uint80` | The round ID in which the answer was computed | + +### latestRoundData + +Gets the latest round data. + +```solidity +function latestRoundData() + external + view + returns ( + uint80 roundId, + int256 answer, + uint256 startedAt, + uint256 updatedAt, + uint80 answeredInRound + ) +``` + + + +#### Returns + +| Parameter | Type | Description | +| --------------- | --------- | ---------------------------------------------------- | +| roundId | `uint80` | The latest round ID | +| answer | `int256` | The latest answer | +| startedAt | `uint256` | The timestamp when the latest round started | +| updatedAt | `uint256` | The timestamp when the latest round was updated | +| answeredInRound | `uint80` | The round ID in which the latest answer was computed | + +### version + +Gets the version of the aggregator. + +```solidity +function version() external view returns (uint256) +``` + + + +#### Returns + +| Parameter | Type | Description | +| --------- | --------- | ----------------------------- | +| (unnamed) | `uint256` | The version of the aggregator | diff --git a/src/content/chainlink-local/api-reference/v0.3.1/burn-mint-erc677-helper.mdx b/src/content/chainlink-local/api-reference/v0.3.1/burn-mint-erc677-helper.mdx new file mode 100644 index 00000000000..9564aaab56e --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.1/burn-mint-erc677-helper.mdx @@ -0,0 +1,70 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "BurnMintERC677Helper v0.3.1 API Reference" +metadata: + description: "API documentation for BurnMintERC677Helper in Solidity, version v0.3.1." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## BurnMintERC677Helper + +A helper contract that extends the BurnMintERC677 token contract to provide additional minting functionality. + +[`BurnMintERC677Helper`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/ccip/BurnMintERC677Helper.sol) + + + +## Functions + +### constructor + +Initializes the token with a name and symbol, setting fixed decimals and initial supply. + +```solidity +constructor(string memory name, string memory symbol) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | -------- | ----------------------- | +| name | `string` | The name of the token | +| symbol | `string` | The symbol of the token | + +### drip + +Mints exactly one token (1e18 units) to a specified address. + +```solidity +function drip(address to) external +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | --------------------------------------- | +| to | `address` | The address to receive the minted token | diff --git a/src/content/chainlink-local/api-reference/v0.3.1/ccip-local-router.mdx b/src/content/chainlink-local/api-reference/v0.3.1/ccip-local-router.mdx new file mode 100644 index 00000000000..456c005625f --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.1/ccip-local-router.mdx @@ -0,0 +1,216 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalRouter v0.3.1 API Reference" +metadata: + description: "API documentation for CCIPLocalRouter in Solidity, version v0.3.1." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalRouter + +The local-mode router used by [`CCIPLocalSimulator`](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator). It mirrors `MockCCIPRouter` from `@chainlink/contracts-ccip` 2.0.0 (same ABI, events and behaviour) and additionally applies the CCIP 2.0 finality rules of the OnRamp and OffRamp, so a test that passes locally does not fail on a fork or in production. + +[`CCIPLocalRouter`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/ccip/CCIPLocalRouter.sol) + + + +## Errors + +### CanOnlySendOneTokenPerMessage + +```solidity +error CanOnlySendOneTokenPerMessage() +``` + + + +### CannotSendZeroTokens + +```solidity +error CannotSendZeroTokens() +``` + + + +### InvalidAddress + +```solidity +error InvalidAddress(bytes encodedAddress) +``` + +### InvalidExtraArgsTag + +```solidity +error InvalidExtraArgsTag() +``` + +### InvalidOptionalThreshold + +```solidity +error InvalidOptionalThreshold(uint8 wanted, uint256 got) +``` + + + +### MessageGasLimitTooHigh + +```solidity +error MessageGasLimitTooHigh() +``` + + + +### ReceiverError + +```solidity +error ReceiverError(bytes err) +``` + + + +### TokenReceiverNotAllowed + +```solidity +error TokenReceiverNotAllowed(uint64 destChainSelector) +``` + + + +## Events + +### MessageExecuted + +```solidity +event MessageExecuted(bytes32 messageId, uint64 sourceChainSelector, address offRamp, bytes32 calldataHash) +``` + + + +### MsgExecuted + +```solidity +event MsgExecuted(bool success, bytes retData, uint256 gasUsed) +``` + + + +## Constants + +### GAS_FOR_CALL_EXACT_CHECK + +```solidity +uint16 public constant GAS_FOR_CALL_EXACT_CHECK = 5_000 +``` + +### DEFAULT_GAS_LIMIT + +```solidity +uint32 public constant DEFAULT_GAS_LIMIT = 200_000 +``` + + + +## Functions + +### ccipSend + +Sends the message locally to the receiver instead of on the destination chain. + +```solidity +function ccipSend(uint64 destinationChainSelector, Client.EVM2AnyMessage calldata message) external payable returns (bytes32) +``` + + + +### getFee + +Returns the fee set with `setFee`. + +```solidity +function getFee(uint64, Client.EVM2AnyMessage memory) public view returns (uint256) +``` + + + +### setFee + +Sets the fees returned by `getFee`. + +```solidity +function setFee(uint256 feeAmount) external +``` + + + +### getOnRamp + +```solidity +function getOnRamp(uint64) external pure returns (address onRampAddress) +``` + + + +### getSupportedTokens + +```solidity +function getSupportedTokens(uint64) external pure returns (address[] memory tokens) +``` + + + +### isChainSupported + +```solidity +function isChainSupported(uint64) external pure returns (bool supported) +``` + + + +### isOffRamp + +```solidity +function isOffRamp(uint64, address) external pure returns (bool) +``` + + + +### routeMessage + +Routes a message to a receiver directly, bypassing `ccipSend` validation. + +```solidity +function routeMessage(Client.Any2EVMMessage calldata message, uint16 gasForCallExactCheck, uint256 gasLimit, address receiver) external returns (bool success, bytes memory retData, uint256 gasUsed) +``` + + diff --git a/src/content/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork-js.mdx b/src/content/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork-js.mdx new file mode 100644 index 00000000000..e15fcadf5f1 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork-js.mdx @@ -0,0 +1,145 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalSimulatorFork JS v0.3.1 API Reference" +metadata: + description: "API documentation for the CCIPLocalSimulatorFork JavaScript helpers, version v0.3.1." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalSimulatorFork JS + +Hardhat 3 helpers for routing CCIP messages between forked networks: the JavaScript counterpart of the Solidity [`CCIPLocalSimulatorFork`](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork). Supports pre-1.6 (`EVM2EVMOnRamp`), 1.6 and CCIP 2.0 (CCV-based) lanes. + +[`CCIPLocalSimulatorFork.js`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/scripts/CCIPLocalSimulatorFork.js) + + + +## Constants + +### CCIP_V2_ROUTERS + +```javascript +export const CCIP_V2_ROUTERS = Object.freeze({ + 11155111: "0x784d49a71BB4C48eB7dA4cD7e6Ecb424f9b5EAB1", // Ethereum Sepolia + 43113: "0x7C9B8B4e8024e5Ee8A630F6FCe9015e470dA5763", // Avalanche Fuji +}) +``` + + + +## Types + +### CCIPSentMessage + +Represents a CCIP message sent in a transaction, for any supported protocol version. + +| Property | Type | Description | +| ------------------- | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- | +| era | `"PRE_V1_6" \| "V1_6" \| "V2"` | CCIP protocol version of the lane the message was sent on | +| onRamp | `string` | Source OnRamp that emitted the message | +| messageId | `string` | The message ID | +| sourceChainSelector | `bigint` | The source chain selector | +| destChainSelector | `bigint` | The destination chain selector (`undefined` for pre-1.6) | +| message | `object` | Era-specific payload: the pre-1.6 `EVM2EVMMessage`, the 1.6 `EVM2AnyRampMessage`, or for CCIP 2.0 `{ encodedMessage, receipts }` | + +## Functions + +### getCCIPMessages + +Extracts every CCIP message sent in a transaction, for all supported protocol versions. + +```javascript +function getCCIPMessages(connection, receipt) => CCIPSentMessage[] +``` + + + +#### Parameters + +| Parameter | Type | Description | +| ---------- | -------- | ------------------------------------------ | +| connection | `object` | Network connection of the source chain | +| receipt | `object` | Transaction receipt of the `ccipSend` call | + +#### Returns + +| Type | Description | +| ------------------- | ----------------------------------------------- | +| `CCIPSentMessage[]` | The sent messages, in log order (empty if none) | + +### requestLinkFromTheFaucet + +Requests LINK tokens from the testnet faucet by impersonating it. + +```javascript +async function requestLinkFromTheFaucet(connection, linkAddress, to, amount) => Promise +``` + +#### Parameters + +| Parameter | Type | Description | +| ----------- | -------- | --------------------------------------------------------- | +| connection | `object` | Network connection from `network.connect()` | +| linkAddress | `string` | The address of the LINK contract on the connected network | +| to | `string` | The address to send LINK to | +| amount | `bigint` | The amount of LINK to request | + +#### Returns + +| Type | Description | +| ----------------- | -------------------------------------------------------------- | +| `Promise` | Promise resolving to the transaction hash of the fund transfer | + +### routeMessage + +Routes a sent message on the destination (connected) network, as the destination OffRamp would execute it. + +```javascript +async function routeMessage(connection, routerAddresses, sent, options = {}) => Promise +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| connection | `object` | Network connection of the destination chain | +| routerAddresses | `string \| string[]` | Destination router address(es) whose OffRamps are searched, e.g. the default router and `CCIP_V2_ROUTERS[chainId]` | +| sent | `CCIPSentMessage` | A message returned by `getCCIPMessages` | +| options | `Object` | Optional: `forceExecution` (default `false`) executes CCIP 2.0 messages whose executor is `NO_EXECUTION_ADDRESS` (manual execution) | + +#### Returns + +| Type | Description | +| -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Object` | `{ offRamp, executed, reason }`: `executed` is `false` only for a CCIP 2.0 `NO_EXECUTION` message routed without `forceExecution` (`reason` is then `"NO_EXECUTION_ADDRESS"`) | + + diff --git a/src/content/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork.mdx b/src/content/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork.mdx new file mode 100644 index 00000000000..2c4340ab577 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork.mdx @@ -0,0 +1,541 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalSimulatorFork v0.3.1 API Reference" +metadata: + description: "API documentation for CCIPLocalSimulatorFork in Solidity, version v0.3.1." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalSimulatorFork + +A contract that simulates CCIP (Cross-Chain Interoperability Protocol) message routing in a Foundry test environment, for every CCIP era: pre-1.6 (`EVM2EVMOnRamp`), 1.6 and CCIP 2.0 (CCV-based lanes, which live testnet lanes run today). + +[`CCIPLocalSimulatorFork`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/ccip/CCIPLocalSimulatorFork.sol) + + + +## Enums + +### CCIPEra + +```solidity +enum CCIPEra { UNKNOWN, PRE_V1_DOT_6, V1_DOT_6, V2 } +``` + + + +### V2VerificationMode + +```solidity +enum V2VerificationMode { STRICT, HYBRID, SYNTHETIC_ONLY, OFFRAMP_DERIVED } +``` + + + +### V2ExecutionMode + +```solidity +enum V2ExecutionMode { AUTO, RESPECT_NO_EXEC, MANUAL_ONLY } +``` + + + +### MessageStatus + +```solidity +enum MessageStatus { NOT_FOUND, QUEUED, FAILED, SUCCESS } +``` + + + +## Structs + +### MessageOutcome + +```solidity +struct MessageOutcome { + MessageStatus status; + bytes reason; +} +``` + +| Field | Type | Description | +| ------ | --------------- | ---------------------------------------------------------------------------------------------------------------- | +| status | `MessageStatus` | The outcome of the message | +| reason | `bytes` | For `FAILED`: the revert data, or an `Error(string)` explaining why the message was not routed. Empty otherwise. | + +## Errors + +### CCIPLocalSimulatorFork\_\_MessageNotRouted + +```solidity +error CCIPLocalSimulatorFork__MessageNotRouted(bytes32 messageId, string reason) +``` + + + +### CCIPLocalSimulatorFork\_\_MessageExecutionFailed + +```solidity +error CCIPLocalSimulatorFork__MessageExecutionFailed(bytes32 messageId, bytes reason) +``` + + + +## Variables + +### i_register + +```solidity +Register immutable i_register +``` + + + +### LINK_FAUCET + +```solidity +address constant LINK_FAUCET = 0x4281eCF07378Ee595C564a59048801330f3084eE +``` + + + +### s_processedMessages + +```solidity +mapping(bytes32 messageId => bool isProcessed) internal s_processedMessages +``` + + + +### s_messageOutcomes + +```solidity +mapping(bytes32 messageId => MessageOutcome outcome) internal s_messageOutcomes +``` + + + +### s_strictRouting + +```solidity +bool internal s_strictRouting +``` + + + +### s_ccipV2Routers + +```solidity +mapping(uint256 chainId => address router) internal s_ccipV2Routers +``` + + + +## Functions + +### constructor + +Initializes the contract and sets up logging and persistence. + +```solidity +constructor() +``` + + + +### switchChainAndRouteMessage + +Routes a cross-chain message on the destination network after switching to the specified fork. + +```solidity +function switchChainAndRouteMessage(uint256 forkId) external +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | ------------------------------------------------------------------------------------------- | +| forkId | `uint256` | The ID of the destination network fork (returned by `createFork()` or `createSelectFork()`) | + + + +### switchChainAndRouteMessage (multiple forks) + +Override variant of `switchChainAndRouteMessage(uint256 forkId)` for multiple destination forks. + +```solidity +function switchChainAndRouteMessage(uint256[] memory forkIds) external +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | ----------- | ---------------------------------------- | +| forkIds | `uint256[]` | The IDs of the destination network forks | + +### getNetworkDetails + +Returns the network configuration details for a specified chain ID. + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (Register.NetworkDetails memory) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | --------------------------------------------------------------------- | +| chainId | `uint256` | The blockchain network chain ID (e.g., 11155111 for Ethereum Sepolia) | + +#### Returns + +| Parameter | Type | Description | +| --------- | ---------------- | --------------------------------------------------------- | +| (unnamed) | `NetworkDetails` | The network configuration details for the specified chain | + +### setNetworkDetails + +Updates or adds new network configuration details for a specified chain ID. + +```solidity +function setNetworkDetails(uint256 chainId, Register.NetworkDetails memory networkDetails) external +``` + + + +#### Parameters + +| Parameter | Type | Description | +| -------------- | ---------------- | --------------------------------------------------------------------- | +| chainId | `uint256` | The blockchain network chain ID (e.g., 11155111 for Ethereum Sepolia) | +| networkDetails | `NetworkDetails` | The network configuration details to be stored | + +### getCCIPV2RouterAddress + +Returns the CCIP 2.0 router for a chain, or `address(0)` if none is known. + +```solidity +function getCCIPV2RouterAddress(uint256 chainId) external view returns (address) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | ------------------------------- | +| chainId | `uint256` | The blockchain network chain ID | + +### setCCIPV2RouterAddress + +Manually sets the CCIP 2.0 router for a chain. + +```solidity +function setCCIPV2RouterAddress(uint256 chainId, address router) external +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | ---------------------------------- | +| chainId | `uint256` | The blockchain network chain ID | +| router | `address` | The CCIP 2.0 router address to set | + +### getOffRampForLane + +Returns the destination OffRamp configured for a source OnRamp on the given fork. + +```solidity +function getOffRampForLane(uint256 forkId, uint64 sourceChainSelector, address sourceOnRamp) external returns (address offRamp) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| ------------------- | --------- | --------------------------------------------- | +| forkId | `uint256` | The ID of the destination network fork | +| sourceChainSelector | `uint64` | The chain selector of the source chain | +| sourceOnRamp | `address` | The address of the OnRamp on the source chain | + +#### Returns + +| Parameter | Type | Description | +| --------- | --------- | ------------------------------------------------------------ | +| offRamp | `address` | The matching OffRamp address, or `address(0)` when not found | + +### setLaneDefaultCCVs + +Points a destination lane's default CCVs at a CCV address by impersonating the OffRamp owner. + +```solidity +function setLaneDefaultCCVs(uint256 forkId, address offRamp, uint64 sourceChainSelector, address ccv) external +``` + + + +#### Parameters + +| Parameter | Type | Description | +| ------------------- | --------- | -------------------------------------------------- | +| forkId | `uint256` | The ID of the destination network fork | +| offRamp | `address` | The destination OffRamp that holds the lane config | +| sourceChainSelector | `uint64` | The chain selector of the source chain | +| ccv | `address` | The CCV address to set as the lane default | + +### requestLinkFromFaucet + +Requests LINK tokens from the faucet for a specified address. + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | -------------------------------------- | +| to | `address` | The address to receive the LINK tokens | +| amount | `uint256` | The amount of LINK tokens to transfer | + +#### Returns + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------- | +| success | `bool` | Returns true if the token transfer was successful | + +### setStrictRouting + +Enables or disables strict routing (enabled by default). + +```solidity +function setStrictRouting(bool strict) external +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | ------ | ---------------------------------------------------------- | +| strict | `bool` | Whether to enable (true) or disable (false) strict routing | + +### getStrictRouting + +Returns whether strict routing is enabled. + +```solidity +function getStrictRouting() external view returns (bool strict) +``` + +### getMessageStatus + +Returns the outcome of a captured CCIP message. + +```solidity +function getMessageStatus(bytes32 messageId) external view returns (MessageStatus status, bytes memory reason) +``` + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | ------------------- | +| messageId | `bytes32` | The CCIP message ID | + +#### Returns + +| Parameter | Type | Description | +| --------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------- | +| status | `MessageStatus` | `NOT_FOUND`, `QUEUED`, `FAILED` or `SUCCESS` | +| reason | `bytes` | For `FAILED`: the revert data of the execution, or an `Error(string)` explaining why the message was not routed. Empty otherwise. | + +### setV2VerificationMode + +Sets how CCIP 2.0 messages are verified when routed. + +```solidity +function setV2VerificationMode(V2VerificationMode mode) external +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | -------------------- | ---------------------------- | +| mode | `V2VerificationMode` | The verification mode to set | + +### getV2VerificationMode + +Returns the current CCIP 2.0 verification mode. + +```solidity +function getV2VerificationMode() external view returns (V2VerificationMode mode) +``` + +### setV2ExecutionMode + +Sets how `NO_EXECUTION_ADDRESS` (manual execution) CCIP 2.0 messages are handled. + +```solidity +function setV2ExecutionMode(V2ExecutionMode mode) external +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | ----------------- | ------------------------- | +| mode | `V2ExecutionMode` | The execution mode to set | + +### getV2ExecutionMode + +Returns the current CCIP 2.0 execution mode. + +```solidity +function getV2ExecutionMode() external view returns (V2ExecutionMode mode) +``` + +### getPendingV2MessageIds + +Returns the message IDs of pending CCIP 2.0 `NO_EXECUTION_ADDRESS` messages on the current route scope. + +```solidity +function getPendingV2MessageIds() external view returns (bytes32[] memory messageIds) +``` + +### isPendingV2Message + +Checks whether a CCIP 2.0 message is pending manual execution. + +```solidity +function isPendingV2Message(bytes32 messageId) external view returns (bool isPending) +``` + +### executePendingV2Message + +Executes a pending CCIP 2.0 `NO_EXECUTION_ADDRESS` message on the current fork. + +```solidity +function executePendingV2Message(bytes32 messageId) external returns (bool attempted) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | ------------------------------ | +| messageId | `bytes32` | The CCIP message ID to execute | + +#### Returns + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------ | +| attempted | `bool` | Whether an execution was attempted on the current fork | diff --git a/src/content/chainlink-local/api-reference/v0.3.1/ccip-local-simulator.mdx b/src/content/chainlink-local/api-reference/v0.3.1/ccip-local-simulator.mdx new file mode 100644 index 00000000000..1bd361d6135 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.1/ccip-local-simulator.mdx @@ -0,0 +1,286 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "CCIPLocalSimulator v0.3.1 API Reference" +metadata: + description: "API documentation for CCIPLocalSimulator in Solidity, version v0.3.1." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## CCIPLocalSimulator + +A contract that simulates local CCIP (Cross-Chain Interoperability Protocol) operations for testing and development purposes. + +[`CCIPLocalSimulator`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/ccip/CCIPLocalSimulator.sol) + + + +## Variables + +### CHAIN_SELECTOR + +```solidity +uint64 constant CHAIN_SELECTOR = 16015286601757825753 +``` + + + +### i_ccipBnM + +```solidity +BurnMintERC677Helper internal immutable i_ccipBnM +``` + + + +### i_ccipLnM + +```solidity +BurnMintERC677Helper internal immutable i_ccipLnM +``` + + + +### i_linkToken + +```solidity +LinkToken internal immutable i_linkToken +``` + + + +### i_mockRouter + +```solidity +CCIPLocalRouter internal immutable i_mockRouter +``` + + + +### i_wrappedNative + +```solidity +WETH9 internal immutable i_wrappedNative +``` + + + +### s_supportedTokens + +```solidity +address[] internal s_supportedTokens +``` + + + +## Errors + +### CCIPLocalSimulator\_\_MsgSenderIsNotTokenOwner + +```solidity +error CCIPLocalSimulator__MsgSenderIsNotTokenOwner() +``` + +### CCIPLocalSimulator\_\_RequiredRoleNotFound + +```solidity +error CCIPLocalSimulator__RequiredRoleNotFound(address account, bytes32 role, address token) +``` + +## Functions + +### configuration + +Returns the configuration details for pre-deployed contracts and services needed for local CCIP simulations. + +```solidity +function configuration() public view returns (uint64 chainSelector_, IRouterClient sourceRouter_, IRouterClient destinationRouter_, WETH9 wrappedNative_, LinkToken linkToken_, BurnMintERC677Helper ccipBnM_, BurnMintERC677Helper ccipLnM_) +``` + + + +#### Returns + +| Parameter | Type | Description | +| ------------------- | ---------------------- | -------------------------------------------------------- | +| chainSelector\_ | `uint64` | The unique CCIP Chain Selector | +| sourceRouter\_ | `IRouterClient` | The source chain Router contract | +| destinationRouter\_ | `IRouterClient` | The destination chain Router contract | +| wrappedNative\_ | `WETH9` | The wrapped native token which can be used for CCIP fees | +| linkToken\_ | `LinkToken` | The LINK token | +| ccipBnM\_ | `BurnMintERC677Helper` | The ccipBnM token | +| ccipLnM\_ | `BurnMintERC677Helper` | The ccipLnM token | + +### constructor + +Initializes the contract with pre-deployed token instances. + +```solidity +constructor() +``` + + + +### getSupportedTokens + +Gets the list of supported token addresses for a given chain selector. + +```solidity +function getSupportedTokens(uint64 chainSelector) external view returns (address[] memory tokens) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| ------------- | -------- | ------------------------------ | +| chainSelector | `uint64` | The unique CCIP Chain Selector | + +#### Returns + +| Parameter | Type | Description | +| --------- | ----------- | ------------------------------------------------------------------------------ | +| tokens | `address[]` | Returns a list of token addresses that are supported for cross-chain transfers | + +### isChainSupported + +Checks if a given chain selector is supported. + +```solidity +function isChainSupported(uint64 chainSelector) public pure returns (bool supported) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| ------------- | -------- | ------------------------------ | +| chainSelector | `uint64` | The unique CCIP Chain Selector | + +#### Returns + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------- | +| supported | `bool` | Returns true if `chainSelector` is supported by the simulator | + +### requestLinkFromFaucet + +Transfers LINK tokens from the faucet to a specified address. + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | ----------------------------------------------- | +| to | `address` | The address to which LINK tokens are to be sent | +| amount | `uint256` | The amount of LINK tokens to send | + +#### Returns + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------- | +| success | `bool` | Returns `true` if the transfer of tokens was successful | + +### supportNewTokenViaAccessControlDefaultAdmin + +Adds a new token to supported tokens list via AccessControl's DEFAULT_ADMIN_ROLE. + +```solidity +function supportNewTokenViaAccessControlDefaultAdmin(address tokenAddress) external +``` + + + +#### Parameters + +| Parameter | Type | Description | +| ------------ | --------- | --------------------------------------------------------------- | +| tokenAddress | `address` | The address of the token to add to the list of supported tokens | + + + +### supportNewTokenViaGetCCIPAdmin + +Adds a new token to supported tokens list via CCIP admin role. + +```solidity +function supportNewTokenViaGetCCIPAdmin(address tokenAddress) external +``` + + + +#### Parameters + +| Parameter | Type | Description | +| ------------ | --------- | --------------------------------------------------------------- | +| tokenAddress | `address` | The address of the token to add to the list of supported tokens | + + + +### supportNewTokenViaOwner + +Adds a new token to supported tokens list via token owner. + +```solidity +function supportNewTokenViaOwner(address tokenAddress) external +``` + + + +#### Parameters + +| Parameter | Type | Description | +| ------------ | --------- | --------------------------------------------------------------- | +| tokenAddress | `address` | The address of the token to add to the list of supported tokens | + + diff --git a/src/content/chainlink-local/api-reference/v0.3.1/data-streams-local-simulator-fork.mdx b/src/content/chainlink-local/api-reference/v0.3.1/data-streams-local-simulator-fork.mdx new file mode 100644 index 00000000000..01c88d0b6ef --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.1/data-streams-local-simulator-fork.mdx @@ -0,0 +1,136 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "DataStreamsLocalSimulatorFork v0.3.1 API Reference" +metadata: + description: "API documentation for DataStreamsLocalSimulatorFork in Solidity, version v0.3.1." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## DataStreamsLocalSimulatorFork + +A contract that simulates Data Streams operations on forked networks in a Foundry test environment. + +[`DataStreamsLocalSimulatorFork`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-streams/DataStreamsLocalSimulatorFork.sol) + + + +## Variables + +### i_register + +```solidity +Register immutable i_register +``` + + + +### LINK_FAUCET + +```solidity +address constant LINK_FAUCET = 0x4281eCF07378Ee595C564a59048801330f3084eE +``` + + + +## Functions + +### constructor + +Initializes the contract. + +```solidity +constructor() +``` + + + +### getNetworkDetails + +Returns the default values for currently Data Streams supported networks. + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (Register.NetworkDetails memory) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | ------------------------------------------------------------------- | +| chainId | `uint256` | The blockchain network chain ID (e.g., 421614 for Arbitrum Sepolia) | + +#### Returns + +| Parameter | Type | Description | +| -------------- | ---------------- | ---------------------------------------------------------------- | +| networkDetails | `NetworkDetails` | `verifierProxyAddress` and `linkAddress` for the specified chain | + +### setNetworkDetails + +Sets the network details for a given chain ID. + +```solidity +function setNetworkDetails(uint256 chainId, Register.NetworkDetails memory networkDetails) external +``` + +#### Parameters + +| Parameter | Type | Description | +| -------------- | ---------------- | ----------------------------------------------------- | +| chainId | `uint256` | The blockchain network chain ID | +| networkDetails | `NetworkDetails` | The network details to set for the specified chain ID | + +### requestLinkFromFaucet + +Requests LINK tokens from the faucet. + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | -------------------------------------- | +| to | `address` | The address to receive the LINK tokens | +| amount | `uint256` | The amount of LINK tokens to transfer | + +#### Returns + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------- | +| success | `bool` | Returns true if the token transfer was successful | + +### requestNativeFromFaucet + +Requests native coins from the faucet. + +```solidity +function requestNativeFromFaucet(address to, uint256 amount) external +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | --------------------------------------- | +| to | `address` | The address to receive the native coins | +| amount | `uint256` | The amount of native coins to send | diff --git a/src/content/chainlink-local/api-reference/v0.3.1/data-streams-local-simulator.mdx b/src/content/chainlink-local/api-reference/v0.3.1/data-streams-local-simulator.mdx new file mode 100644 index 00000000000..66e6ad12959 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.1/data-streams-local-simulator.mdx @@ -0,0 +1,133 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "DataStreamsLocalSimulator v0.3.1 API Reference" +metadata: + description: "API documentation for DataStreamsLocalSimulator in Solidity, version v0.3.1." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## DataStreamsLocalSimulator + +A contract that simulates local Data Streams operations for testing and development purposes. + +[`DataStreamsLocalSimulator`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-streams/DataStreamsLocalSimulator.sol) + + + +## Variables + +### feeManagerEnabled + +```solidity +bool public feeManagerEnabled +``` + + + +## Functions + +### configuration + +Returns the configuration details for pre-deployed contracts and services needed for local Data Streams simulations. + +```solidity +function configuration() public view returns (WETH9 wrappedNative_, LinkToken linkToken_, MockVerifier mockVerifier_, MockVerifierProxy mockVerifierProxy_, MockFeeManager mockFeeManager_, MockRewardManager mockRewardManager_) +``` + + + +#### Returns + +| Parameter | Type | Description | +| ------------------- | ------------------- | --------------------------------------------------------------------------- | +| wrappedNative\_ | `WETH9` | The wrapped native token | +| linkToken\_ | `LinkToken` | The LINK token | +| mockVerifier\_ | `MockVerifier` | The mock verifier contract | +| mockVerifierProxy\_ | `MockVerifierProxy` | The mock verifier proxy contract | +| mockFeeManager\_ | `MockFeeManager` | The mock fee manager contract (what is currently set on the verifier proxy) | +| mockRewardManager\_ | `MockRewardManager` | The mock reward manager contract (`address(0)` if fee manager is disabled) | + +### constructor + +Initializes the contract with pre-deployed instances. + +```solidity +constructor() +``` + + + +### enableOffChainBilling + +Enables the off-chain billing mechanism by removing the fee manager. + +```solidity +function enableOffChainBilling() external +``` + + + +### enableOnChainBilling + +Enables the on-chain billing mechanism by deploying/setting the fee manager. + +```solidity +function enableOnChainBilling() external +``` + + + +### getBillingMechanism + +Returns the current billing mechanism type. + +```solidity +function getBillingMechanism() external view returns (string memory billingType) +``` + + + +### requestLinkFromFaucet + +Requests LINK tokens from the faucet. + +```solidity +function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success) +``` + + + +#### 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 | diff --git a/src/content/chainlink-local/api-reference/v0.3.1/data-streams-register.mdx b/src/content/chainlink-local/api-reference/v0.3.1/data-streams-register.mdx new file mode 100644 index 00000000000..3526298e0c5 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.1/data-streams-register.mdx @@ -0,0 +1,86 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Register (Data Streams) v0.3.1 API Reference" +metadata: + description: "API documentation for the Data Streams Register contract, version v0.3.1." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## Register (Data Streams) + +A contract that stores and retrieves Data Streams network details for various chains. + +[`Register`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-streams/Register.sol) + + + +## Structs + +### NetworkDetails + +Contains Data Streams configuration details for a specific network/chain. + +| Field | Type | Description | +| -------------------- | --------- | ------------------------------------------ | +| verifierProxyAddress | `address` | The address of the Verifier Proxy contract | +| linkAddress | `address` | The address of the LINK token contract | + +## Functions + +### constructor + +Initializes the contract with predefined network details. + +```solidity +constructor() +``` + + + +### getNetworkDetails + +Retrieves network details for a given chain ID. + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (NetworkDetails memory networkDetails) +``` + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | ------------------------------------------ | +| chainId | `uint256` | The ID of the chain to get the details for | + +#### Returns + +| Parameter | Type | Description | +| -------------- | ---------------- | ---------------------------------------------- | +| networkDetails | `NetworkDetails` | The network details for the specified chain ID | + +### setNetworkDetails + +Sets the network details for a given chain ID. + +```solidity +function setNetworkDetails(uint256 chainId, NetworkDetails memory networkDetails) external +``` + + + +#### Parameters + +| Parameter | Type | Description | +| -------------- | ---------------- | ----------------------------------------------------- | +| chainId | `uint256` | The ID of the chain to set the details for | +| networkDetails | `NetworkDetails` | The network details to set for the specified chain ID | diff --git a/src/content/chainlink-local/api-reference/v0.3.1/index.mdx b/src/content/chainlink-local/api-reference/v0.3.1/index.mdx new file mode 100644 index 00000000000..8126798aeb4 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.1/index.mdx @@ -0,0 +1,57 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Chainlink Local v0.3.1 API Reference" +metadata: + description: "API reference documentation for Chainlink Local v0.3.1" +isIndex: true +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +Chainlink Local v0.3.1 (V3) targets CCIP 2.0: it pins `@chainlink/contracts-ccip` 2.0.0 and `@chainlink/contracts` 1.5.0, and the local router applies the CCIP 2.0 OnRamp and OffRamp message rules. Fork routing supports every CCIP era (pre-1.6, 1.6 and CCIP 2.0). Hardhat 2 is not supported in `0.3.x`; Hardhat 2 users stay on `0.2.x` (see [the release notes](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/CHANGELOG.md)). + +## CCIP + +These contracts provide Cross-Chain Interoperability Protocol (CCIP) functionality in a local testing environment: + +- [CCIPLocalSimulator](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator) - Local CCIP simulator (no-fork mode) +- [CCIPLocalRouter](/chainlink-local/api-reference/v0.3.1/ccip-local-router) - The local-mode router with CCIP 2.0 message rules +- [CCIPLocalSimulatorFork](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork) - CCIP simulator for forked networks (all CCIP eras) +- [CCIPLocalSimulatorFork JS](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork-js) - Hardhat 3 JavaScript helpers for fork routing +- [Register](/chainlink-local/api-reference/v0.3.1/register) - CCIP network configuration registry + +## Data Streams + +Contracts for simulating Chainlink Data Streams: + +- [DataStreamsLocalSimulator](/chainlink-local/api-reference/v0.3.1/data-streams-local-simulator) - Local Data Streams simulator (no-fork mode) +- [DataStreamsLocalSimulatorFork](/chainlink-local/api-reference/v0.3.1/data-streams-local-simulator-fork) - Data Streams simulator for forked networks +- [MockVerifier](/chainlink-local/api-reference/v0.3.1/mock-verifier) - Mock Data Streams verifier +- [MockVerifierProxy](/chainlink-local/api-reference/v0.3.1/mock-verifier-proxy) - Mock Data Streams verifier proxy +- [MockReportGenerator](/chainlink-local/api-reference/v0.3.1/mock-report-generator) - Signed report generator for every report schema +- [MockFeeManager](/chainlink-local/api-reference/v0.3.1/mock-fee-manager) - Mock verifier fee manager +- [MockRewardManager](/chainlink-local/api-reference/v0.3.1/mock-reward-manager) - Mock reward manager +- [ReportVersions](/chainlink-local/api-reference/v0.3.1/report-versions) - Data Streams report schemas (`ReportV1`-`ReportV13`) +- [Register (Data Streams)](/chainlink-local/api-reference/v0.3.1/data-streams-register) - Data Streams network configuration registry + +## Data Feeds + +Contracts for simulating Chainlink Data Feeds: + +- [AggregatorInterface](/chainlink-local/api-reference/v0.3.1/aggregator-interface) - Basic price feed interface +- [AggregatorV2V3Interface](/chainlink-local/api-reference/v0.3.1/aggregator-v2-v3-interface) - Combined V2/V3 price feed interface +- [AggregatorV3Interface](/chainlink-local/api-reference/v0.3.1/aggregator-v3-interface) - Extended price feed interface +- [MockOffchainAggregator](/chainlink-local/api-reference/v0.3.1/mock-offchain-aggregator) - Mock implementation of off-chain aggregator +- [MockV3Aggregator](/chainlink-local/api-reference/v0.3.1/mock-v3-aggregator) - Mock implementation of V3 aggregator + +## Token Contracts + +Standard token implementations for testing: + +- [BurnMintERC677Helper](/chainlink-local/api-reference/v0.3.1/burn-mint-erc677-helper) - Helper contract for ERC677 token operations +- [LinkToken](/chainlink-local/api-reference/v0.3.1/link-token) - LINK token implementation +- [WETH9](/chainlink-local/api-reference/v0.3.1/weth9) - Wrapped Ether implementation diff --git a/src/content/chainlink-local/api-reference/v0.3.1/link-token.mdx b/src/content/chainlink-local/api-reference/v0.3.1/link-token.mdx new file mode 100644 index 00000000000..ad0838c66c6 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.1/link-token.mdx @@ -0,0 +1,52 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "LinkToken v0.3.1 API Reference" +metadata: + description: "API documentation for LinkToken in Solidity, version v0.3.1." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## LinkToken + +A contract that implements the ChainLink Token (LINK) using the ERC677 standard. + +[`LinkToken`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/shared/LinkToken.sol) + + + +## Functions + +### constructor + +Initializes the contract with fixed token details. + +```solidity +constructor() +``` + + + +### \_onCreate + +Internal hook called during contract creation. + +```solidity +function _onCreate() internal virtual +``` + + diff --git a/src/content/chainlink-local/api-reference/v0.3.1/mock-fee-manager.mdx b/src/content/chainlink-local/api-reference/v0.3.1/mock-fee-manager.mdx new file mode 100644 index 00000000000..144358e358a --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.1/mock-fee-manager.mdx @@ -0,0 +1,175 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockFeeManager v0.3.1 API Reference" +metadata: + description: "API documentation for MockFeeManager in Solidity, version v0.3.1." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockFeeManager + +A mock implementation of the Data Streams verifier fee manager for local testing. + +[`MockFeeManager`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-streams/MockFeeManager.sol) + + + +## Errors + +### Unauthorized + +```solidity +error Unauthorized() +``` + + + +### InvalidAddress + +```solidity +error InvalidAddress() +``` + +### InvalidQuote + +```solidity +error InvalidQuote() +``` + + + +### ExpiredReport + +```solidity +error ExpiredReport() +``` + +### InvalidDiscount + +```solidity +error InvalidDiscount() +``` + +### InvalidSurcharge + +```solidity +error InvalidSurcharge() +``` + +### InvalidDeposit + +```solidity +error InvalidDeposit() +``` + +## Functions + +### constructor + +Initializes the contract. + +```solidity +constructor(address linkAddress, address nativeAddress, address proxyAddress, address rewardManager) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| ------------- | --------- | ---------------------------------------- | +| linkAddress | `address` | The LINK token address | +| nativeAddress | `address` | The wrapped native token address | +| proxyAddress | `address` | The verifier proxy address (only caller) | +| rewardManager | `address` | The reward manager address | + +### processFee + +Processes the fee for a single report verification. + +```solidity +function processFee(bytes calldata payload, bytes calldata parameterPayload, address subscriber) external payable override onlyProxy +``` + + + +### processFeeBulk + +Processes fees for multiple report verifications. + +```solidity +function processFeeBulk(bytes[] calldata payloads, bytes calldata parameterPayload, address subscriber) external payable override onlyProxy +``` + +### getFeeAndReward + +Returns the fee and reward for a report and quote token. + +```solidity +function getFeeAndReward(address subscriber, bytes memory report, address quoteAddress) public view returns (Common.Asset memory, Common.Asset memory, uint256) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| ------------ | --------- | ------------------------------------------------ | +| subscriber | `address` | The subscriber address (for the discount lookup) | +| report | `bytes` | The report data | +| quoteAddress | `address` | The fee token to quote (LINK or wrapped native) | + +#### Returns + +| Parameter | Type | Description | +| --------- | -------------- | ----------------------------------------- | +| (unnamed) | `Common.Asset` | The fee asset and amount | +| (unnamed) | `Common.Asset` | The reward asset and amount (always LINK) | +| (unnamed) | `uint256` | The discount applied | + +### setNativeSurcharge + +Sets the surcharge applied to native token fees. + +```solidity +function setNativeSurcharge(uint256 surcharge) external onlyOwner +``` + +### setMockDiscount + +Sets a per-subscriber discount. + +```solidity +function setMockDiscount(address subscriber, uint256 discount) external onlyOwner +``` + + + +### withdrawMockFee + +Withdraws accumulated fees. + +```solidity +function withdrawMockFee(address to, address coin) external onlyOwner +``` + +### withdrawLink + +Withdraws accumulated LINK. + +```solidity +function withdrawLink(address to) external onlyOwner +``` diff --git a/src/content/chainlink-local/api-reference/v0.3.1/mock-offchain-aggregator.mdx b/src/content/chainlink-local/api-reference/v0.3.1/mock-offchain-aggregator.mdx new file mode 100644 index 00000000000..462f0ccc613 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.1/mock-offchain-aggregator.mdx @@ -0,0 +1,227 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockOffchainAggregator v0.3.1 API Reference" +metadata: + description: "API documentation for MockOffchainAggregator in Solidity, version v0.3.1." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockOffchainAggregator + +A mock implementation of an offchain aggregator for testing purposes. + +[`MockOffchainAggregator`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-feeds/MockOffchainAggregator.sol) + + + +## Variables + +### decimals + +```solidity +uint8 public decimals +``` + + + +### getAnswer + +```solidity +mapping(uint256 => int256) public getAnswer +``` + + + +### getTimestamp + +```solidity +mapping(uint256 => uint256) public getTimestamp +``` + + + +### latestAnswer + +```solidity +int256 public latestAnswer +``` + + + +### latestRound + +```solidity +uint256 public latestRound +``` + + + +### latestTimestamp + +```solidity +uint256 public latestTimestamp +``` + + + +### maxAnswer + +```solidity +int192 public maxAnswer +``` + + + +### minAnswer + +```solidity +int192 public minAnswer +``` + + + +## Functions + +### constructor + +Initializes the contract with decimals and initial answer. + +```solidity +constructor(uint8 _decimals, int256 _initialAnswer) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------------- | -------- | ----------------------------------------- | +| \_decimals | `uint8` | The number of decimals for the aggregator | +| \_initialAnswer | `int256` | The initial answer to be set | + +### getRoundData + +Gets the round data for a specific round ID. + +```solidity +function getRoundData(uint80 _roundId) + external + view + returns ( + uint80 roundId, + int256 answer, + uint256 startedAt, + uint256 updatedAt, + uint80 answeredInRound + ) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | -------- | -------------------------------- | +| \_roundId | `uint80` | The round ID to get the data for | + +#### Returns + +| Parameter | Type | Description | +| --------------- | --------- | --------------------------------------------- | +| roundId | `uint80` | The round ID | +| answer | `int256` | The answer for the round | +| startedAt | `uint256` | The timestamp when the round started | +| updatedAt | `uint256` | The timestamp when the round was updated | +| answeredInRound | `uint80` | The round ID in which the answer was computed | + +### latestRoundData + +Gets the latest round data. + +```solidity +function latestRoundData() + external + view + returns ( + uint80 roundId, + int256 answer, + uint256 startedAt, + uint256 updatedAt, + uint80 answeredInRound + ) +``` + + + +#### Returns + +| Parameter | Type | Description | +| --------------- | --------- | ---------------------------------------------------- | +| roundId | `uint80` | The latest round ID | +| answer | `int256` | The latest answer | +| startedAt | `uint256` | The timestamp when the latest round started | +| updatedAt | `uint256` | The timestamp when the latest round was updated | +| answeredInRound | `uint80` | The round ID in which the latest answer was computed | + +### updateAnswer + +Updates the answer in the mock aggregator. + +```solidity +function updateAnswer(int256 _answer) public +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | -------- | ------------------------ | +| \_answer | `int256` | The new answer to be set | + +### updateMinAndMaxAnswers + +Updates the minimum and maximum answers the aggregator can report. + +```solidity +function updateMinAndMaxAnswers(int192 _minAnswer, int192 _maxAnswer) external +``` + + + +#### Parameters + +| Parameter | Type | Description | +| ----------- | -------- | ---------------------- | +| \_minAnswer | `int192` | The new minimum answer | +| \_maxAnswer | `int192` | The new maximum answer | + +#### Possible Reverts + +- Reverts if minAnswer is not less than maxAnswer with "minAnswer must be less than maxAnswer" +- Reverts if minAnswer is too low with "minAnswer is too low" +- Reverts if maxAnswer is too high with "maxAnswer is too high" + +### updateRoundData + +Updates the round data in the mock aggregator. + +```solidity +function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public +``` + + + +#### Parameters + +| Parameter | Type | Description | +| ----------- | --------- | ------------------------------------ | +| \_roundId | `uint80` | The round ID to be updated | +| \_answer | `int256` | The new answer to be set | +| \_timestamp | `uint256` | The timestamp to be set | +| \_startedAt | `uint256` | The timestamp when the round started | diff --git a/src/content/chainlink-local/api-reference/v0.3.1/mock-report-generator.mdx b/src/content/chainlink-local/api-reference/v0.3.1/mock-report-generator.mdx new file mode 100644 index 00000000000..fb80229231c --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.1/mock-report-generator.mdx @@ -0,0 +1,137 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockReportGenerator v0.3.1 API Reference" +metadata: + description: "API documentation for MockReportGenerator in Solidity, version v0.3.1." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockReportGenerator + +A contract that generates signed Data Streams reports for local testing. + +[`MockReportGenerator`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-streams/MockReportGenerator.sol) + + + +## Errors + +### MockReportGenerator\_\_InvalidBid + +```solidity +error MockReportGenerator__InvalidBid() +``` + +### MockReportGenerator\_\_InvalidAsk + +```solidity +error MockReportGenerator__InvalidAsk() +``` + +### MockReportGenerator\_\_CastOverflow + +```solidity +error MockReportGenerator__CastOverflow() +``` + +## Functions + +### constructor + +Initializes the generator with an initial price. + +```solidity +constructor(int192 initialPrice) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| ------------ | -------- | ------------------------ | +| initialPrice | `int192` | The initial report price | + +### generateReportV1..V13 + +Generates a signed report for a specific schema version. + +```solidity +function generateReportV3() external returns (bytes memory signedReport, ReportV3 memory report) +``` + + + +#### Returns + +| Parameter | Type | Description | +| ------------ | ---------- | ----------------------------- | +| signedReport | `bytes` | The ABI-encoded signed report | +| report | `ReportVn` | The generated report struct | + +### updatePrice + +Updates the price used in generated reports. + +```solidity +function updatePrice(int192 price) public +``` + +### updatePriceBidAndAsk + +Updates the price, bid and ask used in generated reports. + +```solidity +function updatePriceBidAndAsk(int192 price, int192 bid, int192 ask) external +``` + +### updateExpiresPeriod + +Updates the report expiry period. + +```solidity +function updateExpiresPeriod(uint32 period) external +``` + + + +### updateMarketStatus + +Updates the market status used in generated reports. + +```solidity +function updateMarketStatus(uint32 status) external +``` + + + +### updateFees + +Updates the native and LINK fees carried in generated reports. + +```solidity +function updateFees(uint192 nativeFee, uint192 linkFee) external +``` + + diff --git a/src/content/chainlink-local/api-reference/v0.3.1/mock-reward-manager.mdx b/src/content/chainlink-local/api-reference/v0.3.1/mock-reward-manager.mdx new file mode 100644 index 00000000000..c2a9aa645fa --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.1/mock-reward-manager.mdx @@ -0,0 +1,100 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockRewardManager v0.3.1 API Reference" +metadata: + description: "API documentation for MockRewardManager in Solidity, version v0.3.1." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockRewardManager + +A mock implementation of the Data Streams reward manager for local testing. + +[`MockRewardManager`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-streams/MockRewardManager.sol) + + + +## Errors + +### Unauthorized + +```solidity +error Unauthorized() +``` + + + +## Events + +### FeePaid + +```solidity +event FeePaid(IRewardManager.FeePayment[] payments, address payer) +``` + +## Functions + +### constructor + +Initializes the contract with the LINK token address. + +```solidity +constructor(address linkAddress) +``` + +#### Parameters + +| Parameter | Type | Description | +| ----------- | --------- | ---------------------- | +| linkAddress | `address` | The LINK token address | + +### onFeePaid + +Records a fee payment and pulls the LINK from the payer. + +```solidity +function onFeePaid(FeePayment[] calldata payments, address payer) external override onlyFeeManager +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | -------------- | ------------------------------------------ | +| payments | `FeePayment[]` | The fee payments (pool ID and amount each) | +| payer | `address` | The address that paid the fees | + +### claimRewards + +Not implemented. + +```solidity +function claimRewards(bytes32[] memory) external pure override +``` + + + +### setFeeManager + +Sets the fee manager address. + +```solidity +function setFeeManager(address newFeeManager) external override +``` + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) external pure override returns (bool) +``` + + diff --git a/src/content/chainlink-local/api-reference/v0.3.1/mock-v3-aggregator.mdx b/src/content/chainlink-local/api-reference/v0.3.1/mock-v3-aggregator.mdx new file mode 100644 index 00000000000..f3880e203d1 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.1/mock-v3-aggregator.mdx @@ -0,0 +1,332 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockV3Aggregator v0.3.1 API Reference" +metadata: + description: "API documentation for MockV3Aggregator in Solidity, version v0.3.1." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockV3Aggregator + +A mock implementation of the AggregatorV2V3Interface for testing purposes. + +[`MockV3Aggregator`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-feeds/MockV3Aggregator.sol) + + + +## Variables + +### aggregator + +```solidity +address public aggregator +``` + + + +### proposedAggregator + +```solidity +address public proposedAggregator +``` + + + +### version + +```solidity +uint256 public constant override version = 0 +``` + + + +## Functions + +### confirmAggregator + +Confirms the proposed aggregator. + +```solidity +function confirmAggregator(address _aggregator) external +``` + + + +#### Parameters + +| Parameter | Type | Description | +| ------------ | --------- | -------------------------------------- | +| \_aggregator | `address` | The address of the proposed aggregator | + +#### Possible Reverts + +- Reverts if the provided aggregator address does not match the proposed aggregator with "Invalid proposed aggregator" + +### constructor + +Initializes the contract with decimals and initial answer. + +```solidity +constructor(uint8 _decimals, int256 _initialAnswer) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------------- | -------- | ----------------------------------------- | +| \_decimals | `uint8` | The number of decimals for the aggregator | +| \_initialAnswer | `int256` | The initial answer to be set | + +### decimals + +Gets the number of decimals used by the aggregator. + +```solidity +function decimals() external view returns (uint8) +``` + + + +#### Returns + +| Parameter | Type | Description | +| --------- | ------- | ---------------------- | +| (unnamed) | `uint8` | The number of decimals | + +### description + +Gets the description of the aggregator. + +```solidity +function description() external pure returns (string memory) +``` + + + +#### Returns + +| Parameter | Type | Description | +| --------- | -------- | ------------------------------------ | +| (unnamed) | `string` | The contract path as the description | + +### getAnswer + +Gets the answer for a specific round ID. + +```solidity +function getAnswer(uint256 roundId) external view returns (int256) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | ------------------------------ | +| roundId | `uint256` | The round ID to get answer for | + +#### Returns + +| Parameter | Type | Description | +| --------- | -------- | --------------------------------- | +| (unnamed) | `int256` | The answer for the given round ID | + +### getRoundData + +Gets the round data for a specific round ID. + +```solidity +function getRoundData(uint80 _roundId) + external + view + returns ( + uint80 roundId, + int256 answer, + uint256 startedAt, + uint256 updatedAt, + uint80 answeredInRound + ) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | -------- | -------------------------------- | +| \_roundId | `uint80` | The round ID to get the data for | + +#### Returns + +| Parameter | Type | Description | +| --------------- | --------- | --------------------------------------------- | +| roundId | `uint80` | The round ID | +| answer | `int256` | The answer for the round | +| startedAt | `uint256` | The timestamp when the round started | +| updatedAt | `uint256` | The timestamp when the round was updated | +| answeredInRound | `uint80` | The round ID in which the answer was computed | + +### getTimestamp + +Gets the timestamp for a specific round ID. + +```solidity +function getTimestamp(uint256 roundId) external view returns (uint256) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | --------------------------------- | +| roundId | `uint256` | The round ID to get timestamp for | + +#### Returns + +| Parameter | Type | Description | +| --------- | --------- | ------------------------------------ | +| (unnamed) | `uint256` | The timestamp for the given round ID | + +### latestAnswer + +Gets the latest answer from the aggregator. + +```solidity +function latestAnswer() external view returns (int256) +``` + + + +#### Returns + +| Parameter | Type | Description | +| --------- | -------- | ----------------- | +| (unnamed) | `int256` | The latest answer | + +### latestRound + +Gets the latest round ID from the aggregator. + +```solidity +function latestRound() external view returns (uint256) +``` + + + +#### Returns + +| Parameter | Type | Description | +| --------- | --------- | ------------------- | +| (unnamed) | `uint256` | The latest round ID | + +### latestRoundData + +Gets the latest round data. + +```solidity +function latestRoundData() + external + view + returns ( + uint80 roundId, + int256 answer, + uint256 startedAt, + uint256 updatedAt, + uint80 answeredInRound + ) +``` + + + +#### Returns + +| Parameter | Type | Description | +| --------------- | --------- | ---------------------------------------------------- | +| roundId | `uint80` | The latest round ID | +| answer | `int256` | The latest answer | +| startedAt | `uint256` | The timestamp when the latest round started | +| updatedAt | `uint256` | The timestamp when the latest round was updated | +| answeredInRound | `uint80` | The round ID in which the latest answer was computed | + +### latestTimestamp + +Gets the timestamp of the latest answer. + +```solidity +function latestTimestamp() external view returns (uint256) +``` + + + +#### Returns + +| Parameter | Type | Description | +| --------- | --------- | ---------------------------------- | +| (unnamed) | `uint256` | The timestamp of the latest answer | + +### proposeAggregator + +Proposes a new aggregator. + +```solidity +function proposeAggregator(AggregatorV2V3Interface _aggregator) external +``` + + + +#### Parameters + +| Parameter | Type | Description | +| ------------ | ------------------------- | -------------------------------------- | +| \_aggregator | `AggregatorV2V3Interface` | The address of the proposed aggregator | + +#### Possible Reverts + +- Reverts if the proposed aggregator is the zero address with "Proposed aggregator cannot be zero address" +- Reverts if the proposed aggregator is the current aggregator with "Proposed aggregator cannot be current aggregator" + +### updateAnswer + +Updates the answer in the mock aggregator. + +```solidity +function updateAnswer(int256 _answer) public +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | -------- | ------------------------ | +| \_answer | `int256` | The new answer to be set | + +### updateRoundData + +Updates the round data in the mock aggregator. + +```solidity +function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public +``` + + + +#### Parameters + +| Parameter | Type | Description | +| ----------- | --------- | ------------------------------------ | +| \_roundId | `uint80` | The round ID to be updated | +| \_answer | `int256` | The new answer to be set | +| \_timestamp | `uint256` | The timestamp to be set | +| \_startedAt | `uint256` | The timestamp when the round started | diff --git a/src/content/chainlink-local/api-reference/v0.3.1/mock-verifier-proxy.mdx b/src/content/chainlink-local/api-reference/v0.3.1/mock-verifier-proxy.mdx new file mode 100644 index 00000000000..3d40725b555 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.1/mock-verifier-proxy.mdx @@ -0,0 +1,146 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockVerifierProxy v0.3.1 API Reference" +metadata: + description: "API documentation for MockVerifierProxy in Solidity, version v0.3.1." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockVerifierProxy + +A mock implementation of the Data Streams verifier proxy for local testing. + +[`MockVerifierProxy`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-streams/MockVerifierProxy.sol) + + + +## Errors + +### ZeroAddress + +```solidity +error ZeroAddress() +``` + +### VerifierInvalid + +```solidity +error VerifierInvalid() +``` + + + +### VerifierNotFound + +```solidity +error VerifierNotFound() +``` + +### FeeManagerRequired + +```solidity +error FeeManagerRequired(string message) +``` + + + +### FeeManagerNotExpected + +```solidity +error FeeManagerNotExpected(string message) +``` + + + +## Events + +### VerifierInitialized + +```solidity +event VerifierInitialized(address indexed verifierAddress) +``` + +## Functions + +### verify + +Verifies a report payload, billing the caller first when a fee manager is set. + +```solidity +function verify(bytes calldata payload, bytes calldata parameterPayload) external payable returns (bytes memory) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| ---------------- | ------- | ---------------------------------------------------------------------------------------- | +| payload | `bytes` | The signed report payload | +| parameterPayload | `bytes` | The fee payment parameters (fee token address for on-chain billing, empty for off-chain) | + +### verifyBulk + +Verifies multiple report payloads in one call. + +```solidity +function verifyBulk(bytes[] calldata payloads, bytes calldata parameterPayload) external payable returns (bytes[] memory verifiedReports) +``` + +### initializeVerifier + +Initializes the verifier address. + +```solidity +function initializeVerifier(address verifierAddress) external onlyOwner +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------------- | --------- | ------------------------------------ | +| verifierAddress | `address` | The address of the verifier contract | + +### getVerifier + +Returns the verifier address. + +```solidity +function getVerifier(bytes32) external view returns (address) +``` + +### setFeeManager + +Sets the fee manager. + +```solidity +function setFeeManager(IVerifierFeeManager feeManager) external +``` + + + +#### Parameters + +| Parameter | Type | Description | +| ---------- | --------------------- | ------------------------------- | +| feeManager | `IVerifierFeeManager` | The fee manager contract to set | diff --git a/src/content/chainlink-local/api-reference/v0.3.1/mock-verifier.mdx b/src/content/chainlink-local/api-reference/v0.3.1/mock-verifier.mdx new file mode 100644 index 00000000000..00d120b7d11 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.1/mock-verifier.mdx @@ -0,0 +1,172 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "MockVerifier v0.3.1 API Reference" +metadata: + description: "API documentation for MockVerifier in Solidity, version v0.3.1." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## MockVerifier + +A mock implementation of the Data Streams verifier for local testing. + +[`MockVerifier`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-streams/MockVerifier.sol) + + + +## Errors + +### AccessForbidden + +```solidity +error AccessForbidden() +``` + + + +### InactiveFeed + +```solidity +error InactiveFeed(bytes32 feedId) +``` + +### DigestInactive + +```solidity +error DigestInactive(bytes32 feedId, bytes32 configDigest) +``` + +### BadVerification + +```solidity +error BadVerification() +``` + + + +### InvalidV + +```solidity +error InvalidV() +``` + +### AlreadyUsedSignature + +```solidity +error AlreadyUsedSignature() +``` + + + +### InvalidSignatureLength + +```solidity +error InvalidSignatureLength() +``` + +### InvalidS + +```solidity +error InvalidS() +``` + + + +## Events + +### ReportVerified + +```solidity +event ReportVerified(bytes32 indexed feedId, address indexed sender) +``` + +## Functions + +### constructor + +Initializes the contract with the verifier proxy address. + +```solidity +constructor(address verifierProxy) +``` + +#### Parameters + +| Parameter | Type | Description | +| ------------- | --------- | ------------------------------------------ | +| verifierProxy | `address` | The address of the verifier proxy contract | + +### verify + +Verifies a signed report and returns the report data. + +```solidity +function verify(bytes calldata signedReport, address sender) external returns (bytes memory verifierResponse) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| ------------ | --------- | ------------------------------------- | +| signedReport | `bytes` | The ABI-encoded signed report | +| sender | `address` | The address that submitted the report | + +#### Returns + +| Parameter | Type | Description | +| ---------------- | ------- | ----------------------- | +| verifierResponse | `bytes` | The decoded report data | + +### deactivateConfig + +Deactivates a config digest for a feed. + +```solidity +function deactivateConfig(bytes32 feedId, bytes32 configDigest) external +``` + +### activateConfig + +Activates a config digest for a feed. + +```solidity +function activateConfig(bytes32 feedId, bytes32 configDigest) external +``` + +### deactivateFeed + +Deactivates a feed. + +```solidity +function deactivateFeed(bytes32 feedId) external +``` + +### activateFeed + +Activates a feed. + +```solidity +function activateFeed(bytes32 feedId) external +``` + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) external pure override returns (bool) +``` + + diff --git a/src/content/chainlink-local/api-reference/v0.3.1/register.mdx b/src/content/chainlink-local/api-reference/v0.3.1/register.mdx new file mode 100644 index 00000000000..5e3c7693a43 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.1/register.mdx @@ -0,0 +1,138 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Register v0.3.1 API Reference" +metadata: + description: "API documentation for Register in Solidity, version v0.3.1." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## Register + +A contract that stores and retrieves network details for various chains. + +[`Register`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/ccip/Register.sol) + + + +## Structs + +### NetworkDetails + +Contains configuration details for a specific network/chain. + +| Field | Type | Description | +| -------------------------------- | --------- | -------------------------------------------- | +| chainSelector | `uint64` | Unique identifier for the chain in CCIP | +| routerAddress | `address` | Address of the CCIP Router contract | +| linkAddress | `address` | Address of the LINK token contract | +| wrappedNativeAddress | `address` | Address of the wrapped native token contract | +| ccipBnMAddress | `address` | Address of the CCIP BnM token contract | +| ccipLnMAddress | `address` | Address of the CCIP LnM token contract | +| rmnProxyAddress | `address` | Address of the RMN proxy contract | +| registryModuleOwnerCustomAddress | `address` | Address of the registry module owner | +| tokenAdminRegistryAddress | `address` | Address of the token admin registry contract | + +## Variables + +### s_networkDetails + +```solidity +mapping(uint256 chainId => NetworkDetails) internal s_networkDetails +``` + + + +### s_isOverridden + +```solidity +mapping(uint256 chainId => bool isOverridden) internal s_isOverridden +``` + + + +## Functions + +### constructor + +Initializes the contract. + +```solidity +constructor() +``` + + + +### getNetworkDetails + +Retrieves network details for a given chain ID. + +```solidity +function getNetworkDetails(uint256 chainId) external view returns (NetworkDetails memory networkDetails) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | ------------------------------------------ | +| chainId | `uint256` | The ID of the chain to get the details for | + +#### Returns + +| Parameter | Type | Description | +| -------------- | ---------------- | ---------------------------------------------- | +| networkDetails | `NetworkDetails` | The network details for the specified chain ID | + +### setNetworkDetails + +Sets the network details for a given chain ID. + +```solidity +function setNetworkDetails(uint256 chainId, NetworkDetails memory networkDetails) external +``` + + + +#### Parameters + +| Parameter | Type | Description | +| -------------- | ---------------- | ----------------------------------------------------- | +| chainId | `uint256` | The ID of the chain to set the details for | +| networkDetails | `NetworkDetails` | The network details to set for the specified chain ID | + +### shardAddress + +Returns the deterministic address of built-in data shard `index`. + +```solidity +function shardAddress(uint256 index) public view returns (address) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | ----------------------------------------- | +| index | `uint256` | The shard index (0 to `_SHARD_COUNT - 1`) | diff --git a/src/content/chainlink-local/api-reference/v0.3.1/report-versions.mdx b/src/content/chainlink-local/api-reference/v0.3.1/report-versions.mdx new file mode 100644 index 00000000000..a9880ac0511 --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.1/report-versions.mdx @@ -0,0 +1,142 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "ReportVersions v0.3.1 API Reference" +metadata: + description: "API documentation for ReportVersions in Solidity, version v0.3.1." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## ReportVersions + +An abstract contract that defines the Data Streams report schemas (`ReportV1` through `ReportV13`). + +[`ReportVersions`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-streams/ReportVersions.sol) + + + +## Structs + +### ReportV1 + + + +| Field | Type | Description | +| --------------------- | --------- | ---------------------------------------------------- | +| feedId | `bytes32` | The stream ID the report has data for | +| observationsTimestamp | `uint32` | Observation timestamp in seconds | +| benchmarkPrice | `int192` | DON consensus median benchmark price | +| bid | `int192` | Bid-side price estimate | +| ask | `int192` | Ask-side price estimate | +| currentBlockNum | `uint64` | Current block number used by the report | +| currentBlockHash | `bytes32` | Current block hash used by the report | +| validFromBlockNum | `uint64` | Earliest block number from which the report is valid | +| currentBlockTimestamp | `uint64` | Current block timestamp in seconds | + +### ReportV2 + + + +| Field | Type | Description | +| --------------------- | --------- | ---------------------------------------------------------- | +| feedId | `bytes32` | The feed ID the report has data for | +| validFromTimestamp | `uint32` | Earliest timestamp for which price is applicable | +| observationsTimestamp | `uint32` | Latest timestamp for which price is applicable | +| nativeFee | `uint192` | Base cost to validate a transaction, in the native token | +| linkFee | `uint192` | Base cost to validate a transaction, in LINK | +| expiresAt | `uint32` | Latest timestamp where the report can be verified on-chain | +| benchmarkPrice | `int192` | DON consensus median price | + +### ReportV3 + + + +| Field | Type | Description | +| --------------------- | --------- | ---------------------------------------------------------------------------------- | +| feedId | `bytes32` | The stream ID the report has data for | +| validFromTimestamp | `uint32` | Earliest timestamp for which price is applicable | +| observationsTimestamp | `uint32` | Latest timestamp for which price is applicable | +| nativeFee | `uint192` | Base cost to validate a transaction, in the native token | +| linkFee | `uint192` | Base cost to validate a transaction, in LINK | +| expiresAt | `uint32` | Latest timestamp where the report can be verified on-chain | +| price | `int192` | DON consensus median price | +| bid | `int192` | Simulated price impact of a buy order up to the X% depth of liquidity utilisation | +| ask | `int192` | Simulated price impact of a sell order up to the X% depth of liquidity utilisation | + +### ReportV4 + + + +| Field | Type | Description | +| --------------------- | --------- | ----------------------------------------------------------- | +| feedId | `bytes32` | The stream ID the report has data for | +| validFromTimestamp | `uint32` | Earliest timestamp for which price is applicable | +| observationsTimestamp | `uint32` | Latest timestamp for which price is applicable | +| nativeFee | `uint192` | Base cost to validate a transaction, in the native token | +| linkFee | `uint192` | Base cost to validate a transaction, in LINK | +| expiresAt | `uint32` | Latest timestamp where the report can be verified on-chain | +| price | `int192` | DON consensus median benchmark price | +| marketStatus | `uint32` | The DON's consensus on whether the market is currently open | + +### ReportV5 + + + +| Field | Type | Description | +| --------------------- | --------- | ---------------------------------------------------------- | +| feedId | `bytes32` | The stream ID the report has data for | +| validFromTimestamp | `uint32` | Earliest timestamp for which the report is applicable | +| observationsTimestamp | `uint32` | Latest timestamp for which the report is applicable | +| nativeFee | `uint192` | Base cost to validate a transaction, in the native token | +| linkFee | `uint192` | Base cost to validate a transaction, in LINK | +| expiresAt | `uint32` | Latest timestamp where the report can be verified on-chain | +| rate | `int192` | Reported rate value | +| timestamp | `uint32` | Rate timestamp in seconds | +| duration | `uint32` | Duration window in seconds | + +### ReportV6 + + + +| Field | Type | Description | +| --------------------- | --------- | ---------------------------------------------------------- | +| feedId | `bytes32` | The stream ID the report has data for | +| validFromTimestamp | `uint32` | Earliest timestamp for which the report is applicable | +| observationsTimestamp | `uint32` | Latest timestamp for which the report is applicable | +| nativeFee | `uint192` | Base cost to validate a transaction, in the native token | +| linkFee | `uint192` | Base cost to validate a transaction, in LINK | +| expiresAt | `uint32` | Latest timestamp where the report can be verified on-chain | +| price | `int192` | Primary price value | +| price2 | `int192` | Secondary price value | +| price3 | `int192` | Third price value | +| price4 | `int192` | Fourth price value | +| price5 | `int192` | Fifth price value | + +### ReportV7 through ReportV13 + + diff --git a/src/content/chainlink-local/api-reference/v0.3.1/weth9.mdx b/src/content/chainlink-local/api-reference/v0.3.1/weth9.mdx new file mode 100644 index 00000000000..b278a2c18ce --- /dev/null +++ b/src/content/chainlink-local/api-reference/v0.3.1/weth9.mdx @@ -0,0 +1,252 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "WETH9 v0.3.1 API Reference" +metadata: + description: "API documentation for WETH9 in Solidity, version v0.3.1." +--- + +import { Aside } from "@components" +import Common from "@features/chainlink-local/Common.astro" + + + +## WETH9 + +A contract that implements Wrapped Ether (WETH), allowing users to wrap and unwrap ETH. + +[`WETH9`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/shared/WETH9.sol) + + + +## Variables + +### allowance + +```solidity +mapping(address => mapping(address => uint256)) public allowance +``` + + + +### balanceOf + +```solidity +mapping(address => uint256) public balanceOf +``` + + + +### decimals + +```solidity +uint8 public decimals = 18 +``` + + + +### name + +```solidity +string public name = "Wrapped Ether" +``` + + + +### symbol + +```solidity +string public symbol = "WETH" +``` + + + +## Events + +### Approval + +```solidity +event Approval(address indexed src, address indexed guy, uint256 wad) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | ----------------------------------- | +| src | `address` | The address giving the approval | +| guy | `address` | The address receiving the approval | +| wad | `uint256` | The amount of tokens being approved | + +### Deposit + +```solidity +event Deposit(address indexed dst, uint256 wad) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | ------------------------------- | +| dst | `address` | The address receiving the WETH | +| wad | `uint256` | The amount of ETH being wrapped | + +### Transfer + +```solidity +event Transfer(address indexed src, address indexed dst, uint256 wad) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | -------------------------------------- | +| src | `address` | The address sending the tokens | +| dst | `address` | The address receiving the tokens | +| wad | `uint256` | The amount of tokens being transferred | + +### Withdrawal + +```solidity +event Withdrawal(address indexed src, uint256 wad) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | ---------------------------------- | +| src | `address` | The address unwrapping the WETH | +| wad | `uint256` | The amount of WETH being unwrapped | + +## Functions + +### approve + +Approves another address to spend tokens. + +```solidity +function approve(address guy, uint256 wad) public returns (bool) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | ------------------------------- | +| guy | `address` | The address to approve | +| wad | `uint256` | The amount of tokens to approve | + +#### Returns + +| Parameter | Type | Description | +| --------- | ------ | ------------------- | +| (unnamed) | `bool` | Always returns true | + +### deposit + +Deposits ETH to receive WETH. + +```solidity +function deposit() external payable +``` + + + +### totalSupply + +Gets the total supply of WETH. + +```solidity +function totalSupply() public view returns (uint256) +``` + + + +#### Returns + +| Parameter | Type | Description | +| --------- | --------- | ------------------------ | +| (unnamed) | `uint256` | The total supply of WETH | + +### transfer + +Transfers tokens to another address. + +```solidity +function transfer(address dst, uint256 wad) public returns (bool) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | -------------------------------- | +| dst | `address` | The recipient address | +| wad | `uint256` | The amount of tokens to transfer | + +#### Returns + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------- | +| (unnamed) | `bool` | Returns true if the transfer succeeds | + +### transferFrom + +Transfers tokens from one address to another. + +```solidity +function transferFrom(address src, address dst, uint256 wad) public returns (bool) +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | -------------------------------- | +| src | `address` | The source address | +| dst | `address` | The destination address | +| wad | `uint256` | The amount of tokens to transfer | + +#### Returns + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------- | +| (unnamed) | `bool` | Returns true if the transfer succeeds | + +#### Possible Reverts + +- Reverts if the source address has insufficient balance +- Reverts if the caller has insufficient allowance (unless caller is source or has maximum allowance) + +### withdraw + +Withdraws ETH by unwrapping WETH. + +```solidity +function withdraw(uint256 wad) external +``` + + + +#### Parameters + +| Parameter | Type | Description | +| --------- | --------- | ---------------------------- | +| wad | `uint256` | The amount of WETH to unwrap | + +#### Possible Reverts + +- Reverts if the caller has insufficient WETH balance diff --git a/src/content/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork.mdx b/src/content/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork.mdx index 1adf27d6485..d2181728c6d 100644 --- a/src/content/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork.mdx +++ b/src/content/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork.mdx @@ -11,13 +11,15 @@ import CcipCommon from "@features/ccip/CcipCommon.astro" -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. +This tutorial walks you through testing the procedure of enabling your own tokens in CCIP 2.0, using the [CCIP Foundry Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-foundry)'s Example 06 (CCT 01). You will deploy a `CrossChainToken` (a CCT-compatible ERC-20 that exposes `getCCIPAdmin()`) with a Burn & Mint pool on forks of _Ethereum Sepolia_ and _Polygon Amoy_, register it in the live TokenAdminRegistry, link the pools, opt them into Fast Transfers, and send a transfer across the CCIP 2.0 lane with `CCIPLocalSimulatorFork` routing the message. + +The kit runs this exact flow as a fork test (`test/fork/Example06.fork.t.sol`), so every step below is verified against pinned forks of the live testnets. ## Prerequisites Before we start with this guide, let's recap parts of the CCT standard that we will need for it. @@ -26,7 +28,7 @@ Before we start with this guide, let's recap parts of the CCT standard that we w 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: +- **Recommended permissionless token administrator address registration methods**: A token can use either of these supported function signatures to register permissionlessly: - `owner()`: This function returns the token contract owner's address. - `getCCIPAdmin()`: This function returns the token administrator's address and is recommended for new tokens, as it allows for abstraction of the CCIP Token Administrator role from other common roles, like `owner()`. @@ -44,13 +46,8 @@ Before enabling an ERC20-compatible token in CCIP, it's important to understand - `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. +If you don't have an existing token, the kit deploys a `CrossChainToken` for you: a `BaseERC20` with `getCCIPAdmin()`, mint and burn roles, and a pre-mint, configured in one constructor call. ### Understanding the Procedure @@ -66,755 +63,209 @@ The diagram below outlines the entire process: ## 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. +1. **Install Foundry >= 1.5.1**: If you haven't already, follow the instructions in the [Foundry documentation](https://book.getfoundry.sh/getting-started/installation). -1. **Create new Foundry project**: Create a new Foundry project by running the following command: +1. **Clone the starter kit** and initialize the submodules one level deep: ```bash - forge init + git clone https://github.com/smartcontractkit/ccip-starter-kit-foundry + cd ccip-starter-kit-foundry + git submodule update --init ``` -1. **Set up your environment**: Create a `.env` file, and fill in the required values: - - Example `.env` file: +1. **Set up your environment**: Copy `.env.example` to `.env` and fill in archive-capable RPC endpoints for both chains: ```bash ETHEREUM_SEPOLIA_RPC_URL= - BASE_SEPOLIA_RPC_URL= + POLYGON_AMOY_RPC_URL= ``` -## Create the `getCCIPAdmin()` ERC-20 token +1. **Import a keystore account** for script execution: -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. + ```bash + cast wallet import myAccount --interactive + ``` -Create the CCT-compatible ERC-20 token with `getCCIPAdmin()` function and burning and minting capabilities. + This tutorial assumes `--account myAccount`. -```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 +## Step 1: Deploy the token and pool on Ethereum Sepolia (source) -Expand the existing `CCIPv1_5ForkBurnMintPoolFork.t.sol` file to create and set up our basic test. +Run the `DeployCCTBurnMintTokenAndPool` script. It deploys the `CrossChainToken` (name `TestToken`, symbol `TEST`, 18 decimals, `1_000_000e18` pre-mint to the broadcaster, `100_000_000e18` max supply), the BurnMint pool, grants the pool mint and burn roles on the token, registers the token admin via `getCCIPAdmin()`, accepts the admin role, and sets the pool in the TokenAdminRegistry: -```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)); - } -} +```bash +FOUNDRY_PROFILE=cct forge script script/examples/Example06.s.sol:DeployCCTBurnMintTokenAndPool \ + --rpc-url ethereumSepolia \ + --account myAccount \ + --broadcast \ + --sig "run(address,address,address,address)" \ + \ + \ + \ + ``` -#### Step 1) Deploy token on Ethereum Sepolia +Read the four addresses from the [CCIP Directory](/ccip/directory/testnet) (or from `Register.getNetworkDetails(11155111)`). Save from the logs: -```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 +## Step 2: Deploy the token and pool on Polygon Amoy (destination) -```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(); - } -} +Repeat the same script on Amoy: + +```bash +FOUNDRY_PROFILE=cct forge script script/examples/Example06.s.sol:DeployCCTBurnMintTokenAndPool \ + --rpc-url polygonAmoy \ + --account myAccount \ + --broadcast \ + --sig "run(address,address,address,address)" \ + \ + \ + \ + ``` -#### Step 3) Deploy BurnMintTokenPool on Ethereum Sepolia +Save `` and ``. -```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 3: Configure the Sepolia pool with the Amoy remote -#### Step 4) Deploy BurnMintTokenPool on Base Sepolia +The `Example06` script links a pool to its remote chain: it sets the remote token, the remote pool, and (in this example) a disabled rate limiter. Re-running it for the same remote chain selector replaces the existing config: -```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(); - } -} +```bash +FOUNDRY_PROFILE=cct forge script script/examples/Example06.s.sol:Example06 \ + --rpc-url ethereumSepolia \ + --account myAccount \ + --broadcast \ + --sig "run(address,uint64,address,address)" \ + \ + \ + \ + ``` -#### Step 5) Grant Mint and Burn roles to BurnMintTokenPool on Ethereum Sepolia - -```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 4: Configure the Amoy pool with the Sepolia remote + +```bash +FOUNDRY_PROFILE=cct forge script script/examples/Example06.s.sol:Example06 \ + --rpc-url polygonAmoy \ + --account myAccount \ + --broadcast \ + --sig "run(address,uint64,address,address)" \ + \ + \ + \ + ``` -#### Step 6) Grant Mint and Burn roles to BurnMintTokenPool on Base Sepolia +## Step 5: (Optional) Enable Fast Transfers on both pools -```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(); - } -} +New pools allow full finality only (`0x00000000`): every transfer waits for full finality. To opt a pool into Faster Than Finality, set its allowed finality config to a minimum block depth: + +```bash +FOUNDRY_PROFILE=cct forge script script/examples/Example06.s.sol:Example06SetPoolAllowedFinalityConfig \ + --rpc-url ethereumSepolia \ + --account myAccount \ + --broadcast \ + --sig "run(address,bytes4)" \ + \ + ``` -#### Step 7) Claim Admin role on Ethereum Sepolia +Repeat on Amoy with `--rpc-url polygonAmoy` and ``. `0x00000000` disables Faster Than Finality; values `0x00000001`-`0x0000ffff` set the minimum block depth. Read each pool back with the `Example06GetPoolAllowedFinalityConfig` script. -```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(); - } -} -``` +Before an FTF send, check the lane's finality gates (pool, executor and CCV settings) with the read-only `Example06CheckFinalityGates` script. A `getFee` quote alone does not prove `ccipSend` will succeed for a non-`IPoolV2` pool. -#### Step 8) Claim Admin role on Base Sepolia +## Step 6: Send the transfer across the lane -```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(); - } -} +Send with default finality (`blockConfirmations = 0`): + +```bash +FOUNDRY_PROFILE=cct forge script script/examples/Example06.s.sol:SendCCTTokenWithExtraArgsV3DefaultFinality \ + --rpc-url ethereumSepolia \ + --account myAccount \ + --broadcast \ + --sig "run(address,uint64,address,address,uint256,uint32,address)" \ + \ + \ + \ + \ + \ + \ + ``` -#### Step 9) Accept Admin role on Ethereum Sepolia +Parameter notes: -```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(); - } -} -``` +- `` uses token decimals (`1e18` is 1 token for an 18-decimal token). +- ``: set to `0` for a token-only transfer to an EOA receiver. +- ``: the LINK token address on Sepolia to pay in LINK, or `0x0000000000000000000000000000000000000000` to pay in native. -#### Step 10) Accept Admin role on Base Sepolia +For the Faster Than Finality version (after Step 5), use `SendCCTTokenWithExtraArgsV3CustomFinality` with the same signature plus ``. -```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(); - } -} -``` +The script logs the message ID. Monitor the message on [CCIP Explorer](https://ccip.chain.link). + +## Run the same flow as a fork test -#### Step 11) Link token to pool on Ethereum Sepolia +The kit's `test/fork/Example06.fork.t.sol` runs this entire procedure against pinned forks of the live testnets, with `CCIPLocalSimulatorFork` routing each message to the Amoy OffRamp. The core of the test: ```solidity -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(); - } -} +// Deploy on both forks through the real script +(sepoliaToken, sepoliaPool) = _deploy(sepoliaFork, sepolia); +(amoyToken, amoyPool) = _deploy(amoyFork, amoy); + +// Link the pools through the real script +vm.selectFork(sepoliaFork); +configureLaneScript.run(sepoliaPool, amoy.chainSelector, amoyToken, amoyPool); +vm.selectFork(amoyFork); +configureLaneScript.run(amoyPool, sepolia.chainSelector, sepoliaToken, sepoliaPool); + +// Send on Sepolia and route to the Amoy OffRamp +vm.selectFork(sepoliaFork); +sendDefaultFinality.run( + sepolia.routerAddress, amoy.chainSelector, receiver, sepoliaToken, TRANSFER_AMOUNT, + EOA_RECEIVER_GAS_LIMIT, address(0) +); +simulator.switchChainAndRouteMessage(amoyFork); + +// Burn & Mint: supply shrinks on the source and grows on the destination +assertEq(_balanceOnFork(amoyFork, amoyToken, receiver), TRANSFER_AMOUNT); +assertEq(_supplyOnFork(amoyFork, amoyToken), destinationSupplyBefore + TRANSFER_AMOUNT); ``` -#### Step 12) Link token to pool on Base Sepolia +Run it with: -```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(); - } -} +```bash +FOUNDRY_PROFILE=fork forge test --match-contract Example06ForkTest -j 1 ``` -#### Step 13) Configure Token Pool on Ethereum Sepolia +The fork test also covers the Faster Than Finality gates: it asserts the pool rejects block-depth requests until `setAllowedFinalityConfig` opts it in, then finds the smallest depth the live lane accepts and delivers the transfer at that depth. -```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(); - } -} -``` +## Verify the result on the live testnets -#### Step 14) Configure Token Pool on Base Sepolia +After the transfer finalizes, verify the registration and the lane mapping: -```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(); - } -} +```bash +cast call "getPool(address)(address)" --rpc-url ethereumSepolia +cast call "getRemoteToken(uint64)(bytes)" --rpc-url ethereumSepolia +cast call "getRemotePools(uint64)(bytes[])" --rpc-url ethereumSepolia ``` -#### Step 15) Mint tokens on Ethereum Sepolia and transfer them to Base Sepolia +Verify the Burn & Mint behavior (burn on source, mint on destination): -```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); - } -} +```bash +cast call "balanceOf(address)(uint256)" --rpc-url ethereumSepolia +cast call "balanceOf(address)(uint256)" --rpc-url polygonAmoy +cast call "totalSupply()(uint256)" --rpc-url ethereumSepolia +cast call "totalSupply()(uint256)" --rpc-url polygonAmoy ``` -## Final code - full example +## Next steps -```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); - } -} -``` +- For the Lock & Release flow (with a lock box and liquidity funding), read the [CCT lock and release tutorial](/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork). +- For the full CCT registration procedure against live testnets (not forks), read [Register a new Burn and Mint token from an EOA](/ccip/evm/tutorials/cross-chain-tokens/register-from-eoa-burn-mint-foundry). diff --git a/src/content/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork.mdx b/src/content/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork.mdx index c58eb041a0d..65cd554c575 100644 --- a/src/content/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork.mdx +++ b/src/content/chainlink-local/build/ccip/foundry/cct-lock-and-release-fork.mdx @@ -1,7 +1,7 @@ --- section: chainlinkLocal date: Last Modified -title: "CCT - owner() token with Lock and Release Pool in forked environments" +title: "CCT - getCCIPAdmin() token with Lock and Release Pool in forked environments" isIndex: false --- @@ -11,13 +11,17 @@ import CcipCommon from "@features/ccip/CcipCommon.astro" -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. +This tutorial walks you through testing the Lock & Release flow for enabling your own tokens in CCIP 2.0, using the [CCIP Foundry Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-foundry)'s Example 07 (CCT 02). You will deploy a `CrossChainToken` (a CCT-compatible ERC-20 that exposes `getCCIPAdmin()`) with an `ERC20LockBox` and a Lock & Release pool on forks of _Ethereum Sepolia_ and _Polygon Amoy_, fund the destination lock box with liquidity, and send a transfer across the CCIP 2.0 lane with `CCIPLocalSimulatorFork` routing the message. + +The kit runs this exact flow as a fork test (`test/fork/Example07.fork.t.sol`), so every step below is verified against pinned forks of the live testnets. ## Prerequisites Before we start with this guide, let's recap parts of the CCT standard that we will need for it. @@ -26,7 +30,7 @@ Before we start with this guide, let's recap parts of the CCT standard that we w 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: +- **Recommended permissionless token administrator address registration methods**: A token can use either of these supported function signatures to register permissionlessly: - `owner()`: This function returns the token contract owner's address. - `getCCIPAdmin()`: This function returns the token administrator's address and is recommended for new tokens, as it allows for abstraction of the CCIP Token Administrator role from other common roles, like `owner()`. @@ -36,21 +40,13 @@ Before enabling an ERC20-compatible token in CCIP, it's important to understand - **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**: + - **Lock & Release Requirements**: - The token smart contract must have the following functions: - `decimals()`: Returns the token's number of decimals. - `balanceOf(address account)`: Returns the current token balance of the specified `account`. - - On the destination blockchain, The token contract must support granting mint and burn permissions. The token developers or another role (such as the token administrator) will grant these permissions to the token pool. + - 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. +In the Lock & Release flow, the source pool locks the tokens in its lock box and the destination pool releases tokens from its own lock box liquidity. Nothing is burned or minted: the total supply stays constant on every chain, and the destination lock box must hold enough liquidity before a transfer can execute. ### Understanding the Procedure @@ -66,710 +62,173 @@ The diagram below outlines the entire process: ## 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. - -1. **Create new Foundry project**: Create a new Foundry project by running the following command: - - ```bash - forge init - ``` +Complete the [CCT burn and mint tutorial](/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork) prerequisites: clone the kit, initialize the submodules, set `ETHEREUM_SEPOLIA_RPC_URL` and `POLYGON_AMOY_RPC_URL` in `.env`, and import a keystore account (`cast wallet import myAccount --interactive`). This tutorial assumes `--account myAccount` and `FOUNDRY_PROFILE=cct` for the deployment commands. -1. **Set up your environment**: Create a `.env` file, and fill in the required values: +## Step 1: Deploy the token, lock box and pool on Ethereum Sepolia (source) - Example `.env` file: +Run the `DeployCCTLockReleaseTokenAndPool` script. It deploys the `CrossChainToken` (name `TestToken`, symbol `TEST`, 18 decimals, `1_000_000e18` pre-mint to the broadcaster, `100_000_000e18` max supply), the `ERC20LockBox`, and the Lock & Release pool (wired to the lock box), authorizes the pool as a lock box caller, registers the token admin via `getCCIPAdmin()`, accepts the admin role, and sets the pool in the TokenAdminRegistry: - ```bash - ETHEREUM_SEPOLIA_RPC_URL= - BASE_SEPOLIA_RPC_URL= - ``` - -## 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. - -```solidity -// test/CCIPv1_5LockReleasePoolFork.t.sol +```bash +FOUNDRY_PROFILE=cct forge script script/examples/Example07.s.sol:DeployCCTLockReleaseTokenAndPool \ + --rpc-url ethereumSepolia \ + --account myAccount \ + --broadcast \ + --sig "run(address,address,address,address)" \ + \ + \ + \ + +``` -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +Read the four addresses from the [CCIP Directory](/ccip/directory/testnet). Save from the logs: -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") {} +## Step 2: Deploy the token, lock box and pool on Polygon Amoy (destination) - function mint(address account, uint256 amount) public onlyOwner { - _mint(account, amount); - } -} +```bash +FOUNDRY_PROFILE=cct forge script script/examples/Example07.s.sol:DeployCCTLockReleaseTokenAndPool \ + --rpc-url polygonAmoy \ + --account myAccount \ + --broadcast \ + --sig "run(address,address,address,address)" \ + \ + \ + \ + ``` -## Test the CCT enabling procedure - -Expand the existing `CCIPv1_5LockReleasePoolFork.t.sol` file to create and set up our basic test. +Save ``, `` and ``. -```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 3: Configure each pool with the other chain as its remote -#### Step 1) Deploy token on Ethereum Sepolia +The `Example07` script links a pool to its remote chain (remote token, remote pool, disabled rate limiter in this example). Run it on both chains: -```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(); - } -} +```bash +FOUNDRY_PROFILE=cct forge script script/examples/Example07.s.sol:Example07 \ + --rpc-url ethereumSepolia \ + --account myAccount \ + --broadcast \ + --sig "run(address,uint64,address,address)" \ + \ + \ + \ + ``` -#### Step 2) Deploy token on Base Sepolia - -```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(); - } -} +```bash +FOUNDRY_PROFILE=cct forge script script/examples/Example07.s.sol:Example07 \ + --rpc-url polygonAmoy \ + --account myAccount \ + --broadcast \ + --sig "run(address,uint64,address,address)" \ + \ + \ + \ + ``` -#### Step 3) Deploy LockReleaseTokenPool on Ethereum Sepolia +## Step 4: Fund the destination lock box with liquidity -```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(); - } -} -``` +Before a Sepolia → Amoy transfer can execute, the Amoy lock box must hold tokens to release. Fund it with the `FundCCTLockBoxLiquidity` script: -#### Step 4) Deploy LockReleaseTokenPool on Base Sepolia - -```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(); - } -} +```bash +FOUNDRY_PROFILE=cct forge script script/examples/Example07.s.sol:FundCCTLockBoxLiquidity \ + --rpc-url polygonAmoy \ + --account myAccount \ + --broadcast \ + --sig "run(address,address,uint256)" \ + \ + \ + ``` -#### Step 5) Set the LiquidityManager address and Add liquidity to the pool on Ethereum Sepolia + -```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 5: Send the transfer across the lane -#### Step 6) Set the LiquidityManager address and Add liquidity to the pool on Base Sepolia +Send with default finality using the shared CCT sender script: -```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(); - } -} +```bash +FOUNDRY_PROFILE=cct forge script script/examples/Example06.s.sol:SendCCTTokenWithExtraArgsV3DefaultFinality \ + --rpc-url ethereumSepolia \ + --account myAccount \ + --broadcast \ + --sig "run(address,uint64,address,address,uint256,uint32,address)" \ + \ + \ + \ + \ + \ + \ + ``` -#### Step 7) Claim Admin role on Ethereum Sepolia +- ``: set to `0` for a token-only transfer to an EOA receiver. +- ``: the LINK token address on Sepolia to pay in LINK, or `0x0000000000000000000000000000000000000000` to pay in native. -```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(); - } -} -``` +The script logs the message ID. Monitor the message on [CCIP Explorer](https://ccip.chain.link). -#### Step 8) Claim Admin role on Base Sepolia +## Run the same flow as a fork test -```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 +The kit's `test/fork/Example07.fork.t.sol` runs this entire procedure against pinned forks of the live testnets. The core of the test: ```solidity -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(); - } -} -``` +// Deploy on both forks through the real script +(sepoliaToken, sepoliaLockBox, sepoliaPool) = _deploy(sepoliaFork, sepolia); +(amoyToken, amoyLockBox, amoyPool) = _deploy(amoyFork, amoy); -#### Step 10) Accept Admin role on Base Sepolia +// Link the pools through the real script +vm.selectFork(sepoliaFork); +configureLaneScript.run(sepoliaPool, amoy.chainSelector, amoyToken, amoyPool); +vm.selectFork(amoyFork); +configureLaneScript.run(amoyPool, sepolia.chainSelector, sepoliaToken, sepoliaPool); -```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(); - } -} -``` +// Fund the destination lock box first +vm.selectFork(amoyFork); +fundLockBoxScript.run(amoyToken, amoyLockBox, DESTINATION_LIQUIDITY); -#### Step 11) Link token to pool on Ethereum Sepolia +// Send on Sepolia and route to the Amoy OffRamp +_sendDefaultFinalityAndRoute(sepoliaToken, TRANSFER_AMOUNT); -```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(); - } -} +// Lock & Release: supply is unchanged on both chains +assertEq(_balanceOnFork(sepoliaFork, sepoliaToken, sepoliaLockBox), TRANSFER_AMOUNT); +assertEq(_supplyOnFork(sepoliaFork, sepoliaToken), PREMINT); +assertEq(_balanceOnFork(amoyFork, amoyToken, receiver), TRANSFER_AMOUNT); +assertEq(_balanceOnFork(amoyFork, amoyToken, amoyLockBox), DESTINATION_LIQUIDITY - TRANSFER_AMOUNT); +assertEq(_supplyOnFork(amoyFork, amoyToken), PREMINT); ``` -#### Step 12) Link token to pool on Base Sepolia +Run it with: -```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(); - } -} +```bash +FOUNDRY_PROFILE=fork forge test --match-contract Example07ForkTest -j 1 ``` -#### Step 13) Configure Token Pool on Ethereum Sepolia +The fork test also asserts the empty-lock-box failure: it sends without funding the Amoy lock box and expects the routing call to revert with `CCIPLocalSimulatorFork__MessageExecutionFailed`, which is the strict-routing surface of the destination OffRamp's recorded failure. -```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(); - } -} -``` +## Verify the result on the live testnets -#### Step 14) Configure Token Pool on Base Sepolia +After the transfer finalizes, verify the registration, the lane mapping and the Lock & Release behavior: -```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(); - } -} +```bash +cast call "getPool(address)(address)" --rpc-url ethereumSepolia +cast call "getRemoteToken(uint64)(bytes)" --rpc-url ethereumSepolia +cast call "balanceOf(address)(uint256)" --rpc-url ethereumSepolia +cast call "balanceOf(address)(uint256)" --rpc-url polygonAmoy +cast call "balanceOf(address)(uint256)" --rpc-url polygonAmoy ``` -#### Step 15) Mint tokens on Ethereum Sepolia and transfer them to Base Sepolia +The total supply on each chain is unchanged: nothing was burned or minted. -```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 +## Next steps -```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); - } -} -``` +- For the Burn & Mint flow, read the [CCT burn and mint tutorial](/chainlink-local/build/ccip/foundry/cct-burn-and-mint-fork). +- For pool hooks, pool-based CCVs and policy engines, see the kit's Examples 08-10 (`AdvancedPoolHooks`). +- For the full CCT registration procedure against live testnets (not forks), read [Register a new Lock and Mint token from an EOA](/ccip/evm/tutorials/cross-chain-tokens/register-from-eoa-lock-mint-foundry). diff --git a/src/content/chainlink-local/build/ccip/foundry/data-messages-receiver-ccv-config.mdx b/src/content/chainlink-local/build/ccip/foundry/data-messages-receiver-ccv-config.mdx new file mode 100644 index 00000000000..517a21dce5f --- /dev/null +++ b/src/content/chainlink-local/build/ccip/foundry/data-messages-receiver-ccv-config.mdx @@ -0,0 +1,187 @@ +--- +section: chainlinkLocal +date: Last Modified +title: "Sending data to a receiver with CCV config in your Foundry project" +isIndex: false +--- + +import Common from "@features/chainlink-local/Common.astro" + + + +This guide walks you through the CCIP 2.0 receiver-side finality rules in local mode, using the [CCIP Foundry Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-foundry)'s Example 02. You will send a data-only message to a `BasicMessageReceiverWithCCVs` contract with Fast Transfers, and see the local router reject it when the requested block confirmations fall below the receiver's minimum block depth. + +The Example 01 guide covers a token-only transfer to an EOA, which is exactly the case that skips the receiver finality check. This guide covers the opposite case: a message with data and a receiver contract, where the local router reads the receiver's `getCCVsAndFinalityConfig` and enforces its allowed finality, reproducing the CCIP 2.0 OffRamp check. Read [CCIP 2.0 behavior in local mode](/chainlink-local/learn/ccip-v2-local) for the full rule list. + +## Prerequisites + +Complete the [Foundry local simulator guide](/chainlink-local/build/ccip/foundry/local-simulator) first: it covers cloning the kit, initializing the submodules, and the `LocalSimulatorTest` setup this guide builds on. + +## Test data messages to a receiver with CCV config + +The test file `Example02.t.sol` is located in the `./test` directory. It runs the real Example 02 scripts (`script/examples/Example02.s.sol`) against the Chainlink Local simulator. The file contains eight test cases: + +1. **Deploy**: The deploy script wires the receiver to the router and the broadcaster owns it. +1. **Deliver above the minimum depth**: A Fast Transfer with confirmations above the receiver's `minBlockDepth` is delivered. +1. **Deliver at the minimum depth**: Confirmations equal to `minBlockDepth` are also delivered. +1. **Deliver with a CCV config applied**: A receiver with required and optional CCVs still gates on `minBlockDepth`. +1. **Revert below the minimum depth**: Confirmations below `minBlockDepth` revert with `FinalityCodec.InvalidRequestedFinality`. +1. **Revert when the minimum depth is unset**: Without a configured depth, the receiver accepts finalized messages only. +1. **Argument validation**: The `SetBasicMessageReceiverWithCCVsMinBlockDepth` script rejects a zero source chain selector. +1. **Send-time validation**: The send script requires `blockConfirmations > 0`, so every send in this file is a Fast Transfer. + +In your terminal, run the following command to execute the test: + + ```shell + forge test --match-contract Example02Test + ``` + +Example output: + + ```text + $ forge test --match-contract Example02Test + [⠊] Compiling... + No files changed, compilation skipped + + Ran 8 tests for test/Example02.t.sol:Example02Test + [PASS] test_deliversMessageWhenConfirmationsAreAtLeastMinBlockDepth() (gas: 2033236) + [PASS] test_deliversMessageWhenConfirmationsEqualMinBlockDepth() (gas: 1993766) + [PASS] test_deliversMessageWhenReceiverHasCCVConfigApplied() (gas: 3418578) + [PASS] test_deployScriptWiresReceiverToRouterAndBroadcasterOwnsIt() (gas: 17951) + [PASS] test_revertsWhenConfirmationsAreBelowMinBlockDepth() (gas: 1835829) + [PASS] test_revertsWhenMinBlockDepthIsUnsetSoOnlyFullFinalityIsAccepted() (gas: 1233516) + [PASS] test_sendScriptRequiresNonZeroBlockConfirmations() (gas: 41304) + [PASS] test_setMinBlockDepthScriptRejectsZeroSourceChainSelector() (gas: 572902) + Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 3.21ms (3.83ms CPU time) + + Ran 1 test suite in 6.65ms (3.21ms CPU time): 8 tests passed, 0 failed, 0 skipped (8 total tests) + ``` + +## Examine the code + +### The receiver contract + +`src/BasicMessageReceiverWithCCVs.sol` extends `BasicMessageReceiver` with a per-source-chain CCV and finality policy. Two settings matter for this guide: + +- `setMinBlockDepth(sourceChainSelector, minBlockDepth)`: the minimum block depth the receiver accepts for Fast Transfers from that chain. `0` means the receiver requires default finality (fully finalized messages only). +- `getCCVsAndFinalityConfig(sourceChainSelector, sender)`: the CCIP 2.0 receiver interface the OffRamp calls for every message that is not a token-only transfer. The kit's receiver returns its stored CCV config and encodes `minBlockDepth` as the allowed finality with `FinalityCodec._encodeBlockDepth`. + +### Setup + +The `setUp()` function deploys the receiver through the kit's deploy script, so the test exercises the same deployment path the book's live-testnet flow uses: + +```solidity +function setUp() public override { + super.setUp(); + example = new Example02(); + receiver = BasicMessageReceiverWithCCVs(new DeployBasicMessageReceiverWithCCVs().run(address(router))); +} +``` + +The helper functions wrap the two scripts the test drives: + +```solidity +function _setMinBlockDepth(uint16 minBlockDepth) internal { + new SetBasicMessageReceiverWithCCVsMinBlockDepth().run(address(receiver), chainSelector, minBlockDepth); +} + +function _send(uint16 blockConfirmations) internal returns (bytes32) { + return example.run( + address(router), chainSelector, address(receiver), MESSAGE_TEXT, GAS_LIMIT, blockConfirmations, address(0) + ); +} +``` + +The constants used: + +```solidity +string internal constant MESSAGE_TEXT = "Hello CCIP 2.0"; +uint32 internal constant GAS_LIMIT = 200_000; +``` + +`GAS_LIMIT` must be `> 0`: the receiver has a `ccipReceive` callback to execute, unlike the EOA receiver of Example 01. + +### Deliver when confirmations meet the minimum depth + +`test_deliversMessageWhenConfirmationsAreAtLeastMinBlockDepth` sets the receiver's minimum depth to `3` and sends with `5` confirmations: + +```solidity +_setMinBlockDepth(3); + +bytes32 messageId = _send(5); + +assertEq(receiver.latestMessageId(), messageId); +assertEq(receiver.latestSourceChainSelector(), chainSelector); +assertEq(receiver.latestSender(), broadcaster); +assertEq(receiver.latestMessage(), abi.encode(MESSAGE_TEXT)); +``` + +Inside the send, the local router parses the `ExtraArgsV3` requested finality, sees the message has data (not a token-only transfer), and calls the receiver's `getCCVsAndFinalityConfig`. The receiver's allowed finality is `FinalityCodec._encodeBlockDepth(3)`; the requested `5` is at least that, so the message is delivered synchronously and the assertions read the receiver's stored state directly. + +`test_deliversMessageWhenConfirmationsEqualMinBlockDepth` sends with exactly `3` confirmations and passes: the check is inclusive. + +### Revert when confirmations fall below the minimum depth + +`test_revertsWhenConfirmationsAreBelowMinBlockDepth` sends with `2` confirmations against a minimum depth of `3`. The local router rejects the send with the same error the production OffRamp records, and no tokens or data move: + +```solidity +_setMinBlockDepth(3); + +vm.expectRevert( + abi.encodeWithSelector( + FinalityCodec.InvalidRequestedFinality.selector, + FinalityCodec._encodeBlockDepth(2), + FinalityCodec._encodeBlockDepth(3) + ) +); +_send(2); +``` + +The error carries both sides of the comparison: the requested finality (`2` block confirmations) and the allowed finality (the receiver's minimum depth `3`). + +`test_revertsWhenMinBlockDepthIsUnsetSoOnlyFullFinalityIsAccepted` shows the default: with no depth configured, the receiver's allowed finality is `FinalityCodec.WAIT_FOR_FINALITY_FLAG`, so any Fast Transfer request reverts: + +```solidity +vm.expectRevert( + abi.encodeWithSelector( + FinalityCodec.InvalidRequestedFinality.selector, + FinalityCodec._encodeBlockDepth(1), + FinalityCodec.WAIT_FOR_FINALITY_FLAG + ) +); +_send(1); +``` + +A message with `blockConfirmations = 0` (default finality) would still be delivered in this state, but the send script requires `> 0`, so this file always sends Fast Transfers. + +### Deliver with a CCV config applied + +`test_deliversMessageWhenReceiverHasCCVConfigApplied` configures the receiver with required and optional CCVs through `applyCCVConfigUpdates`, then verifies the finality gate still applies on top: + +```solidity +address[] memory required = new address[](1); +required[0] = makeAddr("requiredCCV"); +address[] memory optional = new address[](2); +optional[0] = makeAddr("optionalCCV1"); +optional[1] = makeAddr("optionalCCV2"); +BasicMessageReceiverWithCCVs.CCVConfigArgs[] memory configs = + new BasicMessageReceiverWithCCVs.CCVConfigArgs[](1); +configs[0] = BasicMessageReceiverWithCCVs.CCVConfigArgs({ + requiredCCVs: required, optionalCCVs: optional, sourceChainSelector: chainSelector, optionalThreshold: 1 +}); +vm.prank(broadcaster); +receiver.applyCCVConfigUpdates(configs); +_setMinBlockDepth(3); +``` + +Local mode has no CCV verifiers, so it cannot check quorum. It does validate the config itself (duplicate CCVs, `optionalThreshold` beyond the optional list length) the same way the OffRamp does, so a receiver configured this way is accepted by the router-side validation and keeps gating on the minimum block depth. The test then asserts the same `InvalidRequestedFinality` revert for a `2`-confirmation send. + +## Run the same flow on a live testnet + +The kit's book chapter lists the script commands for the live-testnet flow: deploy the receiver on the destination chain, set its minimum block depth for your source chain, then send the data message from the source chain. See the [Example 02 chapter](https://smartcontractkit.github.io/ccip-starter-kit-foundry/examples/example02-hello-world-to-basic-message-receiver.html) of the kit's book. + +## Next steps + +- `Example03.t.sol` combines this receiver-side gating with a token transfer (data + tokens in one message). +- To see the receiver finality rules enforced by the real OffRamp instead of the local router, read the [forked environments guide](/chainlink-local/build/ccip/foundry/local-simulator-fork). +- For an index of every kit example and where its topic is documented, read the [CCIP starter kit examples map](/chainlink-local/learn/starter-kit-examples). diff --git a/src/content/chainlink-local/build/ccip/foundry/forking-mainnets.mdx b/src/content/chainlink-local/build/ccip/foundry/forking-mainnets.mdx index a923c55cb28..fb946598a68 100644 --- a/src/content/chainlink-local/build/ccip/foundry/forking-mainnets.mdx +++ b/src/content/chainlink-local/build/ccip/foundry/forking-mainnets.mdx @@ -10,11 +10,13 @@ import { Aside } from "@components" -This guide explains how to use the Chainlink 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. +This guide explains how to use the Chainlink Local Simulator to test cross-chain transactions in forked mainnet environments using Foundry. You'll use the `Register.sol` contract to read the network details of the chains you fork, and `setNetworkDetails` to add or override details when a chain is not in `Register` or its values have changed. + +Fork routing supports every CCIP era: pre-1.6, 1.6 and CCIP 2.0 (CCV-based) lanes. If the mainnet lane you fork runs CCIP 2.0 through a dedicated router, read it with [`getCCIPV2RouterAddress`](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork#getccipv2routeraddress) or set it with [`setCCIPV2RouterAddress`](/chainlink-local/api-reference/v0.3.1/ccip-local-simulator-fork#setccipv2routeraddress), and send through that router. Messages sent through either router are routed by `switchChainAndRouteMessage`. ## Understanding Network Registration -The `Register.sol` smart contract contains pre-configured details for test networks to help accelerate cross-chain transaction simulations in Foundry. However, mainnet details are intentionally excluded and must be manually configured. +The `Register.sol` smart contract contains pre-configured details for 134 chains, mainnets included, to accelerate cross-chain transaction simulations in Foundry. `getNetworkDetails` returns an all-zero struct for a chain ID that is not in `Register`; use `setNetworkDetails` to add it.