Skip to content

Split ERC7943 into separate dedicated interfaces#216

Merged
ernestognw merged 3 commits intomasterfrom
update/ERC7943
Sep 25, 2025
Merged

Split ERC7943 into separate dedicated interfaces#216
ernestognw merged 3 commits intomasterfrom
update/ERC7943

Conversation

@ernestognw
Copy link
Copy Markdown
Member

@ernestognw ernestognw commented Sep 23, 2025

See ethereum/ERCs#1210

Summary by CodeRabbit

  • New Features

    • Introduced distinct interfaces for fungible, non-fungible, and multi-token assets.
    • Added user-allowance checks, frozen-token management, and forced transfer capabilities.
    • Provided a backward-compatible alias to ease migration.
  • Refactor

    • Standardized method names and simplified event parameters for clarity and consistency.
    • Updated ERC20 extensions to align with the fungible interface and new event formats.
  • Tests

    • Updated tests to reflect the new interfaces, renamed methods, and revised event signatures.
  • Documentation

    • Refreshed references to match the new interface variants and terminology.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Sep 23, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Replaces the single IERC7943 interface with three variants (Fungible, NonFungible, MultiToken) and aliases IERC7943 to IERC7943MultiToken. Updates ERC20Freezable and ERC20uRWA to use IERC7943Fungible. Renames functions/events (e.g., isTransferAllowed→canTransfer, forceTransfer→forcedTransfer) and adjusts Frozen/ForcedTransfer event parameters. Tests updated accordingly.

Changes

Cohort / File(s) Summary of edits
Interfaces split and renames
contracts/interfaces/IERC7943.sol
Introduced IERC7943Fungible, IERC7943NonFungible, IERC7943MultiToken; aliased IERC7943 to IERC7943MultiToken. Added/renamed functions: canTransfer, forcedTransfer, setFrozenTokens, getFrozenTokens, isUserAllowed. Updated/added events ForcedTransfer, Frozen. Replaced/added errors, removed ERC7943NotAllowedTransfer.
ERC20 fungible implementations
contracts/token/ERC20/extensions/ERC20Freezable.sol, contracts/token/ERC20/extensions/ERC20uRWA.sol
Switched imports/implements to IERC7943Fungible. Renamed APIs to fungible forms: isTransferAllowedcanTransfer, forceTransferforcedTransfer, setFrozensetFrozenTokens, getFrozengetFrozenTokens. Adjusted event emissions to new signatures. Updated supportsInterface.
Tests updated for new API and events
test/token/ERC20/extensions/ERC20Freezable.test.js, test/token/ERC20/extensions/ERC20uRWA.test.js
Updated expectations for Frozen and ForcedTransfer event args. Replaced calls and interface checks to fungible variants and new function names. Maintained existing behavior checks under new signatures.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Admin
  participant Token as ERC20uRWA (IERC7943Fungible)

  rect rgb(245,248,255)
    note right of Token: Permission/freeze management
    Admin->>Token: setFrozenTokens(user, amount)
    Token-->>Admin: emit Frozen(user, amount)
  end

  rect rgb(245,255,245)
    note right of Token: Transfer capability check
    participant From as from
    participant To as to
    From->>Token: canTransfer(from, to, amount)
    Token-->>From: bool allowed
  end

  rect rgb(255,248,245)
    note right of Token: Administrative forced move
    Admin->>Token: forcedTransfer(from, to, amount)
    Token-->>Admin: emit ForcedTransfer(from, to, amount)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

A nibble of code, a hop to refine,
Three paths of tokens now neatly align.
I twitch my nose—events renamed,
Freezes set, permissions tamed.
With forced hops swift and checks that sing,
This burrowed spec now feels in spring. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Split ERC7943 into separate dedicated interfaces" succinctly and accurately describes the primary change in the diff: the single IERC7943 interface is split into IERC7943Fungible, IERC7943NonFungible, and IERC7943MultiToken with a backward-compatible alias, and related function/event renames across contracts and tests; it is concise, specific, and relevant to the changeset.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ernestognw ernestognw marked this pull request as ready for review September 23, 2025 16:54
@ernestognw ernestognw requested a review from a team as a code owner September 23, 2025 16:54
@ernestognw ernestognw merged commit b0ddd27 into master Sep 25, 2025
11 checks passed
@Amxx Amxx deleted the update/ERC7943 branch March 9, 2026 13:40
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.

2 participants