Skip to content

About

ERC-6909 multi-token: minimal per-id multi-token standard (reference impl + owner-issued MultiToken), operator + per-id allowance auth, per-id supply conservation invariant

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

multitoken-6909

A clean ERC-6909 multi-token: many fungible balances (per id) in one contract. Lighter than ERC-1155 — no receiver-hook callbacks, no forced batch — which is why v4-era protocols use it for claim tokens and pooled positions. Ships the reusable base plus a concrete owner-issued MultiToken. MIT.

What's here

  • ERC6909.sol — the reference implementation: balanceOf(owner,id), per-id allowance, global isOperator, transfer / transferFrom / approve / setOperator, ERC-165, and internal _mint/_burn for subclasses. Also tracks per-id totalSupply (a useful extension over the bare standard).
  • MultiToken.sol — a concrete issuer: the owner mints/burns any id (game items, editions, claim tokens); holders transfer freely. Optional {id} base URI. Holders are never custodial to the issuer — the owner is the minter, nothing more.

Authorization (the two-tier model)

transferFrom(sender, ...) is allowed when the caller is sender, or an operator of sender (setOperator — approved for all ids), or has a per-id allowance (approve). An allowance of type(uint256).max is treated as infinite and never decremented; the operator path never touches allowances. All three are covered by tests.

Invariant (fuzzed, fail_on_revert=true, non-hollow)

  • Supply conservation — for every id, Σ balanceOf(holder, id) == totalSupply(id) across any sequence of mint / burn / transfer / allowance-transferFrom / operator-transferFrom (12,800 calls, 0 reverts; every selector exercised). Mutation-checked: dropping the supply bump, or decrementing an infinite allowance, each fails a test.

Notes (honest)

  • The standard has no transfer hooks, so tokens can be sent to any address (including contracts that don't expect them) — that is by design (the deliberate simplification vs ERC-1155); integrators that need acceptance checks add them at the app layer.
  • MultiToken's owner is the issuer/minter; there is no admin path to holders' balances.
  • Unaudited reference implementation.
forge test   # 18 tests: transfers, allowance + operator paths, ERC-165, mint/burn, supply invariant

About

ERC-6909 multi-token: minimal per-id multi-token standard (reference impl + owner-issued MultiToken), operator + per-id allowance auth, per-id supply conservation invariant

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages