From 7313969118651f1925b9604b5256ee5fc749eed1 Mon Sep 17 00:00:00 2001 From: Martin Hofmann Date: Mon, 23 Dec 2024 16:54:19 +0100 Subject: [PATCH 1/2] Added hub and spoke description (#172) * Added hub and spoke description and passed grammarly check * add note for required steps * Add hub and spoke details for solana deployment * grammarly check and reorg * updated spoke information * added link to deployment models page * rephrased sentence * detailed description * update note * Update build/contract-integrations/native-token-transfers/deployment-process/deploy-to-evm.md Co-authored-by: Dawn Kelly <83190195+dawnkelly09@users.noreply.github.com> * Update build/contract-integrations/native-token-transfers/deployment-process/deploy-to-solana.md Co-authored-by: Dawn Kelly <83190195+dawnkelly09@users.noreply.github.com> * Update build/contract-integrations/native-token-transfers/deployment-process/deploy-to-evm.md Co-authored-by: Erin Shaben --------- Co-authored-by: Dawn Kelly <83190195+dawnkelly09@users.noreply.github.com> Co-authored-by: Ilaria <43253244+ilariae@users.noreply.github.com> Co-authored-by: Erin Shaben --- .../deployment-process/deploy-to-evm.md | 29 ++++++++++++++++++- .../deployment-process/deploy-to-solana.md | 22 ++++++++++---- 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/build/contract-integrations/native-token-transfers/deployment-process/deploy-to-evm.md b/build/contract-integrations/native-token-transfers/deployment-process/deploy-to-evm.md index 6e02f07a..125e75b3 100644 --- a/build/contract-integrations/native-token-transfers/deployment-process/deploy-to-evm.md +++ b/build/contract-integrations/native-token-transfers/deployment-process/deploy-to-evm.md @@ -9,6 +9,12 @@ description: Deploy and configure Wormhole’s Native Token Transfers (NTT) for If you still need to do so, deploy the token contract to the destination or spoke chains. +### Requirements for Token Deployment + +Wormhole’s NTT is an open framework that supports various deployment modes. The NTT CLI currently supports two deployment modes: burn-and-mint and hub-and-spoke. These modes differ in how tokens are managed across chains. + +#### Burn-and-Mint Mode + Tokens integrated with `NttManager` in `burning` mode require the following two functions to be present: - `burn(uint256 amount)` @@ -23,6 +29,27 @@ These functions aren't part of the standard ERC-20 interface. The [`INttToken` i Later, you set mint authority to the corresponding `NttManager` contract. You can also follow the scripts in the [example NTT token](https://github.com/wormhole-foundation/example-ntt-token){target=\_blank} repository to deploy a token contract. +#### Hub-and-Spoke Mode + +A central hub chain (e.g., Ethereum) manages the total token supply in hub-and-spoke mode. Other chains (spokes) mint or burn tokens during cross-chain transfers, ensuring consistency with the locked tokens on the hub chain. + + - **Hub chain** - tokens are locked on the hub chain when transferring to spoke chains + - **Spoke chains** - tokens are native to the spoke chains and are either minted or burned during cross-chain transfers + +!!! note + The only requirement for using the NTT framework is an ERC20 token, which can be newly deployed or existing. Steps like setting mint authority apply only to spoke chains. + +For example, when transferring tokens from Ethereum (hub) to Polygon (spoke), the NTT Manager locks tokens on Ethereum, and the corresponding amount is minted on Polygon. Similarly, transferring tokens back from Polygon to Ethereum burns the tokens on Polygon and unlocks the equivalent tokens on Ethereum. + +This process ensures that the total token supply remains consistent across all chains, with the hub chain acting as the source of truth. + +For more detailed information, see the [Deployment Models](/docs/learn/messaging/native-token-transfers/deployment/){target=\_blank} page. + +### Key Differences Between Modes + + - **Burn-and-mint** - tokens must implement custom `mint` and `burn` functions, allowing each chain to manage token issuance independently + - **Hub-and-spoke** - tokens only need to be ERC20 compliant, with the hub chain acting as the source of truth for supply consistency + ## Deploy NTT Create a new NTT project: @@ -32,7 +59,7 @@ ntt new my-ntt-deployment cd my-ntt-deployment ``` -Initialize a new `deployment.json` file, specifying the network: +Initialize a new `deployment.json` file specifying the network: === "Testnet" diff --git a/build/contract-integrations/native-token-transfers/deployment-process/deploy-to-solana.md b/build/contract-integrations/native-token-transfers/deployment-process/deploy-to-solana.md index 40434275..46512eb3 100644 --- a/build/contract-integrations/native-token-transfers/deployment-process/deploy-to-solana.md +++ b/build/contract-integrations/native-token-transfers/deployment-process/deploy-to-solana.md @@ -25,7 +25,7 @@ ntt new my-ntt-deployment cd my-ntt-deployment ``` -Initialize a new `deployment.json` file, specifying the network: +Initialize a new `deployment.json` file specifying the network: === "Testnet" @@ -48,7 +48,7 @@ Initialize a new `deployment.json` file, specifying the network: solana-keygen grind --starts-with w:1 --ignore-case ``` - 2. Set Solana configuration to use the new key pair create in step 1: + 2. Set Solana configuration to use the new key pair created in step 1: ```bash solana config set --keypair INSERT_PATH_TO_KEYPAIR_JSON ``` @@ -83,11 +83,21 @@ Initialize a new `deployment.json` file, specifying the network: spl-token mint INSERT_TOKEN_ADDRESS 1000 ``` - - !!! note NTT versions `>=v2.0.0+solana` support SPL tokens with transfer hooks. +### Hub Chain Requirements + +For hub chain deployments on Solana, the token can be either an SPL or Token2022. Hub chain tokens do not require additional configuration, such as setting the mint authority. + +For more detailed information, see the [Deployment Models](/docs/learn/messaging/native-token-transfers/deployment/){target=\_blank} page. + +### Burning Mode Requirements + +In burning mode, tokens require their mint authority to be assigned to the NTT program. This allows the NTT Manager to mint and burn tokens as needed during cross-chain transfers. + +All necessary steps for configuring burning mode, including mint authority setup, are explained in the sections below. + ## Configuration and Deployment ### Generate NTT Program Key Pair @@ -140,7 +150,7 @@ The NTT Solana program will then compile and deploy, returning the program ID. The NTT CLI takes inspiration from [git](https://git-scm.com/){target=\_blank}. You can run: - `ntt status` - checks whether your `deployment.json` file is consistent with what is on-chain -- `ntt pull` - syncs your `deployment.json` file with the on-chain configuration and set up rate limits with the appropriate number of decimals, depending on the specific chain. For example: +- `ntt pull` - syncs your `deployment.json` file with the on-chain configuration and sets up rate limits with the appropriate number of decimals, depending on the specific chain. For example: For Solana, the limits are set with 9 decimal places: ```json @@ -156,7 +166,7 @@ The NTT CLI takes inspiration from [git](https://git-scm.com/){target=\_blank}. } ``` - This initial configuration ensures that the rate limits are correctly represented for each chain's token precision + This initial configuration ensures that the rate limits are correctly represented for each chain's token precision. ### Deploy NTT to Solana From b2df66269e6cad7b6dc65a54ee522aeed9da08a5 Mon Sep 17 00:00:00 2001 From: Martin Hofmann Date: Mon, 23 Dec 2024 16:57:53 +0100 Subject: [PATCH 2/2] Martinh/ntt cli commands (#171) * created ntt cli commands page * created cli page and checked with grammarly * Update build/contract-integrations/native-token-transfers/cli-commands.md --------- Co-authored-by: Erin Shaben Co-authored-by: Ilaria <43253244+ilariae@users.noreply.github.com> --- .../native-token-transfers/.pages | 1 + .../native-token-transfers/cli-commands.md | 47 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 build/contract-integrations/native-token-transfers/cli-commands.md diff --git a/build/contract-integrations/native-token-transfers/.pages b/build/contract-integrations/native-token-transfers/.pages index f8915e43..a3f09de7 100644 --- a/build/contract-integrations/native-token-transfers/.pages +++ b/build/contract-integrations/native-token-transfers/.pages @@ -2,6 +2,7 @@ title: Native Token Transfers nav: - index.md - deployment-process + - 'NTT CLI Commands': 'cli-commands.md' - configuration - 'Managers and Transceivers': 'managers-transceivers.md' - 'FAQS': faqs.md \ No newline at end of file diff --git a/build/contract-integrations/native-token-transfers/cli-commands.md b/build/contract-integrations/native-token-transfers/cli-commands.md new file mode 100644 index 00000000..b85cc5dc --- /dev/null +++ b/build/contract-integrations/native-token-transfers/cli-commands.md @@ -0,0 +1,47 @@ +--- +title: NTT CLI Commands +description: A comprehensive guide to the Native Token Transfers (NTT) CLI, detailing commands for managing token transfers across chains within the Wormhole ecosystem. +--- + +# NTT CLI Commands + +## Introduction + +The NTT Command-Line Interface (CLI) is a powerful tool for managing native token transfers across multiple blockchain networks within the Wormhole ecosystem. This page provides a comprehensive list of available commands, their descriptions, and examples to help you interact with and configure the NTT system effectively. Whether initializing deployments, updating configurations, or working with specific chains, the NTT CLI simplifies these operations through its intuitive commands. + +## Table of Commands + +The following table lists the available NTT CLI commands, descriptions, and examples. + +!!! note + To explore detailed information about any NTT CLI command, including its options and examples, you can append `--help` to the command. This will display a comprehensive guide for the specific command. + +### General Commands + +| Command | Description | Examples | +|-----------------------------------------|-------------------------------------------------------|--------------------------| +| `ntt update` | update the NTT CLI | `ntt update` | +| `ntt new ` | create a new NTT project | `ntt new my-ntt-project` | +| `ntt add-chain ` | add a chain to the deployment file | `ntt add-chain Ethereum --token 0x1234... --mode burning --latest`| +| `ntt upgrade ` | upgrade the contract on a specific chain | `ntt upgrade Solana --ver 1.1.0`| +| `ntt clone
` | initialize a deployment file from an existing contract| `ntt clone Mainnet Solana Sol5678...`| +| `ntt init ` | initialize a deployment file | `ntt init devnet` | +| `ntt pull` | pull the remote configuration | `ntt pull` | +| `ntt push` | push the local configuration | `ntt push` | +| `ntt status` | check the status of the deployment | `ntt status` | + +### Configuration Commands + +| Command | Description | Examples | +|---------------------------------------------|----------------------------------------|-------------------------------------| +| `ntt config set-chain `| set a configuration value for a chain | `ntt config set-chain Ethereum scan_api_key`| +| `ntt config unset-chain ` | unset a configuration value for a chain| `ntt config unset-chain Ethereum scan_api_key`| +| `ntt config get-chain ` | get a configuration value for a chain | `ntt config get-chain Ethereum scan_api_key`| + +### Solana Commands + +| Command | Description | Examples | +|-----------------------------------------------|---------------------------------------------------------|------------------| +| `ntt solana key-base58 ` | print private key in base58 | `ntt solana key-base58 /path/to/keypair.json`| +| `ntt solana token-authority ` | print the token authority address for a given program ID| `ntt solana token-authority Sol1234...`| +| `ntt solana ata `| print the token authority address for a given program ID| `ntt solana ata Mint123... Owner123... token22`|