Repository navigation
feat(contracts): view and claim contract fee pots - #1121
Claudius-Maginificent wants to merge 15 commits into
Conversation
On protocol 14 a contract keeps an owner and a moderators fee pot, filled by document action fees (ContractFeePots capability). Both pots are read together with an elected contract's seated moderation team, which claims the moderators pot instead of the interim team. A claim needs a CRITICAL authentication key not bound to a contract and is refused before signing without one. The claimant's new balance is stored afterwards; a claim the network paid out is reported as paid out even if saving that balance fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
Map Platform's refusals of a fee claim (identity not a recipient, pot already claimed this epoch, nothing to claim) to dedicated TaskError variants, plus local refusals for networks without fee pots and for a claimant without a usable key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
The Contracts screen offers Fee Pots where the network keeps them. It shows both pots of a contract with their balance and last payout, offers a claim only to an identity that receives the pot, blocks claims Platform would refuse, and reports failed reads and claims on the screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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 |
|
🕓 Review not started yet because this PR is a draft.
Commit bf2b257. Normal review starts when eligible; priority review starts as soon as a slot is available. |
…efusals from the signing key branch Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
A moderators-pot claim pays the whole team, and the proved claim result carries every paid identity's new balance. Each one kept on this device is stored now, not only the claimant's; paid identities not kept here are skipped, and a failed write still reports the claim as paid out. Also merges the module's two impl blocks and drops an unrelated dpns_contract() cleanup from this branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
…ract fee pot branch Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q # Conflicts: # src/context/feature_gate.rs
The Platform bump dropped DET's protocol version copy, so fee pot tests have the SDK prove the version instead of setting it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
…to the contract fee pots branch Conflict in src/context/feature_gate.rs: this branch adds the ContractFeePots capability and gate, v1.0-dev (via #1117) adds NonTransferableTokens. Both stay, and the protocol 14 gate tests cover both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
|
Next steps: the updated #1117 head is merged into this branch locally and verified (fmt, clippy, area tests); it will be pushed right after #1117. Once #1117 merges, this PR gets retargeted to 🤖 Co-authored by Claudius the Magnificent AI Agent |
…e-pots Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
…t-fee-pots Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WunYYhY7P2FJqHVgkHiXtT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WunYYhY7P2FJqHVgkHiXtT
TL;DR: On networks running protocol 14, the Contracts screen has a new Fee Pots view. It shows the owner and moderators fee pots of a contract and lets an identity that receives a pot claim it, including the seated moderation team of an elected contract.
Stacked atop #1117.
User story
As a contract owner or moderator, I want to see what my contract's document fees have collected and claim it, so that the fees reach my identity (DOC-012).
Scenario
Base flow
Actual
The app had no way to see or claim a contract's fee pots.
Expected
Detailed discussion
src/context/feature_gate.rs):Capability::ContractFeePots/FeatureGate::ContractFeePotsopens at upstream'sCONTRACT_FEE_CLAIM_INITIAL_PROTOCOL_VERSION, and only once the network has proven it runs that version. Before that, the backend refuses both the read and the claim (TaskError::ContractFeePotsNotSupported).src/backend_task/contract_fee_pots.rs):ContractTask::FetchContractFeePotsreads both pots. A contract nobody has paid fees to reads as two empty pots.src/model/contract_fee_pots.rs): only identities that receive a pot are offered. The owner pot goes to the contract owner; the moderators pot goes to a member of the moderation team.SigningScope::NonBatch). Without such a key, the claim is refused before anything is signed (TaskError::NoFeeClaimSigningKey).TaskError::ContractFeesAlreadyClaimedThisEpoch).ContractFeesClaimedButBalanceNotSaved), so the user does not claim again.src/backend_task/error.rs): dedicated messages cover an identity that does not receive the pot, a pot already claimed this epoch, an empty pot, a network without fee pots, and no usable claim key. Each refusal from the network keeps the SDK error as its source.Testing
model::contract_fee_pots: who may claim each pot, including seated and interim teams, an unread team, and a contract without moderation.backend_task::contract_fee_pots::tests:fee_pots_need_a_network_that_keeps_them;a_claim_needs_a_critical_unbound_key;a_claim_whose_balance_cannot_be_saved_is_reported_as_paid_out;a_claim_stores_the_new_balance_of_every_paid_identity_kept_here.ui::contracts_documents::contract_fee_pots_screen::tests:context::feature_gate(the capability gate) andbackend_task::error(the refusal mappings).contract_fee_pots: 15 passed.cargo clippy --all-features --lib --tests -- -D warningsandcargo fmt --allpass.🤖 Co-authored by Claudius the Magnificent AI Agent
🤖 Generated with Claude Code
https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q