From b89ab9f050570083f8c86e1ab749d9f1f471fd1d Mon Sep 17 00:00:00 2001 From: aelmanaa Date: Fri, 29 Nov 2024 23:00:34 +0100 Subject: [PATCH 01/57] update --- src/config/data/ccip/data.ts | 63 +- .../data/ccip/errors/{ => v1_5_0}/erc20.json | 0 src/config/data/ccip/errors/v1_5_0/index.ts | 5 + .../data/ccip/errors/{ => v1_5_0}/onramp.json | 0 .../errors/{ => v1_5_0}/priceregistry.json | 0 .../ccip/errors/{ => v1_5_0}/ratelimiter.json | 0 .../data/ccip/errors/{ => v1_5_0}/router.json | 0 .../ccip/errors/v1_5_1/burnMintERC20.json | 24 + src/config/data/ccip/errors/v1_5_1/erc20.json | 10 + src/config/data/ccip/errors/v1_5_1/index.ts | 6 + .../data/ccip/errors/v1_5_1/onramp.json | 104 ++ src/config/data/ccip/errors/v1_5_1/pool.json | 52 + .../data/ccip/errors/v1_5_1/ratelimiter.json | 82 ++ .../data/ccip/errors/v1_5_1/router.json | 37 + .../api-reference/burn-mint-token-pool.mdx | 77 -- src/content/ccip/api-reference/errors.mdx | 33 - src/content/ccip/api-reference/index.mdx | 52 + .../v1.5.0/burn-from-mint-token-pool.mdx | 55 + .../v1.5.0/burn-mint-token-pool-abstract.mdx | 72 ++ .../v1.5.0/burn-mint-token-pool.mdx | 55 + .../{ => v1.5.0}/ccip-receiver.mdx | 6 +- .../api-reference/{ => v1.5.0}/client.mdx | 36 +- .../ccip/api-reference/v1.5.0/errors.mdx | 35 + .../{ => v1.5.0}/i-router-client.mdx | 8 +- .../ccip/api-reference/v1.5.0/index.mdx | 43 + .../{ => v1.5.0}/lock-release-token-pool.mdx | 22 +- .../ccip/api-reference/{ => v1.5.0}/pool.mdx | 6 +- .../registry-module-owner-custom.mdx | 10 +- .../{ => v1.5.0}/token-admin-registry.mdx | 10 +- .../api-reference/{ => v1.5.0}/token-pool.mdx | 6 +- .../v1.5.1/burn-from-mint-token-pool.mdx | 81 ++ .../api-reference/v1.5.1/burn-mint-erc20.mdx | 202 ++++ .../v1.5.1/burn-mint-token-pool-abstract.mdx | 78 ++ .../v1.5.1/burn-mint-token-pool.mdx | 76 ++ .../api-reference/v1.5.1/ccip-receiver.mdx | 115 ++ .../ccip/api-reference/v1.5.1/client.mdx | 152 +++ .../ccip/api-reference/v1.5.1/errors.mdx | 39 + .../api-reference/v1.5.1/i-router-client.mdx | 110 ++ .../ccip/api-reference/v1.5.1/index.mdx | 42 + .../v1.5.1/lock-release-token-pool.mdx | 262 +++++ .../ccip/api-reference/v1.5.1/pool.mdx | 136 +++ .../api-reference/v1.5.1/rate-limiter.mdx | 246 ++++ .../v1.5.1/registry-module-owner-custom.mdx | 152 +++ .../v1.5.1/token-admin-registry.mdx | 467 ++++++++ .../ccip/api-reference/v1.5.1/token-pool.mdx | 1030 +++++++++++++++++ src/features/ccip/CcipCommon.astro | 12 +- src/features/ccip/ImportCCIPPackage.mdx | 53 - .../ImportCCIPPackage150.mdx | 32 + .../ImportCCIPPackage151.mdx | 32 + .../components/api-reference/Errors.astro | 127 +- 50 files changed, 4041 insertions(+), 312 deletions(-) rename src/config/data/ccip/errors/{ => v1_5_0}/erc20.json (100%) create mode 100644 src/config/data/ccip/errors/v1_5_0/index.ts rename src/config/data/ccip/errors/{ => v1_5_0}/onramp.json (100%) rename src/config/data/ccip/errors/{ => v1_5_0}/priceregistry.json (100%) rename src/config/data/ccip/errors/{ => v1_5_0}/ratelimiter.json (100%) rename src/config/data/ccip/errors/{ => v1_5_0}/router.json (100%) create mode 100644 src/config/data/ccip/errors/v1_5_1/burnMintERC20.json create mode 100644 src/config/data/ccip/errors/v1_5_1/erc20.json create mode 100644 src/config/data/ccip/errors/v1_5_1/index.ts create mode 100644 src/config/data/ccip/errors/v1_5_1/onramp.json create mode 100644 src/config/data/ccip/errors/v1_5_1/pool.json create mode 100644 src/config/data/ccip/errors/v1_5_1/ratelimiter.json create mode 100644 src/config/data/ccip/errors/v1_5_1/router.json delete mode 100644 src/content/ccip/api-reference/burn-mint-token-pool.mdx delete mode 100644 src/content/ccip/api-reference/errors.mdx create mode 100644 src/content/ccip/api-reference/index.mdx create mode 100644 src/content/ccip/api-reference/v1.5.0/burn-from-mint-token-pool.mdx create mode 100644 src/content/ccip/api-reference/v1.5.0/burn-mint-token-pool-abstract.mdx create mode 100644 src/content/ccip/api-reference/v1.5.0/burn-mint-token-pool.mdx rename src/content/ccip/api-reference/{ => v1.5.0}/ccip-receiver.mdx (90%) rename src/content/ccip/api-reference/{ => v1.5.0}/client.mdx (82%) create mode 100644 src/content/ccip/api-reference/v1.5.0/errors.mdx rename src/content/ccip/api-reference/{ => v1.5.0}/i-router-client.mdx (90%) create mode 100644 src/content/ccip/api-reference/v1.5.0/index.mdx rename src/content/ccip/api-reference/{ => v1.5.0}/lock-release-token-pool.mdx (88%) rename src/content/ccip/api-reference/{ => v1.5.0}/pool.mdx (95%) rename src/content/ccip/api-reference/{ => v1.5.0}/registry-module-owner-custom.mdx (90%) rename src/content/ccip/api-reference/{ => v1.5.0}/token-admin-registry.mdx (96%) rename src/content/ccip/api-reference/{ => v1.5.0}/token-pool.mdx (98%) create mode 100644 src/content/ccip/api-reference/v1.5.1/burn-from-mint-token-pool.mdx create mode 100644 src/content/ccip/api-reference/v1.5.1/burn-mint-erc20.mdx create mode 100644 src/content/ccip/api-reference/v1.5.1/burn-mint-token-pool-abstract.mdx create mode 100644 src/content/ccip/api-reference/v1.5.1/burn-mint-token-pool.mdx create mode 100644 src/content/ccip/api-reference/v1.5.1/ccip-receiver.mdx create mode 100644 src/content/ccip/api-reference/v1.5.1/client.mdx create mode 100644 src/content/ccip/api-reference/v1.5.1/errors.mdx create mode 100644 src/content/ccip/api-reference/v1.5.1/i-router-client.mdx create mode 100644 src/content/ccip/api-reference/v1.5.1/index.mdx create mode 100644 src/content/ccip/api-reference/v1.5.1/lock-release-token-pool.mdx create mode 100644 src/content/ccip/api-reference/v1.5.1/pool.mdx create mode 100644 src/content/ccip/api-reference/v1.5.1/rate-limiter.mdx create mode 100644 src/content/ccip/api-reference/v1.5.1/registry-module-owner-custom.mdx create mode 100644 src/content/ccip/api-reference/v1.5.1/token-admin-registry.mdx create mode 100644 src/content/ccip/api-reference/v1.5.1/token-pool.mdx delete mode 100644 src/features/ccip/ImportCCIPPackage.mdx create mode 100644 src/features/ccip/api-reference-callout/ImportCCIPPackage150.mdx create mode 100644 src/features/ccip/api-reference-callout/ImportCCIPPackage151.mdx diff --git a/src/config/data/ccip/data.ts b/src/config/data/ccip/data.ts index f7b8c46c4ff..569396e9660 100644 --- a/src/config/data/ccip/data.ts +++ b/src/config/data/ccip/data.ts @@ -11,6 +11,15 @@ import { NetworkFees, LaneConfig, } from "." +import { SupportedChain } from "@config/types" +import { + directoryToSupportedChain, + getChainIcon, + getExplorer, + getExplorerAddressUrl, + getTitle, + supportedChainToChainInRdd, +} from "@features/utils" // For mainnet import chainsMainnetv120 from "@config/data/ccip/v1_2_0/mainnet/chains.json" @@ -23,32 +32,42 @@ import chainsTestnetv120 from "@config/data/ccip/v1_2_0/testnet/chains.json" import lanesTestnetv120 from "@config/data/ccip/v1_2_0/testnet/lanes.json" import tokensTestnetv120 from "@config/data/ccip/v1_2_0/testnet/tokens.json" -// errors - -import erc20CCIPSendErrors from "@config/data/ccip/errors/erc20.json" -import routerCCIPSendErrors from "@config/data/ccip/errors/router.json" -import onrampCCIPSendErrors from "@config/data/ccip/errors/onramp.json" -import ratelimiterCCIPSendErrors from "@config/data/ccip/errors/ratelimiter.json" -import priceregistryCCIPSendErrors from "@config/data/ccip/errors/priceregistry.json" - -import { SupportedChain } from "@config/types" -import { - directoryToSupportedChain, - getChainIcon, - getExplorer, - getExplorerAddressUrl, - getTitle, - supportedChainToChainInRdd, -} from "@features/utils" +// Import errors by version +// eslint-disable-next-line camelcase +import * as errors_v1_5_0 from "./errors/v1_5_0" +// eslint-disable-next-line camelcase +import * as errors_v1_5_1 from "./errors/v1_5_1" export const getAllEnvironments = () => [Environment.Mainnet, Environment.Testnet] export const getAllVersions = () => [Version.V1_2_0] -export const erc20Errors: CCIPSendErrorEntry[] = erc20CCIPSendErrors -export const routerErrors: CCIPSendErrorEntry[] = routerCCIPSendErrors -export const onrampErrors: CCIPSendErrorEntry[] = onrampCCIPSendErrors -export const ratelimiterErrors: CCIPSendErrorEntry[] = ratelimiterCCIPSendErrors -export const priceRegistryErrors: CCIPSendErrorEntry[] = priceregistryCCIPSendErrors +// Type for v1.5.0 errors +type ErrorTypesV150 = { + erc20CCIPSendErrors: CCIPSendErrorEntry[] + routerCCIPSendErrors: CCIPSendErrorEntry[] + onrampCCIPSendErrors: CCIPSendErrorEntry[] + ratelimiterCCIPSendErrors: CCIPSendErrorEntry[] + priceregistryCCIPSendErrors: CCIPSendErrorEntry[] +} + +// Type for v1.5.1 errors +type ErrorTypesV151 = ErrorTypesV150 & { + poolCCIPSendErrors: CCIPSendErrorEntry[] + burnMintERC20CCIPSendErrors: CCIPSendErrorEntry[] +} + +type VersionedErrors = { + v1_5_0: ErrorTypesV150 + v1_5_1: ErrorTypesV151 +} + +// Export errors by version with type safety +export const errors: VersionedErrors = { + // eslint-disable-next-line camelcase + v1_5_0: errors_v1_5_0 as ErrorTypesV150, + // eslint-disable-next-line camelcase + v1_5_1: errors_v1_5_1 as ErrorTypesV151, +} export const networkFees: NetworkFees = { tokenTransfers: { diff --git a/src/config/data/ccip/errors/erc20.json b/src/config/data/ccip/errors/v1_5_0/erc20.json similarity index 100% rename from src/config/data/ccip/errors/erc20.json rename to src/config/data/ccip/errors/v1_5_0/erc20.json diff --git a/src/config/data/ccip/errors/v1_5_0/index.ts b/src/config/data/ccip/errors/v1_5_0/index.ts new file mode 100644 index 00000000000..cd82a31c923 --- /dev/null +++ b/src/config/data/ccip/errors/v1_5_0/index.ts @@ -0,0 +1,5 @@ +export { default as erc20CCIPSendErrors } from "./erc20.json" +export { default as routerCCIPSendErrors } from "./router.json" +export { default as onrampCCIPSendErrors } from "./onramp.json" +export { default as ratelimiterCCIPSendErrors } from "./ratelimiter.json" +export { default as priceregistryCCIPSendErrors } from "./priceregistry.json" diff --git a/src/config/data/ccip/errors/onramp.json b/src/config/data/ccip/errors/v1_5_0/onramp.json similarity index 100% rename from src/config/data/ccip/errors/onramp.json rename to src/config/data/ccip/errors/v1_5_0/onramp.json diff --git a/src/config/data/ccip/errors/priceregistry.json b/src/config/data/ccip/errors/v1_5_0/priceregistry.json similarity index 100% rename from src/config/data/ccip/errors/priceregistry.json rename to src/config/data/ccip/errors/v1_5_0/priceregistry.json diff --git a/src/config/data/ccip/errors/ratelimiter.json b/src/config/data/ccip/errors/v1_5_0/ratelimiter.json similarity index 100% rename from src/config/data/ccip/errors/ratelimiter.json rename to src/config/data/ccip/errors/v1_5_0/ratelimiter.json diff --git a/src/config/data/ccip/errors/router.json b/src/config/data/ccip/errors/v1_5_0/router.json similarity index 100% rename from src/config/data/ccip/errors/router.json rename to src/config/data/ccip/errors/v1_5_0/router.json diff --git a/src/config/data/ccip/errors/v1_5_1/burnMintERC20.json b/src/config/data/ccip/errors/v1_5_1/burnMintERC20.json new file mode 100644 index 00000000000..1d061a74415 --- /dev/null +++ b/src/config/data/ccip/errors/v1_5_1/burnMintERC20.json @@ -0,0 +1,24 @@ +[ + { + "error": "MaxSupplyExceeded", + "parameters": [ + { + "type": "uint256", + "name": "supplyAfterMint" + } + ], + "errorSelector": "0xcbbf1113", + "description": "Thrown when a mint operation would cause the total supply to exceed the maximum supply limit." + }, + { + "error": "InvalidRecipient", + "parameters": [ + { + "type": "address", + "name": "recipient" + } + ], + "errorSelector": "0x17858bbe", + "description": "Thrown when attempting to transfer or approve tokens for the contract itself (address(this))." + } +] diff --git a/src/config/data/ccip/errors/v1_5_1/erc20.json b/src/config/data/ccip/errors/v1_5_1/erc20.json new file mode 100644 index 00000000000..43ea19415c2 --- /dev/null +++ b/src/config/data/ccip/errors/v1_5_1/erc20.json @@ -0,0 +1,10 @@ +[ + { + "error": "ERC20: burn amount exceeds balance", + "description": "Thrown when the amount to be burned exceeds the pool balance." + }, + { + "error": "ERC20: transfer amount exceeds allowance", + "description": "Thrown when the transfer amount exceeds the allowance." + } +] diff --git a/src/config/data/ccip/errors/v1_5_1/index.ts b/src/config/data/ccip/errors/v1_5_1/index.ts new file mode 100644 index 00000000000..2f5d50b6549 --- /dev/null +++ b/src/config/data/ccip/errors/v1_5_1/index.ts @@ -0,0 +1,6 @@ +export { default as erc20CCIPSendErrors } from "./erc20.json" +export { default as burnMintERC20CCIPSendErrors } from "./burnMintERC20.json" +export { default as routerCCIPSendErrors } from "./router.json" +export { default as onrampCCIPSendErrors } from "./onramp.json" +export { default as ratelimiterCCIPSendErrors } from "./ratelimiter.json" +export { default as poolCCIPSendErrors } from "./pool.json" diff --git a/src/config/data/ccip/errors/v1_5_1/onramp.json b/src/config/data/ccip/errors/v1_5_1/onramp.json new file mode 100644 index 00000000000..9108abfe702 --- /dev/null +++ b/src/config/data/ccip/errors/v1_5_1/onramp.json @@ -0,0 +1,104 @@ +[ + { + "error": "CursedByRMN", + "parameters": [], + "errorSelector": "0x53ad11d8", + "description": "Thrown when the RMN (Risk Management Network) has cursed the destination chain." + }, + { + "error": "RouterMustSetOriginalSender", + "parameters": [], + "errorSelector": "0xa4ec7479", + "description": "Thrown when the router has not set the original sender address." + }, + { + "error": "MustBeCalledByRouter", + "parameters": [], + "errorSelector": "0x1c0a3529", + "description": "Thrown when the caller is not the configured router address." + }, + { + "error": "InvalidChainSelector", + "parameters": [ + { + "name": "destChainSelector", + "type": "uint64" + } + ], + "errorSelector": "0xd9a9cd68", + "description": "Thrown when the destination chain selector does not match the configured one." + }, + { + "error": "InvalidExtraArgsTag", + "parameters": [], + "errorSelector": "0x5247fdce", + "description": "Thrown when an invalid extra arguments tag is used." + }, + { + "error": "MessageTooLarge", + "parameters": [ + { + "type": "uint256", + "name": "maxSize" + }, + { + "type": "uint256", + "name": "actualSize" + } + ], + "errorSelector": "0x86933789", + "description": "Thrown when the message size exceeds the maximum allowed size." + }, + { + "error": "MessageGasLimitTooHigh", + "parameters": [], + "errorSelector": "0x4c4fc93a", + "description": "Thrown when the gas limit exceeds the maximum per-message gas limit." + }, + { + "error": "CannotSendZeroTokens", + "parameters": [], + "errorSelector": "0x5cf04449", + "description": "Thrown when attempting to send a token with amount zero." + }, + { + "error": "MaxFeeBalanceReached", + "parameters": [], + "errorSelector": "0xe5c7a491", + "description": "Thrown when the onRamp has reached its maximum fee storage capacity." + }, + { + "error": "UnsupportedNumberOfTokens", + "parameters": [], + "errorSelector": "0x4c056b6a", + "description": "Thrown when too many tokens are involved in the transfer." + }, + { + "error": "UnsupportedToken", + "parameters": [ + { + "type": "address", + "name": "token" + } + ], + "errorSelector": "0xbf16aab6", + "description": "Thrown when attempting to send an unsupported token." + }, + { + "error": "ExtraArgOutOfOrderExecutionMustBeTrue", + "parameters": [], + "errorSelector": "0xee433e99", + "description": "Thrown when enforceOutOfOrder is true but allowOutOfOrderExecution is false." + }, + { + "error": "SourceTokenDataTooLarge", + "parameters": [ + { + "name": "token", + "type": "address" + } + ], + "errorSelector": "0x36f536ca", + "description": "Thrown when the source token data exceeds the configured maximum size." + } +] diff --git a/src/config/data/ccip/errors/v1_5_1/pool.json b/src/config/data/ccip/errors/v1_5_1/pool.json new file mode 100644 index 00000000000..fce9c52b55e --- /dev/null +++ b/src/config/data/ccip/errors/v1_5_1/pool.json @@ -0,0 +1,52 @@ +[ + { + "error": "InvalidToken", + "parameters": [ + { + "name": "token", + "type": "address" + } + ], + "errorSelector": "0x961c9a4f", + "description": "Thrown when the token being locked or burned is not supported by the pool." + }, + { + "error": "CursedByRMN", + "parameters": [], + "errorSelector": "0x53ad11d8", + "description": "Thrown when the RMN (Risk Management Network) has cursed the network." + }, + { + "error": "SenderNotAllowed", + "parameters": [ + { + "name": "sender", + "type": "address" + } + ], + "errorSelector": "0xd0d25976", + "description": "Thrown when the sender is not on the allowlist (when allowlist is enabled)." + }, + { + "error": "ChainNotAllowed", + "parameters": [ + { + "name": "remoteChainSelector", + "type": "uint64" + } + ], + "errorSelector": "0xa9902c7e", + "description": "Thrown when the remote chain selector is not supported." + }, + { + "error": "CallerIsNotARampOnRouter", + "parameters": [ + { + "name": "caller", + "type": "address" + } + ], + "errorSelector": "0x728fe07b", + "description": "Thrown when the caller is not a valid onRamp for the given chain on the Router." + } +] diff --git a/src/config/data/ccip/errors/v1_5_1/ratelimiter.json b/src/config/data/ccip/errors/v1_5_1/ratelimiter.json new file mode 100644 index 00000000000..42cbe093702 --- /dev/null +++ b/src/config/data/ccip/errors/v1_5_1/ratelimiter.json @@ -0,0 +1,82 @@ +[ + { + "error": "BucketOverfilled", + "parameters": [], + "errorSelector": "0x9725942a", + "description": "Thrown when the token bucket contains more tokens than its capacity." + }, + { + "error": "OnlyCallableByAdminOrOwner", + "parameters": [], + "errorSelector": "0xf6cd5620", + "description": "Thrown when a function is called by an address that is not the admin or owner." + }, + { + "error": "TokenMaxCapacityExceeded", + "parameters": [ + { + "name": "capacity", + "type": "uint256" + }, + { + "name": "requested", + "type": "uint256" + }, + { + "name": "tokenAddress", + "type": "address" + } + ], + "errorSelector": "0x1a76572a", + "description": "Thrown when attempting to consume more tokens than the bucket's maximum capacity." + }, + { + "error": "TokenRateLimitReached", + "parameters": [ + { + "name": "minWaitInSeconds", + "type": "uint256" + }, + { + "name": "available", + "type": "uint256" + }, + { + "name": "tokenAddress", + "type": "address" + } + ], + "errorSelector": "0xd0c8d23a", + "description": "Thrown when attempting to consume more tokens than currently available in the bucket." + }, + { + "error": "AggregateValueMaxCapacityExceeded", + "parameters": [ + { + "name": "capacity", + "type": "uint256" + }, + { + "name": "requested", + "type": "uint256" + } + ], + "errorSelector": "0xf94ebcd1", + "description": "Thrown when attempting to consume more aggregate value than the bucket's maximum capacity." + }, + { + "error": "AggregateValueRateLimitReached", + "parameters": [ + { + "name": "minWaitInSeconds", + "type": "uint256" + }, + { + "name": "available", + "type": "uint256" + } + ], + "errorSelector": "0x15279c08", + "description": "Thrown when attempting to consume more aggregate value than currently available in the bucket." + } +] diff --git a/src/config/data/ccip/errors/v1_5_1/router.json b/src/config/data/ccip/errors/v1_5_1/router.json new file mode 100644 index 00000000000..8e5a37f7b17 --- /dev/null +++ b/src/config/data/ccip/errors/v1_5_1/router.json @@ -0,0 +1,37 @@ +[ + { + "error": "UnsupportedDestinationChain", + "parameters": [ + { + "name": "destChainSelector", + "type": "uint64" + } + ], + "errorSelector": "0xae236d9c", + "description": "Thrown when sending to an unsupported destination chain." + }, + { + "error": "InsufficientFeeTokenAmount", + "parameters": [], + "errorSelector": "0x07da6ee6", + "description": "Thrown when the fee token amount provided is less than required." + }, + { + "error": "InvalidMsgValue", + "parameters": [], + "errorSelector": "0x1841b4e1", + "description": "Thrown when msg.value is non-zero for non-native fee token payments." + }, + { + "error": "BadARMSignal", + "parameters": [], + "errorSelector": "0xc1483715", + "description": "Thrown when the RMN (Risk Management Network) has cursed the network." + }, + { + "error": "SafeERC20FailedOperation", + "parameters": [], + "errorSelector": "0x70c9c181", + "description": "Thrown when an ERC20 token transfer fails." + } +] diff --git a/src/content/ccip/api-reference/burn-mint-token-pool.mdx b/src/content/ccip/api-reference/burn-mint-token-pool.mdx deleted file mode 100644 index bacae9c1546..00000000000 --- a/src/content/ccip/api-reference/burn-mint-token-pool.mdx +++ /dev/null @@ -1,77 +0,0 @@ ---- -section: ccip -date: Last Modified -title: "BurnMintTokenPool API Reference" ---- - -import { Aside } from "@components" -import CcipCommon from "@features/ccip/CcipCommon.astro" - - - -## BurnMintTokenPoolAbstract - -[`BurnMintTokenPoolAbstract`](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/pools/BurnMintTokenPoolAbstract.sol) is an abstract contract that extends the [`TokenPool`](/ccip/api-reference/token-pool) contract. It defines the common logic for burning tokens in the pool. This contract contains validation mechanisms and logic for burning tokens in the context of a cross-chain token transfer. The main goal of this abstract contract is to allow different pools to inherit from it and customize the specific burn logic. - -## BurnMintTokenPool and BurnFromMintTokenPool - -The [`BurnMintTokenPool`](https://github.com/smartcontractkit/ccip/blob/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/pools/BurnMintTokenPool.sol) and [`BurnFromMintTokenPool`](https://github.com/smartcontractkit/ccip/blob/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/pools/BurnFromMintTokenPool.sol) contracts are concrete implementations that inherit from [`BurnMintTokenPoolAbstract`](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/pools/BurnMintTokenPoolAbstract.sol). Both are designed to mint and burn a 3rd-party token, but they differ in how the token burning is implemented: - -- `BurnMintTokenPool` uses the `burn(amount)` function for burning tokens. -- `BurnFromMintTokenPool` uses the `burnFrom(address, amount)` function, where the contract burns tokens from its own balance. - -### \_burn - -```solidity -function _burn(uint256 amount) internal virtual -``` - -Contains the specific burn call for a pool. - -_Overriding this method allows us to create pools with different burn signatures without duplicating the underlying logic._ - -### lockOrBurn - -```solidity -function lockOrBurn(struct Pool.LockOrBurnInV1 lockOrBurnIn) external virtual returns (struct Pool.LockOrBurnOutV1) -``` - -Burn the token in the pool. - -_The \_validateLockOrBurn check is an essential security check._ - -### releaseOrMint - -```solidity -function releaseOrMint(struct Pool.ReleaseOrMintInV1 releaseOrMintIn) external virtual returns (struct Pool.ReleaseOrMintOutV1) -``` - -Mint tokens from the pool to the recipient. - -_The \_validateReleaseOrMint check is an essential security check._ - -## BurnMintTokenPool - -[`BurnMintTokenPool`](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/pools/BurnMintTokenPool.sol) is a concrete implementation that inherits from [`BurnMintTokenPoolAbstract`](#burnminttokenpoolabstract). It is designed to mint and burn a 3rd-party token, using the `burn(amount)` function for burning tokens. Pool whitelisting mode is set during the contract's deployment and cannot be modified later. The pool either accepts any address as the `originalSender` or restricts to a whitelisted set of senders. - -This contract variant is particularly suited for use cases where the token’s minter and burner roles need to be adjustable. - -### typeAndVersion - -```solidity -string typeAndVersion -``` - -### constructor - -```solidity -constructor(contract IBurnMintERC20 token, address[] allowlist, address rmnProxy, address router) public -``` - -### \_burn - -```solidity -function _burn(uint256 amount) internal virtual -``` - -Contains the specific burn call for a pool. diff --git a/src/content/ccip/api-reference/errors.mdx b/src/content/ccip/api-reference/errors.mdx deleted file mode 100644 index 768f804b8df..00000000000 --- a/src/content/ccip/api-reference/errors.mdx +++ /dev/null @@ -1,33 +0,0 @@ ---- -section: ccip -date: Last Modified -title: "Errors API Reference" ---- - -import CcipCommon from "@features/ccip/CcipCommon.astro" -import { CCIPSendError } from "@features/ccip/components/api-reference" -import { Aside, CopyText } from "@components" - - - -When invoking the `ccipSend` [function](/ccip/api-reference/i-router-client#ccipsend), it is possible to encounter various errors. These might be thrown either by the CCIP router or by one of the downstream contracts called by the CCIP router. Below is a compiled list of potential errors you might encounter. Referencing this list will enable you to capture and handle these exceptions gracefully. - -## Router - - - -## Onramp - - - -## RateLimiter - - - -## ERC20 - - - -## PriceRegistry - - diff --git a/src/content/ccip/api-reference/index.mdx b/src/content/ccip/api-reference/index.mdx new file mode 100644 index 00000000000..e0426d10392 --- /dev/null +++ b/src/content/ccip/api-reference/index.mdx @@ -0,0 +1,52 @@ +--- +section: ccip +date: Last Modified +title: "Chainlink CCIP API Reference Documentation" +metadata: + description: "Complete API reference documentation for Chainlink Cross-Chain Interoperability Protocol (CCIP). Includes smart contracts, libraries, and interfaces for cross-chain messaging and token transfers." +--- + +import { Aside } from "@components" + +# Chainlink CCIP API Reference + + + +## Available Versions + +### Latest Release + +- **[CCIP v1.5.1](/ccip/api-reference/v1.5.1/)** (Current Version) + - Added support for tokens with different decimals across chains + - Enhanced token pool upgrades to support multiple active pools, ensuring in-flight messages remain deliverable during upgrades + - Added decimal validation and overflow protection + - Upgraded token pool access control from OwnerIsCreator to Ownable2StepMsgSender for better security + - Added support for OpenZeppelin's AccessControl DEFAULT_ADMIN_ROLE in token admin registration + - Introduced BurnMintERC20 contract for easy token deployment and cross-chain expansion + - Configurable decimals and max supply + - Built-in CCIP admin support + - Role-based access control for minting and burning + +### Previous Versions + +- **[CCIP v1.5.0](/ccip/api-reference/v1.5.0/)** (Legacy Version) + - Base implementation + - Cross-chain: + - Send arbitrary data + - Transfer tokens + - Programmable Token Transfers + - [Cross-Chain Token (CCT) standard](/ccip/concepts/cross-chain-tokens) + - ⚠️ We recommend upgrading to v1.5.1 for latest features + +## Documentation Structure + +Each version includes detailed documentation for: + +- Core Contracts (Router, Receiver) +- Token Pool Implementations +- Registry Components +- Interface Definitions +- Library Definitions +- Error Handling diff --git a/src/content/ccip/api-reference/v1.5.0/burn-from-mint-token-pool.mdx b/src/content/ccip/api-reference/v1.5.0/burn-from-mint-token-pool.mdx new file mode 100644 index 00000000000..659c87bae68 --- /dev/null +++ b/src/content/ccip/api-reference/v1.5.0/burn-from-mint-token-pool.mdx @@ -0,0 +1,55 @@ +--- +section: ccip +date: Last Modified +title: "CCIP v1.5.0 BurnFromMintTokenPool Contract API Reference" +metadata: + description: "API documentation for the BurnFromMintTokenPool contract in Chainlink CCIP v1.5.0, implementing burn/mint functionality for third-party tokens using burnFrom(address, amount)." +--- + +import { Aside } from "@components" +import CcipCommon from "@features/ccip/CcipCommon.astro" + + + +## BurnFromMintTokenPool + +[`BurnFromMintTokenPool`](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/pools/BurnFromMintTokenPool.sol) is a concrete implementation that inherits from [`BurnMintTokenPoolAbstract`](/ccip/api-reference/burn-mint-token-pool-abstract). It is designed to mint and burn a 3rd-party token, using the `burnFrom(address, amount)` function for burning tokens, where the contract burns tokens from its own balance. When allowlist is enabled, it ensures only token-developer specified addresses can transfer tokens. + +## Variables + +### typeAndVersion + +```solidity +string typeAndVersion +``` + +## Functions + +### constructor + +```solidity +constructor(contract IBurnMintERC20 token, address[] allowlist, address rmnProxy, address router) public +``` + +#### Parameters + +| Name | Type | Description | +| --------- | -------------- | --------------------------------------------------------------------- | +| token | IBurnMintERC20 | The token that will be burned and minted. | +| allowlist | address[] | List of addresses allowed to be original senders for token transfers. | +| rmnProxy | address | The RMN proxy address. | +| router | address | The router address. | + +### \_burn + +```solidity +function _burn(uint256 amount) internal virtual +``` + +Contains the specific burn call for a pool using the token's burnFrom(address, amount) function. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ----------------------------- | +| amount | uint256 | The amount of tokens to burn. | diff --git a/src/content/ccip/api-reference/v1.5.0/burn-mint-token-pool-abstract.mdx b/src/content/ccip/api-reference/v1.5.0/burn-mint-token-pool-abstract.mdx new file mode 100644 index 00000000000..9cb36dbb736 --- /dev/null +++ b/src/content/ccip/api-reference/v1.5.0/burn-mint-token-pool-abstract.mdx @@ -0,0 +1,72 @@ +--- +section: ccip +date: Last Modified +title: "CCIP v1.5.0 BurnMintTokenPoolAbstract Contract API Reference" +metadata: + description: "API documentation for the BurnMintTokenPoolAbstract contract in Chainlink CCIP v1.5.0, implementing burn/mint functionality for cross-chain token transfers." +--- + +import { Aside } from "@components" +import CcipCommon from "@features/ccip/CcipCommon.astro" + + + +## BurnMintTokenPoolAbstract + +[`BurnMintTokenPoolAbstract`](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/pools/BurnMintTokenPoolAbstract.sol) is an abstract contract that extends the [`TokenPool`](/ccip/api-reference/token-pool) contract. It defines the common logic for burning tokens in the pool. This contract contains validation mechanisms and logic for burning tokens in the context of a cross-chain token transfer. When allowlist is enabled, it ensures only token-developer specified addresses can transfer tokens. + +## Functions + +### \_burn + +```solidity +function _burn(uint256 amount) internal virtual +``` + +Contains the specific burn call for a pool. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ----------------------------- | +| amount | uint256 | The amount of tokens to burn. | + +### lockOrBurn + +```solidity +function lockOrBurn(struct Pool.LockOrBurnInV1 lockOrBurnIn) external virtual returns (struct Pool.LockOrBurnOutV1) +``` + +Burn the token in the pool. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------------------- | ---------------------------------------- | +| lockOrBurnIn | Pool.LockOrBurnInV1 | The input parameters for burning tokens. | + +#### Return Values + +| Name | Type | Description | +| ---- | -------------------- | ----------------------------------------- | +| [0] | Pool.LockOrBurnOutV1 | The output data after burning the tokens. | + +### releaseOrMint + +```solidity +function releaseOrMint(struct Pool.ReleaseOrMintInV1 releaseOrMintIn) external virtual returns (struct Pool.ReleaseOrMintOutV1) +``` + +Mint tokens from the pool to the recipient. + +#### Parameters + +| Name | Type | Description | +| --------------- | ---------------------- | ---------------------------------------- | +| releaseOrMintIn | Pool.ReleaseOrMintInV1 | The input parameters for minting tokens. | + +#### Return Values + +| Name | Type | Description | +| ---- | ----------------------- | ----------------------------------------- | +| [0] | Pool.ReleaseOrMintOutV1 | The output data after minting the tokens. | diff --git a/src/content/ccip/api-reference/v1.5.0/burn-mint-token-pool.mdx b/src/content/ccip/api-reference/v1.5.0/burn-mint-token-pool.mdx new file mode 100644 index 00000000000..fdbd1766b9f --- /dev/null +++ b/src/content/ccip/api-reference/v1.5.0/burn-mint-token-pool.mdx @@ -0,0 +1,55 @@ +--- +section: ccip +date: Last Modified +title: "CCIP v1.5.0 BurnMintTokenPool Contract API Reference" +metadata: + description: "API documentation for the BurnMintTokenPool contract in Chainlink CCIP v1.5.0, implementing burn/mint functionality for third-party tokens using burn(amount)." +--- + +import { Aside } from "@components" +import CcipCommon from "@features/ccip/CcipCommon.astro" + + + +## BurnMintTokenPool + +[`BurnMintTokenPool`](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/pools/BurnMintTokenPool.sol) is a concrete implementation that inherits from [`BurnMintTokenPoolAbstract`](/ccip/api-reference/burn-mint-token-pool-abstract). It is designed to mint and burn a 3rd-party token, using the `burn(amount)` function for burning tokens. Pool whitelisting mode is set during the contract's deployment and cannot be modified later. + +## Variables + +### typeAndVersion + +```solidity +string typeAndVersion +``` + +## Functions + +### constructor + +```solidity +constructor(contract IBurnMintERC20 token, address[] allowlist, address rmnProxy, address router) public +``` + +#### Parameters + +| Name | Type | Description | +| --------- | -------------- | --------------------------------------------------------------------- | +| token | IBurnMintERC20 | The token that will be burned and minted. | +| allowlist | address[] | List of addresses allowed to be original senders for token transfers. | +| rmnProxy | address | The RMN proxy address. | +| router | address | The router address. | + +### \_burn + +```solidity +function _burn(uint256 amount) internal virtual +``` + +Contains the specific burn call for a pool using the token's burn(amount) function. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ----------------------------- | +| amount | uint256 | The amount of tokens to burn. | diff --git a/src/content/ccip/api-reference/ccip-receiver.mdx b/src/content/ccip/api-reference/v1.5.0/ccip-receiver.mdx similarity index 90% rename from src/content/ccip/api-reference/ccip-receiver.mdx rename to src/content/ccip/api-reference/v1.5.0/ccip-receiver.mdx index 495f9f6ac0c..3b1cbc6ada7 100644 --- a/src/content/ccip/api-reference/ccip-receiver.mdx +++ b/src/content/ccip/api-reference/v1.5.0/ccip-receiver.mdx @@ -1,12 +1,14 @@ --- section: ccip date: Last Modified -title: "CCIPReceiver API Reference" +title: "CCIP v1.5.0 CCIPReceiver API Reference" +metadata: + description: "API documentation for the CCIPReceiver contract in Chainlink CCIP v1.5.0, the base contract for applications receiving cross-chain messages." --- import CcipCommon from "@features/ccip/CcipCommon.astro" - + CCIP receiver contracts inherit from [`CCIPReceiver`](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/applications/CCIPReceiver.sol). diff --git a/src/content/ccip/api-reference/client.mdx b/src/content/ccip/api-reference/v1.5.0/client.mdx similarity index 82% rename from src/content/ccip/api-reference/client.mdx rename to src/content/ccip/api-reference/v1.5.0/client.mdx index 1cbfc6f33a0..eaad5224429 100644 --- a/src/content/ccip/api-reference/client.mdx +++ b/src/content/ccip/api-reference/v1.5.0/client.mdx @@ -1,13 +1,15 @@ --- section: ccip date: Last Modified -title: "Client Library API Reference" +title: "CCIP v1.5.0 Client Library API Reference" +metadata: + description: "API documentation for the Client library in Chainlink CCIP v1.5.0, used for building and handling cross-chain messages." --- import { Aside } from "@components" import CcipCommon from "@features/ccip/CcipCommon.astro" - + CCIP senders and receivers use the CCIP [`Client`](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/libraries/Client.sol) library to build CCIP messages. @@ -81,10 +83,7 @@ struct EVM2AnyMessage { #### EVM_EXTRA_ARGS_V1_TAG - + ```solidity bytes4 EVM_EXTRA_ARGS_V1_TAG @@ -92,11 +91,6 @@ bytes4 EVM_EXTRA_ARGS_V1_TAG #### EVM_EXTRA_ARGS_V2_TAG - - ```solidity bytes4 EVM_EXTRA_ARGS_V2_TAG ``` @@ -105,10 +99,7 @@ bytes4 EVM_EXTRA_ARGS_V2_TAG #### EVMExtraArgsV1 - + ```solidity struct EVMExtraArgsV1 { @@ -122,11 +113,6 @@ struct EVMExtraArgsV1 { #### EVMExtraArgsV2 - - ```solidity struct EVMExtraArgsV2 { uint256 gasLimit; @@ -145,10 +131,7 @@ struct EVMExtraArgsV2 { #### \_argsToBytes (v1) - + ```solidity function _argsToBytes(struct Client.EVMExtraArgsV1 extraArgs) internal pure returns (bytes bts) @@ -170,11 +153,6 @@ It is used to convert the arguments to bytes. #### \_argsToBytes (v2) - - ```solidity function _argsToBytes(struct Client.EVMExtraArgsV2 extraArgs) internal pure returns (bytes bts) ``` diff --git a/src/content/ccip/api-reference/v1.5.0/errors.mdx b/src/content/ccip/api-reference/v1.5.0/errors.mdx new file mode 100644 index 00000000000..7ec0b3f3250 --- /dev/null +++ b/src/content/ccip/api-reference/v1.5.0/errors.mdx @@ -0,0 +1,35 @@ +--- +section: ccip +date: Last Modified +title: "CCIP v1.5.0 Error Codes and Messages API Reference" +metadata: + description: "API documentation for error handling in Chainlink CCIP v1.5.0, including router, onramp, rate limiter, and token-related errors." +--- + +import CcipCommon from "@features/ccip/CcipCommon.astro" +import { CCIPSendError } from "@features/ccip/components/api-reference" +import { Aside, CopyText } from "@components" + + + +When invoking the `ccipSend` [function](/ccip/api-reference/v1.5.0/i-router-client#ccipsend), it is possible to encounter various errors. These might be thrown either by the CCIP router or by one of the downstream contracts called by the CCIP router. Below is a compiled list of potential errors you might encounter. Referencing this list will enable you to capture and handle these exceptions gracefully. + +## Router Errors + + + +## OnRamp Errors + + + +## Rate Limiter Errors + + + +## Token (ERC20) Errors + + + +## Price Registry Errors + + diff --git a/src/content/ccip/api-reference/i-router-client.mdx b/src/content/ccip/api-reference/v1.5.0/i-router-client.mdx similarity index 90% rename from src/content/ccip/api-reference/i-router-client.mdx rename to src/content/ccip/api-reference/v1.5.0/i-router-client.mdx index 072dd62f760..efc2fa06ac0 100644 --- a/src/content/ccip/api-reference/i-router-client.mdx +++ b/src/content/ccip/api-reference/v1.5.0/i-router-client.mdx @@ -1,15 +1,17 @@ --- section: ccip date: Last Modified -title: "IRouterClient API Reference" +title: "CCIP v1.5.0 IRouterClient API Reference" +metadata: + description: "API documentation for the IRouterClient interface in Chainlink CCIP v1.5.0, used for sending cross-chain messages through CCIP." --- import { Aside } from "@components" import CcipCommon from "@features/ccip/CcipCommon.astro" - + -To send messages through CCIP, users must interact with the []`IRouterClient`](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/interfaces/IRouterClient.sol) interface. +To send messages through CCIP, users must interact with the [`IRouterClient`](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/interfaces/IRouterClient.sol) interface. After you import `IRouterClient.sol`, you can initialize a router client instance: ```solidity diff --git a/src/content/ccip/api-reference/v1.5.0/index.mdx b/src/content/ccip/api-reference/v1.5.0/index.mdx new file mode 100644 index 00000000000..e45b16fc80f --- /dev/null +++ b/src/content/ccip/api-reference/v1.5.0/index.mdx @@ -0,0 +1,43 @@ +--- +section: ccip +date: Last Modified +title: "CCIP v1.5.0 API Reference" +metadata: + description: "API reference documentation for Chainlink CCIP v1.5.0. Includes core components, token pools, registry components, and error handling for cross-chain messaging and token transfers." +--- + +import { Aside } from "@components" +import CcipCommon from "@features/ccip/CcipCommon.astro" + + + + + +## API References + +### Core Components + +- [Client](/ccip/api-reference/v1.5.0/client) - Library providing structs and types for building CCIP messages +- [CCIPReceiver](/ccip/api-reference/v1.5.0/ccip-receiver) - Base contract for receiving CCIP messages +- [IRouterClient](/ccip/api-reference/v1.5.0/i-router-client) - Interface for sending messages through CCIP +- [Pool](/ccip/api-reference/v1.5.0/pool) - Library providing token pool functions for cross-chain operations + +### Token Pools + +- [TokenPool](/ccip/api-reference/v1.5.0/token-pool) - Base abstract class defining common functionality for all token pools +- [BurnMintTokenPoolAbstract](/ccip/api-reference/v1.5.0/burn-mint-token-pool-abstract) - Abstract contract for burn/mint token handling +- [BurnMintTokenPool](/ccip/api-reference/v1.5.0/burn-mint-token-pool) - Implementation using `burn(amount)` for token burning +- [BurnFromMintTokenPool](/ccip/api-reference/v1.5.0/burn-from-mint-token-pool) - Implementation using `burnFrom(address, amount)` for token burning +- [LockReleaseTokenPool](/ccip/api-reference/v1.5.0/lock-release-token-pool) - Implementation for locking and releasing tokens on their native chain + +### Registry Components + +- [TokenAdminRegistry](/ccip/api-reference/v1.5.0/token-admin-registry) - Contract for storing token pool configurations +- [RegistryModuleOwnerCustom](/ccip/api-reference/v1.5.0/registry-module-owner-custom) - Registry module for token admin registration + +### Error Handling + +- [Errors](/ccip/api-reference/v1.5.0/errors) - Comprehensive list of CCIP error codes and their descriptions diff --git a/src/content/ccip/api-reference/lock-release-token-pool.mdx b/src/content/ccip/api-reference/v1.5.0/lock-release-token-pool.mdx similarity index 88% rename from src/content/ccip/api-reference/lock-release-token-pool.mdx rename to src/content/ccip/api-reference/v1.5.0/lock-release-token-pool.mdx index 79382077ca6..927dc9aa0a7 100644 --- a/src/content/ccip/api-reference/lock-release-token-pool.mdx +++ b/src/content/ccip/api-reference/v1.5.0/lock-release-token-pool.mdx @@ -1,17 +1,19 @@ --- section: ccip date: Last Modified -title: "LockReleaseTokenPool API Reference" +title: "CCIP v1.5.0 LockReleaseTokenPool Contract API Reference" +metadata: + description: "API documentation for the LockReleaseTokenPool contract in Chainlink CCIP v1.5.0, implementing lock/release functionality for tokens on their native chain." --- import { Aside } from "@components" import CcipCommon from "@features/ccip/CcipCommon.astro" - + ## LockReleaseTokenPool -The [`LockReleaseTokenPool`](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/pools/LockReleaseTokenPool.sol) contract is used for handling tokens on their native chain using a lock and release mechanism. It allows tokens to be locked in the pool, facilitating their transfer across blockchains, and then released to the recipient on the destination chain. This pool contract also manages liquidity, enabling users and liquidity providers to add and remove liquidity from the pool. +The [`LockReleaseTokenPool`](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/pools/LockReleaseTokenPool.sol) contract is used for handling tokens on their native chain using a lock and release mechanism. It allows tokens to be locked in the pool, facilitating their transfer across blockchains, and then released to the recipient on the destination chain. When allowlist is enabled, it ensures only token-developer specified addresses can transfer tokens. This contract inherits from the [`TokenPool`](/ccip/api-reference/token-pool) contract and implements additional functions for liquidity management. @@ -31,13 +33,13 @@ Initializes the pool with a token, allowlist, RMN proxy, and router. The constru #### Parameters -| Name | Type | Description | -| --------------- | --------- | ------------------------------------------------- | -| token | IERC20 | The token managed by the pool. | -| allowlist | address[] | Addresses allowed to interact with the pool. | -| rmnProxy | address | The RMN proxy address. | -| acceptLiquidity | bool | Whether the pool accepts liquidity. | -| router | address | The router address for cross-chain communication. | +| Name | Type | Description | +| --------------- | --------- | --------------------------------------------------------------------- | +| token | IERC20 | The token managed by the pool. | +| allowlist | address[] | List of addresses allowed to be original senders for token transfers. | +| rmnProxy | address | The RMN proxy address. | +| acceptLiquidity | bool | Whether the pool accepts liquidity. | +| router | address | The router address for cross-chain communication. | ### lockOrBurn diff --git a/src/content/ccip/api-reference/pool.mdx b/src/content/ccip/api-reference/v1.5.0/pool.mdx similarity index 95% rename from src/content/ccip/api-reference/pool.mdx rename to src/content/ccip/api-reference/v1.5.0/pool.mdx index 23828fcde1c..f3de71e3767 100644 --- a/src/content/ccip/api-reference/pool.mdx +++ b/src/content/ccip/api-reference/v1.5.0/pool.mdx @@ -1,13 +1,15 @@ --- section: ccip date: Last Modified -title: "Pool Library API Reference" +title: "CCIP v1.5.0 Pool Library API Reference" +metadata: + description: "API documentation for the Pool library in Chainlink CCIP v1.5.0, providing token pool functions for cross-chain operations." --- import { Aside } from "@components" import CcipCommon from "@features/ccip/CcipCommon.astro" - + The [`Pool`](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/libraries/Pool.sol) library provides various token pool functions to construct return data for cross-chain operations in Chainlink's CCIP. diff --git a/src/content/ccip/api-reference/registry-module-owner-custom.mdx b/src/content/ccip/api-reference/v1.5.0/registry-module-owner-custom.mdx similarity index 90% rename from src/content/ccip/api-reference/registry-module-owner-custom.mdx rename to src/content/ccip/api-reference/v1.5.0/registry-module-owner-custom.mdx index c7d6f6030a7..95673173515 100644 --- a/src/content/ccip/api-reference/registry-module-owner-custom.mdx +++ b/src/content/ccip/api-reference/v1.5.0/registry-module-owner-custom.mdx @@ -1,17 +1,15 @@ --- section: ccip date: Last Modified -title: "RegistryModuleOwnerCustom API Reference" +title: "CCIP v1.5.0 RegistryModuleOwnerCustom Contract API Reference" +metadata: + description: "API documentation for the RegistryModuleOwnerCustom contract in Chainlink CCIP v1.5.0, enabling token developers to register as administrators for their tokens." --- import { Aside } from "@components" import CcipCommon from "@features/ccip/CcipCommon.astro" - - - + The [`RegistryModuleOwnerCustom`](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol) contract is responsible for registering the administrator of a token in the [`TokenAdminRegistry`](/ccip/api-reference/token-admin-registry). This contract allows for the registration of token administrators through either the `getCCIPAdmin()` method (for tokens with a CCIP admin) or the `owner()` method (for standard tokens with an owner). The contract enforces that only the rightful administrator of the token can register themselves, ensuring secure and accurate registration within the `TokenAdminRegistry`. The contract also emits an event, `AdministratorRegistered`, whenever a token administrator is successfully registered. diff --git a/src/content/ccip/api-reference/token-admin-registry.mdx b/src/content/ccip/api-reference/v1.5.0/token-admin-registry.mdx similarity index 96% rename from src/content/ccip/api-reference/token-admin-registry.mdx rename to src/content/ccip/api-reference/v1.5.0/token-admin-registry.mdx index 8629a968c0b..88e379c0711 100644 --- a/src/content/ccip/api-reference/token-admin-registry.mdx +++ b/src/content/ccip/api-reference/v1.5.0/token-admin-registry.mdx @@ -1,17 +1,15 @@ --- section: ccip date: Last Modified -title: "TokenAdminRegistry API Reference" +title: "CCIP v1.5.0 TokenAdminRegistry Contract API Reference" +metadata: + description: "API documentation for the TokenAdminRegistry contract in Chainlink CCIP v1.5.0, managing token pool configurations and administrator permissions for cross-chain tokens." --- import { Aside } from "@components" import CcipCommon from "@features/ccip/CcipCommon.astro" - - - + The [`TokenAdminRegistry`](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/tokenAdminRegistry/TokenAdminRegistry.sol) contract stores the token pool configuration for all cross-chain tokens. It operates on a self-serve basis, where tokens can be registered without intervention from the CCIP owner. diff --git a/src/content/ccip/api-reference/token-pool.mdx b/src/content/ccip/api-reference/v1.5.0/token-pool.mdx similarity index 98% rename from src/content/ccip/api-reference/token-pool.mdx rename to src/content/ccip/api-reference/v1.5.0/token-pool.mdx index cb23cb66080..36ba944f0c5 100644 --- a/src/content/ccip/api-reference/token-pool.mdx +++ b/src/content/ccip/api-reference/v1.5.0/token-pool.mdx @@ -1,13 +1,15 @@ --- section: ccip date: Last Modified -title: "TokenPool API Reference" +title: "CCIP v1.5.0 TokenPool Contract API Reference" +metadata: + description: "API documentation for the TokenPool abstract contract in Chainlink CCIP v1.5.0, providing base functionality for token pools with cross-chain operations." --- import { Aside } from "@components" import CcipCommon from "@features/ccip/CcipCommon.astro" - + ## TokenPool diff --git a/src/content/ccip/api-reference/v1.5.1/burn-from-mint-token-pool.mdx b/src/content/ccip/api-reference/v1.5.1/burn-from-mint-token-pool.mdx new file mode 100644 index 00000000000..f6b5897a841 --- /dev/null +++ b/src/content/ccip/api-reference/v1.5.1/burn-from-mint-token-pool.mdx @@ -0,0 +1,81 @@ +--- +section: ccip +date: Last Modified +title: "CCIP v1.5.1 BurnFromMintTokenPool Contract API Reference" +metadata: + description: "API documentation for the BurnFromMintTokenPool contract in Chainlink CCIP v1.5.1, implementing burn/mint functionality for third-party tokens using burnFrom." +--- + +import { Aside } from "@components" +import CcipCommon from "@features/ccip/CcipCommon.astro" + + + +The [`BurnFromMintTokenPool`](https://github.com/smartcontractkit/ccip/blob/release/contracts-ccip-1.5.1/contracts/src/v0.8/ccip/pools/BurnFromMintTokenPool.sol) contract extends BurnMintTokenPoolAbstract to implement burn/mint functionality for third-party tokens using the `burnFrom(from, amount)` signature. + + + +## Functions + +### constructor + +```solidity +constructor( + IBurnMintERC20 token, + uint8 localTokenDecimals, + address[] memory allowlist, + address rmnProxy, + address router +) TokenPool(token, localTokenDecimals, allowlist, rmnProxy, router) +``` + +Initializes the token pool with the specified parameters and approves the pool to burn from itself. + + + +#### Parameters + +| Name | Type | Description | +| ------------------ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| token | IBurnMintERC20 | The token managed by this pool | +| localTokenDecimals | uint8 | The number of decimals for the token on the local chain | +| allowlist | address[] | List of addresses allowed to be original senders for token transfers. When allowlist is enabled, it ensures only token-developer specified addresses can transfer tokens | +| rmnProxy | address | Address of the RMN proxy | +| router | address | Address of the router | + +### \_burn + +```solidity +function _burn( + uint256 amount +) internal virtual override +``` + +Burns the specified amount of tokens using the `burnFrom(from, amount)` signature. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ------------------------ | +| amount | uint256 | Amount of tokens to burn | + +### typeAndVersion + +```solidity +string public constant override typeAndVersion = "BurnFromMintTokenPool 1.5.1" +``` + +Returns the type and version of the contract. + +#### Return Value + +| Type | Description | +| ------ | ---------------------------------------- | +| string | The string "BurnFromMintTokenPool 1.5.1" | diff --git a/src/content/ccip/api-reference/v1.5.1/burn-mint-erc20.mdx b/src/content/ccip/api-reference/v1.5.1/burn-mint-erc20.mdx new file mode 100644 index 00000000000..da1881f5d1f --- /dev/null +++ b/src/content/ccip/api-reference/v1.5.1/burn-mint-erc20.mdx @@ -0,0 +1,202 @@ +--- +section: ccip +date: Last Modified +title: "CCIP v1.5.1 BurnMintERC20 Contract API Reference" +metadata: + description: "API documentation for the BurnMintERC20 contract in Chainlink CCIP v1.5.1" +--- + +import { Aside } from "@components" +import CcipCommon from "@features/ccip/CcipCommon.astro" + + + +The [`BurnMintERC20`](https://github.com/smartcontractkit/ccip/blob/release/contracts-ccip-1.5.1/contracts/src/v0.8/shared/token/ERC20/BurnMintERC20.sol) contract implements a basic ERC20 token with burn and mint capabilities controlled through roles. + + + +## Errors + +### MaxSupplyExceeded + +```solidity +error MaxSupplyExceeded(uint256 supplyAfterMint) +``` + +Thrown when a mint would exceed the maximum token supply. + +| Parameter | Type | Description | +| --------------- | ------- | -------------------------------------------- | +| supplyAfterMint | uint256 | Total supply that would result from the mint | + +### InvalidRecipient + +```solidity +error InvalidRecipient(address recipient) +``` + +Thrown when trying to transfer or approve tokens for the contract itself. + +| Parameter | Type | Description | +| --------- | ------- | ------------------------- | +| recipient | address | Invalid recipient address | + +## Events + +### CCIPAdminTransferred + +```solidity +event CCIPAdminTransferred(address indexed previousAdmin, address indexed newAdmin) +``` + +Emitted when the CCIP admin role is transferred. + +| Parameter | Type | Description | +| ------------- | ------- | --------------------------- | +| previousAdmin | address | Previous CCIP admin address | +| newAdmin | address | New CCIP admin address | + +## Constants + +### MINTER_ROLE + +```solidity +bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE") +``` + +Role identifier for addresses allowed to mint tokens. + +### BURNER_ROLE + +```solidity +bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE") +``` + +Role identifier for addresses allowed to burn tokens. + +## Functions + +### constructor + +```solidity +constructor( + string memory name, + string memory symbol, + uint8 decimals_, + uint256 maxSupply_, + uint256 preMint +) ERC20(name, symbol) +``` + +Initializes the token with its basic properties. + +#### Parameters + +| Name | Type | Description | +| ----------- | ------- | ---------------------------------------- | +| name | string | Token name | +| symbol | string | Token symbol | +| decimals\_ | uint8 | Number of decimal places | +| maxSupply\_ | uint256 | Maximum token supply (0 for unlimited) | +| preMint | uint256 | Amount to mint to the deployer initially | + +### burn + +```solidity +function burn(uint256 amount) public override(IBurnMintERC20, ERC20Burnable) onlyRole(BURNER_ROLE) +``` + +Burns tokens from the caller's balance. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ------------------------ | +| amount | uint256 | Amount of tokens to burn | + +### burnFrom + +```solidity +function burnFrom( + address account, + uint256 amount +) public override(IBurnMintERC20, ERC20Burnable) onlyRole(BURNER_ROLE) +``` + +Burns tokens from a specific account (requires approval). + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | --------------------------- | +| account | address | Account to burn tokens from | +| amount | uint256 | Amount of tokens to burn | + +### mint + +```solidity +function mint(address account, uint256 amount) external override onlyRole(MINTER_ROLE) +``` + +Mints new tokens to a specified account. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------ | +| account | address | Recipient of the minted tokens | +| amount | uint256 | Amount of tokens to mint | + +### CCIP Admin Management + +### getCCIPAdmin + +```solidity +function getCCIPAdmin() external view returns (address) +``` + +Returns the current CCIP admin address. + +#### Return Value + +| Type | Description | +| ------- | -------------------------- | +| address | Current CCIP admin address | + +### setCCIPAdmin + +```solidity +function setCCIPAdmin(address newAdmin) public onlyRole(DEFAULT_ADMIN_ROLE) +``` + +Transfers the CCIP admin role to a new address. + + + +#### Parameters + +| Name | Type | Description | +| -------- | ------- | ---------------------- | +| newAdmin | address | New CCIP admin address | + +### Role Management + +### grantMintAndBurnRoles + +```solidity +function grantMintAndBurnRoles(address burnAndMinter) external +``` + +Grants both minting and burning roles to an address. + +#### Parameters + +| Name | Type | Description | +| ------------- | ------- | ----------------------------- | +| burnAndMinter | address | Address to receive both roles | diff --git a/src/content/ccip/api-reference/v1.5.1/burn-mint-token-pool-abstract.mdx b/src/content/ccip/api-reference/v1.5.1/burn-mint-token-pool-abstract.mdx new file mode 100644 index 00000000000..c3d9c35d201 --- /dev/null +++ b/src/content/ccip/api-reference/v1.5.1/burn-mint-token-pool-abstract.mdx @@ -0,0 +1,78 @@ +--- +section: ccip +date: Last Modified +title: "CCIP v1.5.1 BurnMintTokenPoolAbstract Contract API Reference" +metadata: + description: "API documentation for the BurnMintTokenPoolAbstract contract in Chainlink CCIP v1.5.1, implementing burn/mint functionality for cross-chain token transfers." +--- + +import { Aside } from "@components" +import CcipCommon from "@features/ccip/CcipCommon.astro" + + + +The [`BurnMintTokenPoolAbstract`](https://github.com/smartcontractkit/ccip/blob/release/contracts-ccip-1.5.1/contracts/src/v0.8/ccip/pools/BurnMintTokenPoolAbstract.sol) contract extends TokenPool to implement burn/mint functionality for cross-chain token transfers. + +## Functions + +### \_burn + +```solidity +function _burn(uint256 amount) internal virtual +``` + +Contains the specific burn call for a pool. This function is virtual to allow different burn signatures without duplicating logic. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ---------------------------- | +| amount | uint256 | The amount of tokens to burn | + +### lockOrBurn + +```solidity +function lockOrBurn( + Pool.LockOrBurnInV1 calldata lockOrBurnIn +) external virtual override returns (Pool.LockOrBurnOutV1 memory) +``` + +Burns tokens in the pool after validating the operation. + + + +#### Parameters + +| Name | Type | Description | +| ------------ | ------------------- | --------------------------------------- | +| lockOrBurnIn | Pool.LockOrBurnInV1 | Input parameters for the burn operation | + +#### Return Value + +| Type | Description | +| -------------------- | -------------------------------------------------------- | +| Pool.LockOrBurnOutV1 | Contains destination token address and pool decimal data | + +### releaseOrMint + +```solidity +function releaseOrMint( + Pool.ReleaseOrMintInV1 calldata releaseOrMintIn +) external virtual override returns (Pool.ReleaseOrMintOutV1 memory) +``` + +Mints tokens from the pool to the recipient after validating the operation. + + + +#### Parameters + +| Name | Type | Description | +| --------------- | ---------------------- | --------------------------------------- | +| releaseOrMintIn | Pool.ReleaseOrMintInV1 | Input parameters for the mint operation | + +#### Return Value + +| Type | Description | +| ----------------------- | -------------------------------------------- | +| Pool.ReleaseOrMintOutV1 | Contains the final destination amount minted | diff --git a/src/content/ccip/api-reference/v1.5.1/burn-mint-token-pool.mdx b/src/content/ccip/api-reference/v1.5.1/burn-mint-token-pool.mdx new file mode 100644 index 00000000000..f2620028a21 --- /dev/null +++ b/src/content/ccip/api-reference/v1.5.1/burn-mint-token-pool.mdx @@ -0,0 +1,76 @@ +--- +section: ccip +date: Last Modified +title: "CCIP v1.5.1 BurnMintTokenPool Contract API Reference" +metadata: + description: "API documentation for the BurnMintTokenPool contract in Chainlink CCIP v1.5.1, implementing burn/mint functionality for third-party tokens." +--- + +import { Aside } from "@components" +import CcipCommon from "@features/ccip/CcipCommon.astro" + + + +The [`BurnMintTokenPool`](https://github.com/smartcontractkit/ccip/blob/release/contracts-ccip-1.5.1/contracts/src/v0.8/ccip/pools/BurnMintTokenPool.sol) contract extends BurnMintTokenPoolAbstract to implement burn/mint functionality for third-party tokens using the `burn(amount)` signature. + + + +## Functions + +### constructor + +```solidity +constructor( + IBurnMintERC20 token, + uint8 localTokenDecimals, + address[] memory allowlist, + address rmnProxy, + address router +) TokenPool(token, localTokenDecimals, allowlist, rmnProxy, router) +``` + +Initializes the token pool with the specified parameters. + +#### Parameters + +| Name | Type | Description | +| ------------------ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| token | IBurnMintERC20 | The token managed by this pool | +| localTokenDecimals | uint8 | The number of decimals for the token on the local chain | +| allowlist | address[] | List of addresses allowed to be original senders for token transfers. When allowlist is enabled, it ensures only token-developer specified addresses can transfer tokens | +| rmnProxy | address | Address of the RMN proxy | +| router | address | Address of the router | + +### \_burn + +```solidity +function _burn( + uint256 amount +) internal virtual override +``` + +Burns the specified amount of tokens using the `burn(amount)` signature. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ------------------------ | +| amount | uint256 | Amount of tokens to burn | + +### typeAndVersion + +```solidity +string public constant override typeAndVersion = "BurnMintTokenPool 1.5.1" +``` + +Returns the type and version of the contract. + +#### Return Value + +| Type | Description | +| ------ | ------------------------------------ | +| string | The string "BurnMintTokenPool 1.5.1" | diff --git a/src/content/ccip/api-reference/v1.5.1/ccip-receiver.mdx b/src/content/ccip/api-reference/v1.5.1/ccip-receiver.mdx new file mode 100644 index 00000000000..324213b93e6 --- /dev/null +++ b/src/content/ccip/api-reference/v1.5.1/ccip-receiver.mdx @@ -0,0 +1,115 @@ +--- +section: ccip +date: Last Modified +title: "CCIP v1.5.1 CCIPReceiver API Reference" +metadata: + description: "API documentation for the CCIPReceiver contract in Chainlink CCIP v1.5.1, the base contract for applications receiving cross-chain messages." +--- + +import CcipCommon from "@features/ccip/CcipCommon.astro" + + + +CCIP receiver contracts inherit from [`CCIPReceiver`](https://github.com/smartcontractkit/ccip/blob/release/contracts-ccip-1.5.1/contracts/src/v0.8/ccip/applications/CCIPReceiver.sol). + +```solidity +import {CCIPReceiver} from "@chainlink/contracts-ccip/src/v0.8/ccip/applications/CCIPReceiver.sol"; +... + +constructor(address _router) CCIPReceiver(router) { + } +``` + +## Errors + +### InvalidRouter + +```solidity +error InvalidRouter(address router) +``` + +## Functions + +### constructor + +```solidity +constructor(address router) internal +``` + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ------------------- | +| router | address | The router address. | + +### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceId) public pure returns (bool) +``` + +IERC165 supports an interfaceId. This allows CCIP to check if ccipReceive is available before calling it. + +- If this returns false or reverts, only tokens are transferred to the receiver. +- If this returns true, tokens are transferred and ccipReceive is called atomically. +- If the receiver address does not have code associated with it at execution time (EXTCODESIZE returns 0), only tokens will be transferred. + +#### Parameters + +| Name | Type | Description | +| ----------- | ------ | ------------------------ | +| interfaceId | bytes4 | The interfaceId to check | + +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ------------------------------------ | +| [0] | bool | true if the interfaceId is supported | + +### ccipReceive + +```solidity +function ccipReceive(Client.Any2EVMMessage calldata message) external +``` + +#### Parameters + +| Name | Type | Description | +| ------- | -------------------------------------------------------------------------------- | -------------- | +| message | struct [Client.Any2EVMMessage](/ccip/api-reference/v1.5.1/client#any2evmmessage) | Any2EVMMessage | + +### \_ccipReceive + +```solidity +function _ccipReceive(Client.Any2EVMMessage memory message) internal virtual +``` + +Override this function in your implementation. + +#### Parameters + +| Name | Type | Description | +| ------- | -------------------------------------------------------------------------------- | -------------- | +| message | struct [Client.Any2EVMMessage](/ccip/api-reference/v1.5.1/client#any2evmmessage) | Any2EVMMessage | + +### getRouter + +```solidity +function getRouter() public view returns (address) +``` + +This function returns the current Router address. + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | ---------------- | +| [0] | address | i_router address | + +### onlyRouter + +```solidity +modifier onlyRouter() +``` + +_Only calls from the set router are accepted._ diff --git a/src/content/ccip/api-reference/v1.5.1/client.mdx b/src/content/ccip/api-reference/v1.5.1/client.mdx new file mode 100644 index 00000000000..38b0136acdf --- /dev/null +++ b/src/content/ccip/api-reference/v1.5.1/client.mdx @@ -0,0 +1,152 @@ +--- +section: ccip +date: Last Modified +title: "CCIP v1.5.1 Client Library API Reference" +metadata: + description: "API documentation for the Client library in Chainlink CCIP v1.5.1, used for building and handling cross-chain messages." +--- + +import { Aside } from "@components" +import CcipCommon from "@features/ccip/CcipCommon.astro" + + + +CCIP senders and receivers use the CCIP [`Client`](https://github.com/smartcontractkit/ccip/blob/release/contracts-ccip-1.5.1/contracts/src/v0.8/ccip/libraries/Client.sol) library to build CCIP messages. + +```solidity +import { Client } from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Client.sol"; +``` + +## Types and Constants + +### EVMTokenAmount + +Use this solidity struct to specify the token address and amount. + +```solidity +struct EVMTokenAmount { + address token; + uint256 amount; +} +``` + +| Name | Type | Description | +| ------ | ------- | --------------------------------- | +| token | address | token address on the local chain. | +| amount | uint256 | Amount of tokens. | + +### Any2EVMMessage + +CCIP receivers use this solidity struct to parse the received CCIP message. + +```solidity +struct Any2EVMMessage { + bytes32 messageId; + uint64 sourceChainSelector; + bytes sender; + bytes data; + EVMTokenAmount[] destTokenAmounts; +} +``` + +| Name | Type | Description | +| ------------------- | ---------------- | ------------------------------------------------------------------------------------ | +| messageId | bytes32 | CCIP messageId, generated on the source chain. | +| sourceChainSelector | uint64 | Source chain selector. | +| sender | bytes | Sender address. `abi.decode(sender, (address))` if the source chain is an EVM chain. | +| data | bytes | Payload sent within the CCIP message. | +| destTokenAmounts | EVMTokenAmount[] | Tokens and their amounts in their destination chain representation. | + +### EVM2AnyMessage + +CCIP senders use this solidity struct to build a CCIP message. + +```solidity +struct EVM2AnyMessage { + bytes receiver; + bytes data; + EVMTokenAmount[] tokenAmounts; + address feeToken; + bytes extraArgs; +} +``` + +| Name | Type | Description | +| ------------ | ---------------- | -------------------------------------------------------------- | +| receiver | bytes | abi.encode(receiver address) for destination EVM chains. | +| data | bytes | Data payload. | +| tokenAmounts | EVMTokenAmount[] | Token transfers. | +| feeToken | address | Address of feeToken. address(0) means you will send msg.value. | +| extraArgs | bytes | Populate this with \_argsToBytes(EVMExtraArgsV2). | + +### EVMExtraArgsV1 + +```solidity +bytes4 public constant EVM_EXTRA_ARGS_V1_TAG = 0x97a657c9; + +struct EVMExtraArgsV1 { + uint256 gasLimit; +} +``` + +### EVMExtraArgsV2 + +```solidity +bytes4 public constant EVM_EXTRA_ARGS_V2_TAG = 0x181dcf10; + +struct EVMExtraArgsV2 { + uint256 gasLimit; + bool allowOutOfOrderExecution; +} +``` + +| Name | Type | Description | +| ------------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| gasLimit | uint256 | specifies the maximum amount of gas CCIP can consume to execute `ccipReceive()` on the contract located on the destination blockchain. Read [Setting gasLimit](/ccip/best-practices#setting-gaslimit) for more details. | +| allowOutOfOrderExecution | bool | if true, it indicates that the message can be executed in any order relative to other messages from the same sender. This value's default varies by chain. On some chains, a particular value is enforced, meaning if the expected value is not set, the message request will revert. | + +## Functions + +### \_argsToBytes + +#### \_argsToBytes (v1) + + + +```solidity +function _argsToBytes(struct Client.EVMExtraArgsV1 extraArgs) internal pure returns (bytes bts) +``` + +It is used to convert the arguments to bytes. + +##### Parameters + +| Name | Type | Description | +| --------- | ---------------------------------------- | ---------------- | +| extraArgs | [Client.EVMExtraArgsV1](#evmextraargsv1) | Extra arguments. | + +##### Return Values + +| Name | Type | Description | +| ---- | ----- | ----------------------------------- | +| bts | bytes | Encoded extra arguments in _bytes_. | + +#### \_argsToBytes (v2) + +```solidity +function _argsToBytes(struct Client.EVMExtraArgsV2 extraArgs) internal pure returns (bytes bts) +``` + +It is used to convert the arguments to bytes. + +##### Parameters + +| Name | Type | Description | +| --------- | ---------------------------------------- | ---------------- | +| extraArgs | [Client.EVMExtraArgsV2](#evmextraargsv2) | Extra arguments. | + +##### Return Values + +| Name | Type | Description | +| ---- | ----- | ----------------------------------- | +| bts | bytes | Encoded extra arguments in _bytes_. | diff --git a/src/content/ccip/api-reference/v1.5.1/errors.mdx b/src/content/ccip/api-reference/v1.5.1/errors.mdx new file mode 100644 index 00000000000..8fa054f10e1 --- /dev/null +++ b/src/content/ccip/api-reference/v1.5.1/errors.mdx @@ -0,0 +1,39 @@ +--- +section: ccip +date: Last Modified +title: "CCIP v1.5.1 Error Codes and Messages API Reference" +metadata: + description: "API documentation for error handling in Chainlink CCIP v1.5.1, including router, onramp, rate limiter, and token-related errors." +--- + +import CcipCommon from "@features/ccip/CcipCommon.astro" +import { CCIPSendError } from "@features/ccip/components/api-reference" +import { Aside, CopyText } from "@components" + + + +When invoking the `ccipSend` [function](/ccip/api-reference/v1.5.1/i-router-client#ccipsend), it is possible to encounter various errors. These might be thrown either by the CCIP router or by one of the downstream contracts called by the CCIP router. Below is a compiled list of potential errors you might encounter. Referencing this list will enable you to capture and handle these exceptions gracefully. + +## Router Errors + + + +## OnRamp Errors + + + +## Rate Limiter Errors + + + +## Token (ERC20) Errors + + + +## BurnMintERC20 Errors + + + +## Token Pool Errors + + diff --git a/src/content/ccip/api-reference/v1.5.1/i-router-client.mdx b/src/content/ccip/api-reference/v1.5.1/i-router-client.mdx new file mode 100644 index 00000000000..3ef550cdaa2 --- /dev/null +++ b/src/content/ccip/api-reference/v1.5.1/i-router-client.mdx @@ -0,0 +1,110 @@ +--- +section: ccip +date: Last Modified +title: "CCIP v1.5.1 IRouterClient API Reference" +metadata: + description: "API documentation for the IRouterClient interface in Chainlink CCIP v1.5.1, used for sending cross-chain messages through CCIP." +--- + +import { Aside } from "@components" +import CcipCommon from "@features/ccip/CcipCommon.astro" + + + +To send messages through CCIP, users must interact with the [`IRouterClient`](https://github.com/smartcontractkit/ccip/blob/release/contracts-ccip-1.5.1/contracts/src/v0.8/ccip/interfaces/IRouterClient.sol) interface. +After you import `IRouterClient.sol`, you can initialize a router client instance: + +```solidity +import {IRouterClient} from "@chainlink/contracts-ccip/src/v0.8/ccip/interfaces/IRouterClient.sol"; +... +IRouterClient router; +constructor(address _router) { + router = IRouterClient(_router); + } +``` + +## Errors + +### UnsupportedDestinationChain + +```solidity +error UnsupportedDestinationChain(uint64 destChainSelector) +``` + +### InsufficientFeeTokenAmount + +```solidity +error InsufficientFeeTokenAmount() +``` + +### InvalidMsgValue + +```solidity +error InvalidMsgValue() +``` + +## Functions + +### isChainSupported + +```solidity +function isChainSupported(uint64 destChainSelector) external view returns (bool supported) +``` + +Checks if the given chain ID is supported for sending/receiving. + +#### Parameters + +| Name | Type | Description | +| ----------------- | ------ | ------------------- | +| destChainSelector | uint64 | The chain to check. | + +#### Return Values + +| Name | Type | Description | +| --------- | ---- | ---------------------------------------------- | +| supported | bool | returns true if it is supported, false if not. | + +### getFee + +```solidity +function getFee(uint64 destinationChainSelector, struct Client.EVM2AnyMessage message) external view returns (uint256 fee) +``` + +#### Parameters + +| Name | Type | Description | +| ------------------------ | -------------------------------------------------------------------------------- | --------------------------------------------------------- | +| destinationChainSelector | uint64 | The destination chainSelector | +| message | struct [Client.EVM2AnyMessage](/ccip/api-reference/v1.5.1/client#evm2anymessage) | The cross-chain CCIP message including data and/or tokens | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | -------------------------------------------------------------------------------------------- | +| fee | uint256 | returns guaranteed execution fee for the specified message delivery to the destination chain | + +### ccipSend + +```solidity +function ccipSend(uint64 destinationChainSelector, struct Client.EVM2AnyMessage message) external payable returns (bytes32) +``` + +Request a message to be sent to the destination chain. + + + +#### Parameters + +| Name | Type | Description | +| ------------------------ | -------------------------------------------------------------------------------- | ---------------------------------------------------------- | +| destinationChainSelector | uint64 | The destination chain ID | +| message | struct [Client.EVM2AnyMessage](/ccip/api-reference/v1.5.1/client#evm2anymessage) | The cross-chain CCIP message, including data and/or tokens | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | ------------------------ | +| [0] | bytes32 | messageId The message ID | diff --git a/src/content/ccip/api-reference/v1.5.1/index.mdx b/src/content/ccip/api-reference/v1.5.1/index.mdx new file mode 100644 index 00000000000..1e10c93f8b3 --- /dev/null +++ b/src/content/ccip/api-reference/v1.5.1/index.mdx @@ -0,0 +1,42 @@ +--- +section: ccip +date: Last Modified +title: "CCIP v1.5.1 API Reference" +metadata: + description: "API reference documentation for Chainlink CCIP v1.5.1. Includes core components, token pools, registry components, and error handling for cross-chain interoperability." +--- + +import { Aside } from "@components" +import CcipCommon from "@features/ccip/CcipCommon.astro" + + + + + +## API References + +### Core Components + +- [Client](/ccip/api-reference/v1.5.1/client) - Library providing structs and types for building CCIP messages +- [CCIPReceiver](/ccip/api-reference/v1.5.1/ccip-receiver) - Base contract for receiving CCIP messages +- [IRouterClient](/ccip/api-reference/v1.5.1/i-router-client) - Interface for sending messages through CCIP +- [Pool](/ccip/api-reference/v1.5.1/pool) - Library providing token pool functions for cross-chain operations +- [RateLimiter](/ccip/api-reference/v1.5.1/rate-limiter) - Contract for managing rate limits on token transfers + +### Token Pools + +- [TokenPool](/ccip/api-reference/v1.5.1/token-pool) - Base abstract class defining common functionality for all token pools +- [BurnMintTokenPoolAbstract](/ccip/api-reference/v1.5.1/burn-mint-token-pool-abstract) - Abstract contract for burn/mint token handling +- [BurnMintTokenPool](/ccip/api-reference/v1.5.1/burn-mint-token-pool) - Implementation using `burn(amount)` for token burning +- [BurnFromMintTokenPool](/ccip/api-reference/v1.5.1/burn-from-mint-token-pool) - Implementation using `burnFrom(address, amount)` for token burning +- [LockReleaseTokenPool](/ccip/api-reference/v1.5.1/lock-release-token-pool) - Implementation for locking and releasing tokens on their native chain +- [BurnMintERC20](/ccip/api-reference/v1.5.1/burn-mint-erc20) - Implementation for burning and minting ERC20 tokens + +### Registry Components + +- [TokenAdminRegistry](/ccip/api-reference/v1.5.1/token-admin-registry) - Contract for storing token pool configurations +- [RegistryModuleOwnerCustom](/ccip/api-reference/v1.5.1/registry-module-owner-custom) - Registry module for token admin registration + +### Error Handling + +- [Errors](/ccip/api-reference/v1.5.1/errors) - Comprehensive list of CCIP error codes and their descriptions diff --git a/src/content/ccip/api-reference/v1.5.1/lock-release-token-pool.mdx b/src/content/ccip/api-reference/v1.5.1/lock-release-token-pool.mdx new file mode 100644 index 00000000000..f9283f3d2db --- /dev/null +++ b/src/content/ccip/api-reference/v1.5.1/lock-release-token-pool.mdx @@ -0,0 +1,262 @@ +--- +section: ccip +date: Last Modified +title: "CCIP v1.5.1 LockReleaseTokenPool Contract API Reference" +metadata: + description: "API documentation for the LockReleaseTokenPool contract in Chainlink CCIP v1.5.1, implementing lock/release functionality for tokens on their native chain." +--- + +import { Aside } from "@components" +import CcipCommon from "@features/ccip/CcipCommon.astro" + + + +The [`LockReleaseTokenPool`](https://github.com/smartcontractkit/ccip/blob/release/contracts-ccip-1.5.1/contracts/src/v0.8/ccip/pools/LockReleaseTokenPool.sol) contract manages tokens on their original blockchain (native chain). When tokens are transferred across chains: + +- On the source chain: tokens are locked (held) in this pool +- On the destination chain: an equivalent amount is released to the recipient + +Since this pool needs to hold tokens to release them later, it includes features to: + +- Add and remove liquidity (token reserves) +- Track balances for both users and liquidity providers +- Ensure proper accounting of all token movements + + + +## Errors + +### InsufficientLiquidity + +```solidity +error InsufficientLiquidity() +``` + +Thrown when there is not enough liquidity in the pool for a withdrawal. + +### LiquidityNotAccepted + +```solidity +error LiquidityNotAccepted() +``` + +Thrown when trying to provide liquidity to a pool that doesn't accept it. + +## Events + +### LiquidityTransferred + +```solidity +event LiquidityTransferred(address indexed from, uint256 amount) +``` + +Emitted when liquidity is transferred from an old pool version. + +| Parameter | Type | Description | +| --------- | ------- | ------------------------------- | +| from | address | Address of the old pool | +| amount | uint256 | Amount of liquidity transferred | + +## Functions + +### constructor + +```solidity +constructor( + IERC20 token, + uint8 localTokenDecimals, + address[] memory allowlist, + address rmnProxy, + bool acceptLiquidity, + address router +) TokenPool(token, localTokenDecimals, allowlist, rmnProxy, router) +``` + +Initializes the token pool with the specified parameters. + +#### Parameters + +| Name | Type | Description | +| ------------------ | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| token | IERC20 | The token managed by this pool | +| localTokenDecimals | uint8 | The number of decimals for the token on the local chain | +| allowlist | address[] | List of addresses allowed to be original senders for token transfers. When allowlist is enabled, it ensures only token-developer specified addresses can transfer tokens | +| rmnProxy | address | Address of the RMN proxy | +| acceptLiquidity | bool | Whether the pool accepts external liquidity | +| router | address | Address of the router | + +### lockOrBurn + +```solidity +function lockOrBurn( + Pool.LockOrBurnInV1 calldata lockOrBurnIn +) external virtual override returns (Pool.LockOrBurnOutV1 memory) +``` + +Locks the token in the pool. + + + +#### Parameters + +| Name | Type | Description | +| ------------ | ------------------- | --------------------------------------- | +| lockOrBurnIn | Pool.LockOrBurnInV1 | Input parameters for the lock operation | + +#### Return Value + +| Type | Description | +| -------------------- | --------------------------------------------------------- | +| Pool.LockOrBurnOutV1 | Struct containing destination token address and pool data | + +### releaseOrMint + +```solidity +function releaseOrMint( + Pool.ReleaseOrMintInV1 calldata releaseOrMintIn +) external virtual override returns (Pool.ReleaseOrMintOutV1 memory) +``` + +Releases tokens from the pool to the recipient. + + + +#### Parameters + +| Name | Type | Description | +| --------------- | ---------------------- | ------------------------------------------ | +| releaseOrMintIn | Pool.ReleaseOrMintInV1 | Input parameters for the release operation | + +#### Return Value + +| Type | Description | +| ----------------------- | ---------------------------------------- | +| Pool.ReleaseOrMintOutV1 | Struct containing the destination amount | + +### Liquidity Management Functions + +### getRebalancer + +```solidity +function getRebalancer() external view returns (address) +``` + +Gets the LiquidityManager address. + +#### Return Value + +| Type | Description | +| ------- | -------------------------------------------------------------------- | +| address | The current liquidity manager (can be address(0) if none configured) | + +### setRebalancer + +```solidity +function setRebalancer( + address rebalancer +) external onlyOwner +``` + +Sets the LiquidityManager address. + +#### Parameters + +| Name | Type | Description | +| ---------- | ------- | ---------------------- | +| rebalancer | address | New rebalancer address | + +### canAcceptLiquidity + +```solidity +function canAcceptLiquidity() external view returns (bool) +``` + +Checks if the pool can accept liquidity. + +#### Return Value + +| Type | Description | +| ---- | ------------------------------------- | +| bool | True if the pool can accept liquidity | + +### provideLiquidity + +```solidity +function provideLiquidity( + uint256 amount +) external +``` + +Adds liquidity to the pool. The tokens should be approved first. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ------------------------------ | +| amount | uint256 | Amount of liquidity to provide | + +### withdrawLiquidity + +```solidity +function withdrawLiquidity( + uint256 amount +) external +``` + +Removes liquidity from the pool. The tokens will be sent to msg.sender. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ----------------------------- | +| amount | uint256 | Amount of liquidity to remove | + +### transferLiquidity + +```solidity +function transferLiquidity(address from, uint256 amount) external onlyOwner +``` + +Transfers liquidity from an old version of the pool to this new pool. This function is specifically designed for pool upgrades. + + + +There are two ways to use this function during a pool upgrade: + +1. **Single Transaction Upgrade** (if multicall is available): + + - Call this function at the same time as updating the pool in TokenAdminRegistry + - This ensures a smooth transition of both liquidity and transactions + +2. **Gradual Upgrade** (if multicall is not available): + 1. First, transfer some liquidity to the new pool + 2. Update the TokenAdminRegistry to use the new pool + 3. New transactions will now use the new pool and its liquidity + 4. Finally, transfer the remaining liquidity using this function + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ------------------------------- | +| from | address | Address of the old pool | +| amount | uint256 | Amount of liquidity to transfer | + +### typeAndVersion + +```solidity +string public constant override typeAndVersion = "LockReleaseTokenPool 1.5.1" +``` + +Returns the type and version of the contract. + +#### Return Value + +| Type | Description | +| ------ | --------------------------------------- | +| string | The string "LockReleaseTokenPool 1.5.1" | diff --git a/src/content/ccip/api-reference/v1.5.1/pool.mdx b/src/content/ccip/api-reference/v1.5.1/pool.mdx new file mode 100644 index 00000000000..547dcf592c8 --- /dev/null +++ b/src/content/ccip/api-reference/v1.5.1/pool.mdx @@ -0,0 +1,136 @@ +--- +section: ccip +date: Last Modified +title: "CCIP v1.5.1 Pool Library API Reference" +metadata: + description: "API documentation for the Pool library in Chainlink CCIP v1.5.1, providing token pool functions for cross-chain operations." +--- + +import { Aside } from "@components" +import CcipCommon from "@features/ccip/CcipCommon.astro" + + + +The [`Pool`](https://github.com/smartcontractkit/ccip/blob/release/contracts-ccip-1.5.1/contracts/src/v0.8/ccip/libraries/Pool.sol) library provides various token pool functions to construct return data for cross-chain operations in Chainlink's CCIP. + +```solidity +import { Pool } from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Pool.sol"; +``` + +## Types and Constants + +### CCIP_POOL_V1 + +The tag used to signal support for the Pool v1 standard. + +```solidity +bytes4 public constant CCIP_POOL_V1 = 0xaff2afbf; +``` + +### CCIP_POOL_V1_RET_BYTES + +The number of bytes in the return data for a pool v1 releaseOrMint call. + +```solidity +uint16 public constant CCIP_POOL_V1_RET_BYTES = 32; +``` + +### CCIP_LOCK_OR_BURN_V1_RET_BYTES + +The default max number of bytes in the return data for a pool v1 lockOrBurn call. + +```solidity +uint32 public constant CCIP_LOCK_OR_BURN_V1_RET_BYTES = 32; +``` + +### LockOrBurnInV1 + +This struct represents the input data for a `lockOrBurn` call. + +```solidity +struct LockOrBurnInV1 { + bytes receiver; + uint64 remoteChainSelector; + address originalSender; + uint256 amount; + address localToken; +} +``` + +| Name | Type | Description | +| ------------------- | ------- | -------------------------------------------------------------------------------- | +| receiver | bytes | The recipient of the tokens on the destination chain, abi encoded | +| remoteChainSelector | uint64 | The chain ID of the destination chain | +| originalSender | address | The original sender of the tx on the source chain | +| amount | uint256 | The amount of tokens to lock or burn, denominated in the source token's decimals | +| localToken | address | The address on this chain of the token to lock or burn | + +### LockOrBurnOutV1 + +This struct represents the output data from a `lockOrBurn` call. + +```solidity +struct LockOrBurnOutV1 { + bytes destTokenAddress; + bytes destPoolData; +} +``` + +| Name | Type | Description | +| ---------------- | ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| destTokenAddress | bytes | The address of the destination token, abi encoded in the case of EVM chains. This value is UNTRUSTED as any pool owner can return whatever value they want. | +| destPoolData | bytes | Optional pool data to be transferred to the destination chain. By default this is capped at CCIP_LOCK_OR_BURN_V1_RET_BYTES bytes. If more data is required, the TokenTransferFeeConfig.destBytesOverhead has to be set for the specific token. | + +### ReleaseOrMintInV1 + +This struct represents the input data for a `releaseOrMint` call. + +```solidity +struct ReleaseOrMintInV1 { + bytes originalSender; + uint64 remoteChainSelector; + address receiver; + uint256 amount; + address localToken; + bytes sourcePoolAddress; + bytes sourcePoolData; + bytes offchainTokenData; +} +``` + +| Name | Type | Description | +| ------------------- | ------- | ----------------------------------------------------------------------------------- | +| originalSender | bytes | The original sender of the tx on the source chain | +| remoteChainSelector | uint64 | The chain ID of the source chain | +| receiver | address | The recipient of the tokens on the destination chain | +| amount | uint256 | The amount of tokens to release or mint, denominated in the source token's decimals | +| localToken | address | The address on this chain of the token to release or mint | +| sourcePoolAddress | bytes | The address of the source pool, abi encoded in the case of EVM chains | +| sourcePoolData | bytes | The data received from the source pool to process the release or mint | +| offchainTokenData | bytes | The offchain data to process the release or mint | + + + +### ReleaseOrMintOutV1 + +This struct represents the output data from a `releaseOrMint` call. + +```solidity +struct ReleaseOrMintOutV1 { + uint256 destinationAmount; +} +``` + +| Name | Type | Description | +| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | +| destinationAmount | uint256 | The number of tokens released or minted on the destination chain, denominated in the local token's decimals. Expected to match the input amount. | diff --git a/src/content/ccip/api-reference/v1.5.1/rate-limiter.mdx b/src/content/ccip/api-reference/v1.5.1/rate-limiter.mdx new file mode 100644 index 00000000000..2e334a213d5 --- /dev/null +++ b/src/content/ccip/api-reference/v1.5.1/rate-limiter.mdx @@ -0,0 +1,246 @@ +--- +section: ccip +date: Last Modified +title: "CCIP v1.5.1 RateLimiter Library API Reference" +metadata: + description: "API documentation for the RateLimiter library in Chainlink CCIP v1.5.1, implementing Token Bucket rate limiting for cross-chain operations." +--- + +import { Aside } from "@components" +import CcipCommon from "@features/ccip/CcipCommon.astro" + + + +The [`RateLimiter`](https://github.com/smartcontractkit/ccip/blob/release/contracts-ccip-1.5.1/contracts/src/v0.8/ccip/libraries/RateLimiter.sol) library implements Token Bucket rate limiting for CCIP operations. + + + +## Errors + +### BucketOverfilled + +```solidity +error BucketOverfilled() +``` + +### OnlyCallableByAdminOrOwner + +```solidity +error OnlyCallableByAdminOrOwner() +``` + +### TokenMaxCapacityExceeded + +```solidity +error TokenMaxCapacityExceeded(uint256 capacity, uint256 requested, address tokenAddress) +``` + +### TokenRateLimitReached + +```solidity +error TokenRateLimitReached(uint256 minWaitInSeconds, uint256 available, address tokenAddress) +``` + +### AggregateValueMaxCapacityExceeded + +```solidity +error AggregateValueMaxCapacityExceeded(uint256 capacity, uint256 requested) +``` + +### AggregateValueRateLimitReached + +```solidity +error AggregateValueRateLimitReached(uint256 minWaitInSeconds, uint256 available) +``` + +### InvalidRateLimitRate + +```solidity +error InvalidRateLimitRate(Config rateLimiterConfig) +``` + +### DisabledNonZeroRateLimit + +```solidity +error DisabledNonZeroRateLimit(Config config) +``` + +### RateLimitMustBeDisabled + +```solidity +error RateLimitMustBeDisabled() +``` + +## Events + +### TokensConsumed + +```solidity +event TokensConsumed(uint256 tokens) +``` + +### ConfigChanged + +```solidity +event ConfigChanged(Config config) +``` + +## Structs + +### TokenBucket + +```solidity +struct TokenBucket { + uint128 tokens; + uint32 lastUpdated; + bool isEnabled; + uint128 capacity; + uint128 rate; +} +``` + +| Name | Type | Description | +| ----------- | ------- | ------------------------------------------------------------------ | +| tokens | uint128 | Current number of tokens that are in the bucket | +| lastUpdated | uint32 | Timestamp in seconds of the last token refill, good for 100+ years | +| isEnabled | bool | Indication whether the rate limiting is enabled or not | +| capacity | uint128 | Maximum number of tokens that can be in the bucket | +| rate | uint128 | Number of tokens per second that the bucket is refilled | + +### Config + +```solidity +struct Config { + bool isEnabled; + uint128 capacity; + uint128 rate; +} +``` + +| Name | Type | Description | +| --------- | ------- | ------------------------------------------------------ | +| isEnabled | bool | Indication whether the rate limiting should be enabled | +| capacity | uint128 | Specifies the capacity of the rate limiter | +| rate | uint128 | Specifies the rate of the rate limiter | + +## Functions + +### \_consume + +```solidity +function _consume(TokenBucket storage s_bucket, uint256 requestTokens, address tokenAddress) internal +``` + +Removes the given tokens from the pool, lowering the rate tokens allowed to be consumed for subsequent calls. + +#### Parameters + +| Name | Type | Description | +| ------------- | ----------- | ------------------------------------------------------------------------------- | +| s_bucket | TokenBucket | The token bucket to consume from | +| requestTokens | uint256 | The total tokens to be consumed from the bucket | +| tokenAddress | address | The token to consume capacity for, use 0x0 to indicate aggregate value capacity | + + + +### \_currentTokenBucketState + +```solidity +function _currentTokenBucketState(TokenBucket memory bucket) internal view returns (TokenBucket memory) +``` + +Gets the token bucket with its values for the block it was requested at. + +#### Parameters + +| Name | Type | Description | +| ------ | ----------- | ---------------- | +| bucket | TokenBucket | The token bucket | + +#### Return Values + +| Type | Description | +| ----------- | ------------------------------------------ | +| TokenBucket | The token bucket with current block values | + +### \_setTokenBucketConfig + +```solidity +function _setTokenBucketConfig(TokenBucket storage s_bucket, Config memory config) internal +``` + +Sets the rate limited config. + +#### Parameters + +| Name | Type | Description | +| -------- | ----------- | ---------------- | +| s_bucket | TokenBucket | The token bucket | +| config | Config | The new config | + +### \_validateTokenBucketConfig + +```solidity +function _validateTokenBucketConfig(Config memory config, bool mustBeDisabled) internal pure +``` + +Validates the token bucket config. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------ | ----------------------------------- | +| config | Config | The config to validate | +| mustBeDisabled | bool | Whether the config must be disabled | + +### \_calculateRefill + +```solidity +function _calculateRefill(uint256 capacity, uint256 tokens, uint256 timeDiff, uint256 rate) private pure returns (uint256) +``` + +Calculate refilled tokens. + +#### Parameters + +| Name | Type | Description | +| -------- | ------- | --------------------------------------- | +| capacity | uint256 | bucket capacity | +| tokens | uint256 | current bucket tokens | +| timeDiff | uint256 | block time difference since last refill | +| rate | uint256 | bucket refill rate | + +#### Return Values + +| Type | Description | +| ------- | -------------------------------- | +| uint256 | the value of tokens after refill | + +### \_min + +```solidity +function _min(uint256 a, uint256 b) internal pure returns (uint256) +``` + +Return the smallest of two integers. + +#### Parameters + +| Name | Type | Description | +| ---- | ------- | ----------- | +| a | uint256 | first int | +| b | uint256 | second int | + +#### Return Values + +| Type | Description | +| ------- | ---------------- | +| uint256 | smallest integer | diff --git a/src/content/ccip/api-reference/v1.5.1/registry-module-owner-custom.mdx b/src/content/ccip/api-reference/v1.5.1/registry-module-owner-custom.mdx new file mode 100644 index 00000000000..bdc98bcf9e2 --- /dev/null +++ b/src/content/ccip/api-reference/v1.5.1/registry-module-owner-custom.mdx @@ -0,0 +1,152 @@ +--- +section: ccip +date: Last Modified +title: "CCIP v1.5.1 RegistryModuleOwnerCustom Contract API Reference" +metadata: + description: "API documentation for the RegistryModuleOwnerCustom contract in Chainlink CCIP v1.5.1" +--- + +import { Aside } from "@components" +import CcipCommon from "@features/ccip/CcipCommon.astro" + + + +The [`RegistryModuleOwnerCustom`](https://github.com/smartcontractkit/ccip/blob/release/contracts-ccip-1.5.1/contracts/src/v0.8/ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol) contract provides different methods for token developers to register themselves as administrators for their tokens in CCIP. + +## Errors + +### CanOnlySelfRegister + +```solidity +error CanOnlySelfRegister(address admin, address token) +``` + +Thrown when someone tries to register an admin that isn't themselves. + +| Parameter | Type | Description | +| --------- | ------- | ---------------------- | +| admin | address | Expected admin address | +| token | address | Token being registered | + +### RequiredRoleNotFound + +```solidity +error RequiredRoleNotFound(address msgSender, bytes32 role, address token) +``` + +Thrown when caller doesn't have the required role for registration. + +| Parameter | Type | Description | +| --------- | ------- | ----------------------------------- | +| msgSender | address | Address that attempted registration | +| role | bytes32 | Required role that was missing | +| token | address | Token being registered | + +### AddressZero + +```solidity +error AddressZero() +``` + +Thrown when trying to set the TokenAdminRegistry address to zero. + +## Events + +### AdministratorRegistered + +```solidity +event AdministratorRegistered(address indexed token, address indexed administrator) +``` + +Emitted when an administrator is successfully registered for a token. + +| Parameter | Type | Description | +| ------------- | ------- | --------------------------------------- | +| token | address | Token address that got an administrator | +| administrator | address | Address registered as administrator | + +## Functions + +### constructor + +```solidity +constructor( + address tokenAdminRegistry +) +``` + +Initializes the contract with the TokenAdminRegistry address. + +#### Parameters + +| Name | Type | Description | +| ------------------ | ------- | ------------------------------------------ | +| tokenAdminRegistry | address | Address of the TokenAdminRegistry contract | + +### registerAdminViaGetCCIPAdmin + +```solidity +function registerAdminViaGetCCIPAdmin( + address token +) external +``` + +Registers an administrator using the token's `getCCIPAdmin()` method. + + + +#### Parameters + +| Name | Type | Description | +| ----- | ------- | ------------------------------------------- | +| token | address | Token address to register administrator for | + +### registerAdminViaOwner + +```solidity +function registerAdminViaOwner( + address token +) external +``` + +Registers an administrator using the token's `owner()` method. + + + +#### Parameters + +| Name | Type | Description | +| ----- | ------- | ------------------------------------------- | +| token | address | Token address to register administrator for | + +### registerAccessControlDefaultAdmin + +```solidity +function registerAccessControlDefaultAdmin( + address token +) external +``` + +Registers an administrator using OpenZeppelin's AccessControl DEFAULT_ADMIN_ROLE. + + + +#### Parameters + +| Name | Type | Description | +| ----- | ------- | ------------------------------------------- | +| token | address | Token address to register administrator for | + +### typeAndVersion + +```solidity +string public constant override typeAndVersion = "RegistryModuleOwnerCustom 1.6.0" +``` + +Returns the type and version of the contract. + +#### Return Value + +| Type | Description | +| ------ | -------------------------------------------- | +| string | The string "RegistryModuleOwnerCustom 1.6.0" | diff --git a/src/content/ccip/api-reference/v1.5.1/token-admin-registry.mdx b/src/content/ccip/api-reference/v1.5.1/token-admin-registry.mdx new file mode 100644 index 00000000000..45de050a028 --- /dev/null +++ b/src/content/ccip/api-reference/v1.5.1/token-admin-registry.mdx @@ -0,0 +1,467 @@ +--- +section: ccip +date: Last Modified +title: "CCIP v1.5.1 TokenAdminRegistry Contract API Reference" +metadata: + description: "API documentation for the TokenAdminRegistry contract in Chainlink CCIP v1.5.1" +--- + +import { Aside } from "@components" +import CcipCommon from "@features/ccip/CcipCommon.astro" + + + +The [`TokenAdminRegistry`](https://github.com/smartcontractkit/ccip/blob/release/contracts-ccip-1.5.1/contracts/src/v0.8/ccip/tokenAdminRegistry/TokenAdminRegistry.sol) contract manages which tokens can be transferred through CCIP and who can configure them. Key features: + +- Token developers can register their tokens without needing permission from CCIP +- Each token has an administrator who controls its CCIP settings +- Administrators can enable or disable their tokens for CCIP transfers +- The contract is not upgradeable to ensure data persistence + +## Errors + +### OnlyRegistryModuleOrOwner + +```solidity +error OnlyRegistryModuleOrOwner(address sender) +``` + +Thrown when someone tries to perform an action restricted to registry modules or the owner. + +| Parameter | Type | Description | +| --------- | ------- | -------------------------------------------- | +| sender | address | Address that attempted the restricted action | + +### OnlyAdministrator + +```solidity +error OnlyAdministrator(address sender, address token) +``` + +Thrown when someone tries to perform an action restricted to the token's administrator. + +| Parameter | Type | Description | +| --------- | ------- | -------------------------------------------- | +| sender | address | Address that attempted the restricted action | +| token | address | Token address that was being configured | + +### OnlyPendingAdministrator + +```solidity +error OnlyPendingAdministrator(address sender, address token) +``` + +Thrown when someone other than the pending administrator tries to accept the administrator role. + +| Parameter | Type | Description | +| --------- | ------- | ----------------------------------------- | +| sender | address | Address that attempted to accept the role | +| token | address | Token address involved | + +### AlreadyRegistered + +```solidity +error AlreadyRegistered(address token) +``` + +Thrown when trying to register a token that already has an administrator. + +| Parameter | Type | Description | +| --------- | ------- | ----------------------------------------- | +| token | address | Token address that was already registered | + +### ZeroAddress + +```solidity +error ZeroAddress() +``` + +Thrown when trying to set a critical address to zero (except for specific allowed cases). + +### InvalidTokenPoolToken + +```solidity +error InvalidTokenPoolToken(address token) +``` + +Thrown when trying to set a pool that doesn't support the specified token. + +| Parameter | Type | Description | +| --------- | ------- | ------------------------------------------- | +| token | address | Token address that the pool doesn't support | + + + +## Events + +### PoolSet + +```solidity +event PoolSet( + address indexed token, + address indexed previousPool, + address indexed newPool +) +``` + +Emitted when a token's pool address is changed. This indicates a change in how the token is handled in CCIP. + +| Parameter | Type | Description | +| ------------ | ------- | ------------------------------------------------------------------ | +| token | address | Token address whose pool was changed | +| previousPool | address | Old pool address (can be address(0)) | +| newPool | address | New pool address (can be address(0) to disable CCIP for the token) | + +### AdministratorTransferRequested + +```solidity +event AdministratorTransferRequested( + address indexed token, + address indexed currentAdmin, + address indexed newAdmin +) +``` + +Emitted when the first step of an administrator transfer is initiated. + +| Parameter | Type | Description | +| ------------ | ------- | ----------------------------------------------------------------------- | +| token | address | Token address whose administrator is being changed | +| currentAdmin | address | Current administrator address (can be address(0) for new registrations) | +| newAdmin | address | Proposed new administrator address | + +### AdministratorTransferred + +```solidity +event AdministratorTransferred( + address indexed token, + address indexed newAdmin +) +``` + +Emitted when an administrator transfer is completed (after the new administrator accepts the role). + +| Parameter | Type | Description | +| --------- | ------- | ----------------------------------------- | +| token | address | Token address whose administrator changed | +| newAdmin | address | Address of the new administrator | + +### RegistryModuleAdded + +```solidity +event RegistryModuleAdded(address module) +``` + +Emitted when a new registry module is added to the system. + +| Parameter | Type | Description | +| --------- | ------- | ------------------------------------------ | +| module | address | Address of the newly added registry module | + +### RegistryModuleRemoved + +```solidity +event RegistryModuleRemoved(address indexed module) +``` + +Emitted when a registry module is removed from the system. + +| Parameter | Type | Description | +| --------- | ------- | -------------------------------------- | +| module | address | Address of the removed registry module | + + + +## Data Structures + +### TokenConfig + +```solidity +struct TokenConfig { + address administrator; + address pendingAdministrator; + address tokenPool; +} +``` + +Configuration data for each token: +| Field | Type | Description | +|-------|------|-------------| +| administrator | address | Current administrator who can manage the token's CCIP settings | +| pendingAdministrator | address | Address nominated to become the new administrator (part of 2-step transfer) | +| tokenPool | address | Pool contract that handles the token's cross-chain transfers. If set to address(0), the token is disabled for CCIP | + +## Core Query Functions + +### getPools + +```solidity +function getPools( + address[] calldata tokens +) external view returns (address[] memory) +``` + +Gets the pool addresses for multiple tokens at once. + +#### Parameters + +| Name | Type | Description | +| ------ | --------- | --------------------------------- | +| tokens | address[] | Array of token addresses to query | + +#### Return Value + +| Type | Description | +| --------- | -------------------------------------------------------------------- | +| address[] | Array of pool addresses. Will be address(0) for tokens without pools | + +### getPool + +```solidity +function getPool( + address token +) external view returns (address) +``` + +Gets the pool address for a single token. + +#### Parameters + +| Name | Type | Description | +| ----- | ------- | ---------------------- | +| token | address | Token address to query | + +#### Return Value + +| Type | Description | +| ------- | ----------------------------------------------------------- | +| address | Pool address for the token, or address(0) if not configured | + +### getTokenConfig + +```solidity +function getTokenConfig( + address token +) external view returns (TokenConfig memory) +``` + +Gets the complete configuration for a token. + +#### Parameters + +| Name | Type | Description | +| ----- | ------- | ---------------------- | +| token | address | Token address to query | + +#### Return Value + +| Type | Description | +| ----------- | ------------------------------------------------------------------------------------- | +| TokenConfig | Complete token configuration including administrator, pending administrator, and pool | + +### getAllConfiguredTokens + +```solidity +function getAllConfiguredTokens( + uint64 startIndex, + uint64 maxCount +) external view returns (address[] memory tokens) +``` + +Gets a list of all configured tokens, with pagination support to handle large lists. + + + +#### Parameters + +| Name | Type | Description | +| ---------- | ------ | --------------------------------------------------------------------------------- | +| startIndex | uint64 | Position to start reading from (0 for beginning) | +| maxCount | uint64 | Maximum number of tokens to return. Use type(uint64).max for all remaining tokens | + +#### Return Value + +| Type | Description | +| --------- | ------------------------ | +| address[] | Array of token addresses | + +## Administrator Management Functions + +### setPool + +```solidity +function setPool( + address localToken, + address pool +) external onlyTokenAdmin(localToken) +``` + +Sets or changes the pool for a token. Only callable by the token's administrator. + + + +#### Parameters + +| Name | Type | Description | +| ---------- | ------- | ------------------------------------------ | +| localToken | address | Token to configure | +| pool | address | New pool address, or address(0) to disable | + +### transferAdminRole + +```solidity +function transferAdminRole( + address localToken, + address newAdmin +) external onlyTokenAdmin(localToken) +``` + +Initiates the transfer of administrator rights to a new address. + + + +#### Parameters + +| Name | Type | Description | +| ---------- | ------- | --------------------------------------------------------------------- | +| localToken | address | Token whose administrator is being changed | +| newAdmin | address | Proposed new administrator (or address(0) to cancel pending transfer) | + +### acceptAdminRole + +```solidity +function acceptAdminRole( + address localToken +) external +``` + +Completes the transfer of administrator rights. Must be called by the pending administrator. + +#### Parameters + +| Name | Type | Description | +| ---------- | ------- | -------------------------------------- | +| localToken | address | Token to accept administrator role for | + +### isAdministrator + +```solidity +function isAdministrator( + address localToken, + address administrator +) external view returns (bool) +``` + +Checks if an address is the administrator for a token. + +#### Parameters + +| Name | Type | Description | +| ------------- | ------- | ----------------- | +| localToken | address | Token to check | +| administrator | address | Address to verify | + +#### Return Value + +| Type | Description | +| ---- | ------------------------------------------------ | +| bool | True if the address is the token's administrator | + +### proposeAdministrator + +```solidity +function proposeAdministrator( + address localToken, + address administrator +) external +``` + +Proposes an initial administrator for a token. Can only be called by registry modules or owner. + + + +#### Parameters + +| Name | Type | Description | +| ------------- | ------- | ------------------------------ | +| localToken | address | Token to set administrator for | +| administrator | address | Proposed administrator address | + +## Registry Module Management + +### isRegistryModule + +```solidity +function isRegistryModule( + address module +) public view returns (bool) +``` + +Checks if an address is an authorized registry module. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ---------------- | +| module | address | Address to check | + +#### Return Value + +| Type | Description | +| ---- | ---------------------------------------------------- | +| bool | True if the address is an authorized registry module | + +### addRegistryModule + +```solidity +function addRegistryModule( + address module +) external onlyOwner +``` + +Adds a new registry module. Only callable by owner. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ------------------------ | +| module | address | Address of module to add | + +### removeRegistryModule + +```solidity +function removeRegistryModule( + address module +) external onlyOwner +``` + +Removes a registry module. Only callable by owner. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | --------------------------- | +| module | address | Address of module to remove | + +### typeAndVersion + +```solidity +string public constant override typeAndVersion = "TokenAdminRegistry 1.5.0" +``` + +Returns the type and version of the contract. + +#### Return Value + +| Type | Description | +| ------ | ------------------------------------- | +| string | The string "TokenAdminRegistry 1.5.0" | diff --git a/src/content/ccip/api-reference/v1.5.1/token-pool.mdx b/src/content/ccip/api-reference/v1.5.1/token-pool.mdx new file mode 100644 index 00000000000..a2a4511fe0d --- /dev/null +++ b/src/content/ccip/api-reference/v1.5.1/token-pool.mdx @@ -0,0 +1,1030 @@ +--- +section: ccip +date: Last Modified +title: "CCIP v1.5.1 TokenPool Contract API Reference" +metadata: + description: "API documentation for the TokenPool abstract contract in Chainlink CCIP v1.5.1, providing base functionality for token pools with cross-chain operations." +--- + +import { Aside } from "@components" +import CcipCommon from "@features/ccip/CcipCommon.astro" + + + +The [`TokenPool`](https://github.com/smartcontractkit/ccip/blob/release/contracts-ccip-1.5.1/contracts/src/v0.8/ccip/pools/TokenPool.sol) abstract contract provides base functionality for token pools in CCIP, handling cross-chain token transfers with decimal adjustments and rate limiting. + + + +## Errors + +### CallerIsNotARampOnRouter + +```solidity +error CallerIsNotARampOnRouter(address caller) +``` + +Thrown when caller is not a valid ramp on router. + +### ZeroAddressNotAllowed + +```solidity +error ZeroAddressNotAllowed() +``` + +Thrown when a zero address is provided. + +### SenderNotAllowed + +```solidity +error SenderNotAllowed(address sender) +``` + +Thrown when sender is not on allowlist. + +### AllowListNotEnabled + +```solidity +error AllowListNotEnabled() +``` + +Thrown when trying to use allowlist features while disabled. + +### NonExistentChain + +```solidity +error NonExistentChain(uint64 remoteChainSelector) +``` + +Thrown when chain selector doesn't exist. + +### ChainNotAllowed + +```solidity +error ChainNotAllowed(uint64 remoteChainSelector) +``` + +Thrown when chain is not configured. + +### CursedByRMN + +```solidity +error CursedByRMN() +``` + +Thrown when RMN has cursed the operation. + +### ChainAlreadyExists + +```solidity +error ChainAlreadyExists(uint64 chainSelector) +``` + +Thrown when adding an existing chain. + +### InvalidSourcePoolAddress + +```solidity +error InvalidSourcePoolAddress(bytes sourcePoolAddress) +``` + +Thrown when source pool address is invalid. + +### InvalidToken + +```solidity +error InvalidToken(address token) +``` + +Thrown when token is not supported. + +### Unauthorized + +```solidity +error Unauthorized(address caller) +``` + +Thrown when caller lacks required permissions. + +### PoolAlreadyAdded + +```solidity +error PoolAlreadyAdded(uint64 remoteChainSelector, bytes remotePoolAddress) +``` + +Thrown when attempting to add an already existing pool. + +### InvalidRemotePoolForChain + +```solidity +error InvalidRemotePoolForChain(uint64 remoteChainSelector, bytes remotePoolAddress) +``` + +Thrown when remote pool configuration is invalid for the specified chain. + +### InvalidRemoteChainDecimals + +```solidity +error InvalidRemoteChainDecimals(bytes sourcePoolData) +``` + +Thrown when remote chain decimals data is invalid. + +### OverflowDetected + +```solidity +error OverflowDetected(uint8 remoteDecimals, uint8 localDecimals, uint256 remoteAmount) +``` + +Thrown when decimal conversion would result in overflow. + +### InvalidDecimalArgs + +```solidity +error InvalidDecimalArgs(uint8 expected, uint8 actual) +``` + +Thrown when provided decimal arguments don't match expected values. + +## Events + +### Locked + +```solidity +event Locked(address indexed sender, uint256 amount) +``` + +Emitted when tokens are locked in the pool. + +| Parameter | Type | Description | +| --------- | ------- | ------------------------------- | +| sender | address | Address that initiated the lock | +| amount | uint256 | Amount of tokens locked | + +### Burned + +```solidity +event Burned(address indexed sender, uint256 amount) +``` + +Emitted when tokens are burned. + +| Parameter | Type | Description | +| --------- | ------- | ------------------------------- | +| sender | address | Address that initiated the burn | +| amount | uint256 | Amount of tokens burned | + +### Released + +```solidity +event Released(address indexed sender, address indexed recipient, uint256 amount) +``` + +Emitted when tokens are released from the pool. + +| Parameter | Type | Description | +| --------- | ------- | ---------------------------------- | +| sender | address | Address that initiated the release | +| recipient | address | Address receiving the tokens | +| amount | uint256 | Amount of tokens released | + +### Minted + +```solidity +event Minted(address indexed sender, address indexed recipient, uint256 amount) +``` + +Emitted when tokens are minted. + +| Parameter | Type | Description | +| --------- | ------- | ----------------------------------- | +| sender | address | Address that initiated the mint | +| recipient | address | Address receiving the minted tokens | +| amount | uint256 | Amount of tokens minted | + +### ChainAdded + +```solidity +event ChainAdded( + uint64 remoteChainSelector, + bytes remoteToken, + RateLimiter.Config outboundRateLimiterConfig, + RateLimiter.Config inboundRateLimiterConfig +) +``` + +Emitted when a new chain is added to the pool. + +| Parameter | Type | Description | +| ------------------------- | ------------------ | -------------------------------------- | +| remoteChainSelector | uint64 | Selector of the added chain | +| remoteToken | bytes | Address of token on remote chain | +| outboundRateLimiterConfig | RateLimiter.Config | Configuration for outbound rate limits | +| inboundRateLimiterConfig | RateLimiter.Config | Configuration for inbound rate limits | + +### ChainConfigured + +```solidity +event ChainConfigured( + uint64 remoteChainSelector, + RateLimiter.Config outboundRateLimiterConfig, + RateLimiter.Config inboundRateLimiterConfig +) +``` + +Emitted when a chain's configuration is updated. + +| Parameter | Type | Description | +| ------------------------- | ------------------ | ------------------------------------- | +| remoteChainSelector | uint64 | Selector of the configured chain | +| outboundRateLimiterConfig | RateLimiter.Config | New outbound rate limit configuration | +| inboundRateLimiterConfig | RateLimiter.Config | New inbound rate limit configuration | + +### ChainRemoved + +```solidity +event ChainRemoved(uint64 remoteChainSelector) +``` + +Emitted when a chain is removed from the pool. + +| Parameter | Type | Description | +| ------------------- | ------ | ----------------------------- | +| remoteChainSelector | uint64 | Selector of the removed chain | + +### RemotePoolAdded + +```solidity +event RemotePoolAdded(uint64 indexed remoteChainSelector, bytes remotePoolAddress) +``` + +Emitted when a remote pool is added. + +| Parameter | Type | Description | +| ------------------- | ------ | ---------------------------------- | +| remoteChainSelector | uint64 | Chain selector for the remote pool | +| remotePoolAddress | bytes | Address of the added remote pool | + +### RemotePoolRemoved + +```solidity +event RemotePoolRemoved(uint64 indexed remoteChainSelector, bytes remotePoolAddress) +``` + +Emitted when a remote pool is removed. + +| Parameter | Type | Description | +| ------------------- | ------ | ---------------------------------- | +| remoteChainSelector | uint64 | Chain selector for the remote pool | +| remotePoolAddress | bytes | Address of the removed remote pool | + +### AllowListAdd + +```solidity +event AllowListAdd(address sender) +``` + +Emitted when an address is added to the allowlist. + +| Parameter | Type | Description | +| --------- | ------- | -------------------------- | +| sender | address | Address added to allowlist | + +### AllowListRemove + +```solidity +event AllowListRemove(address sender) +``` + +Emitted when an address is removed from the allowlist. + +| Parameter | Type | Description | +| --------- | ------- | ------------------------------ | +| sender | address | Address removed from allowlist | + +### RouterUpdated + +```solidity +event RouterUpdated(address oldRouter, address newRouter) +``` + +Emitted when the router address is updated. + +| Parameter | Type | Description | +| --------- | ------- | ----------------------- | +| oldRouter | address | Previous router address | +| newRouter | address | New router address | + +### RateLimitAdminSet + +```solidity +event RateLimitAdminSet(address rateLimitAdmin) +``` + +Emitted when the rate limit admin is set. + +| Parameter | Type | Description | +| -------------- | ------- | ---------------------------- | +| rateLimitAdmin | address | New rate limit admin address | + +## Structs + +### ChainUpdate + +```solidity +struct ChainUpdate { + uint64 remoteChainSelector; + bytes[] remotePoolAddresses; + bytes remoteTokenAddress; + RateLimiter.Config outboundRateLimiterConfig; + RateLimiter.Config inboundRateLimiterConfig; +} +``` + +| Field | Type | Description | +| ------------------------- | ------------------ | -------------------------------------------------- | +| remoteChainSelector | uint64 | Remote chain selector | +| remotePoolAddresses | bytes[] | Remote pool addresses (ABI encoded for EVM chains) | +| remoteTokenAddress | bytes | Remote token address (ABI encoded for EVM chains) | +| outboundRateLimiterConfig | RateLimiter.Config | Rate limits for onRamps | +| inboundRateLimiterConfig | RateLimiter.Config | Rate limits for offRamps | + +## Functions + +### constructor + +```solidity +constructor( + IERC20 token, + uint8 localTokenDecimals, + address[] memory allowlist, + address rmnProxy, + address router +) +``` + +Initializes the token pool with the specified parameters. + +#### Parameters + +| Name | Type | Description | +| ------------------ | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| token | IERC20 | The token managed by this pool | +| localTokenDecimals | uint8 | The number of decimals for the token on the local chain | +| allowlist | address[] | List of addresses allowed to be original senders for token transfers. When allowlist is enabled, it ensures only token-developer specified addresses can transfer tokens | +| rmnProxy | address | Address of the RMN proxy | +| router | address | Address of the router | + +### Chain Management + +```solidity +function applyChainUpdates( + uint64[] calldata remoteChainSelectorsToRemove, + ChainUpdate[] calldata chainsToAdd +) external onlyOwner +``` + +Updates supported chains and their configurations. + +### Rate Limiting + +```solidity +function setChainRateLimiterConfig( + uint64 remoteChainSelector, + RateLimiter.Config memory outboundConfig, + RateLimiter.Config memory inboundConfig +) external +``` + +Sets rate limiting configuration for a chain. + + + +### Validation + +```solidity +function _validateLockOrBurn( + Pool.LockOrBurnInV1 calldata lockOrBurnIn +) internal +``` + +Validates lock/burn operations for: + +- Token validity +- RMN curse status +- Allowlist status +- OnRamp validity +- Rate limits + +### Decimal Handling + +```solidity +function _calculateLocalAmount( + uint256 remoteAmount, + uint8 remoteDecimals +) internal view returns (uint256) +``` + +Calculates local token amounts based on remote amounts and decimals, with overflow protection. + +### Token Management + +### isSupportedToken + +```solidity +function isSupportedToken( + address token +) public view virtual returns (bool) +``` + +Checks if the given token is supported by this pool. + +#### Parameters + +| Name | Type | Description | +| ----- | ------- | ------------------------- | +| token | address | Address of token to check | + +#### Return Value + +| Type | Description | +| ---- | -------------------------- | +| bool | True if token is supported | + +### getToken + +```solidity +function getToken() public view returns (IERC20 token) +``` + +Gets the IERC20 token that this pool can lock or burn. + +#### Return Value + +| Type | Description | +| ------ | ------------------------------ | +| IERC20 | The token managed by this pool | + +### Router Management + +### getRmnProxy + +```solidity +function getRmnProxy() public view returns (address rmnProxy) +``` + +Gets the RMN proxy address. + +#### Return Value + +| Type | Description | +| ------- | -------------------- | +| address | Address of RMN proxy | + +### getRouter + +```solidity +function getRouter() public view returns (address router) +``` + +Gets the pool's Router address. + +#### Return Value + +| Type | Description | +| ------- | ------------------------- | +| address | The pool's Router address | + +### setRouter + +```solidity +function setRouter( + address newRouter +) public onlyOwner +``` + +Sets the pool's Router address. + +#### Parameters + +| Name | Type | Description | +| --------- | ------- | ---------------------- | +| newRouter | address | The new Router address | + +### Interface Support + +### supportsInterface + +```solidity +function supportsInterface( + bytes4 interfaceId +) public pure virtual override returns (bool) +``` + +Signals which version of the pool interface is supported. + +#### Parameters + +| Name | Type | Description | +| ----------- | ------ | ----------------------------- | +| interfaceId | bytes4 | Interface identifier to check | + +#### Return Value + +| Type | Description | +| ---- | ------------------------------ | +| bool | True if interface is supported | + +### Validation Functions + +### \_validateLockOrBurn + +```solidity +function _validateLockOrBurn( + Pool.LockOrBurnInV1 calldata lockOrBurnIn +) internal +``` + +Validates lock or burn operations for security and configuration requirements. + + + +#### Parameters + +| Name | Type | Description | +| ------------ | ------------------- | -------------------------------------------- | +| lockOrBurnIn | Pool.LockOrBurnInV1 | Input parameters for the lock/burn operation | + +### \_validateReleaseOrMint + +```solidity +function _validateReleaseOrMint( + Pool.ReleaseOrMintInV1 calldata releaseOrMintIn +) internal +``` + +Validates release or mint operations for security and configuration requirements. + + + +#### Parameters + +| Name | Type | Description | +| --------------- | ---------------------- | ----------------------------------------------- | +| releaseOrMintIn | Pool.ReleaseOrMintInV1 | Input parameters for the release/mint operation | + +### Token Decimals Functions + +### getTokenDecimals + +```solidity +function getTokenDecimals() public view virtual returns (uint8 decimals) +``` + +Gets the IERC20 token decimals on the local chain. + +#### Return Value + +| Type | Description | +| ----- | -------------------------------------- | +| uint8 | Number of decimals for the local token | + +### \_encodeLocalDecimals + +```solidity +function _encodeLocalDecimals() internal view virtual returns (bytes memory) +``` + +Encodes the local token decimals for cross-chain communication. + +#### Return Value + +| Type | Description | +| ----- | -------------------------------- | +| bytes | ABI-encoded local token decimals | + +### \_parseRemoteDecimals + +```solidity +function _parseRemoteDecimals( + bytes memory sourcePoolData +) internal view virtual returns (uint8) +``` + +Parses the remote chain's token decimals from the source pool data. + +#### Parameters + +| Name | Type | Description | +| -------------- | ----- | ----------------------------- | +| sourcePoolData | bytes | Encoded data from source pool | + +#### Return Value + +| Type | Description | +| ----- | ---------------------------------- | +| uint8 | Number of decimals on remote chain | + +### \_calculateLocalAmount + +```solidity +function _calculateLocalAmount( + uint256 remoteAmount, + uint8 remoteDecimals +) internal view virtual returns (uint256) +``` + +Calculates the local amount based on remote amount and decimals. + + + +#### Parameters + +| Name | Type | Description | +| -------------- | ------- | --------------------------------- | +| remoteAmount | uint256 | Amount on remote chain | +| remoteDecimals | uint8 | Decimals of token on remote chain | + +#### Return Value + +| Type | Description | +| ------- | ------------------------------- | +| uint256 | Adjusted amount for local chain | + +### Chain Permissions Functions + +### getRemotePools + +```solidity +function getRemotePools( + uint64 remoteChainSelector +) public view returns (bytes[] memory) +``` + +Gets the pool addresses on the remote chain. + +#### Parameters + +| Name | Type | Description | +| ------------------- | ------ | --------------------- | +| remoteChainSelector | uint64 | Remote chain selector | + +#### Return Value + +| Type | Description | +| ------- | ------------------------------ | +| bytes[] | Array of remote pool addresses | + +### isRemotePool + +```solidity +function isRemotePool( + uint64 remoteChainSelector, + bytes calldata remotePoolAddress +) public view returns (bool) +``` + +Checks if a pool address is configured on the remote chain. + +#### Parameters + +| Name | Type | Description | +| ------------------- | ------ | --------------------- | +| remoteChainSelector | uint64 | Remote chain selector | +| remotePoolAddress | bytes | Address to check | + +#### Return Value + +| Type | Description | +| ---- | -------------------------- | +| bool | True if pool is configured | + +### getRemoteToken + +```solidity +function getRemoteToken( + uint64 remoteChainSelector +) public view returns (bytes memory) +``` + +Gets the token address on the remote chain. + +#### Parameters + +| Name | Type | Description | +| ------------------- | ------ | --------------------- | +| remoteChainSelector | uint64 | Remote chain selector | + +#### Return Value + +| Type | Description | +| ----- | ---------------------------- | +| bytes | Encoded remote token address | + +### addRemotePool + +```solidity +function addRemotePool( + uint64 remoteChainSelector, + bytes calldata remotePoolAddress +) external onlyOwner +``` + +Adds a remote pool for a given chain selector. Useful when a pool is upgraded on the remote chain. + +#### Parameters + +| Name | Type | Description | +| ------------------- | ------ | -------------------------- | +| remoteChainSelector | uint64 | Remote chain selector | +| remotePoolAddress | bytes | Address of new remote pool | + +### removeRemotePool + +```solidity +function removeRemotePool( + uint64 remoteChainSelector, + bytes calldata remotePoolAddress +) external onlyOwner +``` + +Removes a remote pool address for a given chain selector. + + + +#### Parameters + +| Name | Type | Description | +| ------------------- | ------ | ------------------------- | +| remoteChainSelector | uint64 | Remote chain selector | +| remotePoolAddress | bytes | Address of pool to remove | + +### Chain Support Functions + +### isSupportedChain + +```solidity +function isSupportedChain( + uint64 remoteChainSelector +) public view returns (bool) +``` + +Checks if a chain is supported. + +#### Parameters + +| Name | Type | Description | +| ------------------- | ------ | ----------------------- | +| remoteChainSelector | uint64 | Chain selector to check | + +#### Return Value + +| Type | Description | +| ---- | -------------------------- | +| bool | True if chain is supported | + +### getSupportedChains + +```solidity +function getSupportedChains() public view returns (uint64[] memory) +``` + +Gets list of all supported chains. + +#### Return Value + +| Type | Description | +| -------- | ---------------------------------- | +| uint64[] | Array of supported chain selectors | + +### applyChainUpdates + +```solidity +function applyChainUpdates( + uint64[] calldata remoteChainSelectorsToRemove, + ChainUpdate[] calldata chainsToAdd +) external virtual onlyOwner +``` + +Updates chain permissions and configurations. + +#### Parameters + +| Name | Type | Description | +| ---------------------------- | ------------- | ------------------------------------- | +| remoteChainSelectorsToRemove | uint64[] | Chain selectors to remove | +| chainsToAdd | ChainUpdate[] | New chains to add with configurations | + +### Rate Limiting Functions + +### setRateLimitAdmin + +```solidity +function setRateLimitAdmin( + address rateLimitAdmin +) external onlyOwner +``` + +Sets the rate limiter admin address. + +#### Parameters + +| Name | Type | Description | +| -------------- | ------- | ------------------------------ | +| rateLimitAdmin | address | New rate limiter admin address | + +### getRateLimitAdmin + +```solidity +function getRateLimitAdmin() external view returns (address) +``` + +Gets the rate limiter admin address. + +#### Return Value + +| Type | Description | +| ------- | ---------------------------------- | +| address | Current rate limiter admin address | + +### getCurrentOutboundRateLimiterState + +```solidity +function getCurrentOutboundRateLimiterState( + uint64 remoteChainSelector +) external view returns (RateLimiter.TokenBucket memory) +``` + +Gets the current outbound token bucket state. + +#### Parameters + +| Name | Type | Description | +| ------------------- | ------ | ----------------------- | +| remoteChainSelector | uint64 | Chain selector to check | + +#### Return Value + +| Type | Description | +| ----------------------- | -------------------------- | +| RateLimiter.TokenBucket | Current token bucket state | + +### getCurrentInboundRateLimiterState + +```solidity +function getCurrentInboundRateLimiterState( + uint64 remoteChainSelector +) external view returns (RateLimiter.TokenBucket memory) +``` + +Gets the current inbound token bucket state. + +#### Parameters + +| Name | Type | Description | +| ------------------- | ------ | ----------------------- | +| remoteChainSelector | uint64 | Chain selector to check | + +#### Return Value + +| Type | Description | +| ----------------------- | -------------------------- | +| RateLimiter.TokenBucket | Current token bucket state | + +### setChainRateLimiterConfig + +```solidity +function setChainRateLimiterConfig( + uint64 remoteChainSelector, + RateLimiter.Config memory outboundConfig, + RateLimiter.Config memory inboundConfig +) external +``` + +Sets the chain rate limiter configuration. + +#### Parameters + +| Name | Type | Description | +| ------------------- | ------------------ | -------------------------------------- | +| remoteChainSelector | uint64 | Chain selector to configure | +| outboundConfig | RateLimiter.Config | Configuration for outbound rate limits | +| inboundConfig | RateLimiter.Config | Configuration for inbound rate limits | + +### Access Control Functions + +### \_onlyOnRamp + +```solidity +function _onlyOnRamp( + uint64 remoteChainSelector +) internal view +``` + +Validates that msg.sender is a permissioned onRamp for the given chain. + +#### Parameters + +| Name | Type | Description | +| ------------------- | ------ | -------------------------- | +| remoteChainSelector | uint64 | Chain selector to validate | + +### \_onlyOffRamp + +```solidity +function _onlyOffRamp( + uint64 remoteChainSelector +) internal view +``` + +Validates that msg.sender is a permissioned offRamp for the given chain. + +#### Parameters + +| Name | Type | Description | +| ------------------- | ------ | -------------------------- | +| remoteChainSelector | uint64 | Chain selector to validate | + +### Allowlist Functions + +### getAllowListEnabled + +```solidity +function getAllowListEnabled() external view returns (bool) +``` + +Checks if allowlist functionality is enabled. + +#### Return Value + +| Type | Description | +| ---- | ---------------------------- | +| bool | True if allowlist is enabled | + +### getAllowList + +```solidity +function getAllowList() external view returns (address[] memory) +``` + +Gets all allowed addresses. + +#### Return Value + +| Type | Description | +| --------- | -------------------------- | +| address[] | Array of allowed addresses | + +### applyAllowListUpdates + +```solidity +function applyAllowListUpdates( + address[] calldata removes, + address[] calldata adds +) external onlyOwner +``` + +Updates the allowlist by adding and removing addresses. + +#### Parameters + +| Name | Type | Description | +| ------- | --------- | ---------------------------------- | +| removes | address[] | Addresses to remove from allowlist | +| adds | address[] | Addresses to add to allowlist | diff --git a/src/features/ccip/CcipCommon.astro b/src/features/ccip/CcipCommon.astro index 18c35fbd1b2..472e0195c3a 100644 --- a/src/features/ccip/CcipCommon.astro +++ b/src/features/ccip/CcipCommon.astro @@ -5,8 +5,10 @@ const thirdPartyApps = await Astro.glob("./third-party-apps.mdx") const ThirdPartyAppsComponent = thirdPartyApps[0].Content const SupportedNetworksConcepts = await Astro.glob("./Supported-networks-concepts.mdx") const SupportedNetworksConceptsComponent = SupportedNetworksConcepts[0].Content -const ImportCCIPPackage = await Astro.glob("./ImportCCIPPackage.mdx") -const ImportCCIPPackageComponent = ImportCCIPPackage[0].Content +const ImportCCIPPackage150 = await Astro.glob("./api-reference-callout/ImportCCIPPackage150.mdx") +const ImportCCIPPackageComponent150 = ImportCCIPPackage150[0].Content +const ImportCCIPPackage151 = await Astro.glob("./api-reference-callout/ImportCCIPPackage151.mdx") +const ImportCCIPPackageComponent151 = ImportCCIPPackage151[0].Content const TalkToExpert = await Astro.glob("./Talk-Expert.mdx") const TalkToExpertComponent = TalkToExpert[0].Content const UseSimulator = await Astro.glob("./Use-Simulator.mdx") @@ -32,6 +34,8 @@ export type Props = { | "thirdPartyApps" | "supportedNetworksConcepts" | "importCCIPPackage" + | "importCCIPPackage150" + | "importCCIPPackage151" | "talkToExpert" | "useSimulator" | "rmnCaution" @@ -48,7 +52,9 @@ const { callout } = Astro.props as Props {callout === "senderContractCallout" && } {callout === "thirdPartyApps" && } {callout === "supportedNetworksConcepts" && } -{callout === "importCCIPPackage" && } +{callout === "importCCIPPackage" && } +{callout === "importCCIPPackage150" && } +{callout === "importCCIPPackage151" && } {callout === "talkToExpert" && } {callout === "useSimulator" && } {callout === "rmnCaution" && } diff --git a/src/features/ccip/ImportCCIPPackage.mdx b/src/features/ccip/ImportCCIPPackage.mdx deleted file mode 100644 index c02ac8c57be..00000000000 --- a/src/features/ccip/ImportCCIPPackage.mdx +++ /dev/null @@ -1,53 +0,0 @@ -import { Aside, CopyText } from "@components" -import { Tabs } from "@components/Tabs" - - diff --git a/src/features/ccip/api-reference-callout/ImportCCIPPackage150.mdx b/src/features/ccip/api-reference-callout/ImportCCIPPackage150.mdx new file mode 100644 index 00000000000..77d7374621f --- /dev/null +++ b/src/features/ccip/api-reference-callout/ImportCCIPPackage150.mdx @@ -0,0 +1,32 @@ +import { Aside, CopyText } from "@components" +import { Tabs } from "@components/Tabs" + + diff --git a/src/features/ccip/api-reference-callout/ImportCCIPPackage151.mdx b/src/features/ccip/api-reference-callout/ImportCCIPPackage151.mdx new file mode 100644 index 00000000000..7738f9bd30b --- /dev/null +++ b/src/features/ccip/api-reference-callout/ImportCCIPPackage151.mdx @@ -0,0 +1,32 @@ +import { Aside, CopyText } from "@components" +import { Tabs } from "@components/Tabs" + + diff --git a/src/features/ccip/components/api-reference/Errors.astro b/src/features/ccip/components/api-reference/Errors.astro index 81d0b42d6a3..65fde44554c 100644 --- a/src/features/ccip/components/api-reference/Errors.astro +++ b/src/features/ccip/components/api-reference/Errors.astro @@ -1,46 +1,51 @@ --- -// Importing necessary modules and error data -import { - erc20Errors, - routerErrors, - onrampErrors, - ratelimiterErrors, - priceRegistryErrors, - CCIPSendErrorEntry, -} from "@config/data/ccip/" +import type { CCIPSendErrorEntry } from "@config/data/ccip" +import { errors } from "@config/data/ccip" import { CopyText } from "@components" import { marked } from "marked" -// Get the prop type and determine which error data to use -const { type } = Astro.props -let errors: CCIPSendErrorEntry[] = [] +// Define error parameter type +interface ErrorParameter { + type: string + name: string +} + +// Props with literal types - use the same keys as in data.ts +interface Props { + type: "erc20" | "router" | "onramp" | "rate-limiter" | "price-registry" | "pool" | "burnMintERC20" + version: "v1_5_0" | "v1_5_1" +} + +const { type, version } = Astro.props + +// Simple mapping to error keys +const typeToErrorKey = { + erc20: "erc20CCIPSendErrors", + router: "routerCCIPSendErrors", + onramp: "onrampCCIPSendErrors", + "rate-limiter": "ratelimiterCCIPSendErrors", + "price-registry": "priceregistryCCIPSendErrors", + pool: "poolCCIPSendErrors", + burnMintERC20: "burnMintERC20CCIPSendErrors", +} as const + +const selectedErrors = errors[version]?.[typeToErrorKey[type]] || [] -switch (type) { - case "erc20": - errors = erc20Errors - break - case "router": - errors = routerErrors - break - case "onramp": - errors = onrampErrors - break - case "rate-limiter": - errors = ratelimiterErrors - break - case "price-registry": - errors = priceRegistryErrors - break - default: - throw new Error(`Invalid error type: ${type}`) +if (!selectedErrors.length) { + throw new Error(`Invalid error type: ${type} or version: ${version}`) } -// Determine if any errors have parameters or an error selector -const hasParameters = errors.some((error) => error.parameters && error.parameters.length > 0) -const hasErrorSelector = errors.some((error) => error.errorSelector) +// Fix for undefined parameters length +const hasParameters = selectedErrors.some( + (error: CCIPSendErrorEntry) => Array.isArray(error.parameters) && error.parameters.length > 0 +) +const hasErrorSelector = selectedErrors.some((error: CCIPSendErrorEntry) => error.errorSelector) -const renderMarkdown = (text: string) => { - return marked.parse(text) +// Fix for marked.parse return type +const renderMarkdown = (text: string): string => { + const result = marked.parse(text) + // Handle potential Promise return + return typeof result === "string" ? result : "" } --- @@ -49,40 +54,34 @@ const renderMarkdown = (text: string) => { Error - {hasParameters ? Parameters : null} - {hasErrorSelector ? Error Selector : null} + {hasParameters && Parameters} + {hasErrorSelector && Error Selector} Description { - errors.map((error) => { - const params = error.parameters || [] - const paramsLength = params.length - return ( - - {error.error} - {hasParameters ? ( - - {paramsLength > 0 - ? params.map((param, index) => ( - <> - - {param.type} {param.name} - - {index < paramsLength - 1 ?
: null} - - )) - : "-"} - - ) : null} - {hasErrorSelector ? ( - {error.errorSelector ? : "-"} - ) : null} - - - ) - }) + selectedErrors.map((error: CCIPSendErrorEntry) => ( + + {error.error} + {hasParameters && ( + + {Array.isArray(error.parameters) && error.parameters.length > 0 + ? error.parameters.map((param: ErrorParameter, i: number) => ( + <> + + {param.type} {param.name} + + {i < error.parameters!.length - 1 &&
} + + )) + : "-"} + + )} + {hasErrorSelector && {error.errorSelector ? : "-"}} + + + )) } From d4a9eac3d689df21cdd12ddeadc6003e311c4086 Mon Sep 17 00:00:00 2001 From: aelmanaa Date: Fri, 29 Nov 2024 23:06:22 +0100 Subject: [PATCH 02/57] update --- src/content/ccip/architecture.mdx | 6 +--- src/content/ccip/best-practices.mdx | 14 ++++---- src/content/ccip/billing.mdx | 8 ++--- .../ccip/concepts/cross-chain-tokens.mdx | 36 +++++++++---------- .../ccip/concepts/manual-execution.mdx | 4 +-- src/content/ccip/getting-started.mdx | 22 ++++++------ src/content/ccip/service-limits.mdx | 12 +++---- .../ccip/tutorials/ccipreceive-gaslimit.mdx | 2 +- .../tutorials/cross-chain-tokens/index.mdx | 4 +-- .../register-from-eoa-burn-mint-foundry.mdx | 2 -- .../register-from-eoa-burn-mint-hardhat.mdx | 2 -- .../register-from-eoa-lock-mint-foundry.mdx | 2 -- .../register-from-eoa-lock-mint-hardhat.mdx | 2 -- .../register-from-safe-burn-mint-hardhat.mdx | 8 ++--- .../update-rate-limiters-foundry.mdx | 6 ++-- .../update-rate-limiters-hardhat.mdx | 6 ++-- ...programmable-token-transfers-defensive.mdx | 2 +- .../programmable-token-transfers.mdx | 26 +++++++------- .../ccip/tutorials/send-arbitrary-data.mdx | 26 +++++++------- .../transfer-tokens-from-contract.mdx | 16 ++++----- src/content/ccip/tutorials/usdc.mdx | 2 +- .../ccip/foundry/cct-burn-and-mint-fork.mdx | 2 -- .../foundry/cct-lock-and-release-fork.mdx | 2 -- .../ccip/foundry/local-simulator-fork.mdx | 6 ++-- .../build/ccip/foundry/local-simulator.mdx | 6 ++-- .../build/ccip/hardhat/local-simulator.mdx | 2 +- src/features/ccip/CcipCommon.astro | 4 --- src/features/ccip/RegisterFromEOAIntro.mdx | 10 +++--- .../ccip/RegisterLockMintFromEOAIntro.mdx | 10 +++--- src/features/ccip/SelfServeCallout.mdx | 9 ----- src/features/ccip/SenderContractCallout.mdx | 2 +- 31 files changed, 112 insertions(+), 149 deletions(-) delete mode 100644 src/features/ccip/SelfServeCallout.mdx diff --git a/src/content/ccip/architecture.mdx b/src/content/ccip/architecture.mdx index e3cb4addd93..a0d16816b4f 100644 --- a/src/content/ccip/architecture.mdx +++ b/src/content/ccip/architecture.mdx @@ -101,8 +101,6 @@ One OffRamp contract exists per [lane](/ccip/concepts#lane). This contract perfo #### TokenAdminRegistry and RegistryModuleOwnerCustom - - The registry contracts manage the registration of tokens within the Cross-Chains Tokens (CCT) standard. For more information, read the [CCT standard concepts](/ccip/concepts/cross-chain-tokens). #### Token pools @@ -120,8 +118,6 @@ Currently, token pools are administered in two ways: - **Self-Administered Token Pools**: These are managed directly by projects, allowing them to self-manage their tokens. Projects configure their token pools autonomously. This is currently only possible on blockchains where the [Cross-Chain Token standard](/ccip/concepts/cross-chain-tokens) is available. - - - **CCIP-Managed Token Pools**: Some token pools that existed before the [Cross-Chain Token standard](/ccip/concepts/cross-chain-tokens) are managed by CCIP and will continue to exist alongside the self-administered ones. Eventually, all token pools will be fully administered by their respective projects. The mechanism for handling tokens varies depending on the characteristics of each token. Below are several examples to illustrate this: @@ -185,7 +181,7 @@ Chainlink CCIP token transfers benefit from rate limits for additional security. You can find the complete list of lanes and their rate limits on the [CCIP Directory](/ccip/directory) page. -The rate limits are enforced at both the source and destination blockchains for maximum security. If these rate limits are reached, descriptive errors with detailed information are generated and returned to the sender. This enables CCIP users to gracefully handle these errors within their dApps to preserve the end-user experience. A comprehensive list of errors and their descriptions is available on the [errors API reference](/ccip/api-reference/errors#ratelimiter) page. +The rate limits are enforced at both the source and destination blockchains for maximum security. If these rate limits are reached, descriptive errors with detailed information are generated and returned to the sender. This enables CCIP users to gracefully handle these errors within their dApps to preserve the end-user experience. A comprehensive list of errors and their descriptions is available on the [errors API reference](/ccip/api-reference/v1.5.1/errors#ratelimiter) page. ### Token pool rate limit diff --git a/src/content/ccip/best-practices.mdx b/src/content/ccip/best-practices.mdx index c1540bda75d..21f67678c71 100644 --- a/src/content/ccip/best-practices.mdx +++ b/src/content/ccip/best-practices.mdx @@ -21,19 +21,19 @@ Before you deploy your cross-chain dApps to mainnet, make sure that your dApps f ## Verify destination chain -Before calling the router's `ccipSend` [function](/ccip/api-reference/i-router-client#ccipsend), ensure that your code allows users to send CCIP messages to trusted destination chains. +Before calling the router's `ccipSend` [function](/ccip/api-reference/v1.5.1/i-router-client#ccipsend), ensure that your code allows users to send CCIP messages to trusted destination chains. **Example**: For an example of how to verify the destination chain, refer to the [Transfer Tokens with Data - Defensive](/ccip/tutorials/programmable-token-transfers-defensive#tutorial) example. ## Verify source chain -When implementing the `ccipReceive` [method](/ccip/api-reference/ccip-receiver#ccipreceive) in a contract residing on the destination chain, ensure to verify the source chain of the incoming CCIP message. This verification ensures that CCIP messages can only be received from trusted source chains. +When implementing the `ccipReceive` [method](/ccip/api-reference/v1.5.1/ccip-receiver#ccipreceive) in a contract residing on the destination chain, ensure to verify the source chain of the incoming CCIP message. This verification ensures that CCIP messages can only be received from trusted source chains. **Example**: For an example of how to verify the source chain, refer to the [Transfer Tokens with Data - Defensive](/ccip/tutorials/programmable-token-transfers-defensive#tutorial) example. ## Verify sender -When implementing the `ccipReceive` [method](/ccip/api-reference/ccip-receiver#ccipreceive) in a contract residing on the destination chain, it's important to validate the sender of the incoming CCIP message. This check ensures that CCIP messages are received only from trusted sender addresses. +When implementing the `ccipReceive` [method](/ccip/api-reference/v1.5.1/ccip-receiver#ccipreceive) in a contract residing on the destination chain, it's important to validate the sender of the incoming CCIP message. This check ensures that CCIP messages are received only from trusted sender addresses. **Note**: Depending on your use case, this verification might not always be necessary. @@ -41,13 +41,13 @@ When implementing the `ccipReceive` [method](/ccip/api-reference/ccip-receiver#c ## Verify router addresses -When you implement the `ccipReceive` [method](/ccip/api-reference/ccip-receiver#ccipreceive) in the contract residing on the destination chain, validate that the `msg.sender` is the correct router address. This verification ensures that only the router contract can call the `ccipReceive` function on the receiver contract and is for developers that want to restrict which accounts are allowed to call `ccipReceive`. +When you implement the `ccipReceive` [method](/ccip/api-reference/v1.5.1/ccip-receiver#ccipreceive) in the contract residing on the destination chain, validate that the `msg.sender` is the correct router address. This verification ensures that only the router contract can call the `ccipReceive` function on the receiver contract and is for developers that want to restrict which accounts are allowed to call `ccipReceive`. **Example**: For an example of how to verify the router, refer to the [Transfer Tokens with Data - Defensive](/ccip/tutorials/programmable-token-transfers-defensive#tutorial) example. ## Using `extraArgs` -The purpose of [`extraArgs`](/ccip/api-reference/client#evmextraargs) is to allow compatibility with future CCIP upgrades. To get this benefit, make sure that `extraArgs` is mutable in production deployments. This allows you to build it offchain and pass it in a call to a function or store it in a variable that you can update on-demand. +The purpose of [`extraArgs`](/ccip/api-reference/v1.5.1/client#evmextraargs) is to allow compatibility with future CCIP upgrades. To get this benefit, make sure that `extraArgs` is mutable in production deployments. This allows you to build it offchain and pass it in a call to a function or store it in a variable that you can update on-demand. If `extraArgs` are left empty, a default of _200000_ `gasLimit` will be set. @@ -68,7 +68,7 @@ To estimate the accurate gas limit for your destination contract, consider the f ### Setting `allowOutOfOrderExecution` -The `allowOutOfOrderExecution` parameter enables you to control the execution order of your messages on the destination blockchain. This parameter is part of [`EVMExtraArgsV2`](/ccip/api-reference/client#evmextraargsv2) and is available only on lanes where the **Out of Order Execution** property is set to **Optional** or **Required**. Refer to the [CCIP Directory](/ccip/directory) to determine if your target lane supports this feature. +The `allowOutOfOrderExecution` parameter enables you to control the execution order of your messages on the destination blockchain. This parameter is part of [`EVMExtraArgsV2`](/ccip/api-reference/v1.5.1/client#evmextraargsv2) and is available only on lanes where the **Out of Order Execution** property is set to **Optional** or **Required**. Refer to the [CCIP Directory](/ccip/directory) to determine if your target lane supports this feature. #### Best Practices @@ -157,7 +157,7 @@ Monitoring the health of your token pool’s liquidity is essential for ensuring ### Use the `provideLiquidity` and `withdrawLiquidity` Functions Properly -In pools like the **LockReleaseTokenPool**, liquidity providers can add and remove liquidity using the [`provideLiquidity`](/ccip/api-reference/lock-release-token-pool#provideliquidity) and [`withdrawLiquidity`](/ccip/api-reference/lock-release-token-pool#withdrawliquidity) functions. +In pools like the **LockReleaseTokenPool**, liquidity providers can add and remove liquidity using the [`provideLiquidity`](/ccip/api-reference/v1.5.1/lock-release-token-pool#provideliquidity) and [`withdrawLiquidity`](/ccip/api-reference/v1.5.1/lock-release-token-pool#withdrawliquidity) functions. - **Best Practice**: Only trusted entities, such as a designated rebalancer, should be allowed to manage liquidity. Make sure to configure liquidity controls securely to prevent unauthorized liquidity manipulation. diff --git a/src/content/ccip/billing.mdx b/src/content/ccip/billing.mdx index 81b2b5fd633..8006cc0dd67 100644 --- a/src/content/ccip/billing.mdx +++ b/src/content/ccip/billing.mdx @@ -12,7 +12,7 @@ import { Billing, TokenCalculator } from "@features/ccip/components/billing" page. -The CCIP billing model uses the `feeToken` specified in the [message](/ccip/api-reference/client#evm2anymessage) to pay a single fee on the source blockchain. CCIP uses a gas-locked fee payment mechanism, referred to as _Smart Execution_, to help ensure the reliable execution of cross-chain transactions regardless of destination blockchain gas spikes. For developers, this means you can simply pay on the source blockchain and CCIP will take care of execution on the destination blockchain. +The CCIP billing model uses the `feeToken` specified in the [message](/ccip/api-reference/v1.5.1/client#evm2anymessage) to pay a single fee on the source blockchain. CCIP uses a gas-locked fee payment mechanism, referred to as _Smart Execution_, to help ensure the reliable execution of cross-chain transactions regardless of destination blockchain gas spikes. For developers, this means you can simply pay on the source blockchain and CCIP will take care of execution on the destination blockchain. CCIP supports fee payments in LINK and in alternative assets, including blockchain-native gas tokens and their ERC-20 wrapped versions. The payment model for CCIP is designed to significantly reduce friction for users and quickly scale CCIP to more blockchains by supporting fee payments that originate across a multitude of blockchains over time. @@ -28,7 +28,7 @@ The fee is calculated by the following formula: Where: - - `fee`: The total fee for processing a [CCIP message](/ccip/api-reference/client#evm2anymessage). **Note:** Users can call the [getFee](/ccip/api-reference/i-router-client#getfee) function to estimate the fee. + - `fee`: The total fee for processing a [CCIP message](/ccip/api-reference/v1.5.1/client#evm2anymessage). **Note:** Users can call the [getFee](/ccip/api-reference/v1.5.1/i-router-client#getfee) function to estimate the fee. - `blockchain fee`: This represents an estimation of the gas cost the node operators will pay to deliver the CCIP message to the destination blockchain. - `network fee`: Fee paid to CCIP service providers, including node operators running the [Decentralized Oracle Network](/ccip/concepts#decentralized-oracle-network-don) and [Risk Management Network](/ccip/concepts#risk-management-network). @@ -60,9 +60,9 @@ Where: Where: - - `gas limit`: This specifies the maximum amount of gas CCIP can consume to execute [ccipReceive()](/ccip/api-reference/ccip-receiver#ccipreceive) on the receiver contract located on the destination blockchain. Users set the gas limit in the [extra argument field](/ccip/api-reference/client#evmextraargsv1) of the CCIP message. **Note:** Remember to [carefully estimate the `gasLimit` that you set](/ccip/best-practices#setting-gaslimit) for your destination contract so CCIP can have enough gas to execute `ccipReceive()`. Any unspent gas from this user-set limit is not refunded. + - `gas limit`: This specifies the maximum amount of gas CCIP can consume to execute [ccipReceive()](/ccip/api-reference/v1.5.1/ccip-receiver#ccipreceive) on the receiver contract located on the destination blockchain. Users set the gas limit in the [extra argument field](/ccip/api-reference/v1.5.1/client#evmextraargsv1) of the CCIP message. **Note:** Remember to [carefully estimate the `gasLimit` that you set](/ccip/best-practices#setting-gaslimit) for your destination contract so CCIP can have enough gas to execute `ccipReceive()`. Any unspent gas from this user-set limit is not refunded. - `destination gas overhead`: This is the fixed gas cost incurred on the destination blockchain by CCIP (Committing DON + Executing DON) and Risk Management Network. - - `destination gas per payload`: This variable gas depends on the length of the data field in the [CCIP message](/ccip/api-reference/client#evm2anymessage). If there is no payload (CCIP only transfers tokens), the value is `0`. + - `destination gas per payload`: This variable gas depends on the length of the data field in the [CCIP message](/ccip/api-reference/v1.5.1/client#evm2anymessage). If there is no payload (CCIP only transfers tokens), the value is `0`. - `gas for token transfers`: This variable gas cost is for transferring tokens onto the destination blockchain. If there are no token transfers, the value is `0`. #### Data availability cost diff --git a/src/content/ccip/concepts/cross-chain-tokens.mdx b/src/content/ccip/concepts/cross-chain-tokens.mdx index 6af2e1b48ee..d23368acc73 100644 --- a/src/content/ccip/concepts/cross-chain-tokens.mdx +++ b/src/content/ccip/concepts/cross-chain-tokens.mdx @@ -8,8 +8,6 @@ whatsnext: { "CCT Guides": "/ccip/tutorials/cross-chain-tokens" } import { Aside, ClickToZoom } from "@components" import CcipCommon from "@features/ccip/CcipCommon.astro" - - The Cross-Chain Token (CCT) standard offers a streamlined and decentralized approach to enabling token transfers across blockchains using Chainlink's Cross-Chain Interoperability Protocol (CCIP). Traditionally, token developers had a friction-laden and manual process to enable their tokens for cross-chain operations. This process required manual deployment of token pools, making it time-consuming. With the introduction of CCTs, token developers now have the power to deploy, configure, and manage their own token pools in CCIP via a simple interface. This self-service model not only accelerates the deployment process but also empowers token developers with greater autonomy and control over their cross-chain token operations. This guide will explore the motivations behind Cross-Chain Token (CCT) and provide an overview of the architectural components in enabling an [ERC20-compatible](#requirements-for-cross-chain-tokens) token in CCIP. ## Motivations @@ -125,11 +123,11 @@ All token pools, whether standard or custom, must adhere to the following guidel 1. **Source Blockchain**: This must include the following function: - - `lockOrBurn(Pool.LockOrBurnInV1 calldata lockOrBurnIn) external returns (Pool.LockOrBurnOutV1 memory)`: This function locks or burns tokens on the source blockchain. Refer to the [`Pool`](/ccip/api-reference/pool) library API reference for details about the input and output parameters. + - `lockOrBurn(Pool.LockOrBurnInV1 calldata lockOrBurnIn) external returns (Pool.LockOrBurnOutV1 memory)`: This function locks or burns tokens on the source blockchain. Refer to the [`Pool`](/ccip/api-reference/v1.5.1/pool) library API reference for details about the input and output parameters. 1. **Destination Blockchain**: This must include the following function: - - `releaseOrMint(Pool.ReleaseOrMintInV1 calldata releaseOrMintIn) external returns (Pool.ReleaseOrMintOutV1 memory)`: This function releases or mints tokens on the destination blockchain. Refer to the [`Pool`](/ccip/api-reference/pool) library API reference for details about the input and output parameters. + - `releaseOrMint(Pool.ReleaseOrMintInV1 calldata releaseOrMintIn) external returns (Pool.ReleaseOrMintOutV1 memory)`: This function releases or mints tokens on the destination blockchain. Refer to the [`Pool`](/ccip/api-reference/v1.5.1/pool) library API reference for details about the input and output parameters. 1. **Gas Limit on the Destination Blockchain**: @@ -147,11 +145,11 @@ All token pools, whether standard or custom, must adhere to the following guidel Depending on your use case (token handling mechanism), you need to deploy the appropriate token pool type for each blockchain you want to support. Chainlink provides a set of token pool contracts that you can use to deploy your token pools in minutes. These token pools are fully audited and ready for deployment on your blockchains. You can find the token pool contracts in the [Chainlink GitHub repository](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/pools/). For most use cases, you should use either: -- [BurnMintTokenPool](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/pools/BurnMintTokenPool.sol): This token pool is used to burn or mint tokens. You can read the API reference [here](/ccip/api-reference/burn-mint-token-pool). -- [BurnFromMintTokenPool](https://github.com/smartcontractkit/ccip/blob/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/pools/BurnFromMintTokenPool.sol): This is a variant of the BurnMintTokenPool that uses the `burnFrom(from, amount)` function to burn tokens from a specified account. You can read the API reference [here](/ccip/api-reference/burn-mint-token-pool). **Note**: If your token supports the standard `burn` function, you should typically use the BurnMintTokenPool instead of BurnFromMintTokenPool. -- [LockReleaseTokenPool](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/pools/LockReleaseTokenPool.sol): This token pool is used to lock or release tokens. You can read the API reference [here](/ccip/api-reference/lock-release-token-pool). +- [BurnMintTokenPool](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/pools/BurnMintTokenPool.sol): This token pool is used to burn or mint tokens. You can read the API reference [here](/ccip/api-reference/v1.5.1/burn-mint-token-pool). +- [BurnFromMintTokenPool](https://github.com/smartcontractkit/ccip/blob/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/pools/BurnFromMintTokenPool.sol): This is a variant of the BurnMintTokenPool that uses the `burnFrom(from, amount)` function to burn tokens from a specified account. You can read the API reference [here](/ccip/api-reference/v1.5.1/burn-mint-token-pool). **Note**: If your token supports the standard `burn` function, you should typically use the BurnMintTokenPool instead of BurnFromMintTokenPool. +- [LockReleaseTokenPool](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/pools/LockReleaseTokenPool.sol): This token pool is used to lock or release tokens. You can read the API reference [here](/ccip/api-reference/v1.5.1/lock-release-token-pool). -**Note**: Both token pools inherit from the same base [TokenPool](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/pools/TokenPool.sol) contract, which provides all the common functions necessary for a token pool. For example, it includes the [`applyChainUpdates`](/ccip/api-reference/token-pool#applychainupdates) function, which is used to configure the token pool. You can read the API reference [here](/ccip/api-reference/token-pool). +**Note**: Both token pools inherit from the same base [TokenPool](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/ccip/pools/TokenPool.sol) contract, which provides all the common functions necessary for a token pool. For example, it includes the [`applyChainUpdates`](/ccip/api-reference/v1.5.1/token-pool#applychainupdates) function, which is used to configure the token pool. You can read the API reference [here](/ccip/api-reference/v1.5.1/token-pool). ### Token Handling Mechanisms and Token Pool Deployment @@ -183,16 +181,16 @@ Here are some examples of use cases that may require custom token pools: - **Use Case**: Rebasing tokens are a unique type of token that adjusts its supply in response to specific parameters (e.g., price). These tokens require custom logic to handle rebasing events during cross-chain transfers. - **Solution**: - - **Source Blockchain**: When initiating a cross-chain transfer of rebasing tokens, the TokenPool on the source blockchain should lock or burn the underlying shares rather than a fixed amount of tokens. This ensures that the value is consistently represented, regardless of changes in supply. The number of shares being locked or burned is recorded in the [`destPoolData`](/ccip/api-reference/pool#lockorburnoutv1) and passed to the destination blockchain. - - **Destination Blockchain**: On the destination blockchain, the TokenPool should accurately convert the number of underlying shares to tokens using the current share-to-token ratio. The calculated token amount should then be minted on the destination blockchain and returned in the `destinationAmount` field of the [`ReleaseOrMintOutV1`](/ccip/api-reference/pool#releaseormintoutv1) struct, which is returned by the `releaseOrMint` function. + - **Source Blockchain**: When initiating a cross-chain transfer of rebasing tokens, the TokenPool on the source blockchain should lock or burn the underlying shares rather than a fixed amount of tokens. This ensures that the value is consistently represented, regardless of changes in supply. The number of shares being locked or burned is recorded in the [`destPoolData`](/ccip/api-reference/v1.5.1/pool#lockorburnoutv1) and passed to the destination blockchain. + - **Destination Blockchain**: On the destination blockchain, the TokenPool should accurately convert the number of underlying shares to tokens using the current share-to-token ratio. The calculated token amount should then be minted on the destination blockchain and returned in the `destinationAmount` field of the [`ReleaseOrMintOutV1`](/ccip/api-reference/v1.5.1/pool#releaseormintoutv1) struct, which is returned by the `releaseOrMint` function. - **Tokens with different decimals across blockchains**: - **Use Case**: Some tokens have different decimal values across various blockchains. - **Solution**: - - **Source Blockchain**: During the lock or burn process on the source blockchain, the TokenPool should include a shared denomination in the `destPoolData` field of the [`LockOrBurnOutV1`](/ccip/api-reference/pool#lockorburnoutv1) struct (returned by the `lockOrBurn` function) to represent the value in a standard format. This data is then passed to the destination blockchain via CCIP. - - **Destination Blockchain**: On the destination blockchain, the TokenPool should use the information contained in the `sourcePoolData` of the [`ReleaseOrMintInV1`](/ccip/api-reference/pool#releaseormintinv1) struct (used by the `releaseOrMint` function) to convert the value into the local denomination. The correct number of tokens should then be minted based on the destination blockchain's decimal format. The minted amount is returned in the `destinationAmount` field of the [`ReleaseOrMintOutV1`](/ccip/api-reference/pool#releaseormintoutv1) struct, which is returned by the `releaseOrMint` function. + - **Source Blockchain**: During the lock or burn process on the source blockchain, the TokenPool should include a shared denomination in the `destPoolData` field of the [`LockOrBurnOutV1`](/ccip/api-reference/v1.5.1/pool#lockorburnoutv1) struct (returned by the `lockOrBurn` function) to represent the value in a standard format. This data is then passed to the destination blockchain via CCIP. + - **Destination Blockchain**: On the destination blockchain, the TokenPool should use the information contained in the `sourcePoolData` of the [`ReleaseOrMintInV1`](/ccip/api-reference/v1.5.1/pool#releaseormintinv1) struct (used by the `releaseOrMint` function) to convert the value into the local denomination. The correct number of tokens should then be minted based on the destination blockchain's decimal format. The minted amount is returned in the `destinationAmount` field of the [`ReleaseOrMintOutV1`](/ccip/api-reference/v1.5.1/pool#releaseormintoutv1) struct, which is returned by the `releaseOrMint` function. ## CCT Architecture Overview @@ -221,8 +219,8 @@ In the Cross-Chain Token (CCT) standard, several key contracts work together to The **Registry contracts** manage the registration tokens within the CCT system. They ensure that the correct entities have control over cross-chain operations. -- [`TokenAdminRegistry`](/ccip/api-reference/token-admin-registry): This contract stores the token administrators and pools for all registered cross-chain tokens. It allows tokens to be registered in a self-service manner and handles administrator role changes via a two-step process (transfer request and acceptance). -- [`RegistryModuleOwnerCustom`](/ccip/api-reference/registry-module-owner-custom): This contract facilitates the registration of token administrators. It works with the TokenAdminRegistry to ensure that only authorized administrators are assigned to manage cross-chain operations. +- [`TokenAdminRegistry`](/ccip/api-reference/v1.5.1/token-admin-registry): This contract stores the token administrators and pools for all registered cross-chain tokens. It allows tokens to be registered in a self-service manner and handles administrator role changes via a two-step process (transfer request and acceptance). +- [`RegistryModuleOwnerCustom`](/ccip/api-reference/v1.5.1/registry-module-owner-custom): This contract facilitates the registration of token administrators. It works with the TokenAdminRegistry to ensure that only authorized administrators are assigned to manage cross-chain operations. #### Token Contract @@ -318,9 +316,9 @@ The sequence diagram below shows how the token administrator sets or updates the ### Configuring the Token Pool -The configuration of token pools includes adding new blockchains, setting remote pool addresses, and applying rate limits for cross-chain transfers. The following functions from the [`TokenPool`](/ccip/api-reference/token-pool) contract are used for configuring token pools: +The configuration of token pools includes adding new blockchains, setting remote pool addresses, and applying rate limits for cross-chain transfers. The following functions from the [`TokenPool`](/ccip/api-reference/v1.5.1/token-pool) contract are used for configuring token pools: -1. [`applyChainUpdates`](/ccip/api-reference/token-pool#applychainupdates): +1. [`applyChainUpdates`](/ccip/api-reference/v1.5.1/token-pool#applychainupdates): - **Purpose**: This function is the primary method for configuring which blockchains the token pool supports and defining rate limits for cross-chain transfers. - **Details**: - It allows the token pool owner to add new chains or remove existing ones. @@ -329,7 +327,7 @@ The configuration of token pools includes adding new blockchains, setting remote - **Usage**: - To add a new blockchain, the pool owner provides the remote chain selector, pool address, token address, and rate limiter configurations. - To remove a blockchain, the `allowed` flag is set to `false`, and the chain is removed from the list of supported chains. -1. [`setRemotePool`](/ccip/api-reference/token-pool#setremotepool): +1. [`setRemotePool`](/ccip/api-reference/v1.5.1/token-pool#setremotepool): - **Purpose**: Set the remote pool's address to link the current token pool to a corresponding pool on a remote blockchain. - **Details**: @@ -337,7 +335,7 @@ The configuration of token pools includes adding new blockchains, setting remote - It validates the provided chain selector and updates the remote pool address for the selected chain. - **Usage**: This function sets or updates the remote pool address for a specific blockchain. -1. [`setChainRateLimiterConfig`](/ccip/api-reference/token-pool#setchainratelimiterconfig): +1. [`setChainRateLimiterConfig`](/ccip/api-reference/v1.5.1/token-pool#setchainratelimiterconfig): - **Purpose**: Configures the rate limits for outbound and inbound token transfers between blockchains. - **Details**: @@ -347,7 +345,7 @@ The configuration of token pools includes adding new blockchains, setting remote - **Notes on Rate Limit Admin**: The rate limit admin is a designated address that is authorized to configure the rate limits for a token pool. This admin can be set by the pool owner using the `setRateLimitAdmin` function. If no rate limit admin is set, only the pool owner can modify the rate limits. You can retrieve the current rate limit admin address using the `getRateLimitAdmin` function. - **Usage**: This function adjusts rate limits to prevent excessive token transfers or overload of the token pool. **Note**: This function also supports disabling rate limits. -1. [`applyAllowListUpdates`](/ccip/api-reference/token-pool#applyallowlistupdates): +1. [`applyAllowListUpdates`](/ccip/api-reference/v1.5.1/token-pool#applyallowlistupdates): - **Purpose**: Manages an allowlist of addresses permitted to interact with the token pool. - **Details**: - This function is only relevant if the token pool is access-controlled (i.e., an allowlist is enabled). diff --git a/src/content/ccip/concepts/manual-execution.mdx b/src/content/ccip/concepts/manual-execution.mdx index 50a708846cf..8b1abff6320 100644 --- a/src/content/ccip/concepts/manual-execution.mdx +++ b/src/content/ccip/concepts/manual-execution.mdx @@ -17,7 +17,7 @@ In general, messages are successfully delivered and processed via CCIP as descri - The receiver contract on the destination blockchain reverted due to an unhandled exception such as a logical error. - For token pools, if the combined execution of the required functions (`balanceOf` checks and `releaseOrMint`) exceeds the default gas limit of **90,000 gas** on the destination blockchain, CCIP execution will fail. Read the Token pools [common requirements](/ccip/concepts/cross-chain-tokens#common-requirements) to learn more. - - The receiver contract on the destination blockchain reverted due to the gas limit being insufficient to execute the triggered function (Note: The gas limit value is set in the [extraArgs](/ccip/api-reference/client#evmextraargsv1) param of the message). + - The receiver contract on the destination blockchain reverted due to the gas limit being insufficient to execute the triggered function (Note: The gas limit value is set in the [extraArgs](/ccip/api-reference/v1.5.1/client#evmextraargsv1) param of the message). - The message could not be executed on the destination chain within CCIP’s Smart Execution time window, which is currently set to 8 hours. This could happen, for example, during extreme network congestion and resulting gas spikes. The flowchart below displays the process of a cross-chain transaction, detailing the steps involved in the manual execution: @@ -40,7 +40,7 @@ The flowchart below displays the process of a cross-chain transaction, detailing 1. If the message involves token transfers, the tokens are first transferred to the receiver. **Important:** If the combined execution of the required functions (`balanceOf` checks of the the token contract and `releaseOrMint` of the token pool contract) exceeds the default gas limit of **90,000 gas** on the destination blockchain, CCIP execution will fail, and the transaction will become eligible for manual execution. It is highly recommended to design your token pools to stay within this gas limit to avoid execution failure. Read the Token Pools [common requirements](/ccip/concepts/cross-chain-tokens#common-requirements) to learn more. - If the receiver is an EOA, then this transaction is considered complete with no further processing. - - If the receiver is a smart contract, the [ccipReceive](/ccip/api-reference/ccip-receiver#ccipreceive) function is invoked after the token transfer. The ccipReceive function processes the CCIP message and any user-specified logic in the receiver contract. The execution of the CCIP message is atomic (all or none). If the ccipReceive function successfully executes, then all aspects of the transaction are complete, and there is no revert. If, however, there is an issue in the receiver execution due to insufficient gas limit or unhandled exceptions, the attempted token transfer will also revert. The transaction then becomes eligible for manual execution. + - If the receiver is a smart contract, the [ccipReceive](/ccip/api-reference/v1.5.1/ccip-receiver#ccipreceive) function is invoked after the token transfer. The ccipReceive function processes the CCIP message and any user-specified logic in the receiver contract. The execution of the CCIP message is atomic (all or none). If the ccipReceive function successfully executes, then all aspects of the transaction are complete, and there is no revert. If, however, there is an issue in the receiver execution due to insufficient gas limit or unhandled exceptions, the attempted token transfer will also revert. The transaction then becomes eligible for manual execution. 1. If the message does not involve token transfers, only arbitrary messaging, and the receiver execution fails due to gas limits or unhandled exceptions, the transaction becomes eligible for manual execution. diff --git a/src/content/ccip/getting-started.mdx b/src/content/ccip/getting-started.mdx index 2f98036889b..a3a272819e6 100644 --- a/src/content/ccip/getting-started.mdx +++ b/src/content/ccip/getting-started.mdx @@ -173,25 +173,25 @@ When deploying the contract, you define the router address and the LINK contract The router address provides functions that are required for this example: -- The `getFee` [function](/ccip/api-reference/i-router-client#getfee) to estimate the CCIP fees. -- The `ccipSend` [function](/ccip/api-reference/i-router-client#ccipsend) to send CCIP messages. +- The `getFee` [function](/ccip/api-reference/v1.5.1/i-router-client#getfee) to estimate the CCIP fees. +- The `ccipSend` [function](/ccip/api-reference/v1.5.1/i-router-client#ccipsend) to send CCIP messages. #### Sending data The `sendMessage` function completes several operations: -1. Construct a CCIP-compatible message using the `EVM2AnyMessage` [struct](/ccip/api-reference/client#evm2anymessage): +1. Construct a CCIP-compatible message using the `EVM2AnyMessage` [struct](/ccip/api-reference/v1.5.1/client#evm2anymessage): - The `receiver` address is encoded in bytes format to accommodate non-EVM destination blockchains with distinct address formats. The encoding is achieved through [abi.encode](https://docs.soliditylang.org/en/develop/abi-spec.html). - The `data` is encoded from a string text to bytes using [abi.encode](https://docs.soliditylang.org/en/develop/abi-spec.html). - - The `tokenAmounts` is an array. Each element comprises a [struct](/ccip/api-reference/client#evmtokenamount) that contains the token address and amount. In this example, the array is empty because no tokens are sent. + - The `tokenAmounts` is an array. Each element comprises a [struct](/ccip/api-reference/v1.5.1/client#evmtokenamount) that contains the token address and amount. In this example, the array is empty because no tokens are sent. - The `extraArgs` specify the `gasLimit` for relaying the CCIP message to the recipient contract on the destination blockchain. In this example, the `gasLimit` is set to `200000`. - The `feeToken` designates the token address used for CCIP fees. Here, `address(linkToken)` signifies payment in LINK. -1. Compute the fees by invoking the router's `getFee` [function](/ccip/api-reference/i-router-client#getfee). +1. Compute the fees by invoking the router's `getFee` [function](/ccip/api-reference/v1.5.1/i-router-client#getfee). 1. Ensure that your contract balance in LINK is enough to cover the fees. 1. Grant the router contract permission to deduct the fees from the contract's LINK balance. -1. Dispatch the CCIP message to the destination chain by executing the router's `ccipSend` [function](/ccip/api-reference/i-router-client#ccipsend). +1. Dispatch the CCIP message to the destination chain by executing the router's `ccipSend` [function](/ccip/api-reference/v1.5.1/i-router-client#ccipsend). @@ -203,15 +203,15 @@ The smart contract in this tutorial is designed to interact with CCIP to receive #### Initializing the contract -When you deploy the contract, you define the router address. The receiver contract inherits from the [CCIPReceiver.sol](/ccip/api-reference/ccip-receiver) contract, which uses the router address. +When you deploy the contract, you define the router address. The receiver contract inherits from the [CCIPReceiver.sol](/ccip/api-reference/v1.5.1/ccip-receiver) contract, which uses the router address. #### Receiving data On the destination blockchain: -1. The CCIP Router invokes the `ccipReceive` [function](/ccip/api-reference/ccip-receiver#ccipreceive). **Note**: This function is protected by the `onlyRouter` [modifier](/ccip/api-reference/ccip-receiver#onlyrouter), which ensures that only the router can call the receiver contract. -1. The `ccipReceive` [function](/ccip/api-reference/ccip-receiver#ccipreceive) calls an internal function `_ccipReceive` [function](/ccip/api-reference/ccip-receiver#_ccipreceive). The receiver contract implements this function. -1. This `_ccipReceive` [function](/ccip/api-reference/ccip-receiver#_ccipreceive) expects an `Any2EVMMessage` [struct](/ccip/api-reference/client#any2evmmessage) that contains the following values: +1. The CCIP Router invokes the `ccipReceive` [function](/ccip/api-reference/v1.5.1/ccip-receiver#ccipreceive). **Note**: This function is protected by the `onlyRouter` [modifier](/ccip/api-reference/v1.5.1/ccip-receiver#onlyrouter), which ensures that only the router can call the receiver contract. +1. The `ccipReceive` [function](/ccip/api-reference/v1.5.1/ccip-receiver#ccipreceive) calls an internal function `_ccipReceive` [function](/ccip/api-reference/v1.5.1/ccip-receiver#_ccipreceive). The receiver contract implements this function. +1. This `_ccipReceive` [function](/ccip/api-reference/v1.5.1/ccip-receiver#_ccipreceive) expects an `Any2EVMMessage` [struct](/ccip/api-reference/v1.5.1/client#any2evmmessage) that contains the following values: - The CCIP `messageId`. - The `sourceChainSelector`. @@ -224,6 +224,6 @@ The example was simplified for learning purposes. For production code, use the f - Validate the source chain. - Depending on your use case, analyze whether you should validate the sender address. -Note that the receiver contract in this example inherits from the base contract [CCIPReceiver.sol](/ccip/api-reference/ccip-receiver), which uses the `onlyRouter` [modifier](/ccip/api-reference/ccip-receiver#onlyrouter) to ensure that only the router can call the `ccipReceive` [function](/ccip/api-reference/ccip-receiver#ccipreceive). +Note that the receiver contract in this example inherits from the base contract [CCIPReceiver.sol](/ccip/api-reference/v1.5.1/ccip-receiver), which uses the `onlyRouter` [modifier](/ccip/api-reference/v1.5.1/ccip-receiver#onlyrouter) to ensure that only the router can call the `ccipReceive` [function](/ccip/api-reference/v1.5.1/ccip-receiver#ccipreceive). diff --git a/src/content/ccip/service-limits.mdx b/src/content/ccip/service-limits.mdx index 074486512cb..ff397bd72f8 100644 --- a/src/content/ccip/service-limits.mdx +++ b/src/content/ccip/service-limits.mdx @@ -23,18 +23,18 @@ import CcipCommon from "@features/ccip/CcipCommon.astro" | Item | Description | Limit | | -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | -| Maximum message `data` length | `data` payload sent within the [CCIP message](/ccip/api-reference/client#evm2anymessage) | 30 kilobytes | -| Message Gas Limit | User specified [gas limit](/ccip/api-reference/client#evmextraargsv1) | 3,000,000 | +| Maximum message `data` length | `data` payload sent within the [CCIP message](/ccip/api-reference/v1.5.1/client#evm2anymessage) | 30 kilobytes | +| Message Gas Limit | User specified [gas limit](/ccip/api-reference/v1.5.1/client#evmextraargsv1) | 3,000,000 | | Maximum number of tokens | Maximum number of distinct tokens a user can transfer in a single transaction | 1 | -| Smart Execution time window | Maximum duration for the execution of a [CCIP message](/ccip/api-reference/client#evm2anymessage) | 8 hours | +| Smart Execution time window | Maximum duration for the execution of a [CCIP message](/ccip/api-reference/v1.5.1/client#evm2anymessage) | 8 hours | | Token Pool Execution Gas Limit | Maximum gas for executing the combined steps in token pools during cross-chain transfers, including: (1) `balanceOf` check before minting/releasing, (2) `releaseOrMint` function, and (3) `balanceOf` check after minting/releasing. For more details on building custom token pools and handling gas constraints, refer to the [Token Pools documentation](/ccip/concepts/cross-chain-tokens#requirement-for-token-pools). | 90,000 | ## Testnet | Item | Description | Limit | | -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | -| Maximum message `data` length | `data` payload sent within the [CCIP message](/ccip/api-reference/client#evm2anymessage) | 30 kilobytes | -| Message Gas Limit | User specified [gas limit](/ccip/api-reference/client#evmextraargsv1) | 3,000,000 | +| Maximum message `data` length | `data` payload sent within the [CCIP message](/ccip/api-reference/v1.5.1/client#evm2anymessage) | 30 kilobytes | +| Message Gas Limit | User specified [gas limit](/ccip/api-reference/v1.5.1/client#evmextraargsv1) | 3,000,000 | | Maximum number of tokens | Maximum number of distinct tokens a user can transfer in a single transaction | 1 | -| Smart Execution timeframe | Maximum duration for the execution of a [CCIP message](/ccip/api-reference/client#evm2anymessage) | 8 hours | +| Smart Execution timeframe | Maximum duration for the execution of a [CCIP message](/ccip/api-reference/v1.5.1/client#evm2anymessage) | 8 hours | | Token Pool Execution Gas Limit | Maximum gas for executing the combined steps in token pools during cross-chain transfers, including: (1) `balanceOf` check before minting/releasing, (2) `releaseOrMint` function, and (3) `balanceOf` check after minting/releasing. For more details on building custom token pools and handling gas constraints, refer to the [Token Pools documentation](/ccip/concepts/cross-chain-tokens#requirement-for-token-pools). | 90,000 | diff --git a/src/content/ccip/tutorials/ccipreceive-gaslimit.mdx b/src/content/ccip/tutorials/ccipreceive-gaslimit.mdx index cd15cec4394..b43b6c403f8 100644 --- a/src/content/ccip/tutorials/ccipreceive-gaslimit.mdx +++ b/src/content/ccip/tutorials/ccipreceive-gaslimit.mdx @@ -4,7 +4,7 @@ date: Last Modified title: "Optimizing Gas Limit Settings in CCIP Messages" --- -When constructing a [CCIP message](/ccip/api-reference/client#evm2anymessage), it's crucial to set the gas limit accurately. The gas limit represents the maximum amount of gas consumed to execute the [`ccipReceive`](/ccip/api-reference/ccip-receiver#ccipreceive) function on the CCIP Receiver, which influences the transaction fees for sending a CCIP message. Notably, unused gas is not reimbursed, making it essential to estimate the gas limit carefully: +When constructing a [CCIP message](/ccip/api-reference/v1.5.1/client#evm2anymessage), it's crucial to set the gas limit accurately. The gas limit represents the maximum amount of gas consumed to execute the [`ccipReceive`](/ccip/api-reference/v1.5.1/ccip-receiver#ccipreceive) function on the CCIP Receiver, which influences the transaction fees for sending a CCIP message. Notably, unused gas is not reimbursed, making it essential to estimate the gas limit carefully: - Setting the gas limit too low will cause the transaction to revert when CCIP calls `ccipReceive` on the CCIP Receiver, which requires a manual re-execution with an increased gas limit. For more details about this scenario, read the [Manual Execution](/ccip/tutorials/manual-execution) guide. - Conversely, an excessively high gas limit leads to higher fees. diff --git a/src/content/ccip/tutorials/cross-chain-tokens/index.mdx b/src/content/ccip/tutorials/cross-chain-tokens/index.mdx index b65525aeb53..5bd2de0711f 100644 --- a/src/content/ccip/tutorials/cross-chain-tokens/index.mdx +++ b/src/content/ccip/tutorials/cross-chain-tokens/index.mdx @@ -13,8 +13,6 @@ import CcipCommon from "@features/ccip/CcipCommon.astro" architecture](/ccip/architecture) before proceeding with these tutorials. - - Before diving into the [tutorials](#tutorials), it's important first to understand the overall procedure for enabling your tokens in CCIP. This procedure involves deploying tokens and token pools, registering administrative roles, and configuring token pools to enable secure token transfers using CCIP. The diagram below outlines the entire process: - - - - - - --network ### Update rate limiter settings -Use the `updateRateLimiters` task to update the rate limiter configurations for an existing chain connection in your token pool. This task specifically interacts with the [`setChainRateLimiterConfig`](/ccip/api-reference/token-pool#setchainratelimiterconfig) function of the `TokenPool` contract, allowing you to adjust the rate limits without altering other configurations like remote pool addresses. +Use the `updateRateLimiters` task to update the rate limiter configurations for an existing chain connection in your token pool. This task specifically interacts with the [`setChainRateLimiterConfig`](/ccip/api-reference/v1.5.1/token-pool#setchainratelimiterconfig) function of the `TokenPool` contract, allowing you to adjust the rate limits without altering other configurations like remote pool addresses. The `updateRateLimiters` task allows you to: diff --git a/src/content/ccip/tutorials/programmable-token-transfers-defensive.mdx b/src/content/ccip/tutorials/programmable-token-transfers-defensive.mdx index 14d3aaa4abf..0ba184b5ba8 100644 --- a/src/content/ccip/tutorials/programmable-token-transfers-defensive.mdx +++ b/src/content/ccip/tutorials/programmable-token-transfers-defensive.mdx @@ -205,7 +205,7 @@ Here's the step-by-step breakdown of the process: 1. Entrance through `ccipReceive`: - - The `ccipReceive` function is invoked with an `Any2EVMMessage` [struct](/ccip/api-reference/client#any2evmmessage) containing the message to be processed. + - The `ccipReceive` function is invoked with an `Any2EVMMessage` [struct](/ccip/api-reference/v1.5.1/client#any2evmmessage) containing the message to be processed. - Security checks ensure the call is from the authorized router, an allowlisted source chain, and an allowlisted sender. 1. Processing Message: diff --git a/src/content/ccip/tutorials/programmable-token-transfers.mdx b/src/content/ccip/tutorials/programmable-token-transfers.mdx index 3a546fceadf..8b31cdb9f31 100644 --- a/src/content/ccip/tutorials/programmable-token-transfers.mdx +++ b/src/content/ccip/tutorials/programmable-token-transfers.mdx @@ -227,21 +227,21 @@ Defining the router address is useful for the following: - Sender part: - - Calls the router's `getFee` [function](/ccip/api-reference/i-router-client#getfee) to estimate the CCIP fees. - - Calls the router's `ccipSend` [function](/ccip/api-reference/i-router-client#ccipsend) to send CCIP messages. + - Calls the router's `getFee` [function](/ccip/api-reference/v1.5.1/i-router-client#getfee) to estimate the CCIP fees. + - Calls the router's `ccipSend` [function](/ccip/api-reference/v1.5.1/i-router-client#ccipsend) to send CCIP messages. - Receiver part: - - The contract inherits from [CCIPReceiver](/ccip/api-reference/ccip-receiver), which serves as a base contract for receiver contracts. This contract requires that child contracts implement the `_ccipReceive` [function](/ccip/api-reference/ccip-receiver#_ccipreceive). `_ccipReceive` is called by the `ccipReceive` [function](/ccip/api-reference/ccip-receiver#ccipreceive), which ensures that only the router can deliver CCIP messages to the receiver contract. + - The contract inherits from [CCIPReceiver](/ccip/api-reference/v1.5.1/ccip-receiver), which serves as a base contract for receiver contracts. This contract requires that child contracts implement the `_ccipReceive` [function](/ccip/api-reference/v1.5.1/ccip-receiver#_ccipreceive). `_ccipReceive` is called by the `ccipReceive` [function](/ccip/api-reference/v1.5.1/ccip-receiver#ccipreceive), which ensures that only the router can deliver CCIP messages to the receiver contract. ### Transferring tokens and data and pay in LINK The `sendMessagePayLINK` function undertakes six primary operations: -1. Call the `_buildCCIPMessage` private function to construct a CCIP-compatible message using the `EVM2AnyMessage` [struct](/ccip/api-reference/client#any2evmmessage): +1. Call the `_buildCCIPMessage` private function to construct a CCIP-compatible message using the `EVM2AnyMessage` [struct](/ccip/api-reference/v1.5.1/client#any2evmmessage): - The `_receiver` address is encoded in bytes to accommodate non-EVM destination blockchains with distinct address formats. The encoding is achieved through [abi.encode](https://docs.soliditylang.org/en/develop/abi-spec.html). - The `data` is encoded from a `string` to `bytes` using [abi.encode](https://docs.soliditylang.org/en/develop/abi-spec.html). - - The `tokenAmounts` is an array, with each element comprising an `EVMTokenAmount` [struct](/ccip/api-reference/client#evmtokenamount) containing the token address and amount. The array contains one element where the `_token` (token address) and `_amount` (token amount) are passed by the user when calling the `sendMessagePayLINK` function. + - The `tokenAmounts` is an array, with each element comprising an `EVMTokenAmount` [struct](/ccip/api-reference/v1.5.1/client#evmtokenamount) containing the token address and amount. The array contains one element where the `_token` (token address) and `_amount` (token amount) are passed by the user when calling the `sendMessagePayLINK` function. - The `extraArgs` specifies the `gasLimit` for relaying the message to the recipient contract on the destination blockchain. In this example, the `gasLimit` is set to `200000. - The `_feeTokenAddress` designates the token address used for CCIP fees. Here, `address(linkToken)` signifies payment in LINK. @@ -249,11 +249,11 @@ The `sendMessagePayLINK` function undertakes six primary operations: -1. Computes the fees by invoking the router's `getFee` [function](/ccip/api-reference/i-router-client#getfee). +1. Computes the fees by invoking the router's `getFee` [function](/ccip/api-reference/v1.5.1/i-router-client#getfee). 1. Ensures your contract balance in LINK is enough to cover the fees. 1. Grants the router contract permission to deduct the fees from the contract's LINK balance. 1. Grants the router contract permission to deduct the amount from the contract's _CCIP-BnM_ balance. -1. Dispatches the CCIP message to the destination chain by executing the router's `ccipSend` [function](/ccip/api-reference/i-router-client#ccipsend). +1. Dispatches the CCIP message to the destination chain by executing the router's `ccipSend` [function](/ccip/api-reference/v1.5.1/i-router-client#ccipsend). **Note**: As a security measure, the `sendMessagePayLINK` function is protected by the `onlyAllowlistedDestinationChain`, ensuring the contract owner has allowlisted a destination chain. @@ -261,11 +261,11 @@ The `sendMessagePayLINK` function undertakes six primary operations: The `sendMessagePayNative` function undertakes five primary operations: -1. Call the `_buildCCIPMessage` private function to construct a CCIP-compatible message using the `EVM2AnyMessage` [struct](/ccip/api-reference/client#any2evmmessage): +1. Call the `_buildCCIPMessage` private function to construct a CCIP-compatible message using the `EVM2AnyMessage` [struct](/ccip/api-reference/v1.5.1/client#any2evmmessage): - The `_receiver` address is encoded in bytes to accommodate non-EVM destination blockchains with distinct address formats. The encoding is achieved through [abi.encode](https://docs.soliditylang.org/en/develop/abi-spec.html). - The `data` is encoded from a `string` to `bytes` using [abi.encode](https://docs.soliditylang.org/en/develop/abi-spec.html). - - The `tokenAmounts` is an array, with each element comprising an `EVMTokenAmount` [struct](/ccip/api-reference/client#evmtokenamount) containing the token address and amount. The array contains one element where the `_token` (token address) and `_amount` (token amount) are passed by the user when calling the `sendMessagePayNative` function. + - The `tokenAmounts` is an array, with each element comprising an `EVMTokenAmount` [struct](/ccip/api-reference/v1.5.1/client#evmtokenamount) containing the token address and amount. The array contains one element where the `_token` (token address) and `_amount` (token amount) are passed by the user when calling the `sendMessagePayNative` function. - The `extraArgs` specifies the `gasLimit` for relaying the message to the recipient contract on the destination blockchain. In this example, the `gasLimit` is set to `200000. - The `_feeTokenAddress` designates the token address used for CCIP fees. Here, `address(0)` signifies payment in native gas tokens (ETH). @@ -273,16 +273,16 @@ The `sendMessagePayNative` function undertakes five primary operations: -1. Computes the fees by invoking the router's `getFee` [function](/ccip/api-reference/i-router-client#getfee). +1. Computes the fees by invoking the router's `getFee` [function](/ccip/api-reference/v1.5.1/i-router-client#getfee). 1. Ensures your contract balance in native gas is enough to cover the fees. 1. Grants the router contract permission to deduct the amount from the contract's _CCIP-BnM_ balance. -1. Dispatches the CCIP message to the destination chain by executing the router's `ccipSend` [function](/ccip/api-reference/i-router-client#ccipsend). **Note**: `msg.value` is set because you pay in native gas. +1. Dispatches the CCIP message to the destination chain by executing the router's `ccipSend` [function](/ccip/api-reference/v1.5.1/i-router-client#ccipsend). **Note**: `msg.value` is set because you pay in native gas. **Note**: As a security measure, the `sendMessagePayNative` function is protected by the `onlyAllowlistedDestinationChain`, ensuring the contract owner has allowlisted a destination chain. ### Receiving messages -On the destination blockchain, the router invokes the `_ccipReceive` [function](/ccip/api-reference/ccip-receiver#_ccipreceive) which expects a `Any2EVMMessage` [struct](/ccip/api-reference/client#any2evmmessage) that contains: +On the destination blockchain, the router invokes the `_ccipReceive` [function](/ccip/api-reference/v1.5.1/ccip-receiver#_ccipreceive) which expects a `Any2EVMMessage` [struct](/ccip/api-reference/v1.5.1/client#any2evmmessage) that contains: - The CCIP `messageId`. - The `sourceChainSelector`. @@ -292,5 +292,5 @@ On the destination blockchain, the router invokes the `_ccipReceive` [function]( **Note**: Three important security measures are applied: -- `_ccipReceive` is called by the `ccipReceive` [function](/ccip/api-reference/ccip-receiver#ccipreceive), which ensures that only the router can deliver CCIP messages to the receiver contract. See the `onlyRouter` [modifier](/ccip/api-reference/ccip-receiver#onlyrouter) for more information. +- `_ccipReceive` is called by the `ccipReceive` [function](/ccip/api-reference/v1.5.1/ccip-receiver#ccipreceive), which ensures that only the router can deliver CCIP messages to the receiver contract. See the `onlyRouter` [modifier](/ccip/api-reference/v1.5.1/ccip-receiver#onlyrouter) for more information. - The modifier `onlyAllowlisted` ensures that only a call from an allowlisted source chain and sender is accepted. diff --git a/src/content/ccip/tutorials/send-arbitrary-data.mdx b/src/content/ccip/tutorials/send-arbitrary-data.mdx index 1a3adfc6502..4cbdc23c227 100644 --- a/src/content/ccip/tutorials/send-arbitrary-data.mdx +++ b/src/content/ccip/tutorials/send-arbitrary-data.mdx @@ -202,21 +202,21 @@ Defining the router address is useful for the following: - Sender part: - - Calls the router's `getFee` [function](/ccip/api-reference/i-router-client#getfee) to estimate the CCIP fees. - - Calls the router's `ccipSend` [function](/ccip/api-reference/i-router-client#ccipsend) to send CCIP messages. + - Calls the router's `getFee` [function](/ccip/api-reference/v1.5.1/i-router-client#getfee) to estimate the CCIP fees. + - Calls the router's `ccipSend` [function](/ccip/api-reference/v1.5.1/i-router-client#ccipsend) to send CCIP messages. - Receiver part: - - The contract inherits from [CCIPReceiver](/ccip/api-reference/ccip-receiver), which serves as a base contract for receiver contracts. This contract requires that child contracts implement the `_ccipReceive` [function](/ccip/api-reference/ccip-receiver#_ccipreceive). `_ccipReceive` is called by the `ccipReceive` [function](/ccip/api-reference/ccip-receiver#ccipreceive), which ensures that only the router can deliver CCIP messages to the receiver contract. + - The contract inherits from [CCIPReceiver](/ccip/api-reference/v1.5.1/ccip-receiver), which serves as a base contract for receiver contracts. This contract requires that child contracts implement the `_ccipReceive` [function](/ccip/api-reference/v1.5.1/ccip-receiver#_ccipreceive). `_ccipReceive` is called by the `ccipReceive` [function](/ccip/api-reference/v1.5.1/ccip-receiver#ccipreceive), which ensures that only the router can deliver CCIP messages to the receiver contract. ### Sending data and pay in LINK The `sendMessagePayLINK` function undertakes five primary operations: -1. Call the `_buildCCIPMessage` private function to construct a CCIP-compatible message using the `EVM2AnyMessage` [struct](/ccip/api-reference/client#any2evmmessage): +1. Call the `_buildCCIPMessage` private function to construct a CCIP-compatible message using the `EVM2AnyMessage` [struct](/ccip/api-reference/v1.5.1/client#any2evmmessage): - The `_receiver` address is encoded in bytes to accommodate non-EVM destination blockchains with distinct address formats. The encoding is achieved through [abi.encode](https://docs.soliditylang.org/en/develop/abi-spec.html). - The `data` is encoded from a `string` to `bytes` using [abi.encode](https://docs.soliditylang.org/en/develop/abi-spec.html). - - The `tokenAmounts` is an empty `EVMTokenAmount` [struct](/ccip/api-reference/client#evmtokenamount) array as no tokens are transferred. + - The `tokenAmounts` is an empty `EVMTokenAmount` [struct](/ccip/api-reference/v1.5.1/client#evmtokenamount) array as no tokens are transferred. - The `extraArgs` specifies the `gasLimit` for relaying the message to the recipient contract on the destination blockchain. In this example, the `gasLimit` is set to `200000`. - The `_feeTokenAddress` designates the token address used for CCIP fees. Here, `address(linkToken)` signifies payment in LINK. @@ -224,10 +224,10 @@ The `sendMessagePayLINK` function undertakes five primary operations: -1. Computes the fees by invoking the router's `getFee` [function](/ccip/api-reference/i-router-client#getfee). +1. Computes the fees by invoking the router's `getFee` [function](/ccip/api-reference/v1.5.1/i-router-client#getfee). 1. Ensures your contract balance in LINK is enough to cover the fees. 1. Grants the router contract permission to deduct the fees from the contract's LINK balance. -1. Dispatches the CCIP message to the destination chain by executing the router's `ccipSend` [function](/ccip/api-reference/i-router-client#ccipsend). +1. Dispatches the CCIP message to the destination chain by executing the router's `ccipSend` [function](/ccip/api-reference/v1.5.1/i-router-client#ccipsend). **Note**: As a security measure, the `sendMessagePayLINK` function is protected by the `onlyAllowlistedDestinationChain`, ensuring the contract owner has allowlisted a destination chain. @@ -235,11 +235,11 @@ The `sendMessagePayLINK` function undertakes five primary operations: The `sendMessagePayNative` function undertakes four primary operations: -1. Call the `_buildCCIPMessage` private function to construct a CCIP-compatible message using the `EVM2AnyMessage` [struct](/ccip/api-reference/client#any2evmmessage): +1. Call the `_buildCCIPMessage` private function to construct a CCIP-compatible message using the `EVM2AnyMessage` [struct](/ccip/api-reference/v1.5.1/client#any2evmmessage): - The `_receiver` address is encoded in bytes to accommodate non-EVM destination blockchains with distinct address formats. The encoding is achieved through [abi.encode](https://docs.soliditylang.org/en/develop/abi-spec.html). - The `data` is encoded from a `string` to `bytes` using [abi.encode](https://docs.soliditylang.org/en/develop/abi-spec.html). - - The `tokenAmounts` is an empty `EVMTokenAmount` [struct](/ccip/api-reference/client#evmtokenamount) array as no tokens are transferred. + - The `tokenAmounts` is an empty `EVMTokenAmount` [struct](/ccip/api-reference/v1.5.1/client#evmtokenamount) array as no tokens are transferred. - The `extraArgs` specifies the `gasLimit` for relaying the message to the recipient contract on the destination blockchain. In this example, the `gasLimit` is set to `200000`. - The `_feeTokenAddress` designates the token address used for CCIP fees. Here, `address(0)` signifies payment in native gas tokens (ETH). @@ -247,15 +247,15 @@ The `sendMessagePayNative` function undertakes four primary operations: -1. Computes the fees by invoking the router's `getFee` [function](/ccip/api-reference/i-router-client#getfee). +1. Computes the fees by invoking the router's `getFee` [function](/ccip/api-reference/v1.5.1/i-router-client#getfee). 1. Ensures your contract balance in native gas is enough to cover the fees. -1. Dispatches the CCIP message to the destination chain by executing the router's `ccipSend` [function](/ccip/api-reference/i-router-client#ccipsend). **Note**: `msg.value` is set because you pay in native gas. +1. Dispatches the CCIP message to the destination chain by executing the router's `ccipSend` [function](/ccip/api-reference/v1.5.1/i-router-client#ccipsend). **Note**: `msg.value` is set because you pay in native gas. **Note**: As a security measure, the `sendMessagePayNative` function is protected by the `onlyAllowlistedDestinationChain`, ensuring the contract owner has allowlisted a destination chain. ### Receiving data -On the destination blockchain, the router invokes the `ccipReceive` [function](/ccip/api-reference/ccip-receiver#ccipreceive) which expects an `Any2EVMMessage` [struct](/ccip/api-reference/client#any2evmmessage) that contains: +On the destination blockchain, the router invokes the `ccipReceive` [function](/ccip/api-reference/v1.5.1/ccip-receiver#ccipreceive) which expects an `Any2EVMMessage` [struct](/ccip/api-reference/v1.5.1/client#any2evmmessage) that contains: - The CCIP `messageId`. - The `sourceChainSelector`. @@ -264,5 +264,5 @@ On the destination blockchain, the router invokes the `ccipReceive` [function](/ This example applies three important security measures: -- `_ccipReceive` is called by the `ccipReceive` [function](/ccip/api-reference/ccip-receiver#ccipreceive), which ensures that only the router can deliver CCIP messages to the receiver contract. See the `onlyRouter` [modifier](/ccip/api-reference/ccip-receiver#onlyrouter) for more information. +- `_ccipReceive` is called by the `ccipReceive` [function](/ccip/api-reference/v1.5.1/ccip-receiver#ccipreceive), which ensures that only the router can deliver CCIP messages to the receiver contract. See the `onlyRouter` [modifier](/ccip/api-reference/v1.5.1/ccip-receiver#onlyrouter) for more information. - The modifier `onlyAllowlisted` ensures that only a call from an allowlisted source chain and sender is accepted. diff --git a/src/content/ccip/tutorials/transfer-tokens-from-contract.mdx b/src/content/ccip/tutorials/transfer-tokens-from-contract.mdx index 0808068d1bd..a6e0d2dc194 100644 --- a/src/content/ccip/tutorials/transfer-tokens-from-contract.mdx +++ b/src/content/ccip/tutorials/transfer-tokens-from-contract.mdx @@ -205,11 +205,11 @@ When you deploy the contract, you define the router address and LINK contract ad The `transferTokensPayLINK` function undertakes six primary operations: -1. Call the `_buildCCIPMessage` private function to construct a CCIP-compatible message using the `EVM2AnyMessage` [struct](/ccip/api-reference/client#any2evmmessage): +1. Call the `_buildCCIPMessage` private function to construct a CCIP-compatible message using the `EVM2AnyMessage` [struct](/ccip/api-reference/v1.5.1/client#any2evmmessage): - The `_receiver` address is encoded in bytes to accommodate non-EVM destination blockchains with distinct address formats. The encoding is achieved through [abi.encode](https://docs.soliditylang.org/en/develop/abi-spec.html). - The `data` is empty because you only transfer tokens. - - The `tokenAmounts` is an array, with each element comprising a [`EVMTokenAmount` struct](/ccip/api-reference/client#evmtokenamount) that contains the token address and amount. The array contains one element where the `_token` (token address) and `_amount` (token amount) are passed by the user when calling the `transferTokensPayLINK` function. + - The `tokenAmounts` is an array, with each element comprising a [`EVMTokenAmount` struct](/ccip/api-reference/v1.5.1/client#evmtokenamount) that contains the token address and amount. The array contains one element where the `_token` (token address) and `_amount` (token amount) are passed by the user when calling the `transferTokensPayLINK` function. - The `extraArgs` specifies the `gasLimit` for relaying the message to the recipient contract on the destination blockchain. In this example, the `gasLimit` is set to `0` because the contract only transfers tokens and does not expect function calls on the destination blockchain. - The `_feeTokenAddress` designates the token address used for CCIP fees. Here, `address(linkToken)` signifies payment in LINK. @@ -217,11 +217,11 @@ The `transferTokensPayLINK` function undertakes six primary operations: -1. Computes the fees by invoking the router's `getFee` [function](/ccip/api-reference/i-router-client#getfee). +1. Computes the fees by invoking the router's `getFee` [function](/ccip/api-reference/v1.5.1/i-router-client#getfee). 1. Ensures your contract balance in LINK is enough to cover the fees. 1. Grants the router contract permission to deduct the fees from the contract's LINK balance. 1. Grants the router contract permission to deduct the amount from the contract's _CCIP-BnM_ balance. -1. Dispatches the CCIP message to the destination chain by executing the router's `ccipSend` [function](/ccip/api-reference/i-router-client#ccipsend). +1. Dispatches the CCIP message to the destination chain by executing the router's `ccipSend` [function](/ccip/api-reference/v1.5.1/i-router-client#ccipsend). **Note**: As a security measure, the `transferTokensPayLINK` function is protected by the `onlyAllowlistedChain` to ensure the contract owner has allowlisted a destination chain. @@ -229,11 +229,11 @@ The `transferTokensPayLINK` function undertakes six primary operations: The `transferTokensPayNative` function undertakes five primary operations: -1. Call the `_buildCCIPMessage` private function to construct a CCIP-compatible message using the `EVM2AnyMessage` [struct](/ccip/api-reference/client#any2evmmessage): +1. Call the `_buildCCIPMessage` private function to construct a CCIP-compatible message using the `EVM2AnyMessage` [struct](/ccip/api-reference/v1.5.1/client#any2evmmessage): - The `_receiver` address is encoded in bytes to accommodate non-EVM destination blockchains with distinct address formats. The encoding is achieved through [abi.encode](https://docs.soliditylang.org/en/develop/abi-spec.html). - The `data` is empty because you only transfer tokens. - - The `tokenAmounts` is an array, with each element comprising an `EVMTokenAmount` [struct](/ccip/api-reference/client#evmtokenamount) containing the token address and amount. The array contains one element where the `_token` (token address) and `_amount` (token amount) are passed by the user when calling the `transferTokensPayNative` function. + - The `tokenAmounts` is an array, with each element comprising an `EVMTokenAmount` [struct](/ccip/api-reference/v1.5.1/client#evmtokenamount) containing the token address and amount. The array contains one element where the `_token` (token address) and `_amount` (token amount) are passed by the user when calling the `transferTokensPayNative` function. - The `extraArgs` specifies the `gasLimit` for relaying the message to the recipient contract on the destination blockchain. In this example, the `gasLimit` is set to `0` because the contract only transfers tokens and does not expect function calls on the destination blockchain. - The `_feeTokenAddress` designates the token address used for CCIP fees. Here, `address(0)` signifies payment in native gas tokens (ETH). @@ -241,9 +241,9 @@ The `transferTokensPayNative` function undertakes five primary operations: -1. Computes the fees by invoking the router's `getFee` [function](/ccip/api-reference/i-router-client#getfee). +1. Computes the fees by invoking the router's `getFee` [function](/ccip/api-reference/v1.5.1/i-router-client#getfee). 1. Ensures your contract balance in native gas is enough to cover the fees. 1. Grants the router contract permission to deduct the amount from the contract's _CCIP-BnM_ balance. -1. Dispatches the CCIP message to the destination chain by executing the router's `ccipSend` [function](/ccip/api-reference/i-router-client#ccipsend). **Note**: `msg.value` is set because you pay in native gas. +1. Dispatches the CCIP message to the destination chain by executing the router's `ccipSend` [function](/ccip/api-reference/v1.5.1/i-router-client#ccipsend). **Note**: `msg.value` is set because you pay in native gas. **Note**: As a security measure, the `transferTokensPayNative` function is protected by the `onlyAllowlistedChain`, ensuring the contract owner has allowlisted a destination chain. diff --git a/src/content/ccip/tutorials/usdc.mdx b/src/content/ccip/tutorials/usdc.mdx index 116aa9864b0..f9571214299 100644 --- a/src/content/ccip/tutorials/usdc.mdx +++ b/src/content/ccip/tutorials/usdc.mdx @@ -14,7 +14,7 @@ This guide will first explain how Chainlink CCIP enables native USDC transfers u ## Architecture -Fundamentally the [architecture](/ccip/architecture#detailed-architecture) of CCIP and [API](/ccip/api-reference/i-router-client) are unchanged: +Fundamentally the [architecture](/ccip/architecture#detailed-architecture) of CCIP and [API](/ccip/api-reference/v1.5.1/i-router-client) are unchanged: - The sender has to interact with the CCIP router to initiate a cross-chain transaction, similar to the process for any other token transfers. See the [Transfer Tokens](/ccip/tutorials/transfer-tokens-from-contract) guide to learn more. - The process uses the same onchain components including the Router, OnRamp, Commit Store, OffRamp, and Token Pool. 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 597a7cb72da..0a96167519b 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,8 +11,6 @@ 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. ## Prerequisites 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 a6adb63b43d..9e3cc677ab8 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 @@ -11,8 +11,6 @@ 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. ## Prerequisites diff --git a/src/content/chainlink-local/build/ccip/foundry/local-simulator-fork.mdx b/src/content/chainlink-local/build/ccip/foundry/local-simulator-fork.mdx index af588677900..63d5d6b4eaf 100644 --- a/src/content/chainlink-local/build/ccip/foundry/local-simulator-fork.mdx +++ b/src/content/chainlink-local/build/ccip/foundry/local-simulator-fork.mdx @@ -147,7 +147,7 @@ The `prepareScenario()` function is invoked at the beginning of each test case. sourceCCIPBnMToken.approve(address(sourceRouter), amountToSend); ``` -1. Create an array [Client.EVMTokenAmount](/ccip/api-reference/client#evmtokenamount)[] to specify the token transfer details. This array and the amount to send +1. Create an array [Client.EVMTokenAmount](/ccip/api-reference/v1.5.1/client#evmtokenamount)[] to specify the token transfer details. This array and the amount to send are returned by the `prepareScenario()` function for use in the calling test case: ```solidity @@ -194,7 +194,7 @@ Here are the steps involved in this test case: ccipLocalSimulatorFork.requestLinkFromFaucet(alice, 10 ether); ``` -1. Construct the [Client.EVM2AnyMessage](/ccip/api-reference/client#evm2anymessage) structure with the receiver, token amounts, and other necessary details. +1. Construct the [Client.EVM2AnyMessage](/ccip/api-reference/v1.5.1/client#evm2anymessage) structure with the receiver, token amounts, and other necessary details. - Set the `data` parameter to an empty string because you are not sending any arbitrary data, only tokens. - In `extraArgs`, set the gas limit to `0`. This gas limit is for execution of receiver logic, which doesn't apply here because you're sending tokens to an EOA. @@ -264,7 +264,7 @@ Here are the steps involved in this test case: deal(alice, 5 ether); ``` -1. Construct the [Client.EVM2AnyMessage](/ccip/api-reference/client#evm2anymessage) structure. This step is the same as in the previous test case. +1. Construct the [Client.EVM2AnyMessage](/ccip/api-reference/v1.5.1/client#evm2anymessage) structure. This step is the same as in the previous test case. The main difference is that the `feeToken` is set with `address(0)` to indicate that the fees are paid in native gas: ```solidity diff --git a/src/content/chainlink-local/build/ccip/foundry/local-simulator.mdx b/src/content/chainlink-local/build/ccip/foundry/local-simulator.mdx index d59ea5d384a..3200fd8a0f0 100644 --- a/src/content/chainlink-local/build/ccip/foundry/local-simulator.mdx +++ b/src/content/chainlink-local/build/ccip/foundry/local-simulator.mdx @@ -134,7 +134,7 @@ The `prepareScenario()` function is invoked at the beginning of each test case. ccipBnMToken.approve(address(router), amountToSend); ``` -1. Create an array [Client.EVMTokenAmount](/ccip/api-reference/client#evmtokenamount)[] to specify the token transfer details. This array and the amount to send are returned by the prepareScenario() function for use in the calling test case: +1. Create an array [Client.EVMTokenAmount](/ccip/api-reference/v1.5.1/client#evmtokenamount)[] to specify the token transfer details. This array and the amount to send are returned by the prepareScenario() function for use in the calling test case: ```solidity tokensToSendDetails = new Client.EVMTokenAmount[](1); @@ -173,7 +173,7 @@ Here are the steps involved in this test case: ccipLocalSimulator.requestLinkFromFaucet(alice, 5 ether); ``` -1. Construct the [Client.EVM2AnyMessage](/ccip/api-reference/client#evm2anymessage) structure with the receiver, token amounts, and other necessary details. +1. Construct the [Client.EVM2AnyMessage](/ccip/api-reference/v1.5.1/client#evm2anymessage) structure with the receiver, token amounts, and other necessary details. - Set the `data` parameter to an empty string because you are not sending any arbitrary data, only tokens. - In `extraArgs`, set the gas limit to `0`. This gas limit is for execution of receiver logic, which doesn't apply here because you're sending tokens to an EOA. @@ -235,7 +235,7 @@ Here are the steps involved in this test case: deal(alice, 5 ether); ``` -1. Construct the [Client.EVM2AnyMessage](/ccip/api-reference/client#evm2anymessage) structure. This step is the same as in the previous test case. +1. Construct the [Client.EVM2AnyMessage](/ccip/api-reference/v1.5.1/client#evm2anymessage) structure. This step is the same as in the previous test case. The main difference is that the `feeToken` is set with `address(0)` to indicate that the fees are paid in native gas: ```solidity diff --git a/src/content/chainlink-local/build/ccip/hardhat/local-simulator.mdx b/src/content/chainlink-local/build/ccip/hardhat/local-simulator.mdx index 31e8ec76b0e..53aa67be357 100644 --- a/src/content/chainlink-local/build/ccip/hardhat/local-simulator.mdx +++ b/src/content/chainlink-local/build/ccip/hardhat/local-simulator.mdx @@ -120,7 +120,7 @@ while paying fees in LINK. Here are the steps involved in this test case: ] ``` -1. Construct the [Client.EVM2AnyMessage](/ccip/api-reference/client#evm2anymessage) structure with the receiver, token amounts, and other necessary details. +1. Construct the [Client.EVM2AnyMessage](/ccip/api-reference/v1.5.1/client#evm2anymessage) structure with the receiver, token amounts, and other necessary details. - Use an empty string for the `data` parameter because you are not sending any arbitrary data (only tokens). - Set `gasLimit` to `0` because you are sending tokens to an EOA, which means you do not expect any execution of receiver logic (and therefore do not need gas for that). diff --git a/src/features/ccip/CcipCommon.astro b/src/features/ccip/CcipCommon.astro index 472e0195c3a..61f0c1999b7 100644 --- a/src/features/ccip/CcipCommon.astro +++ b/src/features/ccip/CcipCommon.astro @@ -18,8 +18,6 @@ const RMNCautionComponent = RMNCaution[0].Content const GasSpike = await Astro.glob("./GasSpike.mdx") const GasSpikeComponent = GasSpike[0].Content -const SelfServeCallout = await Astro.glob("./SelfServeCallout.mdx") -const SelfServeCalloutComponent = SelfServeCallout[0].Content const RegisterFromEOAIntro = await Astro.glob("./RegisterFromEOAIntro.mdx") const RegisterFromEOAIntroComponent = RegisterFromEOAIntro[0].Content const RegisterLockMintFromEOAIntro = await Astro.glob("./RegisterLockMintFromEOAIntro.mdx") @@ -40,7 +38,6 @@ export type Props = { | "useSimulator" | "rmnCaution" | "gasSpike" - | "selfServeCallout" | "registerFromEOAIntro" | "registerLockMintFromEOAIntro" | "gasLimitPool" @@ -59,7 +56,6 @@ const { callout } = Astro.props as Props {callout === "useSimulator" && } {callout === "rmnCaution" && } {callout === "gasSpike" && } -{callout === "selfServeCallout" && } {callout === "registerFromEOAIntro" && } {callout === "registerLockMintFromEOAIntro" && } {callout === "gasLimitPool" && } diff --git a/src/features/ccip/RegisterFromEOAIntro.mdx b/src/features/ccip/RegisterFromEOAIntro.mdx index 0355515d564..fdcd9238101 100644 --- a/src/features/ccip/RegisterFromEOAIntro.mdx +++ b/src/features/ccip/RegisterFromEOAIntro.mdx @@ -2,19 +2,19 @@ We will cover the following key steps: 1. **Deploying Tokens**: You will deploy your [`BurnMintERC677`](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/shared/token/ERC677/BurnMintERC677.sol) tokens on the Avalanche Fuji and Arbitrum Sepolia testnets. -1. **Deploying Token Pools**: Once your tokens are deployed, you will deploy [`BurnMintTokenPool`](/ccip/api-reference/burn-mint-token-pool) token pools on Avalanche Fuji and Arbitrum Sepolia. These pools are essential for minting and burning tokens during cross-chain transfers. Each token will be linked to a pool, which will manage token transfers and ensure proper handling of assets across chains. +1. **Deploying Token Pools**: Once your tokens are deployed, you will deploy [`BurnMintTokenPool`](/ccip/api-reference/v1.5.1/burn-mint-token-pool) token pools on Avalanche Fuji and Arbitrum Sepolia. These pools are essential for minting and burning tokens during cross-chain transfers. Each token will be linked to a pool, which will manage token transfers and ensure proper handling of assets across chains. 1. **Claiming Mint and Burn Roles**: You will [claim the mint and burn roles](https://github.com/smartcontractkit/ccip/blob/f8d2f981e54aa7eb739d21ab925a954e043da9b6/contracts/src/v0.8/shared/token/ERC677/BurnMintERC677.sol#L141) for the token pools, allowing your token pools to control how tokens are minted and burned during cross-chain transfers. 1. **Claiming and Accepting the Admin Role**: This is a two-step process: - 1. You will call the [`RegistryModuleOwnerCustom`](/ccip/api-reference/registry-module-owner-custom) contract's [`registerAdminViaOwner`](/ccip/api-reference/registry-module-owner-custom#registeradminviaowner) function to register your EOA as the token admin. This role is required to enable your token in CCIP. + 1. You will call the [`RegistryModuleOwnerCustom`](/ccip/api-reference/v1.5.1/registry-module-owner-custom) contract's [`registerAdminViaOwner`](/ccip/api-reference/v1.5.1/registry-module-owner-custom#registeradminviaowner) function to register your EOA as the token admin. This role is required to enable your token in CCIP. - 1. Once claimed, you will call the [`TokenAdminRegistry`](/ccip/api-reference/token-admin-registry) contract's [`acceptAdminRole`](/ccip/api-reference/token-admin-registry#acceptadminrole) function to complete the registration process. + 1. Once claimed, you will call the [`TokenAdminRegistry`](/ccip/api-reference/v1.5.1/token-admin-registry) contract's [`acceptAdminRole`](/ccip/api-reference/v1.5.1/token-admin-registry#acceptadminrole) function to complete the registration process. -1. **Linking Tokens to Pools**: You will call the [`TokenAdminRegistry`](/ccip/api-reference/token-admin-registry) contract's [`setPool`](/ccip/api-reference/token-admin-registry#setpool) function to associate each token with its respective token pool. +1. **Linking Tokens to Pools**: You will call the [`TokenAdminRegistry`](/ccip/api-reference/v1.5.1/token-admin-registry) contract's [`setPool`](/ccip/api-reference/v1.5.1/token-admin-registry#setpool) function to associate each token with its respective token pool. -1. **Configuring Token Pools**: You will call the [`applyChainUpdates`](/ccip/api-reference/token-pool#applychainupdates) function on your token pools to configure each pool by setting cross-chain transfer parameters, such as token pool rate limits and enabled destination chains. +1. **Configuring Token Pools**: You will call the [`applyChainUpdates`](/ccip/api-reference/v1.5.1/token-pool#applychainupdates) function on your token pools to configure each pool by setting cross-chain transfer parameters, such as token pool rate limits and enabled destination chains. 1. **Minting Tokens**: You will call the [`mint`](https://github.com/smartcontractkit/ccip/blob/f8d2f981e54aa7eb739d21ab925a954e043da9b6/contracts/src/v0.8/shared/token/ERC677/BurnMintERC677.sol#L128) function to mint tokens on Avalanche Fuji for your EOA. These tokens will later be used to test cross-chain transfers to Arbitrum Sepolia. diff --git a/src/features/ccip/RegisterLockMintFromEOAIntro.mdx b/src/features/ccip/RegisterLockMintFromEOAIntro.mdx index 212509378a5..2487325a3cf 100644 --- a/src/features/ccip/RegisterLockMintFromEOAIntro.mdx +++ b/src/features/ccip/RegisterLockMintFromEOAIntro.mdx @@ -2,19 +2,19 @@ We will cover the following key steps: 1. **Deploying Tokens**: You will deploy your [`BurnMintERC677`](https://github.com/smartcontractkit/ccip/tree/release/contracts-ccip-1.5.0/contracts/src/v0.8/shared/token/ERC677/BurnMintERC677.sol) tokens on the Avalanche Fuji and Arbitrum Sepolia testnets. -1. **Deploying Token Pools**: Once your tokens are deployed, you will deploy [`LockReleaseTokenPool`](/ccip/api-reference/lock-release-token-pool) on Avalanche Fuji and [`BurnMintTokenPool`](/ccip/api-reference/burn-mint-token-pool) token pools on Arbitrum Sepolia. These pools are essential for testing the _Lock & Mint_ token transfer mechanism: Locking the tokens on the source blockchain and then minting an equivalent amount of tokens on the destination blockchain. Each token will be linked to a pool, which will manage token transfers and ensure proper handling of assets across chains. +1. **Deploying Token Pools**: Once your tokens are deployed, you will deploy [`LockReleaseTokenPool`](/ccip/api-reference/v1.5.1/lock-release-token-pool) on Avalanche Fuji and [`BurnMintTokenPool`](/ccip/api-reference/v1.5.1/burn-mint-token-pool) token pools on Arbitrum Sepolia. These pools are essential for testing the _Lock & Mint_ token transfer mechanism: Locking the tokens on the source blockchain and then minting an equivalent amount of tokens on the destination blockchain. Each token will be linked to a pool, which will manage token transfers and ensure proper handling of assets across chains. 1. **Claiming Mint and Burn Roles**: You will [claim the mint and burn roles](https://github.com/smartcontractkit/ccip/blob/f8d2f981e54aa7eb739d21ab925a954e043da9b6/contracts/src/v0.8/shared/token/ERC677/BurnMintERC677.sol#L141) for the destination token pool, allowing it to mint and burn tokens during cross-chain transfers. 1. **Claiming and Accepting the Admin Role**: This is a two-step process: - 1. You will call the [`RegistryModuleOwnerCustom`](/ccip/api-reference/registry-module-owner-custom) contract's [`registerAdminViaOwner`](/ccip/api-reference/registry-module-owner-custom#registeradminviaowner) function to register your EOA as the token admin. This role is required to enable your token in CCIP. + 1. You will call the [`RegistryModuleOwnerCustom`](/ccip/api-reference/v1.5.1/registry-module-owner-custom) contract's [`registerAdminViaOwner`](/ccip/api-reference/v1.5.1/registry-module-owner-custom#registeradminviaowner) function to register your EOA as the token admin. This role is required to enable your token in CCIP. - 1. Once claimed, you will call the [`TokenAdminRegistry`](/ccip/api-reference/token-admin-registry) contract's [`acceptAdminRole`](/ccip/api-reference/token-admin-registry#acceptadminrole) function to complete the registration process. + 1. Once claimed, you will call the [`TokenAdminRegistry`](/ccip/api-reference/v1.5.1/token-admin-registry) contract's [`acceptAdminRole`](/ccip/api-reference/v1.5.1/token-admin-registry#acceptadminrole) function to complete the registration process. -1. **Linking Tokens to Pools**: You will call the [`TokenAdminRegistry`](/ccip/api-reference/token-admin-registry) contract's [`setPool`](/ccip/api-reference/token-admin-registry#setpool) function to associate each token with its respective token pool. +1. **Linking Tokens to Pools**: You will call the [`TokenAdminRegistry`](/ccip/api-reference/v1.5.1/token-admin-registry) contract's [`setPool`](/ccip/api-reference/v1.5.1/token-admin-registry#setpool) function to associate each token with its respective token pool. -1. **Configuring Token Pools**: You will call the [`applyChainUpdates`](/ccip/api-reference/token-pool#applychainupdates) function on your token pools to configure each pool by setting cross-chain transfer parameters, such as token pool rate limits and enabled destination chains. +1. **Configuring Token Pools**: You will call the [`applyChainUpdates`](/ccip/api-reference/v1.5.1/token-pool#applychainupdates) function on your token pools to configure each pool by setting cross-chain transfer parameters, such as token pool rate limits and enabled destination chains. 1. **Minting Tokens**: You will call the [`mint`](https://github.com/smartcontractkit/ccip/blob/f8d2f981e54aa7eb739d21ab925a954e043da9b6/contracts/src/v0.8/shared/token/ERC677/BurnMintERC677.sol#L128) function to mint tokens on Avalanche Fuji for your EOA. These tokens will later be used to test cross-chain transfers to Arbitrum Sepolia. diff --git a/src/features/ccip/SelfServeCallout.mdx b/src/features/ccip/SelfServeCallout.mdx deleted file mode 100644 index cdaf4734230..00000000000 --- a/src/features/ccip/SelfServeCallout.mdx +++ /dev/null @@ -1,9 +0,0 @@ -import { Aside } from "@components" - - diff --git a/src/features/ccip/SenderContractCallout.mdx b/src/features/ccip/SenderContractCallout.mdx index 31d271fe5e9..ddad4716453 100644 --- a/src/features/ccip/SenderContractCallout.mdx +++ b/src/features/ccip/SenderContractCallout.mdx @@ -7,7 +7,7 @@ This example is simplified for educational purposes. For production code, please - **Validate the Destination Chain**: Always ensure that the destination chain is valid and supported before sending messages. -- **Understand `allowOutOfOrderExecution` Usage**: This example sets `allowOutOfOrderExecution` to `true` (see [EVMExtraArgsV2](/ccip/api-reference/client#evmextraargsv2)). However, as documented in the [Best Practices: Setting `allowOutOfOrderExecution`](/ccip/best-practices#setting-allowoutoforderexecution), this parameter is available only on lanes where the **Out of Order Execution** property is set to **Optional** or **Required**. Refer to the [CCIP Directory](/ccip/directory) to determine if your target lane supports this feature. For lanes where this parameter is absent, you must use [`extraArgsV1`](/ccip/api-reference/client#evmextraargsv1) instead. +- **Understand `allowOutOfOrderExecution` Usage**: This example sets `allowOutOfOrderExecution` to `true` (see [EVMExtraArgsV2](/ccip/api-reference/v1.5.1/client#evmextraargsv2)). However, as documented in the [Best Practices: Setting `allowOutOfOrderExecution`](/ccip/best-practices#setting-allowoutoforderexecution), this parameter is available only on lanes where the **Out of Order Execution** property is set to **Optional** or **Required**. Refer to the [CCIP Directory](/ccip/directory) to determine if your target lane supports this feature. For lanes where this parameter is absent, you must use [`extraArgsV1`](/ccip/api-reference/v1.5.1/client#evmextraargsv1) instead. Following these best practices ensures that your contract is robust, future-proof, and compliant with CCIP standards. From 4cd099580c6621683e91ce8973268c3ab4464b57 Mon Sep 17 00:00:00 2001 From: aelmanaa Date: Fri, 29 Nov 2024 23:23:33 +0100 Subject: [PATCH 03/57] update --- astro.config.ts | 2 ++ src/config/redirects/ccip.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 src/config/redirects/ccip.ts diff --git a/astro.config.ts b/astro.config.ts index 14499141024..f0c4883e119 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -9,6 +9,7 @@ import rehypeWrapAll from "rehype-wrap-all" import sitemap from "@astrojs/sitemap" import { RehypePlugins } from "@astrojs/markdown-remark" import yaml from "@rollup/plugin-yaml" +import { ccipRedirects } from "./src/config/redirects/ccip" // https://astro.build/config export default defineConfig({ @@ -18,6 +19,7 @@ export default defineConfig({ "/ccip/supported-networks": "/ccip/directory/mainnet", "/getting-started": "/getting-started/conceptual-overview", "/resources": "/resources/link-token-contracts", + ...ccipRedirects, }, integrations: [ preact({ diff --git a/src/config/redirects/ccip.ts b/src/config/redirects/ccip.ts new file mode 100644 index 00000000000..0b04762d17d --- /dev/null +++ b/src/config/redirects/ccip.ts @@ -0,0 +1,27 @@ +const API_FILES = [ + "burn-from-mint-token-pool", + "burn-mint-token-pool-abstract", + "burn-mint-token-pool", + "ccip-receiver", + "client", + "i-router-client", + "lock-release-token-pool", + "pool", + "registry-module-owner-custom", + "token-admin-registry", + "token-pool", + "errors", +] + +export const ccipRedirects = API_FILES.reduce((redirects, file) => { + // For each file, create redirects with proper status code + redirects[`/ccip/api-reference/${file}`] = { + status: 301, + destination: `/ccip/api-reference/v1.5.1/${file}`, + } + redirects[`/ccip/api-reference/${file}/`] = { + status: 301, + destination: `/ccip/api-reference/v1.5.1/${file}`, + } + return redirects +}, {} as Record) From f2c0aad58839ac837ebe28ea4e6659c5e4113835 Mon Sep 17 00:00:00 2001 From: aelmanaa Date: Fri, 29 Nov 2024 23:38:20 +0100 Subject: [PATCH 04/57] update --- .../ccip/api-reference/v1.5.0/burn-from-mint-token-pool.mdx | 1 + .../ccip/api-reference/v1.5.0/burn-mint-token-pool-abstract.mdx | 1 + src/content/ccip/api-reference/v1.5.0/burn-mint-token-pool.mdx | 1 + src/content/ccip/api-reference/v1.5.0/ccip-receiver.mdx | 1 + src/content/ccip/api-reference/v1.5.0/client.mdx | 1 + src/content/ccip/api-reference/v1.5.0/errors.mdx | 1 + src/content/ccip/api-reference/v1.5.0/i-router-client.mdx | 1 + src/content/ccip/api-reference/v1.5.0/index.mdx | 1 + .../ccip/api-reference/v1.5.0/lock-release-token-pool.mdx | 1 + src/content/ccip/api-reference/v1.5.0/pool.mdx | 1 + .../ccip/api-reference/v1.5.0/registry-module-owner-custom.mdx | 1 + src/content/ccip/api-reference/v1.5.0/token-admin-registry.mdx | 1 + src/content/ccip/api-reference/v1.5.0/token-pool.mdx | 1 + src/content/config.ts | 1 + 14 files changed, 14 insertions(+) diff --git a/src/content/ccip/api-reference/v1.5.0/burn-from-mint-token-pool.mdx b/src/content/ccip/api-reference/v1.5.0/burn-from-mint-token-pool.mdx index 659c87bae68..4f89b016cd5 100644 --- a/src/content/ccip/api-reference/v1.5.0/burn-from-mint-token-pool.mdx +++ b/src/content/ccip/api-reference/v1.5.0/burn-from-mint-token-pool.mdx @@ -4,6 +4,7 @@ date: Last Modified title: "CCIP v1.5.0 BurnFromMintTokenPool Contract API Reference" metadata: description: "API documentation for the BurnFromMintTokenPool contract in Chainlink CCIP v1.5.0, implementing burn/mint functionality for third-party tokens using burnFrom(address, amount)." + canonical: "/ccip/api-reference/v1.5.1/burn-from-mint-token-pool" --- import { Aside } from "@components" diff --git a/src/content/ccip/api-reference/v1.5.0/burn-mint-token-pool-abstract.mdx b/src/content/ccip/api-reference/v1.5.0/burn-mint-token-pool-abstract.mdx index 9cb36dbb736..55cac8cadb0 100644 --- a/src/content/ccip/api-reference/v1.5.0/burn-mint-token-pool-abstract.mdx +++ b/src/content/ccip/api-reference/v1.5.0/burn-mint-token-pool-abstract.mdx @@ -4,6 +4,7 @@ date: Last Modified title: "CCIP v1.5.0 BurnMintTokenPoolAbstract Contract API Reference" metadata: description: "API documentation for the BurnMintTokenPoolAbstract contract in Chainlink CCIP v1.5.0, implementing burn/mint functionality for cross-chain token transfers." + canonical: "/ccip/api-reference/v1.5.1/burn-mint-token-pool-abstract" --- import { Aside } from "@components" diff --git a/src/content/ccip/api-reference/v1.5.0/burn-mint-token-pool.mdx b/src/content/ccip/api-reference/v1.5.0/burn-mint-token-pool.mdx index fdbd1766b9f..59efa5dd9cf 100644 --- a/src/content/ccip/api-reference/v1.5.0/burn-mint-token-pool.mdx +++ b/src/content/ccip/api-reference/v1.5.0/burn-mint-token-pool.mdx @@ -4,6 +4,7 @@ date: Last Modified title: "CCIP v1.5.0 BurnMintTokenPool Contract API Reference" metadata: description: "API documentation for the BurnMintTokenPool contract in Chainlink CCIP v1.5.0, implementing burn/mint functionality for third-party tokens using burn(amount)." + canonical: "/ccip/api-reference/v1.5.1/burn-mint-token-pool" --- import { Aside } from "@components" diff --git a/src/content/ccip/api-reference/v1.5.0/ccip-receiver.mdx b/src/content/ccip/api-reference/v1.5.0/ccip-receiver.mdx index 3b1cbc6ada7..92de053a9b3 100644 --- a/src/content/ccip/api-reference/v1.5.0/ccip-receiver.mdx +++ b/src/content/ccip/api-reference/v1.5.0/ccip-receiver.mdx @@ -4,6 +4,7 @@ date: Last Modified title: "CCIP v1.5.0 CCIPReceiver API Reference" metadata: description: "API documentation for the CCIPReceiver contract in Chainlink CCIP v1.5.0, the base contract for applications receiving cross-chain messages." + canonical: "/ccip/api-reference/v1.5.1/ccip-receiver" --- import CcipCommon from "@features/ccip/CcipCommon.astro" diff --git a/src/content/ccip/api-reference/v1.5.0/client.mdx b/src/content/ccip/api-reference/v1.5.0/client.mdx index eaad5224429..d926c5f5289 100644 --- a/src/content/ccip/api-reference/v1.5.0/client.mdx +++ b/src/content/ccip/api-reference/v1.5.0/client.mdx @@ -4,6 +4,7 @@ date: Last Modified title: "CCIP v1.5.0 Client Library API Reference" metadata: description: "API documentation for the Client library in Chainlink CCIP v1.5.0, used for building and handling cross-chain messages." + canonical: "/ccip/api-reference/v1.5.1/client" --- import { Aside } from "@components" diff --git a/src/content/ccip/api-reference/v1.5.0/errors.mdx b/src/content/ccip/api-reference/v1.5.0/errors.mdx index 7ec0b3f3250..36b5d40f418 100644 --- a/src/content/ccip/api-reference/v1.5.0/errors.mdx +++ b/src/content/ccip/api-reference/v1.5.0/errors.mdx @@ -4,6 +4,7 @@ date: Last Modified title: "CCIP v1.5.0 Error Codes and Messages API Reference" metadata: description: "API documentation for error handling in Chainlink CCIP v1.5.0, including router, onramp, rate limiter, and token-related errors." + canonical: "/ccip/api-reference/v1.5.1/errors" --- import CcipCommon from "@features/ccip/CcipCommon.astro" diff --git a/src/content/ccip/api-reference/v1.5.0/i-router-client.mdx b/src/content/ccip/api-reference/v1.5.0/i-router-client.mdx index efc2fa06ac0..ef9cb0fcbd1 100644 --- a/src/content/ccip/api-reference/v1.5.0/i-router-client.mdx +++ b/src/content/ccip/api-reference/v1.5.0/i-router-client.mdx @@ -4,6 +4,7 @@ date: Last Modified title: "CCIP v1.5.0 IRouterClient API Reference" metadata: description: "API documentation for the IRouterClient interface in Chainlink CCIP v1.5.0, used for sending cross-chain messages through CCIP." + canonical: "/ccip/api-reference/v1.5.1/i-router-client" --- import { Aside } from "@components" diff --git a/src/content/ccip/api-reference/v1.5.0/index.mdx b/src/content/ccip/api-reference/v1.5.0/index.mdx index e45b16fc80f..bec3cda8741 100644 --- a/src/content/ccip/api-reference/v1.5.0/index.mdx +++ b/src/content/ccip/api-reference/v1.5.0/index.mdx @@ -4,6 +4,7 @@ date: Last Modified title: "CCIP v1.5.0 API Reference" metadata: description: "API reference documentation for Chainlink CCIP v1.5.0. Includes core components, token pools, registry components, and error handling for cross-chain messaging and token transfers." + canonical: "/ccip/api-reference/v1.5.1/" --- import { Aside } from "@components" diff --git a/src/content/ccip/api-reference/v1.5.0/lock-release-token-pool.mdx b/src/content/ccip/api-reference/v1.5.0/lock-release-token-pool.mdx index 927dc9aa0a7..f8e35885c7c 100644 --- a/src/content/ccip/api-reference/v1.5.0/lock-release-token-pool.mdx +++ b/src/content/ccip/api-reference/v1.5.0/lock-release-token-pool.mdx @@ -4,6 +4,7 @@ date: Last Modified title: "CCIP v1.5.0 LockReleaseTokenPool Contract API Reference" metadata: description: "API documentation for the LockReleaseTokenPool contract in Chainlink CCIP v1.5.0, implementing lock/release functionality for tokens on their native chain." + canonical: "/ccip/api-reference/v1.5.1/lock-release-token-pool" --- import { Aside } from "@components" diff --git a/src/content/ccip/api-reference/v1.5.0/pool.mdx b/src/content/ccip/api-reference/v1.5.0/pool.mdx index f3de71e3767..d0a38abc254 100644 --- a/src/content/ccip/api-reference/v1.5.0/pool.mdx +++ b/src/content/ccip/api-reference/v1.5.0/pool.mdx @@ -4,6 +4,7 @@ date: Last Modified title: "CCIP v1.5.0 Pool Library API Reference" metadata: description: "API documentation for the Pool library in Chainlink CCIP v1.5.0, providing token pool functions for cross-chain operations." + canonical: "/ccip/api-reference/v1.5.1/pool" --- import { Aside } from "@components" diff --git a/src/content/ccip/api-reference/v1.5.0/registry-module-owner-custom.mdx b/src/content/ccip/api-reference/v1.5.0/registry-module-owner-custom.mdx index 95673173515..ef71761f7ac 100644 --- a/src/content/ccip/api-reference/v1.5.0/registry-module-owner-custom.mdx +++ b/src/content/ccip/api-reference/v1.5.0/registry-module-owner-custom.mdx @@ -4,6 +4,7 @@ date: Last Modified title: "CCIP v1.5.0 RegistryModuleOwnerCustom Contract API Reference" metadata: description: "API documentation for the RegistryModuleOwnerCustom contract in Chainlink CCIP v1.5.0, enabling token developers to register as administrators for their tokens." + canonical: "/ccip/api-reference/v1.5.1/registry-module-owner-custom" --- import { Aside } from "@components" diff --git a/src/content/ccip/api-reference/v1.5.0/token-admin-registry.mdx b/src/content/ccip/api-reference/v1.5.0/token-admin-registry.mdx index 88e379c0711..0c7282a9645 100644 --- a/src/content/ccip/api-reference/v1.5.0/token-admin-registry.mdx +++ b/src/content/ccip/api-reference/v1.5.0/token-admin-registry.mdx @@ -4,6 +4,7 @@ date: Last Modified title: "CCIP v1.5.0 TokenAdminRegistry Contract API Reference" metadata: description: "API documentation for the TokenAdminRegistry contract in Chainlink CCIP v1.5.0, managing token pool configurations and administrator permissions for cross-chain tokens." + canonical: "/ccip/api-reference/v1.5.1/token-admin-registry" --- import { Aside } from "@components" diff --git a/src/content/ccip/api-reference/v1.5.0/token-pool.mdx b/src/content/ccip/api-reference/v1.5.0/token-pool.mdx index 36ba944f0c5..7ffb7e6aae9 100644 --- a/src/content/ccip/api-reference/v1.5.0/token-pool.mdx +++ b/src/content/ccip/api-reference/v1.5.0/token-pool.mdx @@ -4,6 +4,7 @@ date: Last Modified title: "CCIP v1.5.0 TokenPool Contract API Reference" metadata: description: "API documentation for the TokenPool abstract contract in Chainlink CCIP v1.5.0, providing base functionality for token pools with cross-chain operations." + canonical: "/ccip/api-reference/v1.5.1/token-pool" --- import { Aside } from "@components" diff --git a/src/content/config.ts b/src/content/config.ts index cd5803e4987..9ac34a6afaa 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -43,6 +43,7 @@ const metadata = z description: z.string().optional(), image: z.string().optional(), linkToWallet: z.boolean().optional(), + canonical: z.string().optional(), }) .optional() From b0459f83c91d0771f6c5aa73608a8ddcebf27e58 Mon Sep 17 00:00:00 2001 From: aelmanaa Date: Sat, 30 Nov 2024 02:01:45 +0100 Subject: [PATCH 05/57] update --- .../VersionSelector.module.css | 144 ++++++++++++++++++ .../CCIP/VersionSelector/VersionSelector.tsx | 62 ++++++++ src/config/sidebar.ts | 45 ++---- .../sidebar/ccip/api-reference/v1_5_0.json | 50 ++++++ .../sidebar/ccip/api-reference/v1_5_1.json | 58 +++++++ src/config/versions/ccip.ts | 6 + src/content/ccip/api-reference/index.mdx | 6 - .../ccip/api-reference/v1.5.0/pool.mdx | 3 +- .../ccip/api-reference/v1.5.1/pool.mdx | 4 +- src/layouts/DocsLayout.astro | 15 ++ src/pages/ccip/api-reference/[...slug].astro | 59 +++++++ vercel.json | 9 +- 12 files changed, 414 insertions(+), 47 deletions(-) create mode 100644 src/components/CCIP/VersionSelector/VersionSelector.module.css create mode 100644 src/components/CCIP/VersionSelector/VersionSelector.tsx create mode 100644 src/config/sidebar/ccip/api-reference/v1_5_0.json create mode 100644 src/config/sidebar/ccip/api-reference/v1_5_1.json create mode 100644 src/config/versions/ccip.ts create mode 100644 src/pages/ccip/api-reference/[...slug].astro diff --git a/src/components/CCIP/VersionSelector/VersionSelector.module.css b/src/components/CCIP/VersionSelector/VersionSelector.module.css new file mode 100644 index 00000000000..76f5fa3ba3d --- /dev/null +++ b/src/components/CCIP/VersionSelector/VersionSelector.module.css @@ -0,0 +1,144 @@ +.versionSelector { + --select-height: 2.5rem; + --select-padding: 0.75rem; + --border-radius: var(--border-radius-primary, 6px); + + margin: clamp(1rem, 2vw, 1.5rem) 0; + padding: clamp(1rem, 2vw, 1.5rem); + border-bottom: 1px solid var(--theme-divider); + transition: all 0.2s ease; +} + +.selectWrapper { + display: flex; + align-items: center; + gap: 1rem; + flex-wrap: wrap; +} + +.label { + font-weight: 600; + font-size: clamp(0.875rem, 1.5vw, 1rem); + color: var(--theme-text); + white-space: nowrap; +} + +.selectContainer { + position: relative; + min-width: 150px; + flex: 1; + max-width: 300px; +} + +.select { + appearance: none; + width: 100%; + height: var(--select-height); + padding: 0 var(--select-padding); + padding-right: calc(var(--select-padding) * 2.5); + border: 2px solid var(--blue-600); + border-radius: var(--border-radius); + background: var(--theme-bg); + color: var(--theme-text); + font-size: clamp(0.875rem, 1.5vw, 1rem); + cursor: pointer; + transition: all 0.2s ease; +} + +.select:hover { + background-color: var(--blue-600); + color: var(--white); +} + +.select:focus { + outline: none; + border-color: var(--blue-600); + box-shadow: 0 0 0 3px hsla(var(--color-blue), var(--theme-accent-opacity)); +} + +.selectIcon { + position: absolute; + right: var(--select-padding); + top: 50%; + transform: translateY(-50%); + width: 10px; + height: 10px; + border: 2px solid var(--theme-text); + border-left: 0; + border-top: 0; + pointer-events: none; + transform: translateY(-75%) rotate(45deg); +} + +.warning { + margin-top: 1rem; + padding: clamp(0.75rem, 2vw, 1rem); + background: #fff3cd; + border: 1px solid #ffeeba; + border-radius: var(--border-radius); + display: flex; + align-items: flex-start; + gap: 0.75rem; + animation: slideIn 0.3s ease; +} + +.warningIcon { + flex-shrink: 0; + width: 20px; + height: 20px; + background: #856404; + mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2L1 21h22L12 2zm0 3.99L19.53 19H4.47L12 5.99zM11 16h2v2h-2zm0-6h2v4h-2z'/%3E%3C/svg%3E") + center/contain no-repeat; +} + +.warningText { + margin: 0; + font-size: clamp(0.813rem, 1.5vw, 0.938rem); + line-height: 1.5; + color: #856404; +} + +.warningLink { + color: #664d03; + text-decoration: underline; + font-weight: 500; + transition: all 0.2s ease; +} + +.warningLink:hover { + color: #533d02; + text-decoration: none; +} + +/* Responsive adjustments */ +@media (max-width: 480px) { + .selectWrapper { + flex-direction: column; + align-items: flex-start; + gap: 0.5rem; + } + + .selectContainer { + width: 100%; + max-width: none; + } +} + +/* Animation */ +@keyframes slideIn { + from { + opacity: 0; + transform: translateY(-10px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +/* Focus visible polyfill */ +.select:focus-visible { + outline: none; + border-color: var(--blue-600); + box-shadow: 0 0 0 3px hsla(var(--color-blue), var(--theme-accent-opacity)); +} diff --git a/src/components/CCIP/VersionSelector/VersionSelector.tsx b/src/components/CCIP/VersionSelector/VersionSelector.tsx new file mode 100644 index 00000000000..1872c096932 --- /dev/null +++ b/src/components/CCIP/VersionSelector/VersionSelector.tsx @@ -0,0 +1,62 @@ +import { CCIP_VERSIONS, type CCIPVersion } from "@config/versions/ccip" +import styles from "./VersionSelector.module.css" + +type VersionSelectorProps = { + currentVersion: CCIPVersion + currentPath: string +} + +export const VersionSelector = ({ currentVersion, currentPath }: VersionSelectorProps): JSX.Element => { + const pathAfterVersion = currentPath.split(currentVersion)[1] ?? "" + + const handleVersionChange = (newVersion: CCIPVersion): void => { + const newPath = `/ccip/api-reference/${newVersion}${pathAfterVersion}` + window.location.href = newPath + } + + if (!CCIP_VERSIONS.ALL.includes(currentVersion)) { + console.warn(`Invalid version ${currentVersion} provided to VersionSelector`) + } + + return ( +
+
+ +
+ +
+
+ + {currentVersion !== CCIP_VERSIONS.LATEST && ( +
+
+ )} +
+ ) +} diff --git a/src/config/sidebar.ts b/src/config/sidebar.ts index 64c70f6e727..eadab796a05 100644 --- a/src/config/sidebar.ts +++ b/src/config/sidebar.ts @@ -1,5 +1,8 @@ import { Sections } from "../content/config" import chainlinkLocalAPIReference from "./sidebar/chainlink-local/api-reference.json" +import ccipV150Contents from "./sidebar/ccip/api-reference/v1_5_0.json" +import ccipV151Contents from "./sidebar/ccip/api-reference/v1_5_1.json" + export type SectionContent = { title: string url: string @@ -1107,44 +1110,18 @@ export const SIDEBAR: Partial> = { section: "API Reference", contents: [ { - title: "IRouterClient", - url: "ccip/api-reference/i-router-client", - }, - { - title: "CCIPReceiver", - url: "ccip/api-reference/ccip-receiver", - }, - { - title: "Client Library", - url: "ccip/api-reference/client", - }, - { - title: "RegistryModuleOwnerCustom", - url: "ccip/api-reference/registry-module-owner-custom", - }, - { - title: "TokenAdminRegistry", - url: "ccip/api-reference/token-admin-registry", - }, - { - title: "TokenPool", - url: "ccip/api-reference/token-pool", - }, - { - title: "Pool Library", - url: "ccip/api-reference/pool", - }, - { - title: "BurnMintTokenPool", - url: "ccip/api-reference/burn-mint-token-pool", + title: "Overview", + url: "ccip/api-reference", }, { - title: "LockReleaseTokenPool", - url: "ccip/api-reference/lock-release-token-pool", + title: "v1.5.1 (Latest)", + url: "ccip/api-reference/v1.5.1", + children: ccipV151Contents, }, { - title: "Errors", - url: "ccip/api-reference/errors", + title: "v1.5.0", + url: "ccip/api-reference/v1.5.0", + children: ccipV150Contents, }, ], }, diff --git a/src/config/sidebar/ccip/api-reference/v1_5_0.json b/src/config/sidebar/ccip/api-reference/v1_5_0.json new file mode 100644 index 00000000000..36b3f4fae03 --- /dev/null +++ b/src/config/sidebar/ccip/api-reference/v1_5_0.json @@ -0,0 +1,50 @@ +[ + { + "title": "Client Library", + "url": "ccip/api-reference/v1.5.0/client" + }, + { + "title": "IRouterClient", + "url": "ccip/api-reference/v1.5.0/i-router-client" + }, + { + "title": "CCIPReceiver", + "url": "ccip/api-reference/v1.5.0/ccip-receiver" + }, + { + "title": "Pool Library", + "url": "ccip/api-reference/v1.5.0/pool" + }, + { + "title": "TokenPool", + "url": "ccip/api-reference/v1.5.0/token-pool" + }, + { + "title": "BurnMintTokenPool", + "url": "ccip/api-reference/v1.5.0/burn-mint-token-pool" + }, + { + "title": "BurnMintTokenPoolAbstract", + "url": "ccip/api-reference/v1.5.0/burn-mint-token-pool-abstract" + }, + { + "title": "BurnFromMintTokenPool", + "url": "ccip/api-reference/v1.5.0/burn-from-mint-token-pool" + }, + { + "title": "LockReleaseTokenPool", + "url": "ccip/api-reference/v1.5.0/lock-release-token-pool" + }, + { + "title": "TokenAdminRegistry", + "url": "ccip/api-reference/v1.5.0/token-admin-registry" + }, + { + "title": "RegistryModuleOwnerCustom", + "url": "ccip/api-reference/v1.5.0/registry-module-owner-custom" + }, + { + "title": "Errors", + "url": "ccip/api-reference/v1.5.0/errors" + } +] diff --git a/src/config/sidebar/ccip/api-reference/v1_5_1.json b/src/config/sidebar/ccip/api-reference/v1_5_1.json new file mode 100644 index 00000000000..99801228da3 --- /dev/null +++ b/src/config/sidebar/ccip/api-reference/v1_5_1.json @@ -0,0 +1,58 @@ +[ + { + "title": "Client Library", + "url": "ccip/api-reference/v1.5.1/client" + }, + { + "title": "IRouterClient", + "url": "ccip/api-reference/v1.5.1/i-router-client" + }, + { + "title": "CCIPReceiver", + "url": "ccip/api-reference/v1.5.1/ccip-receiver" + }, + { + "title": "Pool Library", + "url": "ccip/api-reference/v1.5.1/pool" + }, + { + "title": "TokenPool", + "url": "ccip/api-reference/v1.5.1/token-pool" + }, + { + "title": "BurnMintTokenPool", + "url": "ccip/api-reference/v1.5.1/burn-mint-token-pool" + }, + { + "title": "BurnMintTokenPoolAbstract", + "url": "ccip/api-reference/v1.5.1/burn-mint-token-pool-abstract" + }, + { + "title": "BurnFromMintTokenPool", + "url": "ccip/api-reference/v1.5.1/burn-from-mint-token-pool" + }, + { + "title": "LockReleaseTokenPool", + "url": "ccip/api-reference/v1.5.1/lock-release-token-pool" + }, + { + "title": "TokenAdminRegistry", + "url": "ccip/api-reference/v1.5.1/token-admin-registry" + }, + { + "title": "RegistryModuleOwnerCustom", + "url": "ccip/api-reference/v1.5.1/registry-module-owner-custom" + }, + { + "title": "BurnMintERC20", + "url": "ccip/api-reference/v1.5.1/burn-mint-erc20" + }, + { + "title": "RateLimiter Library", + "url": "ccip/api-reference/v1.5.1/rate-limiter" + }, + { + "title": "Errors", + "url": "ccip/api-reference/v1.5.1/errors" + } +] diff --git a/src/config/versions/ccip.ts b/src/config/versions/ccip.ts new file mode 100644 index 00000000000..2546a20765f --- /dev/null +++ b/src/config/versions/ccip.ts @@ -0,0 +1,6 @@ +export const CCIP_VERSIONS = { + LATEST: "v1.5.1", + ALL: ["v1.5.1", "v1.5.0"] as const, +} as const + +export type CCIPVersion = (typeof CCIP_VERSIONS.ALL)[number] diff --git a/src/content/ccip/api-reference/index.mdx b/src/content/ccip/api-reference/index.mdx index e0426d10392..38618c9b1a7 100644 --- a/src/content/ccip/api-reference/index.mdx +++ b/src/content/ccip/api-reference/index.mdx @@ -8,12 +8,6 @@ metadata: import { Aside } from "@components" -# Chainlink CCIP API Reference - - - ## Available Versions ### Latest Release diff --git a/src/content/ccip/api-reference/v1.5.0/pool.mdx b/src/content/ccip/api-reference/v1.5.0/pool.mdx index d0a38abc254..f319ea256ba 100644 --- a/src/content/ccip/api-reference/v1.5.0/pool.mdx +++ b/src/content/ccip/api-reference/v1.5.0/pool.mdx @@ -113,8 +113,7 @@ struct ReleaseOrMintInV1 { | offchainTokenData | bytes | Untrusted offchain data to process the release or mint. |