CIP-104 rewards-accounting walkthrough script - #70
Open
pepebndc wants to merge 4 commits into
Open
Conversation
Adds Cip0104RewardsWalkthrough.daml to the interop exemplar: a step-by-step script showing which settlement functions an integrator calls, balances and accumulated attributable activity before/after each action, that failed non-executor settles accrue nothing, and an illustrative round-close reward distribution across beneficiaries. All reward math is off-ledger Daml Script computation over SettlementReceipt and SettlementEventLogEntry queries; no reward-marker templates are introduced. Registers the script in the LocalNet gate (now 12 scripts) and updates the LOCALNET.md scenario row. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…SON Ledger API Adds experiments/interoperability/app-rewards/harness.mjs, a Node client that consumes the CIP-0112 settlement surface the way real CIP-0104 reward infrastructure would: mint, allocation, and settlement driven over the JSON Ledger API v2 (factory passed as a disclosed contract), with attribution and the illustrative accrued reward derived purely from Ledger API reads of SettlementReceipt and SettlementEventLogEntry. It replays the same six steps and asserts the same numbers as Cip0104RewardsWalkthrough.daml so the two artifacts stay in lockstep. scripts/localnet-cip0104-rewards-walkthrough.sh boots a wallclock sandbox with the JSON API enabled, runs the harness, and tears down. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…d Technical English Rewrites all prose in the PR's files to follow ASD-STE100 style: short sentences, one idea per sentence, active voice, present tense, no idioms. Code and log output stay unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sends the dpm build output to a log file, removes the job-control Terminated message at teardown, and shows only the error code for the expected step-3 rejection. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
pepebndc
marked this pull request as ready for review
August 7, 2026 10:36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two artifacts telling the same CIP-0104 rewards-accounting story, one on each side of the ledger boundary:
1. A narrated on-ledger walkthrough (
Cip0104RewardsWalkthrough.daml) addstest_cip0104_rewardsAccountingWalkthrough, a step-by-step script showing:ToyHoldingcreate),SettlementFactory_CreateAllocationInstruction+AllocationInstruction_Acceptper side,SettlementFactory_SettleBatchby the app-provider executor;SettlementReceipt+SettlementEventLogEntryqueries, and an illustrative accrued reward;Registered in the LocalNet gate (
scripts/localnet-cip-interop-validation.sh, now 12 scripts) with the CIP-0104 row updated in LOCALNET.md.2. A fully off-chain client (
app-rewards/harness.mjs+ README) that consumes the settlement surface the way real CIP-0104 reward infrastructure would: a Node harness driving mint, allocation, and settlement over the JSON Ledger API v2 (factory handed to the executor as a disclosed contract), deriving attribution and the accrued reward purely from Ledger API reads. It replays the same six steps and asserts the same numbers as the Daml walkthrough, so the on-ledger executable spec and the off-chain consumer stay in lockstep. Launched byscripts/localnet-cip0104-rewards-walkthrough.sh(wallclock sandbox, no deadline, mirrors the wallet-gateway gate's structure).In both artifacts the reward math is clearly-labeled illustrative stand-ins for CIP-0104's off-ledger traffic-proportional CC calculation (deferred to M2, per the DEX reference architecture section 6.2), and no reward-marker templates are introduced, preserving the exemplar's core CIP-0104 property.
Why
The existing
Cip0104AppRewardsscripts prove the structural properties but do not narrate how rewards are distributed and accounted for. The walkthrough pair gives integrators both the ledger-side spec and a concrete off-chain consumer of it (coordinated with Ionut).Validation
Sample narrative (identical from both artifacts):
🤖 Generated with Claude Code