Module rewards

Source
Expand description

Defines pluggable reward models for computing and distributing value across participants.

Rewards are abstracted into two main models:

§Payout (payout)

  • Computes the total reward value to be distributed.
  • Produces a single payout amount that acts as the source value for downstream distribution.

In this model:

  • Input is a scalar representing a measurable quantity (e.g., stake, era, score).
  • Output is a total payout value.

Useful for scenarios where:

  • The system must determine how much value is available for distribution.
  • Reward generation follows configurable economic or logical rules.

§Payee (payee)

  • Distributes the computed payout among a set of participants.
  • Consumes the payout value and allocates it across entities.

In this model:

  • Input is (Payout, [(Id, Share)]).
  • Output is [(Id, Payout)] allocations.

Useful for scenarios where:

  • The total reward must be split among multiple participants.
  • Allocation depends on contribution, weight, or equal participation.

§Purpose

Separating reward computation into payout and payee provides flexibility:

  • Payout determines how much total value is available.
  • Payee determines how that value is distributed.

This separation enables:

  • Independent evolution of reward generation and distribution strategies.
  • Composable reward pipelines.
  • Extensibility without modifying existing models.

Re-exports§

pub use payout::*;
pub use payee::*;

Modules§

payee
Defines pluggable payee models for distributing a total payout across a set of participants.
payout
Defines pluggable payout models for computing the total reward value from an input signal.