RewardCovenant distributes variable-amount rewards per event. The authority controls the exact amount per reward, bounded by maxRewardAmount.
Contract path: contracts/core/distribution/RewardCovenant.cash
CashScript version: ^0.13.0
Constructor Parameters (Bytecode-Embedded)
| Parameter | Type | Description |
|---|---|---|
vaultId | bytes32 | Links to source vault |
authorityHash | bytes20 | Issues all rewards |
maxRewardAmount | int | Upper bound per single reward |
totalPool | int | Total reward budget |
startTimestamp | int | When rewards open. 0 = immediate. |
endTimestamp | int | When rewards close. 0 = no expiry. |
NFT State (40 bytes)
Transaction Structure
All entrypoints spend reward state fromtx.inputs[0].
| Function | Required outputs | Notes |
|---|---|---|
reward | tx.outputs[0] recipient payout, tx.outputs[1] updated covenant UTXO | Variable payout amount chosen per call, bounded on-chain. |
pause | tx.outputs[0] updated covenant UTXO | Status ACTIVE -> PAUSED. |
resume | tx.outputs[0] updated covenant UTXO | Status PAUSED -> ACTIVE. |
cancel | tx.outputs[0] authority payout | Consumes reward UTXO. |
Functions
reward(sig authSig, pubkey authPubkey, bytes20 recipientHash, int rewardAmount)
Authority-only reward issuance.
Validation
- Authority identity/signature check.
- Status must be
ACTIVE. - Optional time-window checks (
startTimestamp,endTimestamp) viatx.locktime. 0 < rewardAmount <= maxRewardAmount.newTotalDistributed = totalDistributed + rewardAmountmust be<= totalPool.
tx.outputs[0]paysrecipientHashwithrewardAmount(BCH or FT mode by flag bit2).tx.outputs[1]must preserve covenant bytecode/token category and commit:- updated
total_distributed - updated
rewards_count last_reward_timestamp = tx.locktimestatus = COMPLETEDwhen pool is exhausted
- updated
pause() / resume() / cancel()
Authority-only admin paths.
Pause / Resume
pauserequiresACTIVEplus cancelable flag bit0.resumerequiresPAUSED.- Both require output
0as covenant continuation output with updated status.
- Requires status
ACTIVEorPAUSED, plus cancelable flag bit0. - Computes
remainingPool = totalPool - totalDistributed, requiresremainingPool > 0. tx.outputs[0]must pay authority with remaining BCH/FT.

