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
HubToken
on the main chain (Hub chain). - Deploy
PeerToken
on each spoke chain. - Configure the minter address in each
PeerToken
to control minting permissions.
- Deploy
PeerToken
contracts on all participating chains. - Configure the minter address in each
PeerToken
to 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 --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_URL
For 1000 tokens with 18 decimals, use AMOUNT_IN_WEI = 1000000000000000000000