MOR emission logic

The LinearDistributionIntervalDecrease library implements a reward calculation strategy designed for protocols that emit a fixed token amount per interval, with a predictable linear decrease in the emission rate over time. This pattern is used for long-term token emission schemes (e.g., MOR) that reward staking participants based on when they joined and how long they stayed.

Overview

The key concept is linear emission with interval-based reduction. Instead of updating user rewards every second, the protocol defines a base reward amount that decreases linearly every fixed time interval (e.g., s). This model balances emission precision and computational efficiency, making it ideal for large-scale staking systems.

Emission scheme params

  • initialAmount — the starting reward amount per interval (e.g., 1000 tokens per day).

  • decreaseAmount — how much the reward decreases per interval (e.g., 10 tokens less per day).

  • interval — time in seconds (e.g., 86400 for daily).

  • payoutStart — timestamp when emissions start.

  • startTime / endTime — the specific time window to compute rewards for.

Internally, reward calculation over a range (e.g., user staking from day 4 to day 10) is split into three parts:

  1. Partial First Interval

    If the time window begins within an interval (not at its start), a proportional reward is computed based on how much of that interval is included.

  2. Full Intervals in the Middle

    If the period spans multiple full intervals, the total reward for these is computed efficiently using an arithmetic sum of decreasing values:

        initialReward * ip_ - (decreaseAmount_ * (ip_ * (ip_ - 1))) / 2

This handles the geometric drop without looping over each interval.

  1. Partial Last Interval

    If the time window ends within an interval, a proportional reward for the trailing part is added, similar to the first part.

If the input endTime_ exceeds this cutoff, it’s clamped to avoid negative rewards.

Emission cutoff

The system prevents reward underflow by computing a maximum emission end time. This is the timestamp when the emissions would naturally reduce to zero:

maxIntervals = ceil(initialAmount / decreaseAmount)
maxEndTime = payoutStart + maxIntervals * interval

Last updated

Was this helpful?