Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supported tokens #11

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ dist/
.envrc
.env
coverage
coverage-summary.txt
81 changes: 80 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ in supported blockchains, through its publicly accessible data and methods.
> This tool is provided under an MIT license and is for convenience and illustration purposes only.

## Development

In order to run commands/test from this repo, do the following:

```sh
Expand All @@ -26,6 +27,7 @@ npx path/to/repo/ccip-tools-ts --help # or pointing to folder directly
> In dev context below, we'll call `$cli="./src/index.ts"`

## RPCs

All commands require a list of RPCs endpoints for the networks of interest (source and destination).
Both `http[s]` and `ws[s]` (websocket) URLs are supported.

Expand All @@ -38,6 +40,7 @@ arrays should work out of the box.
Once the list is gathered, we connect to all RPCs and use the fastest to reply for each network.

## Wallet

Commands which need to send transactions try to get its private key from a `USER_KEY` environment
variable.

Expand Down Expand Up @@ -98,6 +101,7 @@ $cli send 11155111 0x0BF3dE8c5D3e8A2B34D2BEeB17ABfCeBaf363A59 ethereum-testnet-s
```

Sends a message from router on source network, to dest; positional parameters are:

1. `source`: chainId or name
2. `router`: address on source
3. `dest`: chainId or name
Expand All @@ -118,7 +122,7 @@ If `--fee-token` is omitted, CCIP fee will be paid in native token.
separated by spaces, terminated with `--` if needed). `amount` will be converted using token
decimals (e.g. 0.1 = 10^5 of the smallest unit for USDC, which is 6 decimals).

`--allow-out-of-order-exec` is only available on v1.5+ lanes, and opt-out of *sender* `nonce` order
`--allow-out-of-order-exec` is only available on v1.5+ lanes, and opt-out of _sender_ `nonce` order
enforcement. It's useful for destinations where execution can't be guaranteed (e.g. zkOverflow).

### `estimateGas`
Expand Down Expand Up @@ -166,3 +170,78 @@ If 3rd argument is omitted, 2nd argument (address) should be an OnRamp address.

Also, performs some validations and warns in case of some mistmatches, e.g. OnRamp is not
registered in Router.

### `getSupportedTokens`

```sh
$cli getSupportedTokens <source> <router> <dest>
```

Discovers and validates tokens that can be transferred between chains using CCIP. The command performs a comprehensive analysis of cross-chain token support.

#### Parameters

- `source`: Source chain ID or name (e.g., `ethereum-mainnet`, `1`)
- `router`: CCIP Router contract address on source chain
- `dest`: Destination chain ID or name (e.g., `polygon-mainnet`, `137`)

#### Features

- Automatic pool version detection
- Custom pool support with fallback to latest ABI
- Rate limiter configuration validation
- Parallel processing with configurable batch sizes
- Comprehensive error collection

#### Example

```sh
# Check tokens supported for transfer from Ethereum to Polygon
$cli getSupportedTokens ethereum-mainnet 0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D polygon-mainnet --format pretty
```

#### Output Format Options

- `--format pretty` (default): Human-readable output
- `--format json`: Machine-readable JSON
- `--format log`: Basic console logging

#### Sample Output

```
=== Summary ===
Timestamp: 2025-01-13T16:30:51.983Z

Source:
Chain: ethereum-mainnet (1)
Router: 0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D

Destination:
Chain: polygon-mainnet (137)

Stats:
Total Scanned: 83
Supported: 20
Failed: 0

=== Supported Tokens ===
[INFO] Token: TEST (TEST) at 0xB006...33CC, decimals=18
Pool: 0x5504...d451 (BurnMintTokenPool v1.5.0)
Remote Token: 0x18a4...044a
Remote Pools: 0xa0c3...1fc6
Rate Limiters:
Outbound:
Enabled: true
Tokens: 100000000000000000000000
Capacity: 100000000000000000000000
Rate: 167000000000000000000
Inbound:
Enabled: true
Tokens: 100000000000000000000000
Capacity: 100000000000000000000000
Rate: 167000000000000000000
...
```

> [!NOTE]
> The command requires access to both source and destination chain RPCs. Configure RPCs using the global options described in the [RPCs section](#rpcs).
2 changes: 1 addition & 1 deletion src/abi/BurnMintERC677Token.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default [
// generate:
// fetch('https://github.com/smartcontractkit/ccip/raw/release/2.14.0-ccip1.5/core/gethwrappers/generated/burn_mint_erc677/burn_mint_erc677.go')
// fetch('https://github.com/smartcontractkit/ccip/raw/release/contracts-ccip-1.5.1/core/gethwrappers/generated/burn_mint_erc677/burn_mint_erc677.go')
// .then((res) => res.text())
// .then((body) => body.match(/^\s*ABI: "(.*?)",$/m)?.[1])
// .then((abi) => JSON.parse(abi.replace(/\\"/g, '"')))
Expand Down
Loading
Loading