Skip to content

test: bring MUSD and MuzixCatalog coverage up to repo bar#80

Open
Pattermesh wants to merge 2 commits into
mainfrom
pattermesh/muzix-contract-tests
Open

test: bring MUSD and MuzixCatalog coverage up to repo bar#80
Pattermesh wants to merge 2 commits into
mainfrom
pattermesh/muzix-contract-tests

Conversation

@Pattermesh

Copy link
Copy Markdown
Contributor

Summary

MUSD.t.sol and MuzixCatalog.t.sol had only ~2 tests each, far below sibling suites (27–35). This PR brings both up to par.

  • MUSD.t.sol: 2 → 28 tests
  • MuzixCatalog.t.sol: 2 → 29 tests

What's covered

MUSD (src/MUSD.sol)

  • Token metadata (name/symbol/decimals), constructor (catalog + owner wiring)
  • mint happy path + onlyOwner revert (Ownable.OwnableUnauthorizedAccount)
  • Vanilla ERC20 transfer/transferFrom + allowance accounting, with IERC6093 custom-error reverts (ERC20InsufficientBalance, ERC20InsufficientAllowance)
  • transferWithRoyalty (atomic single distribution): pending-withdrawal crediting, escrow into the contract, event emission, accumulation across calls, single-recipient and partial-split (<100%) remainder behavior, no-split and insufficient-balance reverts
  • batchRoyaltyDistribution: multi-token splits, aggregate BatchRoyaltyProcessed event, onlyOwner + mismatched-array reverts, empty-array no-op, atomic revert when any token lacks a split
  • Pull-payment claimPayments: transfer + zeroing of pending, Withdrawal event, no-funds and double-claim reverts, per-recipient independence, claim across multiple distributions
  • ERC20Permit (EIP-2612) allowance via signed permit

MuzixCatalog (src/MuzixCatalog.sol)

  • Construction (name/symbol/owner)
  • mintMusic: ownership, tokenURI, ISRC/artist metadata, monotonic token ids, onlyOwner revert, nonexistent-token tokenURI revert, transferability
  • setRoyaltySplit: storage of recipients/shares, ERC-2981 10% pool royalty, and reverts for non-owner / array mismatch / total ≠ 100% / nonexistent token, plus overwrite
  • fractionalize view (multi- vs single-recipient vs no split)
  • depositRevenue / claimStreamingRevenue ETH streaming pull-payments: share-weighted payout, incremental claim after top-up, double-claim-without-new-revenue revert, non-stakeholder and zero-revenue reverts, anyone-can-fund
  • ERC-2981 / ERC-721 / ERC-165 introspection via supportsInterface, and royaltyInfo zero before any split

Test infra

Uses a configurable MockCatalog for MUSD (depends only on the royaltySplits ABI slice) and a Stakeholder receiver harness for catalog streaming claims, matching the stub-based conventions in the existing sibling suites.

Verification

forge build   # Compiler run successful (exit 0)
forge test    # 161 passed, 0 failed, 0 skipped across 6 suites (exit 0)
forge fmt --check test/MUSD.t.sol test/MuzixCatalog.t.sol   # clean

🤖 Generated with Claude Code

Pattermesh and others added 2 commits June 30, 2026 00:26
MUSD.t.sol (2 -> 28 tests) and MuzixCatalog.t.sol (2 -> 29 tests),
bringing both up to par with sibling suites (27-35 tests each).

MUSD: ERC20 metadata, onlyOwner mint, transfer/transferFrom + allowance
reverts (IERC6093 custom errors), single (transferWithRoyalty) and batch
(batchRoyaltyDistribution) royalty distribution incl. atomic-revert and
escrow-remainder edge cases, pull-payment claims (claimPayments) incl.
double-claim guard and per-recipient independence, and ERC20Permit.

MuzixCatalog: mintMusic + ISRC metadata, setRoyaltySplit validation
(owner check, array mismatch, 100% total, overwrite), fractionalize view,
depositRevenue/claimStreamingRevenue streaming pull-payments incl.
incremental top-up claims and non-stakeholder/zero-revenue reverts, and
ERC-2981/ERC-165 introspection.

forge build + forge test green: 161 passed, 0 failed across 6 suites.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant