Skip to content

CIP-102 implementation (builds on #297 & #490)#491

Open
SamDelaney wants to merge 2 commits into
Python-Cardano:mainfrom
SamDelaney:cip102
Open

CIP-102 implementation (builds on #297 & #490)#491
SamDelaney wants to merge 2 commits into
Python-Cardano:mainfrom
SamDelaney:cip102

Conversation

@SamDelaney
Copy link
Copy Markdown
Contributor

Add CIP-102 (Royalty Datum Metadata) support

This PR is dependent on the work done in #490 - specifically, CIP-102 makes use of CIP-67 asset names. It can either be reviewed & merged independently as an combined PR for CIPs 67, 68 & 102, or it can be merged after #490 / #297 is merged.

  • Added cip102.py implementing the CIP-102 Royalty Datum Metadata standard
    • CIP102RoyaltyTokenName: Subclasses CIP67TokenName (label 500) to represent royalty token asset names. Supports an optional integer postfix for version-2 multi-recipient policies (e.g. (500)Royalty, (500)Royalty1, (500)Royalty2)
    • RoyaltyRecipient: Plutus constructor 121 encoding a single recipient's address (raw Plutus address bytes), fee denominator (floor(10 / pct * 10)), and optional min/max fee bounds (each encoded as optional_big_int using constructors 121/122)
    • RoyaltyInfo: Top-level datum (Plutus constructor 121) wrapping a list of RoyaltyRecipients, a version field, and an extensible extra field — serializes directly to inline datum CBOR
    • RoyaltyRecipientSomeMinFee / RoyaltyRecipientNoMinFee: Internal Plutus Some/None types for optional integer fields; follows the same optional_big_int CDDL shape as the spec
  • Added test_cip102.py with 29 unit tests covering token name construction, CBOR round-trips, recipient construction with/without optional fees, version 1 vs. version 2 semantics, and fee percentage validation
  • Updated init.py to export all CIP-102 symbols alongside existing CIPs

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 4, 2026

Codecov Report

❌ Patch coverage is 94.73684% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.70%. Comparing base (079d091) to head (3b4f091).

Files with missing lines Patch % Lines
pycardano/cip/cip102.py 94.68% 2 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #491      +/-   ##
==========================================
+ Coverage   87.55%   90.70%   +3.14%     
==========================================
  Files          35       37       +2     
  Lines        5183     5356     +173     
  Branches      781      808      +27     
==========================================
+ Hits         4538     4858     +320     
+ Misses        475      310     -165     
- Partials      170      188      +18     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@theeldermillenial
Copy link
Copy Markdown
Contributor

@SamDelaney If you can fix the issues when you run make qa, I can review and merge.

@SamDelaney
Copy link
Copy Markdown
Contributor Author

@SamDelaney If you can fix the issues when you run make qa, I can review and merge.

Done!

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