Skip to content

Commit

Permalink
feat: add squid whitelisting announcement for ITS (#757)
Browse files Browse the repository at this point in the history
  • Loading branch information
Olanetsoft committed Feb 5, 2024
1 parent eb3bcd2 commit 394dce2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 17 deletions.
31 changes: 22 additions & 9 deletions src/pages/dev/send-tokens/interchain-tokens/create-token.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Create a New Interchain Token

<Callout emoji="">
The [Token Whitelisting for Squid Router
form](https://github.com/axelarnetwork/axelar-configs) is now live! Download
the repo, install dependencies, and `npm run wizard` on the command line to
access the interactive form through the wizard.
</Callout>

import { Callout } from "/src/components/callout";

Interchain tokens are ERC-20 tokens that are available on [multiple blockchains](https://docs.axelar.dev/resources/testnet). They are created using the [Interchain Token Service](https://github.com/axelarnetwork/interchain-token-service/blob/main/contracts/InterchainTokenService.sol) and can be used to transfer value between blockchains.
Expand All @@ -9,7 +16,9 @@ The Interchain Token Service is deployed to [`0xB5FB4BE02232B1bBA4dC8f81dc24C269
You can create a new Interchain Token through the [Interchain Portal](https://testnet.interchain.axelar.dev/), or by building a custom ERC-20 token and deploying it with a Mint/Burn token manager on all chains. These tokens will be accessible on multiple chains, allowing for seamless interaction on each chain by utilizing familiar methods such as send, transfer, and approve -- just as with any standard ERC-20 token.

<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.
**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>

## Create a new Interchain Token using the Interchain Token Portal
Expand All @@ -21,19 +30,23 @@ The simplest way to create an Interchain Token is to do so through the portal:
3. Select a source network where you have funds available.
4. Select the option to deploy a new Interchain token.
5. Add the required details for your new token:
- Name
- Symbol
- Decimals
- Amount to mint
- You can also choose the advanced option where you can add an account as `Token Minter` and `Salt` value. Otherwise, these fields will be prefilled with the deployer (connected account) address and a random, uniquely generated salt value.
- Name
- Symbol
- Decimals
- Amount to mint
- You can also choose the advanced option where you can add an account as `Token Minter` and `Salt` value. Otherwise, these fields will be prefilled with the deployer (connected account) address and a random, uniquely generated salt value.
6. Select additional chains for your token's availability. You can optionally add the token amount to mint on each selected chain.

Congratulations! Your new Interchain Token is now available on multiple chains. Furthermore, it follows the [Interchain Token Standard](https://github.com/axelarnetwork/interchain-token-service/blob/main/contracts/interfaces/IInterchainTokenStandard.sol), meaning that users can call the [`interchainTransfer()`](https://github.com/axelarnetwork/interchain-token-service/blob/9223108211b977d9138fdd67d5b4a641fc35c18c/contracts/interfaces/IInterchainTokenService.sol#L210) method on the token itself to transfer between blockchains.

Refer to the [four-step tutorial](https://axelar.network/blog/how-to-create-an-interchain-token-with-axelar-in-4-steps) for more detailed steps on creating Interchain Tokens using the Interchain Token Portal.

<Callout emoji="💡">
Make sure you consider all relevant stakeholders before deploying a token through ITS. Creating a simple token using the ITS Portal will give the token the same name and symbol on all chains. If you need your token to have different names or symbols on different chains, you’ll have to build a custom token.
Make sure you consider all relevant stakeholders before deploying a token
through ITS. Creating a simple token using the ITS Portal will give the token
the same name and symbol on all chains. If you need your token to have
different names or symbols on different chains, you’ll have to build a custom
token.
</Callout>

## Create a custom Interchain Token
Expand All @@ -45,7 +58,7 @@ To create a custom Interchain Token:
1. Build your [ERC-20](https://docs.alchemy.com/docs/how-to-create-an-erc-20-token-4-steps) token and deploy it on multiple chains.
2. Deploy a [Mint/Burn](../../reference/glossary/#mintburn) - [Token Manager](../../reference/glossary/#token-manager) for existing tokens on all chains using the [`deployTokenManager()`](https://github.com/axelarnetwork/interchain-token-service/blob/9edc4318ac1c17231e65886eea72c0f55469d7e5/contracts/InterchainTokenService.sol#L276) method on the Interchain Token Service specifying parameters like `salt`, `destinationChain`, [`tokenManagerType`](https://github.com/axelarnetwork/interchain-token-service/blob/main/contracts/interfaces/ITokenManagerType.sol), `params`, and `gasValue`.
3. Ensure that the Interchain Token Service can invoke the `Mint/Burn` functions on the token by calling [`transferMintership()`](https://github.com/axelarnetwork/interchain-token-service/blob/9223108211b977d9138fdd67d5b4a641fc35c18c/contracts/utils/Minter.sol#L31) on your token. This will transfer the minter role to the ITS on all chains, enabling it to mint or burn tokens.
* Repeat this step on all other chains where the token exists, using the same deployer address and salt.
- Repeat this step on all other chains where the token exists, using the same deployer address and salt.
4. Transfer Interchain Tokens between chains via the Interchain Token Service by calling [`interchainTransfer()`](https://github.com/axelarnetwork/interchain-token-service/blob/9223108211b977d9138fdd67d5b4a641fc35c18c/contracts/interfaces/IInterchainTokenService.sol#L210).

```solidity
Expand All @@ -66,7 +79,7 @@ function deployTokenManager(
TokenManagerType tokenManagerType,
bytes calldata params,
uint256 gasValue
) external payable
) external payable
```

To create the `params` that will be used to initialize the Token Manager in the `deployTokenManager` method above, you can use the [Online Ethereum ABI Encoder](https://adibas03.github.io/online-ethereum-abi-encoder-decoder/#/encode) specifying the operator of the Token Manager and the token address with the argument type `bytes` and `address` respectively.
Expand Down
25 changes: 17 additions & 8 deletions src/pages/dev/send-tokens/interchain-tokens/upgrade-tokens.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,23 @@

import { Callout } from "/src/components/callout";

<Callout emoji="">
The [Token Whitelisting for Squid Router
form](https://github.com/axelarnetwork/axelar-configs) is now live! Download
the repo, install dependencies, and `npm run wizard` on the command line to
access the interactive form through the wizard.
</Callout>

If you already have an ERC-20 token on one or more blockchains, you can turn it into an Interchain Token by deploying [Token Managers](../../reference/glossary/#token-manager). Token Managers can be either [Lock/Release](../../reference/glossary/#lockunlock) or [Mint/Burn](../../reference/glossary/#mintburn). Canonical tokens are registered under the local chain's Lock/Release token manager and mint/burn on remote chains. They can be deployed to remote chains by anyone and don't depend on a deployer address/salt.

The Interchain Token Service is deployed to [`0xB5FB4BE02232B1bBA4dC8f81dc24C26980dE9e3C`](https://etherscan.io/address/0xB5FB4BE02232B1bBA4dC8f81dc24C26980dE9e3C) while the Interchain Token Factory is deployed to [`0x83a93500d23Fbc3e82B410aD07A6a9F7A0670D66`](https://etherscan.io/address/0x83a93500d23Fbc3e82B410aD07A6a9F7A0670D66).

Now, let's explore how to transform existing tokens into Interchain Tokens.

<Callout emoji="🚨">
**NOTE:** The security of your token is limited to the security of the chains it integrates with. When making a token interchain, make sure that all the chains it will be deployed to are trustworthy.
**NOTE:** The security of your token is limited to the security of the chains
it integrates with. When making a token interchain, make sure that all the
chains it will be deployed to are trustworthy.
</Callout>

## Canonical Tokens (Simple wrappers)
Expand All @@ -18,11 +27,11 @@ If you own an ERC-20 token on a single chain and want a wrapped, bridgeable vers

Want to try this out? [Use Remix to create your own ERC-20](https://remix.ethereum.org/axelarnetwork/axelar-docs/blob/main/public/samples/interchain-token-simple.sol) and register your token on the [Interchain Token Portal](https://testnet.interchain.axelar.dev).

You can also do this directly via the `InterchainTokenService.sol` using `InterchainTokenFactory.sol` to register canonical tokens and deploy remote canonical tokens.
You can also do this directly via the `InterchainTokenService.sol` using `InterchainTokenFactory.sol` to register canonical tokens and deploy remote canonical tokens.

Follow these steps to register your token as a canonical token:

- Register your token as a canonical token using the [`registerCanonicalInterchainToken`](https://github.com/axelarnetwork/interchain-token-service/blob/9edc4318ac1c17231e65886eea72c0f55469d7e5/contracts/InterchainTokenFactory.sol#L240) method on the `InterchainTokenFactory.sol`. This will deploy a [Lock/Release](../../reference/glossary/#lockunlock) - [Token Manager](../../reference/glossary/#token-manager) on the source chain
- Register your token as a canonical token using the [`registerCanonicalInterchainToken`](https://github.com/axelarnetwork/interchain-token-service/blob/9edc4318ac1c17231e65886eea72c0f55469d7e5/contracts/InterchainTokenFactory.sol#L240) method on the `InterchainTokenFactory.sol`. This will deploy a [Lock/Release](../../reference/glossary/#lockunlock) - [Token Manager](../../reference/glossary/#token-manager) on the source chain

Here is an example of registering a canonical token:

Expand All @@ -34,6 +43,7 @@ Here is an example of registering a canonical token:
*/
function registerCanonicalInterchainToken(address tokenAddress) external payable returns (bytes32 tokenId)
```

- Deploy a remote canonical interchain token for a pre-existing token on remote chains using the [`deployRemoteCanonicalInterchainToken`](https://github.com/axelarnetwork/interchain-token-service/blob/9edc4318ac1c17231e65886eea72c0f55469d7e5/contracts/InterchainTokenFactory.sol#L257) method on the `InterchainTokenFactory` for each destination chain. This will create the token on each destination chain and its registered under [Mint/Burn](../../reference/glossary/#mintburn) - [Token Manager](../../reference/glossary/#token-manager). They can be deployed to remote chains by anyone and don't depend on a deployer address/salt

Here is an example of deploying a remote canonical token:
Expand All @@ -54,12 +64,11 @@ function deployRemoteCanonicalInterchainToken(
uint256 gasValue
) external payable returns (bytes32 tokenId)
```
- Approve the Interchain Token Service to spend tokens by calling the `approve` method on your token, specifying the Interchain Token Service address and the amount to be approved. Then, proceed to transfer Interchain Tokens between chains via the Interchain Token Service by calling the [`interchainTransfer`](https://github.com/axelarnetwork/interchain-token-service/blob/9223108211b977d9138fdd67d5b4a641fc35c18c/contracts/interfaces/IInterchainTokenService.sol#L210) method

- Approve the Interchain Token Service to spend tokens by calling the `approve` method on your token, specifying the Interchain Token Service address and the amount to be approved. Then, proceed to transfer Interchain Tokens between chains via the Interchain Token Service by calling the [`interchainTransfer`](https://github.com/axelarnetwork/interchain-token-service/blob/9223108211b977d9138fdd67d5b4a641fc35c18c/contracts/interfaces/IInterchainTokenService.sol#L210) method

If pre-mint is needed, you must make ERC20 approval to the Interchain Token Factory 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.


## Link deployed tokens on multiple chains into Interchain Token(s)

For custom functionality on multiple chains:
Expand All @@ -68,7 +77,6 @@ For custom functionality on multiple chains:
- Deploy a [Mint/Burn](../../reference/glossary/#mintburn) - [Token Manager](../../reference/glossary/#token-manager) for existing tokens on all chains using [`deployTokenManager`](https://github.com/axelarnetwork/interchain-token-service/blob/9edc4318ac1c17231e65886eea72c0f55469d7e5/contracts/InterchainTokenService.sol#L276) on Interchain Token Service. The `deployTokenManager` method requires parameters like `salt`, `destinationChain`, [`tokenManagerType`](https://github.com/axelarnetwork/interchain-token-service/blob/main/contracts/interfaces/ITokenManagerType.sol), `params`, and `gasValue`
- Transfer Interchain Tokens between chains via the Interchain Token Service by calling the [`interchainTransfer`](https://github.com/axelarnetwork/interchain-token-service/blob/9223108211b977d9138fdd67d5b4a641fc35c18c/contracts/interfaces/IInterchainTokenService.sol#L210)


You can optionally have any of these custom tokens extend [`IInterchainTokenStandard`](https://github.com/axelarnetwork/interchain-token-service/blob/main/contracts/interfaces/IInterchainTokenStandard.sol) to 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 your token.

> You could decide to make all of these Token Managers [Mint/Burn](../../reference/glossary/#mintburn), or you could specify at most one (likely your primary/origin chain) to be [Lock/Release](../../reference/glossary/#lockunlock) as indicated in the [`ITokenManagerType.sol`](https://github.com/axelarnetwork/interchain-token-service/blob/main/contracts/interfaces/ITokenManagerType.sol) depending on your needs.
Expand All @@ -93,11 +101,12 @@ function deployTokenManager(
TokenManagerType tokenManagerType,
bytes calldata params,
uint256 gasValue
) external payable
) external payable
```

To create the `params` that will be used to initialize the Token Manager in the `deployTokenManager` method above, you can use the [Online Ethereum ABI Encoder](https://adibas03.github.io/online-ethereum-abi-encoder-decoder/#/encode) specifying the operator of the Token Manager and the token address with the argument type `bytes` and `address` respectively.

>**Note**: 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 your token.
> **Note**: 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 your token.
## What’s next

Expand Down

0 comments on commit 394dce2

Please sign in to comment.