RewardsCalculation

scalus.cardano.ledger.RewardsCalculation

Rewards calculation for an epoch

Implements rewards computation according to the Cardano ledger specification. Based on the POOLREAP and REWARD rules.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

case class EpochRewardsSummary(epoch: Long, totalRewards: Coin, treasuryTax: Coin, availableRewards: Coin, poolRewards: Map[PoolKeyHash, PoolRewardSummary], accountRewards: Map[Credential, Coin])

Complete rewards summary for an epoch

Complete rewards summary for an epoch

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class PoolParameters(cost: Coin, marginNumerator: Long, marginDenominator: Long, pledge: Coin)

Pool parameters needed for rewards calculation

Pool parameters needed for rewards calculation

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class PoolRewardSummary(totalRewards: Coin, leaderReward: Coin, memberRewards: Map[Credential, Coin])

Per-pool rewards breakdown

Per-pool rewards breakdown

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class RewardsConfig(monetaryExpansionRate: Double, treasuryExpansionRate: Double, minPoolCost: Coin, optimalPoolCount: Int, poolPledgeInfluence: Double)

Configuration parameters for rewards calculation

Configuration parameters for rewards calculation

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

Aggregate all member rewards into account rewards

Aggregate all member rewards into account rewards

Attributes

def computeTotalRewards(reserves: Coin, fees: Coin, config: RewardsConfig): (Coin, Coin)

Compute total rewards for an epoch

Compute total rewards for an epoch

Value parameters

config

Rewards configuration parameters

fees

Transaction fees collected

reserves

Current reserve pot

Attributes

Returns

(total rewards, treasury portion)

def distributePoolRewards(availableRewards: Coin, poolStakes: Map[PoolKeyHash, Coin], poolParams: Map[PoolKeyHash, PoolParameters], totalActiveStake: Coin, config: RewardsConfig): Map[PoolKeyHash, Coin]

Compute rewards distribution among pools

Compute rewards distribution among pools

Simplified rewards calculation that distributes available rewards proportionally to pool stakes.

Value parameters

availableRewards

Rewards available after treasury tax

config

Rewards configuration

poolParams

Pool parameters (cost, margin, pledge, etc.)

poolStakes

Stake delegated to each pool

totalActiveStake

Total active stake in the system

Attributes

Returns

Rewards for each pool

def splitPoolRewards(poolReward: Coin, poolParams: PoolParameters, poolStake: Coin, memberStakes: Map[Credential, Coin]): PoolRewardSummary

Split pool rewards between leader and members

Split pool rewards between leader and members

Value parameters

memberStakes

Individual delegator stakes

poolParams

Pool parameters (margin, cost)

poolReward

Total reward for the pool

poolStake

Total stake delegated to pool

Attributes

Returns

Breakdown of rewards