Feat/optional total supply#795
Conversation
WalkthroughThe PR introduces ChangesToken architecture
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #795 +/- ##
==========================================
- Coverage 96.63% 96.04% -0.60%
==========================================
Files 72 73 +1
Lines 7615 7451 -164
==========================================
- Hits 7359 7156 -203
- Misses 256 295 +39 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/tokens/src/fungible/extensions/combinations/mod.rs (1)
87-131: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReduce repetition in single-type
Composableimpls.14 near-identical impls (bare type + 1-tuple, same
Out) for 7 types. A small macro keeps the mapping in one place and removes the risk of forgetting the tuple form when a new contract type is added.♻️ Proposed macro-based refactor
+macro_rules! impl_composable_single { + ($($ty:ty),* $(,)?) => { + $( + impl Composable for $ty { + type Out = $ty; + } + impl Composable for ($ty,) { + type Out = $ty; + } + )* + }; +} + -impl Composable for Base { - type Out = Base; -} -impl Composable for (Base,) { - type Out = Base; -} -impl Composable for AllowList { - type Out = AllowList; -} -impl Composable for (AllowList,) { - type Out = AllowList; -} -impl Composable for BlockList { - type Out = BlockList; -} -impl Composable for (BlockList,) { - type Out = BlockList; -} -impl Composable for TotalSupply { - type Out = TotalSupply; -} -impl Composable for (TotalSupply,) { - type Out = TotalSupply; -} -impl Composable for RWA { - type Out = RWA; -} -impl Composable for (RWA,) { - type Out = RWA; -} -impl Composable for Vault { - type Out = Vault; -} -impl Composable for (Vault,) { - type Out = Vault; -} -impl Composable for FungibleVotes { - type Out = FungibleVotes; -} -impl Composable for (FungibleVotes,) { - type Out = FungibleVotes; -} +impl_composable_single!(Base, AllowList, BlockList, TotalSupply, RWA, Vault, FungibleVotes);🤖 Prompt for 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. In `@packages/tokens/src/fungible/extensions/combinations/mod.rs` around lines 87 - 131, Replace the repeated single-type Composable implementations with a small macro that generates both the bare-type and one-element tuple implementations with the same Out mapping. Invoke it once for each of Base, AllowList, BlockList, TotalSupply, RWA, Vault, and FungibleVotes, preserving the existing resolution behavior.
🤖 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.
Nitpick comments:
In `@packages/tokens/src/fungible/extensions/combinations/mod.rs`:
- Around line 87-131: Replace the repeated single-type Composable
implementations with a small macro that generates both the bare-type and
one-element tuple implementations with the same Out mapping. Invoke it once for
each of Base, AllowList, BlockList, TotalSupply, RWA, Vault, and FungibleVotes,
preserving the existing resolution behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 56514609-a954-4a7c-90b7-957fbb8c277f
📒 Files selected for processing (46)
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/allowlist/mod.rspackages/tokens/src/fungible/extensions/blocklist/mod.rspackages/tokens/src/fungible/extensions/burnable/mod.rspackages/tokens/src/fungible/extensions/burnable/storage.rspackages/tokens/src/fungible/extensions/burnable/test.rspackages/tokens/src/fungible/extensions/capped/mod.rspackages/tokens/src/fungible/extensions/capped/test.rspackages/tokens/src/fungible/extensions/combinations/mod.rspackages/tokens/src/fungible/extensions/combinations/storage.rspackages/tokens/src/fungible/extensions/combinations/test.rspackages/tokens/src/fungible/extensions/mod.rspackages/tokens/src/fungible/extensions/total_supply/mod.rspackages/tokens/src/fungible/extensions/total_supply/storage.rspackages/tokens/src/fungible/extensions/total_supply/test.rspackages/tokens/src/fungible/extensions/votes/storage.rspackages/tokens/src/fungible/extensions/votes/test.rspackages/tokens/src/fungible/mod.rspackages/tokens/src/fungible/overrides.rspackages/tokens/src/fungible/storage.rspackages/tokens/src/fungible/test.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.rspackages/tokens/src/rwa/mod.rspackages/tokens/src/rwa/storage.rspackages/tokens/src/rwa/test.rspackages/tokens/src/vault/mod.rspackages/tokens/src/vault/storage.rspackages/tokens/src/vault/test.rs
💤 Files with no reviewable changes (2)
- packages/tokens/src/fungible/test.rs
- packages/tokens/src/fungible/extensions/burnable/test.rs
Fixes #560
PR Checklist
@brozorec, here is the PR that we were talking about, please take your time for reviewing it, because this is an important change. We should put our best effort into it to make it the "finalized" and "future proof" version if possible
Summary by CodeRabbit
New Features
Documentation