Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 37 additions & 6 deletions docs/primitives/catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"generatedBy": "script/docs/gen-primitives.mjs",
"note": "Generated from the script/ tree and the Makefile. Do not edit by hand; run `npm run docs:catalog`.",
"counts": {
"primitives": 60,
"primitives": 61,
"makeTargets": 27
},
"primitives": [
Expand Down Expand Up @@ -239,7 +239,8 @@
"writes_onchain": true,
"destructive": false,
"inputs": [
"DEST_CHAIN"
"DEST_CHAIN",
"DEST_CHAIN_SELECTOR"
]
},
{
Expand Down Expand Up @@ -285,7 +286,8 @@
"writes_onchain": false,
"destructive": false,
"inputs": [
"DEST_CHAIN"
"DEST_CHAIN",
"DEST_CHAIN_SELECTOR"
]
},
{
Expand All @@ -302,6 +304,7 @@
"destructive": false,
"inputs": [
"DEST_CHAIN",
"DEST_CHAIN_SELECTOR",
"DISABLE"
]
},
Expand Down Expand Up @@ -331,7 +334,8 @@
"writes_onchain": true,
"destructive": false,
"inputs": [
"DEST_CHAIN"
"DEST_CHAIN",
"DEST_CHAIN_SELECTOR"
]
},
{
Expand Down Expand Up @@ -421,6 +425,7 @@
"destructive": false,
"inputs": [
"DEST_CHAIN",
"DEST_CHAIN_SELECTOR",
"FAST_FINALITY"
]
},
Expand All @@ -438,6 +443,7 @@
"destructive": false,
"inputs": [
"DEST_CHAIN",
"DEST_CHAIN_SELECTOR",
"FAST_FINALITY"
]
},
Expand All @@ -454,7 +460,9 @@
"writes_onchain": true,
"destructive": true,
"inputs": [
"DEST_CHAIN"
"DEST_CHAIN",
"DEST_CHAIN_FAMILY",
"DEST_CHAIN_SELECTOR"
]
},
{
Expand All @@ -471,6 +479,8 @@
"destructive": false,
"inputs": [
"DEST_CHAIN",
"DEST_CHAIN_FAMILY",
"DEST_CHAIN_SELECTOR",
"REMOTE_POOL_ADDRESS"
]
},
Expand All @@ -486,7 +496,26 @@
"writes_onchain": false,
"destructive": false,
"inputs": [
"DEST_CHAIN"
"DEST_CHAIN",
"DEST_CHAIN_FAMILY",
"DEST_CHAIN_SELECTOR"
]
},
{
"name": "GetRemoteToken",
"script": "script/configure/remote-pools/GetRemoteToken.s.sol",
"group": "remote-pools",
"description": "Reads and displays the remote token configured on a TokenPool for a given remote chain.",
"modes": [
"read"
],
"read_only": true,
"writes_onchain": false,
"destructive": false,
"inputs": [
"DEST_CHAIN",
"DEST_CHAIN_FAMILY",
"DEST_CHAIN_SELECTOR"
]
},
{
Expand All @@ -503,6 +532,8 @@
"destructive": true,
"inputs": [
"DEST_CHAIN",
"DEST_CHAIN_FAMILY",
"DEST_CHAIN_SELECTOR",
"REMOTE_POOL_ADDRESS"
]
},
Expand Down
1 change: 1 addition & 0 deletions docs/primitives/ccv/UpdateCCVConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Applies CCV (Cross-Chain Verifier) configuration to a token pool's AdvancedPoolH
| Env var | Description |
| --- | --- |
| `DEST_CHAIN` | See the script header. |
| `DEST_CHAIN_SELECTOR` | See the script header. |

## Reference

Expand Down
1 change: 1 addition & 0 deletions docs/primitives/fee-config/GetTokenTransferFeeConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Reads and displays the token transfer fee configuration for a token pool on a gi
| Env var | Description |
| --- | --- |
| `DEST_CHAIN` | See the script header. |
| `DEST_CHAIN_SELECTOR` | See the script header. |

## Reference

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Applies token transfer fee configuration updates to a token pool on a given dest
| Env var | Description |
| --- | --- |
| `DEST_CHAIN` | See the script header. |
| `DEST_CHAIN_SELECTOR` | See the script header. |
| `DISABLE` | See the script header. |

## Reference
Expand Down
1 change: 1 addition & 0 deletions docs/primitives/finality-config/SetFinalityConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Sets the allowed finality configuration on a TokenPool, and optionally updates r
| Env var | Description |
| --- | --- |
| `DEST_CHAIN` | See the script header. |
| `DEST_CHAIN_SELECTOR` | See the script header. |

## Reference

Expand Down
1 change: 1 addition & 0 deletions docs/primitives/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ at [`catalog.json`](catalog.json). These pages are generated from the scripts an

- [AddRemotePool](remote-pools/AddRemotePool.md) - Adds a remote pool address to a TokenPool for a given remote chain. _(write)_
- [GetRemotePools](remote-pools/GetRemotePools.md) - Reads and displays the remote pool addresses configured on a TokenPool for a given remote chain. _(read-only)_
- [GetRemoteToken](remote-pools/GetRemoteToken.md) - Reads and displays the remote token configured on a TokenPool for a given remote chain. _(read-only)_
- [RemoveRemotePool](remote-pools/RemoveRemotePool.md) - Removes a remote pool address from a TokenPool for a given remote chain. _(write, destructive)_

## token-admin-registry
Expand Down
1 change: 1 addition & 0 deletions docs/primitives/rate-limiter/GetCurrentRateLimits.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Reads and displays the current rate limiter state for a TokenPool, compatible wi
| Env var | Description |
| --- | --- |
| `DEST_CHAIN` | See the script header. |
| `DEST_CHAIN_SELECTOR` | See the script header. |
| `FAST_FINALITY` | See the script header. |

## Reference
Expand Down
1 change: 1 addition & 0 deletions docs/primitives/rate-limiter/UpdateRateLimiters.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Updates rate limiter configuration on a TokenPool, compatible with both v1 and v
| Env var | Description |
| --- | --- |
| `DEST_CHAIN` | See the script header. |
| `DEST_CHAIN_SELECTOR` | See the script header. |
| `FAST_FINALITY` | See the script header. |

## Reference
Expand Down
2 changes: 2 additions & 0 deletions docs/primitives/remote-chains/RemoveChain.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Fully unsupports a remote chain on the source TokenPool: removes the chain selec
| Env var | Description |
| --- | --- |
| `DEST_CHAIN` | See the script header. |
| `DEST_CHAIN_FAMILY` | See the script header. |
| `DEST_CHAIN_SELECTOR` | See the script header. |

## Reference

Expand Down
2 changes: 2 additions & 0 deletions docs/primitives/remote-pools/AddRemotePool.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Adds a remote pool address to a TokenPool for a given remote chain.
| Env var | Description |
| --- | --- |
| `DEST_CHAIN` | See the script header. |
| `DEST_CHAIN_FAMILY` | See the script header. |
| `DEST_CHAIN_SELECTOR` | See the script header. |
| `REMOTE_POOL_ADDRESS` | See the script header. |

## Reference
Expand Down
2 changes: 2 additions & 0 deletions docs/primitives/remote-pools/GetRemotePools.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Reads and displays the remote pool addresses configured on a TokenPool for a giv
| Env var | Description |
| --- | --- |
| `DEST_CHAIN` | See the script header. |
| `DEST_CHAIN_FAMILY` | See the script header. |
| `DEST_CHAIN_SELECTOR` | See the script header. |

## Reference

Expand Down
32 changes: 32 additions & 0 deletions docs/primitives/remote-pools/GetRemoteToken.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: GetRemoteToken
script: script/configure/remote-pools/GetRemoteToken.s.sol
group: remote-pools
type: reference
modes: [read]
read_only: true
writes_onchain: false
destructive: false
---

# GetRemoteToken

Reads and displays the remote token configured on a TokenPool for a given remote chain.

## Inputs

| Env var | Description |
| --- | --- |
| `DEST_CHAIN` | See the script header. |
| `DEST_CHAIN_FAMILY` | See the script header. |
| `DEST_CHAIN_SELECTOR` | See the script header. |

## Reference

- Script: [`script/configure/remote-pools/GetRemoteToken.s.sol`](../../../script/configure/remote-pools/GetRemoteToken.s.sol)
- Modes: read
- Read-only: true | Writes on-chain: false | Destructive: false

_This page is generated from the script by `script/docs/gen-primitives.mjs`. Edit the script's
`@notice` for the description, or `docs/primitives/_meta.json` for the authored context; do not edit
this file by hand._
2 changes: 2 additions & 0 deletions docs/primitives/remote-pools/RemoveRemotePool.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Removes a remote pool address from a TokenPool for a given remote chain.
| Env var | Description |
| --- | --- |
| `DEST_CHAIN` | See the script header. |
| `DEST_CHAIN_FAMILY` | See the script header. |
| `DEST_CHAIN_SELECTOR` | See the script header. |
| `REMOTE_POOL_ADDRESS` | See the script header. |

## Reference
Expand Down
24 changes: 24 additions & 0 deletions script/HelperConfig.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,30 @@ contract HelperConfig is Script {
return "Unknown";
}

/// @notice Resolves a NetworkConfig by chain selector directly - the selector-keyed analog of
/// `getDestChainConfig(string)`. Use this when you have a selector (e.g. from
/// `getSupportedChains()`) and need the chain's family/name, NOT the display name that
/// `getChainNameBySelector` returns: `getDestChainConfig` matches the chainNameIdentifier
/// (e.g. "SOLANA_DEVNET"), not the displayName ("Solana Devnet"), so the round-trip
/// selector -> displayName -> getDestChainConfig misses for non-EVM chains and falls back
/// to a zero (evm) config. This function avoids that round-trip.
/// @dev Returns a zero config (chainFamily = "") for an unrecognized selector, mirroring
/// `getDestChainConfig`'s contract for unknown names.
function getDestChainConfigBySelector(uint64 chainSelector) public view returns (NetworkConfig memory) {
if (chainSelector == getEthereumSepoliaConfig().chainSelector) return getEthereumSepoliaConfig();
if (chainSelector == getZeroGTestnetConfig().chainSelector) return getZeroGTestnetConfig();
if (chainSelector == getPlumeTestnetConfig().chainSelector) return getPlumeTestnetConfig();
if (chainSelector == getInkSepoliaConfig().chainSelector) return getInkSepoliaConfig();
if (chainSelector == getMantleSepoliaConfig().chainSelector) return getMantleSepoliaConfig();
if (chainSelector == getSolanaDevnetConfig().chainSelector) return getSolanaDevnetConfig();
// Fallback: the discovered-chain cache.
for (uint256 i = 0; i < s_chains.length; i++) {
if (s_chains[i].chainSelector == chainSelector) return s_chains[i];
}
NetworkConfig memory unknown;
return unknown;
}

function getNativeCurrencySymbol(uint256 chainId) public view returns (string memory) {
return getNetworkConfig(chainId).nativeCurrencySymbol;
}
Expand Down
19 changes: 15 additions & 4 deletions script/configure/ccv/UpdateCCVConfig.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ import {ProjectStore} from "../../../src/utils/ProjectStore.sol";
/// resolves and displays it and MUST be broadcast from that account.
///
/// Environment Variables:
/// DEST_CHAIN - the remote lane to configure CCVs for (optional; omit for threshold-only)
/// DEST_CHAIN - the remote lane to configure CCVs for (optional; omit for threshold-only).
/// Accepts EVM and non-EVM destinations (e.g. MANTLE_SEPOLIA,
/// SOLANA_DEVNET, APTOS_TESTNET).
/// DEST_CHAIN_FAMILY - Override destination family (default: from DEST_CHAIN config)
/// DEST_CHAIN_SELECTOR - Override destination selector (default: from DEST_CHAIN config)
/// OUTBOUND_CCVS - comma-separated address list: base CCVs for outbound messages
/// THRESHOLD_OUTBOUND_CCVS - comma-separated address list: extra outbound CCVs at/above the threshold
/// INBOUND_CCVS - comma-separated address list: base CCVs for inbound messages
Expand Down Expand Up @@ -130,9 +134,16 @@ contract UpdateCCVConfig is EoaExecutor, LanePolicySource {
_header(chainName, tokenPoolAddress, hooksAddress, hooksOwner, destChainName, haveLane);

// ── Read current on-chain state (RMW baseline) ─────────────────────
uint64 destChainSelector = haveLane
? helperConfig.getNetworkConfig(helperConfig.parseChainName(destChainName)).chainSelector
: uint64(0);
uint64 destChainSelector;
if (haveLane) {
HelperConfig.NetworkConfig memory destConfig = helperConfig.getDestChainConfig(destChainName);
destChainSelector = uint64(vm.envOr("DEST_CHAIN_SELECTOR", uint256(destConfig.chainSelector)));
require(
destChainSelector != 0, "Chain selector is not defined for destination chain. Set DEST_CHAIN_SELECTOR."
);
} else {
destChainSelector = uint64(0);
}
AdvancedPoolHooks.CCVConfig memory currentConfig =
haveLane ? AdvancedPoolHooks(hooksAddress).getCCVConfig(destChainSelector) : _emptyConfig();
uint256 currentThreshold = AdvancedPoolHooks(hooksAddress).getThresholdAmount();
Expand Down
18 changes: 13 additions & 5 deletions script/configure/fee-config/GetTokenTransferFeeConfig.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ import {IPoolV2} from "@chainlink/contracts-ccip/contracts/interfaces/IPoolV2.so
/// If the pool does not support this function, the script will revert with an informative message.
///
/// Environment Variables (required):
/// DEST_CHAIN - The remote destination chain whose fee config is being queried (e.g. MANTLE_SEPOLIA)
/// DEST_CHAIN - The remote destination chain whose fee config is being queried
/// (e.g. MANTLE_SEPOLIA, SOLANA_DEVNET, APTOS_TESTNET)
///
/// Environment Variables (optional):
/// DEST_CHAIN_FAMILY - Override destination family (default: from DEST_CHAIN config)
/// DEST_CHAIN_SELECTOR - Override destination selector (default: from DEST_CHAIN config)
///
/// Usage example:
/// DEST_CHAIN=MANTLE_SEPOLIA \
Expand All @@ -26,12 +31,15 @@ contract GetTokenTransferFeeConfig is Script {
// ── Required env vars ──────────────────────────────────────────────
string memory destChainName = vm.envString("DEST_CHAIN");

// ── Resolve chain IDs and selectors ───────────────────────────────
// ── Resolve selector from destination config (EVM and non-EVM) ─────
helperConfig = new HelperConfig();
uint256 chainId = block.chainid;
string memory chainName = helperConfig.getChainName(chainId);
uint256 destChainId = helperConfig.parseChainName(destChainName);
uint64 destChainSelector = helperConfig.getNetworkConfig(destChainId).chainSelector;
HelperConfig.NetworkConfig memory destConfig = helperConfig.getDestChainConfig(destChainName);
uint64 destChainSelector = uint64(vm.envOr("DEST_CHAIN_SELECTOR", uint256(destConfig.chainSelector)));
require(destChainSelector != 0, "Chain selector is not defined for destination chain. Set DEST_CHAIN_SELECTOR.");
string memory destChainDisplayName =
bytes(destConfig.chainName).length > 0 ? destConfig.chainName : destChainName;

// ── Resolve pool address ───────────────────────────────────────────
address tokenPoolAddress = helperConfig.getDeployedTokenPool(chainId);
Expand All @@ -50,7 +58,7 @@ contract GetTokenTransferFeeConfig is Script {
console.log(unicode"💰 Get Token Transfer Fee Config");
console.log("========================================");
console.log(string.concat("Chain: ", chainName));
console.log(string.concat("Remote Chain: ", helperConfig.getChainName(destChainId)));
console.log(string.concat("Remote Chain: ", destChainDisplayName));
console.log(string.concat("Token Pool: ", vm.toString(tokenPoolAddress)));
console.log(string.concat("Action: ", "View fee config"));
console.log("========================================");
Expand Down
Loading
Loading