ERC-20 Compatibility
B20 tokens are implemented as Rust precompiles rather than EVM smart contracts, making them faster, cheaper, and more native to the chain. All tokens are deployed via the singletonIB20Factory precompile.
B20 implements the full ERC-20 standard surface with complete selector parity - it is a drop-in replacement for existing tooling and integrations.
Roles Model
B20 role-based access control extends OpenZeppelinAccessControl with a fixed set of roles and one behavioral override on admin renunciation.
User-defined roles are supported via
setRoleAdmin and grantRole. They carry no built-in effect - B20 only enforces gates against the seven roles above.
Admin Renunciation
The lastDEFAULT_ADMIN_ROLE holder cannot be removed via renounceRole or revokeRole (both revert with LastAdminCannotRenounce). The dedicated renounceLastAdmin() is the only path to permanently transition a token to admin-less.
Tokens that intend to launch admin-less from the start pass initialAdmin == address(0) at creation, which never grants the role and skips the renounceLastAdmin step entirely.
After renounceLastAdmin() (or for tokens deployed with initialAdmin == address(0)):
- Operations gated by
DEFAULT_ADMIN_ROLEbecome permanently uncallable. - Roles already granted to other addresses (
MINT_ROLE,BURN_ROLE, etc.) continue to function independently. - Admin resurrection is blocked:
grantRole,revokeRole, andsetRoleAdminall revert withAccessControlUnauthorizedAccounteven if the caller holds a custom role.
Policy Registry
The PolicyRegistry is a singleton precompile that manages allowlists and blocklists. B20 tokens reference policies byuint64 ID. Any caller can create a policy and nominate its admin.
State-changing functions on the PolicyRegistry are gated by the ActivationRegistry, which tracks which Base features are live. Read functions (
isAuthorized, policyExists, policyAdmin, pendingPolicyAdmin) are always callable.Policy Types
Policy IDs
Policy IDs areuint64 values. The top byte encodes the PolicyType; the low 56 bits are a global counter starting at 2.
Two built-in IDs require no creation:
isAuthorized never reverts on a non-existent policy ID - it collapses to empty-member-set semantics (non-existent BLOCKLIST authorizes everyone; non-existent ALLOWLIST denies everyone).
Admin Model
Each policy has one admin. Admin transfers are two-step: the current admin callstransferPolicyAdmin(policyId, newAdmin), then the pending admin calls acceptPolicyAdmin(policyId). renouncePolicyAdmin(policyId) permanently freezes the policy - membership can never be changed again.
Creating and Managing Policies
Read Interface
Policy Integration
B20 declares a fixed set of policy scopes. Each scope stores auint64 policy ID pointing into the PolicyRegistry. On every gated operation, B20 calls isAuthorized against the relevant scope and reverts with PolicyForbids if the account is not authorized.
approve is not policy-gated - only actual balance movement via transfer / transferFrom is checked.
Scopes are read via policyId(scope) and written via updatePolicy(scope, policyId). updatePolicy is admin-gated and reverts if the scope is not recognized.
Mint
New supply is created viamint / mintWithMemo, gated by MINT_ROLE. The recipient is policy-checked against MINT_RECEIVER_POLICY. The operation reverts with SupplyCapExceeded if it would push totalSupply past the cap.
Burn
Two burn paths exist:burn/burnWithMemo- caller burns from their own balance. Gated byBURN_ROLE.burnBlocked- burns from a third party’s balance. Gated byBURN_BLOCKED_ROLE. The target account MUST be denied byTRANSFER_SENDER_POLICY- this is the freeze-and-seize path for regulated issuers.
Supply Cap
The supply cap is optional. The sentineltype(uint256).max indicates no cap (the default at creation). updateSupplyCap(newCap) is admin-gated and emits SupplyCapUpdated. Lowering below the current totalSupply reverts with InvalidSupplyCap.
Memos
A memo is an optionalbytes32 payload attached to a token operation for off-chain reference. Every memo-emitting operation emits Memo(address indexed caller, bytes32 indexed memo) immediately after the operation’s primary event. Indexers join via (transactionHash, logIndex − 1).
Memo-emitting entrypoints: transferWithMemo, transferFromWithMemo, mintWithMemo, burnWithMemo.
Pause
Pauses are granular: thePausableFeature enum partitions the token surface into independently pausable operations - TRANSFER, MINT, and BURN. The enum is append-only. pause(features) and unpause(features) are gated by separate roles (PAUSE_ROLE and UNPAUSE_ROLE) by design.
ERC-2612 Permit / EIP-712
B20 implements ERC-2612 (signed approvals) using an EIP-712 domain shaped as(name, version, chainId, verifyingContract), with version fixed at "1". updateName rotates the domain separator and emits EIP712DomainChanged (ERC-5267). ERC-1271 contract signatures are not accepted - ECDSA only.
Contract URI (ERC-7572)
contractURI() returns a string pointing to off-chain metadata per ERC-7572. updateContractURI(newUri) is gated by METADATA_ROLE.
Metadata Updates
METADATA_ROLE gates:
updateName(newName)- updatesnameand rotates the EIP-712 domain separator. EmitsNameUpdatedandEIP712DomainChanged.updateSymbol(newSymbol)- updatessymbolonly. EmitsSymbolUpdated.
Factory
All B20 tokens are created through the singletonIB20Factory precompile via createB20(variant, params, initCalls, salt).
Address Derivation
B20 addresses are deterministic and encode the variant directly:getB20Address(variant, deployer, salt), isB20(addr), and isB20Initialized(addr) are available on the factory.
initCalls Semantics
initCalls are dispatched after token creation with admin privilege bypass, allowing configuration (e.g. setting policies, granting roles) in the same transaction as deployment. The bypass is partial:
MINT_RECEIVER_POLICYis always enforced even duringinitCalls.- Pause state is never bypassed.
- Token invariants (supply cap, etc.) are never bypassed.
Variants
Asset
The general-purpose variant for assets of all kinds. Decimals are configurable between 6 and 18 at deployment time and are immutable after creation. In addition to the base B20 surface, Asset tokens add anOPERATOR_ROLE that gates the following capabilities:
Multiplier
A WAD-precision rebase multiplier applied to all balance reads. Raw balances are stored unchanged; the multiplier scales the view returned to callers.Announcements
On-chain disclosure brackets that wrap sensitive operations (e.g. batch mints, multiplier updates) with a public notice period. Gated byOPERATOR_ROLE.
announce(internalCalls, id, description, uri) emits an Announcement event, executes internalCalls, then emits EndAnnouncement. The id must be unique and is enforced forever. Inner call reverts are wrapped in InternalCallFailed.
Batch Mint
batchMint(recipients, amounts) mints to multiple recipients in a single call. Gated by MINT_ROLE. Should be wrapped in announce() for transparency.
Extra Metadata
An arbitrary key/value store for issuer-defined on-chain metadata.Stablecoin
The fixed-decimals, fiat-backed carveout. Decimals are hard-wired to6 and are not configurable.
Adds currency(), which returns an ISO-style currency code string (e.g. "USD", "EUR"). The code is set once at creation via B20StablecoinCreateParams.currency, restricted to characters A-Z only. It is self-declared and not verified against any external registry.