Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: seiyan-writer <[email protected]>
  • Loading branch information
dssei and seiyan-writer authored Sep 13, 2024
1 parent 48a91a7 commit e5649e0
Showing 1 changed file with 45 additions and 16 deletions.
61 changes: 45 additions & 16 deletions pages/dev-tutorials/tokenfactory-allow-list.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Callout } from 'nextra/components';

# Introducing Token Add-ons
# Token Allowlists

As you have learned form the [Token Factory tutorial](tokenfactory-tutorial.mdx), the `tokenfactory` module enables any account to create new tokens with a unique identifier based on the creator's address.

Expand All @@ -9,12 +9,13 @@ With the first add-on being an allow list, which restricts the transferability o

In this tutorial, we will learn how to create a token with an allow list.

## Requirements
## Prerequisites

To create a token on the devnet, ensure you have the following setup:

- The `seid` CLI
- A wallet with SEI tokens on devnet
- The `seid` CLI installed.
- A wallet with SEI tokens on devnet.
- Access to a running Sei blockchain node.

<Callout type='info'>You can obtain devnet tokens from one of the faucets listed [here](../dev-ecosystem-providers/faucets).</Callout>

Expand All @@ -33,8 +34,9 @@ The format of the allow list is as follows:
}
```

Where each address is a valid Sei bech32 address or EVM 0x prefixed address. Please note, that 0x addresses will be converted to bech32 addresses when the allow list is persisted.

> Ensure that all addresses are valid SEI (Bech32) or EVM (0x-prefixed) addresses. Note that 0x addresses will be converted to Bech32 addresses when the allow list is persisted.
> The maximum number of addresses allowed in the allow list is 2000 by default. This can be configured by the chain administrator.
2. Create a new denom with the specified allow list.
```bash
seid tx tokenfactory create-denom $SUBDENOM \
--allow-list=$ALLOW_LIST_FILE_PATH \
Expand All @@ -45,7 +47,16 @@ seid tx tokenfactory create-denom $SUBDENOM \
-y
```

This command creates a new coin with specific allow list.
For example:

```bash
seid tx tokenfactory create-denom mytoken \
--allow-list=./allow_list.json \
--from mykey \
--chain-id sei-chain \
--fees 10000usei \
--gas auto \
-y

### Understanding Command Line Arguments

Expand All @@ -61,28 +72,46 @@ Understanding these arguments will help you execute the commands more confidentl

<Callout type='info'>For detailed descriptions of these arguments, use `seid help` in the CLI.</Callout>

## Updating Token Allow List
## Updating an Existing Denom Allowlist

To update the allow list of a token, you can use the following command:

```bash copy
seid tx tokenfactory update-denom $DENOM --from=$ACCOUNT --allow-list=$ALLOW_LIST_FILE_PATH --chain-id=arctic-1 --node=https://rpc.arctic-1.seinetwork.io/ --broadcast-mode=block --fees=20000usei
```bash
seid tx tokenfactory update-denom $DENOM \
--allow-list=$ALLOW_LIST_FILE_PATH \
--from=$ACCOUNT \
--chain-id=$CHAIN_ID \
--node=$NODE_RPC_URL \
--broadcast-mode=block \
--fees=$FEE_AMOUNT \
--gas=$GAS_LIMIT \
-y
```

This command updates the allow list of a token.
For example:
```bash
seid tx tokenfactory update-denom mytoken \
--allow-list=./updated_allow_list.json \
--from mykey \
--chain-id arctic-1 \
--node https://rpc.arctic-1.seinetwork.io/ \
--broadcast-mode=block \
--fees 20000usei \
--gas auto \
-y
To allow all addresses agian to transfer the token, you can simply submit an empty allow list.
To re-enable all addresses to transfer the token, you can simply submit an empty allowlist.
## Querying Token Allow List
## Querying a Denom Allowlist
You may query the allow list of a token using the node REST endpoint. E.g.:
```bash copy
You may query the allowlist of a token using the node REST endpoint. E.g.:
```bash
curl -X 'GET' \
'https://rest-arctic-1.sei-apis.com/sei-protocol/seichain/tokenfactory/denoms/allow_list?denom=factory/{ACCOUNT}/{DENOM}' \
-H 'accept: application/json'
```


## EVM Support

To enable seamless use of this token in EVM environments, we can create a pointer contract. The process is described in [Token Factory tutorial](tokenfactory-tutorial.mdx#create-pointer-contract).
Expand Down

0 comments on commit e5649e0

Please sign in to comment.