uniform contract type composition via Compose - #821
Conversation
The ContractType on FungibleToken and NonFungibleToken is now selected uniformly with the type-level Compose alias, by listing the contract types that override the Base behavior (e.g. Compose<(AllowList,)>). Invalid lists are rejected at compile time with a curated diagnostic. Additive extensions (burnable, capped, royalties) have no contract type and never appear in the list. Also fixes the contract type bullet lists on both base traits: adds the missing Vault, FungibleVotes and NonFungibleVotes entries, and removes the incorrect claims that Enumerable/Consecutive are incompatible with NonFungibleBurnable. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughChangesCompose contract-type selection
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/tokens/src/non_fungible/extensions/combinations/mod.rs`:
- Around line 28-33: Update the module documentation in the combinations module
to remove the claim that Enumerable and Consecutive are mutually exclusive.
Describe unsupported multi-type combinations as not yet curated, while
preserving the explanation about invalid extension-trait implementations and
their trait bounds.
- Around line 28-33: Remove the hard Enumerable/Consecutive incompatibility: in
packages/tokens/src/non_fungible/extensions/combinations/mod.rs:28-33, replace
the module documentation’s mutual-exclusion claim; in
packages/tokens/src/non_fungible/extensions/combinations/mod.rs:50-58, add the
supported Composable tuple mapping for Enumerable and Consecutive and remove the
diagnostic restriction; in packages/tokens/src/non_fungible/mod.rs:105-110,
remove the repeated incompatibility claim.
In `@packages/tokens/src/non_fungible/mod.rs`:
- Around line 105-110: Update the public documentation for the Consecutive and
Enumerable extension mappings near the Consecutive trait references, removing
the statement that they are incompatible. Keep the supported Compose selections
and mapping descriptions accurate without changing the implementation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 657a6a1b-5aff-41fb-98b0-d4764a85d04d
📒 Files selected for processing (25)
Architecture.mdexamples/fungible-allowlist/src/contract.rsexamples/fungible-blocklist/src/contract.rsexamples/fungible-capped/src/contract.rsexamples/fungible-governor-timelock/token/src/token.rsexamples/fungible-governor/token/src/token.rsexamples/fungible-pausable/src/contract.rsexamples/fungible-vault/src/contract.rsexamples/fungible-votes/src/contract.rsexamples/nft-access-control/src/contract.rsexamples/nft-consecutive/src/contract.rsexamples/nft-enumerable/src/contract.rsexamples/nft-royalties/src/contract.rsexamples/nft-sequential-minting/src/contract.rsexamples/rwa/token/src/contract.rspackages/tokens/src/fungible/extensions/burnable/mod.rspackages/tokens/src/fungible/extensions/combinations/mod.rspackages/tokens/src/fungible/extensions/mod.rspackages/tokens/src/fungible/mod.rspackages/tokens/src/fungible/overrides.rspackages/tokens/src/non_fungible/extensions/burnable/mod.rspackages/tokens/src/non_fungible/extensions/combinations/mod.rspackages/tokens/src/non_fungible/extensions/mod.rspackages/tokens/src/non_fungible/mod.rspackages/tokens/src/non_fungible/overrides.rs
The ContractType on FungibleToken and NonFungibleToken is now selected uniformly with the type-level Compose alias, by listing the contract types that override the Base behavior (e.g. Compose<(AllowList,)>). Invalid lists are rejected at compile time with a curated diagnostic. Additive extensions (burnable, capped, royalties) have no contract type and never appear in the list.
Also fixes the contract type bullet lists on both base traits: adds the missing Vault, FungibleVotes and NonFungibleVotes entries, and removes the incorrect claims that Enumerable/Consecutive are incompatible with NonFungibleBurnable.
Fixes #560
PR Checklist
Summary by CodeRabbit
New Features
Documentation