Skip to content

Fix royalty ABI: correct parameter order and return values#263

Merged
realproject7 merged 1 commit intomainfrom
task/261-fix-royalty-abi
Mar 17, 2026
Merged

Fix royalty ABI: correct parameter order and return values#263
realproject7 merged 1 commit intomainfrom
task/261-fix-royalty-abi

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Summary

  • Fix getRoyaltyInfo ABI: inputs changed from (token, beneficiary) to (wallet, reserveToken), outputs from single uint256 to (balance, claimed)
  • Fix claimRoyalties ABI: pass reserve token address (PLOT_TOKEN) instead of storyline token
  • Update ClaimRoyalties.tsx: swap args to getRoyaltyInfo(beneficiary, PLOT_TOKEN), destructure [balance] from tuple return, call claimRoyalties(PLOT_TOKEN)

Fixes #261

Test plan

  • Writer dashboard shows non-zero royalties after trades occur
  • Claim button successfully claims royalties
  • getRoyaltyInfo called with (writerAddress, PLOT_TOKEN) — verified in contract call
  • npm run typecheck passes

🤖 Generated with Claude Code

- getRoyaltyInfo: fix inputs to (wallet, reserveToken), outputs to
  (balance, claimed) — was (token, beneficiary) → single uint256
- claimRoyalties: pass reserve token (PLOT_TOKEN) not storyline token
- ClaimRoyalties.tsx: swap args, destructure [balance] from return,
  use PLOT_TOKEN for both read and claim calls

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE

ABI fix is correct and minimal:

  1. getRoyaltyInfo: Inputs reordered to (wallet, reserveToken), outputs now tuple (balance, claimed). Call site correctly swaps to (beneficiary, PLOT_TOKEN) and destructures [balance].

  2. claimRoyalties: Now takes PLOT_TOKEN (reserve token) instead of tokenAddress (storyline token). Matches the actual MCV2_Royalty contract signature.

  3. Query key: Still uses [tokenAddress, beneficiary] which is correct — PLOT_TOKEN is a constant so doesn't affect cache invalidation; the key properly varies by storyline context and wallet.

No issues found.

Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Summary

The PR fixes the ABI mismatch and updates the dashboard call sites to use the reserve-token-based royalty contract interface. The change is tightly scoped to the royalty read/claim path.

Findings

  • [info] No blocking issues found.

Decision

Approve. lib/price.ts now matches the contract signature, and ClaimRoyalties.tsx calls/destructures the royalty methods with the correct argument order and return values. CI was still pending when reviewed.

@realproject7 realproject7 merged commit 452c541 into main Mar 17, 2026
1 check passed
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.

[bug] Royalty ABI mismatch — getRoyaltyInfo and claimRoyalties use wrong parameters

2 participants