-
Notifications
You must be signed in to change notification settings - Fork 141
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
fix: rewrite Upgrade Token page #915
Closed
+67
−119
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/pages/dev/send-tokens/interchain-tokens/upgrade-token.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Upgrade existing tokens into Interchain Token(s) | ||
|
||
import { Callout } from "/src/components/callout"; | ||
|
||
<Callout emoji="⭐"> | ||
The [Token Whitelisting for Squid Router | ||
form](https://github.com/axelarnetwork/axelar-configs/blob/main/cli/wizard/commands/list-squid-token/README.md) is now live! Download | ||
the [`axelar-configs`](https://github.com/axelarnetwork/axelar-configs) repo, install dependencies, and `npm run wizard` on the command line to | ||
access the interactive form through the wizard. | ||
</Callout> | ||
|
||
There are two ways upgrade an existing ERC-20 token into an Interchain Token, depending on your situation: | ||
|
||
1. If your token only exists on one chain and you want to make it available on multiple chains as an Interchain Token, you can turn it into a [canonical token](/dev/send-tokens/interchain-tokens/upgrade-token#make-an-existing-token-into-a-canonical-interchain-token). | ||
1. If your token exists on multiple chains, and you want to [link them all into one Interchain Token](/dev/send-tokens/interchain-tokens/upgrade-token#link-tokens-on-multiple-chains-into-one-interchain-token), you can use a [custom token integration](/dev/send-tokens/interchain-tokens/upgrade-token#option-1-use-a-custom-token-integration) and [deploy a token manager](/dev/send-tokens/interchain-tokens/upgrade-token#option-2-deploy-a-token-manager) that does the linking for you. | ||
|
||
<Callout emoji="🚨"> | ||
**NOTE:** The security of your token is limited to the security of the chains | ||
it integrates with. Since blockchains can have different security practices, | ||
we recommend doing due diligence on all chains your token will be deployed to. | ||
</Callout> | ||
|
||
## Contract addresses | ||
|
||
- Interchain Token Service: [`0xB5FB4BE02232B1bBA4dC8f81dc24C26980dE9e3C`](https://etherscan.io/address/0xB5FB4BE02232B1bBA4dC8f81dc24C26980dE9e3C) | ||
- Interchain Token Factory: [`0x83a93500d23Fbc3e82B410aD07A6a9F7A0670D66`](https://etherscan.io/address/0x83a93500d23Fbc3e82B410aD07A6a9F7A0670D66) | ||
|
||
## Make an existing token into a canonical Interchain Token | ||
|
||
If you have an ERC-20 token on a single chain and want a wrapped, bridgeable version on other chains, register and deploy it as a canonical token via the Interchain Token Service using Interchain Token Factory. Each token can only be registered a single time as a canonical chain. | ||
|
||
### Register your token as a canonical Interchain Token | ||
|
||
Register your token as a canonical token by calling [`registerCanonicalInterchainToken()`](https://github.com/axelarnetwork/interchain-token-service/blob/9edc4318ac1c17231e65886eea72c0f55469d7e5/contracts/InterchainTokenFactory.sol#L240) on the `InterchainTokenFactory` contract. This will deploy a Lock/Release token manager on the source chain. | ||
|
||
### Deploy your new remote canonical Interchain Token | ||
|
||
1. Call the [`deployRemoteCanonicalInterchainToken()`](https://github.com/axelarnetwork/interchain-token-service/blob/9edc4318ac1c17231e65886eea72c0f55469d7e5/contracts/InterchainTokenFactory.sol#L257) method on the `InterchainTokenFactory` contract for each destination chain to deploy a remote canonical Interchain Token for a pre-existing token. This will create and register a Mint/Burn token manager for each token on each destination chain. These tokens do not depend on a deployer address or salt. | ||
1. Call the `approve()` method on your token to approve the Interchain Token Service to spend tokens. Specify the Interchain Token Service address and the amount to be approved. | ||
1. Call the [`interchainTransfer()`](https://github.com/axelarnetwork/interchain-token-service/blob/9223108211b977d9138fdd67d5b4a641fc35c18c/contracts/interfaces/IInterchainTokenService.sol#L210) method to begin transferring Interchain Tokens between chains. | ||
|
||
If you need to pre-mint a supply of tokens, you must also give ERC-20 approval to the `InterchainTokenFactory` contract. When tokens are moved from the origin chain to another chain, the token will be locked on the origin chain and minted on the destination chain. If you moved tokens directly from one non-origin chain to another, the token would be burned on the source chain and minted on the destination chain. | ||
|
||
### Tutorial | ||
|
||
For detailed steps on deploying a canonical Interchain Token and transferring it between chains, check out the [Programmatically Create a Canonical Interchain Token Using the Interchain Token Service](/dev/send-tokens/interchain-tokens/developer-guides/programmatically-create-a-canonical-token) tutorial. | ||
|
||
## Link tokens on multiple chains into one Interchain Token | ||
|
||
To link tokens on multiple chains into one Interchain Token, you should already have a [custom token](/dev/send-tokens/glossary#custom-token) deployed on multiple chains, or have existing versions of an ERC-20 token on multiple chains. | ||
|
||
If you want to build your token with the `IInterchainToken` feature yourself, make sure your token implements the [`IInterchainTokenStandard`](https://github.com/axelarnetwork/interchain-token-service/blob/main/contracts/interfaces/IInterchainTokenStandard.sol) interface so you can offer [`interchainTransfer()`](https://github.com/axelarnetwork/interchain-token-service/blob/a2dfcb2490497e627b66be789d944ec3260c5eea/contracts/interfaces/IInterchainTokenStandard.sol#L20) and [`interchainTransferFrom()`](https://github.com/axelarnetwork/interchain-token-service/blob/a2dfcb2490497e627b66be789d944ec3260c5eea/contracts/interfaces/IInterchainTokenStandard.sol#L37) methods directly on the token. | ||
|
||
1. Call [`deployTokenManager()`](https://github.com/axelarnetwork/interchain-token-service/blob/9edc4318ac1c17231e65886eea72c0f55469d7e5/contracts/InterchainTokenService.sol#L276) on the Interchain Token Service to deploy a token manager for the existing version of the token on all chains. | ||
* You can use the [Online Ethereum ABI Encoder](https://adibas03.github.io/online-ethereum-abi-encoder-decoder/#/encode) to create the `params` for initializing the token manager. The token manager operator will be of type `bytes`, and the token address will be an `address`. | ||
* You can specify at most one chain (likely the primary or origin) to have a Lock/Unlock token manager. The rest must be Mint/Burn. | ||
1. Call [`interchainTransfer()`](https://github.com/axelarnetwork/interchain-token-service/blob/9223108211b977d9138fdd67d5b4a641fc35c18c/contracts/interfaces/IInterchainTokenService.sol#L210) to transfer Interchain Tokens between chains. | ||
|
||
## What’s next | ||
|
||
For further examples utilizing the Interchain Token Service, take a look at the [`axelar-examples`](https://github.com/axelarnetwork/axelar-examples/tree/main/examples/evm) repo on GitHub. |
118 changes: 0 additions & 118 deletions
118
src/pages/dev/send-tokens/interchain-tokens/upgrade-tokens.mdx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the info about specifying token manager type can go under the step for calling
deployTokenManager()
for this doc. What do you think?