Splice.Amulet.RewardAccountingV2
Templates and support code for reward accounting based on off-ledger calculations, as initially described in CIP-104 for traffic-based app rewards.
It is a Version 2 compared to the previous reward accounting mechanism that is based on tracking all state on-ledger using App|Validator|SvRewardCoupon and IssuingMiningRound contracts.
The design is flexible to allow for extending it to other kinds of rewards that are based on off-ledger calculations, but the initial implementation is specialized to traffic-based app rewards.
Templates
template CalculateRewardsV2
State contract tracking the need to calculate and confirm the app reward amounts for the given round.
Signatory: dso
Field
Type
Description
dso
round
roundClosedAt
The time at which the round was closed. This should be equal to the creation time of this contract. We store this for ease of doing debugging and gathering metrics.
rewardCouponTimeToLive
Time to live for reward coupons that are created. We store this as part of requesting the calculation of rewards to avoid reading the AmuletConfig later again, which could lead to inconsistencies in case of config changes.
dryRun
Whether to only simulate the confirmation without creating any RewardCouponV2 contracts.
Choice Archive
Controller: dso
Returns: ()
(no fields)
template ProcessRewardsV2
State contract tracking outstanding processing of rewards for a given round and batch hash.
Signatory: dso
Field
Type
Description
dso
round
roundClosedAt
The time at which the round was closed. Copied from the originating CalculateRewardsV2 contract. We store this for ease of doing debugging and gathering metrics.
dryRun
Whether to only simulate the processing without creating any RewardCouponV2 contracts.
rewardCouponTimeToLive
batchHash
Choice Archive
Controller: dso
Returns: ()
(no fields)
Choice ProcessRewardsV2_ProcessBatch
Controller: dso
Returns: ProcessRewardsV2_ProcessBatchResult
Field
Type
Description
batch
providersWithWrongVettingState
Service providers that do not have the correct vetting state for receiving rewards.
Data Types
data Batch
BatchOfMintingAllowances MintingAllowances
instance GetField "batch" ProcessRewardsV2_ProcessBatch Batch
instance SetField "batch" ProcessRewardsV2_ProcessBatch Batch
data MintingAllowance
A minting allowance for a service provider to mint Amulet.
instance Hashable MintingAllowance
instance Eq MintingAllowance
instance Show MintingAllowance
instance GetField "amount" MintingAllowance Decimal
instance GetField "provider" MintingAllowance Party
instance SetField "amount" MintingAllowance Decimal
instance SetField "provider" MintingAllowance Party
- type MintingAllowances
= [MintingAllowance]
data ProcessRewardsV2_ProcessBatchResult
ProcessRewardsV2_ProcessBatchResult
(no fields)
instance Eq ProcessRewardsV2_ProcessBatchResult
instance Show ProcessRewardsV2_ProcessBatchResult
instance HasExercise ProcessRewardsV2 ProcessRewardsV2_ProcessBatch ProcessRewardsV2_ProcessBatchResult
instance HasFromAnyChoice ProcessRewardsV2 ProcessRewardsV2_ProcessBatch ProcessRewardsV2_ProcessBatchResult
instance HasToAnyChoice ProcessRewardsV2 ProcessRewardsV2_ProcessBatch ProcessRewardsV2_ProcessBatchResult
Comments