Overview
The YieldDistributor pays out C0 yield in weekly periods. Each period the operator publishes a merkle root summarizing every holder’s share for the prior week; holders then claim their cut by submitting their leaf and proof against that root. Two function calls cover the holder side:getPeriods— fetch every period the holder has a leaf in, with status, root, and merkle proof. Resolved entirely client-side from your wagmiConfig+ the public artifact endpoint — no API key needed.claim— submit one period’s claim. The on-chainclaim()transfers C0 to the leaf’saccountregardless of who signs the transaction.
How a period works
Every period moves through three phases:- Published — the operator commits a merkle root, exclusion list hash, and total amount on-chain. Claims revert with
NotFinalizedduring this window. - Finalized — after a ~24h replace window, claims open. The operator can no longer replace the root.
- Expired — after the claim window closes, unclaimed funds are sweepable to a recipient. Holders can no longer claim that period.
getPeriods applies the same phase rules client-side, so any entry it returns with status: "unclaimed" is safe to submit immediately.
Reads
Claim
The SDK ships two high-level helpers that wrap proof resolution + the on-chain write:getPeriods returns { data: Period[], count }. Each Period carries its own status: "claimed" | "unclaimed"; filter client-side for the entries you want to submit.
If you want to call the contract directly (custom proof source, calldata-only path, etc.) the wagmi-generated entry point is also exported:
msg.sender is unconstrained — anyone can submit the claim on a holder’s behalf; the funds always go to the account embedded in the leaf.
Watch events
Claimed, Published, Paused, Unpaused, Swept, and RootReplaced all have matching watchYieldDistributor*Event exports — IDE autocomplete on watchYieldDistributor will list them. Admin-only events (role changes, parameter updates) are filtered out of the SDK surface.
Revert reasons
| Error | Meaning |
|---|---|
NotFinalized | Period is still in its 24h replace window. Wait for finalization. |
Expired | Claim window has closed. The leaf is no longer claimable. |
AlreadyClaimed | This (periodId, index) pair has already been submitted. |
InvalidProof | Proof doesn’t verify against the on-chain root. Check the leaf came from the matching period. |
OverAllocated | Per-period cap reached. Indicates a published root with Σ leaves > totalAmount — operator bug. |
ZeroAddress | The leaf’s account is the zero address. |
EnforcedPause | The contract is paused. |
What’s next
- How to claim yield — runnable step-by-step
- C0 Token — read balances and transfer C0