Purpose and Scope
This document provides technical documentation for the NativeCoinAdapter system contract in StableNet.NativeCoinAdapter exposes the chain’s native coin (used for gas fees) through the standard ERC-20 interface, enabling seamless integration with existing DApps and services that expect ERC-20 tokens. For an overview of the governance system and mint/burn control mechanisms, see System Contracts Overview.
For validator management and consensus details, refer to the Anzeon WBFT Consensus Protocol.
Contract Deployment and Identification
NativeCoinAdapter is a genesis system contract deployed at a fixed address and initialized during chain bootstrap.Unlike user-deployed contracts, it has no owner and can only be upgraded via a hard fork, preserving decentralization guarantees.
| Property | Value |
|---|---|
| Contract Address | 0x0000000000000000000000000000000000001000 |
| Deployment Method | Genesis injection via InjectContracts |
| Upgrade Mechanism | Hard fork only |
| Owner | None (system contract) |
| Standard Compliance | ERC20, FiatTokenV2_2 |
Architecture and Design Principles
Dual-Nature Balance Model
NativeCoinAdapter implements a unique dual-nature balance model with the following properties:- No Redundant Storage: The adapter does not store balances in its own storage slots. All balance queries directly reference the native balance field in account state.
- Direct State Mutation: Transfers executed via the adapter modify the same native balances that are affected by gas fee payments, ensuring consistency across all balance mutation paths.
- Allowance Isolation: Only allowance mappings (used by
approve()/transferFrom()) are stored in the contract storage trie. - Unified Balance View:
NativeCoinAdapter.balanceOf(address)always returns exactly the same value as the account’s native balance used for gas accounting.
Storage Layout and State Management
Contract Storage Slots
NativeCoinAdapter maintains minimal storage, tracking only data that cannot be derived from native account state:| Slot Type | Purpose | Storage Location |
|---|---|---|
| Allowances | mapping(address => mapping(address => uint256)) | Contract storage trie |
| Minter Allowances | Per-minter mint/burn limits | Contract storage trie |
| Metadata | Currency name, symbol, decimals | Contract storage trie |
| Balances | NOT STORED – directly references native balance | Account state |
Core Transfer Operations
Direct Transfer Flow
Transfers via NativeCoinAdapter are processed in the following order:- Blacklist Validation: Check blacklist flags for both sender and recipient in the account Extra field.
- Balance Check: Read the sender’s native balance.
- Balance Mutation: Atomically update the native balances of both accounts.
- Journaling: All state changes are journaled to support reversion.
- Event Emission: Emit the
Transfer(from, to, amount)event.
Allowance-Based transferFrom
transferFrom() follows the standard ERC20 delegated transfer pattern:
- Read the allowance from contract storage.
- Decrease the allowance if sufficient.
- Perform the actual balance transfer by directly mutating native balances.
- Emit a
Transferevent.
Allowance System Implementation
Allowances cannot be derived from native state and therefore require dedicated contract storage.| Operation | Storage Access | State Modification |
|---|---|---|
approve | WRITE | Set allowance |
increaseAllowance | READ → WRITE | Increase allowance |
decreaseAllowance | READ → WRITE | Decrease allowance |
transferFrom | READ (+ WRITE) | Deduct allowance and transfer |
allowance | READ | Read-only |
Minting and Burning Integration
NativeCoinAdapter is the sole minting and burning interface for the native coin.These operations are restricted to addresses approved by GovMinter and GovMasterMinter.
Mint/Burn Constraints
- All minting and burning must occur via
mint()/burn(). - Only approved minters may call these functions.
- Per-minter maximum allowances are enforced.
- Standard
Transferevents and dedicatedMint/Burnevents are emitted. - Native balances are modified directly.
Event Emission and Auditability
NativeCoinAdapter emits events for all native coin movements, providing full traceability.| Event | Trigger |
|---|---|
Transfer | Any balance movement |
Approval | Allowance change |
Mint | Minting |
Burn | Burning |
Blacklist and Authorization Flags
NativeCoinAdapter integrates with flags stored in the account Extra field.| Account State | Extra Flag | Effect |
|---|---|---|
| Blacklisted | 0x8000000000000000 | Transfers and receipts blocked |
| Authorized | 0x4000000000000000 | Exempt from governance-enforced gasTip |
| Normal (default) | 0x0 | Governance gasTip enforcement applies |
ERC20 and FiatToken Extension Compliance
NativeCoinAdapter implements both the standard ERC20 interface and the FiatTokenV2_2 extensions, ensuring compatibility with existing USDC-based stablecoin infrastructure.StateDB Integration
NativeCoinAdapter integrates directly with StateDB:- Balance reads → direct native balance access
- Balance updates →
AddBalance/SubBalance - Journaling → supports transaction reversion
- Flag checks → Extra field access
- Event logging → included in receipts
StateObject Structure
Genesis Initialization
NativeCoinAdapter is initialized at genesis with the following parameters:- Contract exists at genesis block
- Initial minters and allowances configured
- Token metadata finalized
- Any future changes require a hard fork
Summary
NativeCoinAdapter achieves the following:- Zero-storage-overhead ERC20
- Event-level traceability for all native coin movements
- Governance-controlled minting and burning
- Full compatibility with existing stablecoin ecosystems
- Protocol-level security and policy enforcement

