Quick Start
This page covers how to deploy the full contract infrastructure, create individual stablecoins, and upgrade logic through the resolver.
Prerequisites
- Node.js 16+ and npm
- Hardhat (installed as a project dependency)
- A Hedera account with sufficient HBAR balance
- The
.envfile configured with your private key (see.env.example)
Deploy Full Infrastructure
Deploy all facets, the factory, and the business logic resolver in one step:
npx hardhat deployAll --network <network>
This command:
- Deploys all facets (HederaTokenManagerFacet, KYCFacet, BurnableFacet, CashInFacet, etc.).
- Deploys and initializes the BusinessLogicResolver.
- Registers all facets in the resolver under their configuration keys.
- Creates versioned logic configurations.
- Deploys a ResolverProxy for the StableCoinFactory.
- Outputs all deployed contract addresses.
Optional Flags
| Flag | Description |
|---|---|
--useDeployed | Reuse already deployed contracts if addresses are known (default: true) |
--privateKey | Use a raw private key as signer instead of Hardhat account |
--signerAddress | Specify signer by address from Hardhat signers |
--signerPosition | Specify signer by index in Hardhat signers array |
Deploy a Stablecoin
Create a single stablecoin using the factory:
npx hardhat deployStableCoin \
--businessLogicResolverProxyAddress <resolverProxy> \
--stableCoinFactoryProxyAddress <factoryProxy> \
--network <network>
Full Example
npx hardhat deployStableCoin \
--tokenName "USD Token" \
--tokenSymbol "USDT" \
--tokenDecimals 6 \
--tokenInitialSupply 1000000 \
--tokenMaxSupply 10000000 \
--createReserve true \
--addKyc true \
--grantKYCToOriginalSender true \
--businessLogicResolverProxyAddress 0x123...abc \
--stableCoinFactoryProxyAddress 0x456...def \
--network testnet
Upgrade Logic
The resolver enables centralized logic upgrades without redeploying stablecoin proxies.
npx hardhat updateBusinessLogicKeys \
--resolverAddress <businessLogicResolverAddress> \
--implementationAddressList <commaSeparatedFacetAddresses> \
--privateKey <yourPrivateKey> \
--network <network>
The BusinessLogicResolver must be initialized before registering facets. If not yet initialized, run
initializeBusinessLogicResolverfirst.
Migration
V1 to V2
- Deploy all new contracts:
npx hardhat deployAll --network <network> - Run the migration task:
npx hardhat migrateStableCoinToV2 \
--network <network> \
--stablecoinconfigurationidkey <configId> \
--stablecoinconfigurationidversion <version> \
--businesslogicresolverproxyaddress <blrProxy> \
--stablecoinaddress <scProxy> \
--stablecoinproxyadminaddress <scProxyAdmin>
V2 to V3
- Migrate the BusinessLogicResolver:
npx hardhat migrateBLRToV3 \
--blrproxyadminaddress <blrProxyAdmin> \
--blrproxyaddress <blrProxy> \
--network <network>
- Redeploy all facets and configurations.
Rollback scripts are available for both migration steps. See the contracts README for full rollback commands.