feat: add fraction event and order listing lexicons - #167
feat: add fraction event and order listing lexicons#167satyam-mishra-pce wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: d241b7e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThis pull request adds three new lexicon schemas to the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
lexicons/org/hypercerts/fraction/transferEvent.json (1)
48-56: Consider documenting whennonceandchainIdcan be omitted.Both fields are optional but the descriptions imply they're important for cryptographic verification. If there are valid scenarios where these can be absent (e.g., legacy transfers, certain chain types), adding a note explaining when omission is acceptable would help consumers understand proper usage.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lexicons/org/hypercerts/fraction/transferEvent.json` around lines 48 - 56, Update the transferEvent JSON schema documentation for the nonce and chainId properties to explicitly state when they are optional and when they are required; add a short note to the "nonce" description indicating acceptable omission cases (e.g., legacy transfers that used alternative replay protections or off-chain nonces) and to the "chainId" description indicating cases where chainId may be omitted (e.g., when transfers are chain-agnostic, occur on non-EVM chains, or when provenance is derived from other metadata), and include guidance on verification implications (how to verify when those fields are absent) so consumers know how to handle omission during cryptographic checks for nonce and chainId in transferEvent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.changeset/add-fraction-lexicons.md:
- Around line 1-11: Update the generated SCHEMAS.md by running the project's
schema generation script so it includes the three new lexicons:
org.hypercerts.fraction.transferEvent, org.hypercerts.fraction.saleEvent, and
org.hypercerts.order.listing (ensure the generated entries reflect the fields
described in the diff such as activityClaimUri,
signedAt/nonce/chainId/signerEVMAddress/signature for transferEvent, receipt
AT-URI for saleEvent, and goalInUSD/currency/allowOversell/status/rkey for
listing). Then manually edit ERD.puml to add the three entities (transferEvent
with optional from/to DIDs and activityClaimUri reference, saleEvent with
activityClaimUri and receipt AT-URI, and listing keyed by activity claim rkey)
and draw their relationships to existing activityClaim and funding/receipt
entities so the diagram matches the new schema.
---
Nitpick comments:
In `@lexicons/org/hypercerts/fraction/transferEvent.json`:
- Around line 48-56: Update the transferEvent JSON schema documentation for the
nonce and chainId properties to explicitly state when they are optional and when
they are required; add a short note to the "nonce" description indicating
acceptable omission cases (e.g., legacy transfers that used alternative replay
protections or off-chain nonces) and to the "chainId" description indicating
cases where chainId may be omitted (e.g., when transfers are chain-agnostic,
occur on non-EVM chains, or when provenance is derived from other metadata), and
include guidance on verification implications (how to verify when those fields
are absent) so consumers know how to handle omission during cryptographic checks
for nonce and chainId in transferEvent.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: db07ad43-9259-4e85-90db-e9f2805cec4b
📒 Files selected for processing (4)
.changeset/add-fraction-lexicons.mdlexicons/org/hypercerts/fraction/saleEvent.jsonlexicons/org/hypercerts/fraction/transferEvent.jsonlexicons/org/hypercerts/order/listing.json
…ctional sales Introduces three new lexicons: - org.hypercerts.fraction.transferEvent — immutable event for peer-to-peer fraction transfers, with full cryptographic proof (signedAt, nonce, chainId, signerEVMAddress, signature), amount as numeric string, and fiat currency - org.hypercerts.fraction.saleEvent — immutable event for fraction purchases, referencing an org.hypercerts.funding.receipt AT-URI as proof, amount as numeric string, and fiat currency - org.hypercerts.order.listing — mutable sale listing keyed by activity claim rkey (one listing per claim); fields: goal (numeric string), currency (fiat, open-ended knownValues), allowOversell, status (open/paused/closed) Also updates SCHEMAS.md (regenerated) and ERD.puml with the three new entities and their relationships to activity, contributorEntity, and fundingReceipt.
372cd51 to
d241b7e
Compare
aspiers
left a comment
There was a problem hiding this comment.
As per discussion earlier this week, I think this needs further thought. ATProto does not provide a way to easily build an immutable append-only ledger with double-counting protection or other business logic enshrined. I think we would be better off tracking this onchain. It could even be a custodial pseudo-token which is like ERC20 but not compliant and tracks balanceOf by ATProto DID instead of onchain address.
|
Agree. I think this can be closed now. |
Summary
Introduces three new lexicons to model the fractional sales lifecycle for hypercerts:
org.hypercerts.fraction.transferEvent— immutable event record for peer-to-peer fraction transfers. Carries a full cryptographic proof directly on the record (signedAt,nonce,chainId,signerEVMAddress,signature), scoped to a specific activity claim viaactivityClaimUri.org.hypercerts.fraction.saleEvent— immutable event record for fraction purchases. References anorg.hypercerts.funding.receiptAT-URI as proof of the transaction, keeping the sale provenance linked to the existing funding receipt lexicon.org.hypercerts.order.listing— mutable listing record for the sale of fractions of an activity claim. Lives underorg.hypercerts.order(separate from the fraction namespace, since it is logically independent). Keyed by the activity claim's rkey to enforce one listing per claim and enable automatic invalidation when the claim is deleted. Fields:goalInUSD,currency(open-ended with known values),allowOversell,status(open/paused/closed).Design notes
order/listingrkey convention (matching the activity claim rkey) is documented in the record description rather than enforced by the schema, consistent with how ATProto handles such patterns.Checklist
npm run gen-api— clean, all three types generated with no validation errorsnpm run format:check— all files pass Prettiernpm run test— 7/7 tests pass.changeset/add-fraction-lexicons.md,minor)Summary by CodeRabbit