Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wormhole-foundation/example-ntt-token
https://github.com/wormhole-foundation/example-ntt-token
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/wormhole-foundation/example-ntt-token
- Owner: wormhole-foundation
- Created: 2024-02-19T18:35:15.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-08-28T22:20:14.000Z (4 months ago)
- Last Synced: 2024-08-28T23:32:07.883Z (4 months ago)
- Language: Solidity
- Size: 14.6 KB
- Stars: 2
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Multichain Token Contracts
This repository contains smart contracts for implementing multichain token deployments using two different models: Hub and Spoke, and Burn and Mint.
## Contracts
### HubToken
`HubToken` is designed for the Hub and Spoke model. It represents the central token on the hub chain where the total supply is maintained.
### PeerToken
`PeerToken` is a flexible contract that can be deployed as either a spoke token in the Hub and Spoke model or as a token in the Burn and Mint model.
## Read more about deployment models
[Deployment Models](https://docs.wormhole.com/wormhole/native-token-transfers/overview/deployment-models)
## Usage
### Hub and Spoke Model
1. Deploy `HubToken` on the main chain (Hub chain).
2. Deploy `PeerToken` on each spoke chain.
3. Configure the minter address in each `PeerToken` to control minting permissions.### Burn and Mint Model
1. Deploy `PeerToken` contracts on all participating chains.
2. Configure the minter address in each `PeerToken` to control minting permissions.## Deployment
To deploy these contracts, you can use Forge. Here's an example of how to deploy the PeerToken contract using forge:
[Install Foundry](https://book.getfoundry.sh/getting-started/installation)
```bash
forge create --rpc-url --private-key src/PeerToken.sol:PeerToken --constructor-args "TestBurnToken" "TBT"
```## Mint Tokens
After deployment, you can mint tokens using the cast send command from Foundry:```bash
cast send $TOKEN_ADDRESS \
"mint(address,uint256)" \
$RECIPIENT_ADDRESS \
$AMOUNT_IN_WEI \
--private-key $ETH_PRIVATE_KEY \
--rpc-url $YOUR_RPC_URL
```For 1000 tokens with 18 decimals, use AMOUNT_IN_WEI = 1000000000000000000000