Skip to content

feat(token): implement ERC-7943 uRWA universal RWA interface #40

@jose-compu

Description

@jose-compu

Why this matters

ERC-7943 (uRWA — Universal Real World Asset Interface) reached Final status and defines a minimal, unopinionated compliance layer for tokenized RWAs (securities, real estate, commodities, etc.).

Unlike heavier standards such as ERC-3643 (T-REX), uRWA focuses on essential primitives — canSend, canReceive, canTransfer, getFrozenTokens, forcedTransfer, and setFrozenTokens — without mandating identity registries, on-chain whitelisting mechanisms, or specific access-control patterns. This makes it a strong composability target for DeFi protocols that need to interact with compliant assets in a standardized way.

The EIP ships reference implementations for ERC-20, ERC-721, and ERC-1155 bases (OpenZeppelin-based, educational only). No canonical, audited library implementation exists today — a gap this project can fill.

Spec: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7943.md
Discussions: https://ethereum-magicians.org/t/erc-universal-rwa-interface/23972
Requires: ERC-165

Scope

Per the per-ERC workflow, deliver canonical implementations for all three interface variants:

Interfaces (src/token/ERC7943/)

  • IERC7943Fungible.sol — ERC-20 extension (interfaceId: 0x3edbb4c4)
  • IERC7943NonFungible.sol — ERC-721 extension (interfaceId: 0xbf1ef5fe)
  • IERC7943MultiToken.sol — ERC-1155 extension (interfaceId: 0x41c4fbad)

Non-upgradeable implementations

  • ERC7943Fungible.sol — abstract ERC-20 extension with compliance hooks
  • ERC7943NonFungible.sol — abstract ERC-721 extension
  • ERC7943MultiToken.sol — abstract ERC-1155 extension

Upgradeable implementations

  • ERC7943FungibleUpgradeable.sol
  • ERC7943NonFungibleUpgradeable.sol
  • ERC7943MultiTokenUpgradeable.sol

Tests (test/token/ERC7943.t.sol)

  • Unit tests for all three variants
  • Fuzz tests for canTransfer, frozen-balance enforcement, and forcedTransfer edge cases
  • ERC-165 supportsInterface checks
  • Transfer/mint/burn must respect canSend / canReceive / canTransfer per spec

Documentation

  • Full NatSpec on all public/external functions, events, and custom errors

Implementation notes

  • Separation of concerns: canSend/canReceive are account-level; canTransfer is transfer-level and must compose both plus frozen-balance checks.
  • Frozen tokens: setFrozenTokens overwrites absolute frozen amount (not delta); getFrozenTokens may exceed balance.
  • Forced transfer: Must emit ForcedTransfer + base transfer event; unfreeze before transfer when bypassing frozen constraints (reentrancy safety for 721/1155).
  • Access control: forcedTransfer and setFrozenTokens must be restricted; use OZ AccessControl with configurable roles — do not mandate a specific RBAC scheme in the interface layer.
  • Custom errors: Implement ERC7943CannotSend, ERC7943CannotReceive, ERC7943CannotTransfer, ERC7943InsufficientUnfrozenBalance per spec.
  • Reference only: Review EIP-7943 assets for semantics, but write from scratch for licensing cleanliness.

Relationship to ERC-3643

ERC-7943 is intentionally minimal and aligns naming with ERC-3643 (forcedTransfer, canTransfer, setFrozenTokens) for interoperability. Implementing 7943 first (or in parallel with #23) provides a lean compliance primitive; 3643 adds the full T-REX identity/compliance stack on top.

Acceptance criteria

  • All three interface variants implemented (fungible, non-fungible, multi-token)
  • Non-upgradeable and upgradeable versions for each
  • forge test passes with full coverage of compliance paths
  • forge fmt --check clean
  • ROADMAP.md updated (correct 7943 entry — currently mislabeled as "Agent Coordination")
  • Internal security review completed (sensitive: forcedTransfer, setFrozenTokens, reentrancy on 721/1155 hooks)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsoliditySolidity smart contract implementationtier-2Tier 2 high-value ERC implementations

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions