STABLECOIN variant. Decimals are fixed at 6, and the token carries an immutable, self-declared currency code such as USD. The type is sealed into the token address at creation and cannot change.
Demo
New to B20? See the B20 Token Standard for the concepts and a full launch walkthrough. These samples target
base-std@be6d045, viem@2.55.11, and Base Foundry v1.1.1.How the Stablecoin Variant Works
PassingSTABLECOIN to createB20 writes discriminant byte 0x01 into position [10] of the token address. After the call returns:
decimals()returns6(hardcoded; you do not pass a decimals value).currency()returns the immutable code you provided (for example"USD"). B20 checks the format only, not that the code is a real currency.- The
IB20Stablecoinsurface is live at that address. - Asset-only selectors (
announce,updateUIMultiplier,batchMint) do not execute on this address.
currency field is required and must be uppercase ASCII A to Z only. An empty code reverts MissingRequiredField; any other byte reverts InvalidCurrency.
Create and Verify the Stablecoin
params blob is ABI-encoded with a leading version byte (currently 1) as B20StablecoinCreateParams: version, name, symbol, initialAdmin, and currency. Optional initCalls run on the new token in the same transaction; the factory drops access after they complete.
See the B20 token standard for the complete interface, roles, and policies.
The factory emits
B20Created, and the returned token address is ready for minting.See Also
Mint Supply
Increase circulating supply.
Restrict Who Can Hold It
Allowlist eligible holders.