Skip to content

Exploring minimum-enshrined IB20 + wrapper architecture (alternative to variant design)#2

Draft
amiecorso wants to merge 1 commit into
masterfrom
amie/minimum-enshrined
Draft

Exploring minimum-enshrined IB20 + wrapper architecture (alternative to variant design)#2
amiecorso wants to merge 1 commit into
masterfrom
amie/minimum-enshrined

Conversation

@amiecorso
Copy link
Copy Markdown
Collaborator

@amiecorso amiecorso commented May 14, 2026

Summary

Alternative to the merged variant-based design (#1). Replaces the
Default/Stablecoin/Security variant interfaces (with capability bits,
role splits, two-step transfers, factory) with a single minimum
precompile bound to an EVM wrapper contract at creation.

The architectural unit: precompile + wrapper

Each B-20 token is a pair:

  • Precompile (IB20): balance state, raw transfer mechanics,
    policy hook, pause flag.
  • EVM wrapper contract: all authorization, all role logic, all
    product-specific behavior.

The pair is created atomically; the binding is permanent (wrapper()
is immutable on the precompile). Privileged operations (mint,
burn, wrapperTransfer, setPaused, setTransferPolicyId)
revert with OnlyWrapper for any other caller.

Mental model: OZ _internal / public split, but enforced at the
protocol level rather than by Solidity inheritance.

What's in the precompile (17 external functions)

  • ERC-20 surface (name, symbol, decimals, totalSupply,
    balanceOf, allowance, transfer, transferFrom, approve)
  • State reads (wrapper, transferPolicyId, paused)
  • Wrapper-only operations (mint, burn, wrapperTransfer,
    setPaused, setTransferPolicyId)

What lives in the wrapper

Everything that was in the variant interfaces:

  • Roles (admin, issuer, pauser, minter, RBAC)
  • Two-step admin / issuer rotation with delays
  • Capability bits / preset variants
  • EIP-2612 permit, ERC-3009, transfer memos
  • Per-minter rate limiting, supply caps
  • Currency identifier, contract URI, asset type
  • Share ratio, corporate actions, brokerage redeem flows
  • Dividend distribution

A future PR can add reference wrapper implementations
(MinimalWrapper.sol, StablecoinWrapper.sol,
SecurityTokenWrapper.sol) to make these concrete.

Open questions

Captured in DESIGN_NOTES.md:

  1. Wrapper rotation path (default: no, use proxy pattern internally)
  2. Initial supply at creation (factory concern)
  3. Burn-during-pause behavior
  4. `setTransferPolicyId` validation against the registry

Files

  • Add `src/interfaces/IB20.sol` (214 lines)
  • Keep `src/interfaces/IPolicyRegistry.sol` (unchanged)
  • Delete `Capabilities.sol`, `IDefaultToken.sol`, `IStablecoin.sol`,
    `ISecurityToken.sol`, `ITokenFactory.sol`
  • Rewrite `DESIGN_NOTES.md`

Status

Draft. Posting for team reaction before deciding whether this
direction supersedes #1 or stays as a parallel sketch.

@amiecorso amiecorso changed the title Pivot to minimum-enshrined IB20 + wrapper architecture (alternative to variant design) Exploring minimum-enshrined IB20 + wrapper architecture (alternative to variant design) May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant