Files
proxmox/docs/11-references/MINT_C_AND_CW_ON_ALL_NETWORKS.md

104 lines
4.6 KiB
Markdown
Raw Permalink Normal View History

# Minting c* and cW* on Chain 138 and Other Networks
**Purpose:** How to mint compliant tokens (c*) and compliant wrapped tokens (cW*) to the deployer on Chain 138 and on other networks where they are deployed.
**Deployer:** `0x4A666F96fC8764181194447A7dFdb7d471b301C8`
---
## Summary
| Token type | Chain 138 | Other networks (1, 25, 56, 137, 100, 10, 42161, 8453, 43114) |
|------------|-----------|---------------------------------------------------------------|
| **c*** (cUSDT, cUSDC, cEURC, …) | Deployer is **owner** → can mint | Deploy first with `DeployCompliantFiatTokensForChain.s.sol` (owner = deployer), then mint same as 138 |
| **cW*** (cWUSDT, cWUSDC, …) | Not deployed on 138 (cW* are on destination chains only) | Deployer is **admin** and has **MINTER_ROLE** → can mint on any chain where cW* are deployed |
---
## 1. c* on Chain 138
All 12 c* are already deployed; deployer is owner. Mint with cast or scripts.
**Script (cUSDT/cUSDC only):** `smom-dbis-138/scripts/mint-for-liquidity.sh`
**Script (all 12 c*):** `smom-dbis-138/scripts/mint-all-c-star-138.sh [amount_human]` — mints cUSDT, cUSDC, cEURC, cEURT, cGBPC, cGBPT, cAUDC, cJPYC, cCHFC, cCADC, cXAUC, cXAUT to deployer (default 1M each).
**Cast (per token):**
```bash
cd smom-dbis-138 && source .env
DEPLOYER=0x4A666F96fC8764181194447A7dFdb7d471b301C8
# 1M tokens = 1000000000000 base units (6 decimals)
cast send <CUSDT_ADDRESS> "mint(address,uint256)" "$DEPLOYER" 1000000000000 \
--rpc-url "$RPC_URL_138" --private-key "$PRIVATE_KEY" --legacy --gas-limit 100000
```
Addresses: see [TOKENS_AND_NETWORKS_MINTABLE_TO_DEPLOYER.md](TOKENS_AND_NETWORKS_MINTABLE_TO_DEPLOYER.md) §1.1.
---
## 2. c* on other networks
### Step 1: Deploy c* to the target chain (if not already deployed)
From `smom-dbis-138/`:
```bash
source .env
# Example: Polygon (137). Set RPC and chain-id for the target chain.
export RPC_URL="$POLYGON_MAINNET_RPC" # or BSC_RPC_URL, etc.
# Deploy cUSDT + cUSDC (default). Add DEPLOY_CEURC=1 etc. for more.
forge script script/deploy/DeployCompliantFiatTokensForChain.s.sol:DeployCompliantFiatTokensForChain \
--rpc-url "$RPC_URL" --broadcast --private-key "$PRIVATE_KEY" --chain-id 137
# Optional: deploy all 12 c* (set env flags)
DEPLOY_CEURC=1 DEPLOY_CEURT=1 DEPLOY_CGBPC=1 DEPLOY_CGBPT=1 \
DEPLOY_CAUDC=1 DEPLOY_CJPYC=1 DEPLOY_CCHFC=1 DEPLOY_CCADC=1 \
DEPLOY_CXAUC=1 DEPLOY_CXAUT=1 \
forge script script/deploy/DeployCompliantFiatTokensForChain.s.sol:DeployCompliantFiatTokensForChain \
--rpc-url "$RPC_URL" --broadcast --private-key "$PRIVATE_KEY" --chain-id 137
```
Then set in `.env`: `CUSDT_137=<addr>`, `CUSDC_137=<addr>`, etc.
### Step 2: Mint c* on that chain
Same as 138: deployer is owner. Use cast with the chains RPC and token address:
```bash
RPC="$POLYGON_MAINNET_RPC"
CUSDT_POLY="0x..." # from deploy output or .env CUSDT_137
cast send "$CUSDT_POLY" "mint(address,uint256)" "$DEPLOYER" 1000000000000 \
--rpc-url "$RPC" --private-key "$PRIVATE_KEY" --legacy --gas-limit 100000
```
Use the same cast pattern with that chain's RPC and token addresses from .env (e.g. `CUSDT_POLYGON`, `CUSDC_POLYGON` for Polygon).
---
## 3. cW* on other networks
cW* are **CompliantWrappedToken**; the deploy script grants **MINTER_ROLE** to both the **bridge** and the **admin (deployer)**. So the deployer can mint cW* on any chain where cW* were deployed by this repo.
**Per token, per chain (cast):**
```bash
cd smom-dbis-138 && source .env
# Example: mint 1M cWUSDT on Polygon (137)
CWUSDT_ADDR="$CWUSDT_137" # from .env after DeployCWTokens
RPC="$POLYGON_MAINNET_RPC"
DEPLOYER=0x4A666F96fC8764181194447A7dFdb7d471b301C8
cast send "$CWUSDT_ADDR" "mint(address,uint256)" "$DEPLOYER" 1000000000000 \
--rpc-url "$RPC" --private-key "$PRIVATE_KEY" --legacy --gas-limit 100000
```
**Env vars for addresses (examples):** `CWUSDT_137`, `CWUSDC_137`, `CWUSDT_1`, `CWUSDC_1`, … (see [CW_TOKENS_AND_NETWORKS.md](CW_TOKENS_AND_NETWORKS.md) and `token-mapping-multichain.json`).
Use `smom-dbis-138/scripts/mint-cw-on-chain.sh <CHAIN_NAME> [amount]` to mint all cW* on a chain (e.g. `./scripts/mint-cw-on-chain.sh Polygon`). Requires `CWUSDT_<CHAIN>`, `CWUSDC_<CHAIN>`, etc. and chain RPC in .env.
---
## 4. Reference: token addresses by chain
- **Chain 138 c*:** [TOKENS_AND_NETWORKS_MINTABLE_TO_DEPLOYER.md](TOKENS_AND_NETWORKS_MINTABLE_TO_DEPLOYER.md) §1.1
- **cW* and networks:** [CW_TOKENS_AND_NETWORKS.md](CW_TOKENS_AND_NETWORKS.md), `config/token-mapping-multichain.json`
- **Deploy c* on a chain:** `DeployCompliantFiatTokensForChain.s.sol`
- **Deploy cW* on a chain:** `DeployCWTokens.s.sol` (set `CW_BRIDGE_ADDRESS`)