This repository contains smart contracts for implementing multichain token deployments using two different models: Hub and Spoke, and Burn and Mint.
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 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.
- Deploy
HubTokenon the main chain (Hub chain). - Deploy
PeerTokenon each spoke chain. - Configure the minter address in each
PeerTokento control minting permissions.
- Deploy
PeerTokencontracts on all participating chains. - Configure the minter address in each
PeerTokento control minting permissions.
To deploy these contracts, you can use Forge. Here's an example of how to deploy the PeerToken contract using forge:
forge create --broadcast --rpc-url <SEPOLIA_RPC_URL> --private-key <PRIVATE_KEY> src/PeerToken.sol:PeerToken --constructor-args "TestBurnToken" "TBT" <MINTER_ADDRESS> <OWNER_ADDRESS>After deployment, you can mint tokens using the cast send command from Foundry:
cast send $TOKEN_ADDRESS \
"mint(address,uint256)" \
$RECIPIENT_ADDRESS \
$AMOUNT_IN_WEI \
--private-key $ETH_PRIVATE_KEY \
--rpc-url $YOUR_RPC_URLFor 1000 tokens with 18 decimals, use AMOUNT_IN_WEI = 1000000000000000000000