RewardPool

Introduction

The RewardPool contract encapsulates the emission logic for MOR tokens across multiple reward buckets. It defines how MOR tokens are distributed over time using emission curves, serving as a shared utility that ensures controlled and sustainable token issuance within the protocol.

The contract supports multiple independent reward pools, each corresponding to a specific bucket — a category of protocol participants eligible to earn MOR rewards. These buckets include Capital, Provider, Builder, Compute, Code, and Protection.

It implements a linear interval-based emission decay model using the LinearDistributionIntervalDecrease library. The contract allows the protocol owner to register reward pools with distinct configurations and provides utilities to query reward amounts over time. Each reward pool has its own emission curve, with customizable payout start time, emission amount, and decay interval.

By isolating emission logic from staking and distribution, RewardPool enables independent upgrades and adjustments to token economics without affecting user balances or yield sources. This modular design helps ensure scalability, transparency, and long-term reward sustainability across the ecosystem.

Storage

rewardPools

The MOR reward pools data, where the pool #0 is a capital reward. pool. rewardPools[<rewardPool>]

RewardPool[] public rewardPools;

struct RewardPool {
  uint128 payoutStart;
  uint128 decreaseInterval;
  uint256 initialReward;
  uint256 rewardDecrease;
  bool isPublic;
}
Name
Description

payoutStart

The unix epoch timestamp in seconds when the pool starts to pay out rewards.

decreaseInterval

The interval in seconds between reward decreases.

initialReward

The initial MOR reward for the bucket. Wei.

rewardDecrease

The MOR reward decrease per decreaseInterval. Wei.

isPublic

true - for Capital bucket, false for others.

Write functions for the contract owner

RewardPool_init

Initializes the contract with a list of reward pool configurations.

function RewardPool_init(RewardPool[] calldata poolsInfo_) external initializer
Name
Description

poolsInfo_

Array of reward pool configs to initialize with.

addRewardPool

Adds a new reward pool to the registry. Only callable by the contract owner.

function addRewardPool(RewardPool calldata rewardPool_) public onlyOwner
Name
Description

rewardPool_

Reward pool configuration with emission parameters.

Validation functions uses by protocol

onlyExistedRewardPool

Reverts if the specified reward pool does not exist.

function onlyExistedRewardPool(uint256 index_) external view
Name
Description

index_

Index of the reward pool to verify.

onlyPublicRewardPool

Reverts if the specified reward pool is not public.

function onlyPublicRewardPool(uint256 index_) external view
Name
Description

index_

Index of the reward pool to verify.

onlyNotPublicRewardPool

Reverts if the specified reward pool is public.

function onlyNotPublicRewardPool(uint256 index_) external view
Name
Description

index_

Index of the reward pool to verify.

Read functions

getPeriodRewards

Calculates the total rewards to be distributed in a given time range using the pool’s emission curve.

function getPeriodRewards(uint256 index_, uint128 startTime_, uint128 endTime_) external view returns (uint256)
Name
Description

index_

Index of the reward pool.

startTime_

Start of the time interval (Unix timestamp in seconds).

endTime_

End of the time interval (Unix timestamp in seconds).

isRewardPoolExist

Checks if a reward pool exists at a specific index.

function isRewardPoolExist(uint256 index_) public view returns (bool)
Name
Description

index_

Index of the reward pool to check.

isRewardPoolPublic

Checks if a reward pool is marked as public.

function isRewardPoolPublic(uint256 index_) public view returns (bool)
Name
Description

index_

Index of the reward pool to query.

supportsInterface

Used for interface detection (ERC165). Returns true if the contract supports a specific interfaceId_. Supports IChainLinkDataConsumer, IERC165.

function supportsInterface(bytes4 interfaceId_) external pure returns (bool)

version

Returns the current version of the contract.

function version() external pure returns (uint256)

Last updated

Was this helpful?