Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

36 Commits

Folders and files

Repository files navigation

rewards-beam

RewardsBeam lets a facilitator multisig re-rate the vesting stream that funds a treasury-funded farm, within boundaries set by Sky governance. It is the on-chain equivalent of the TreasuryFundedFarmingInit.updateFarmVest routine that governance spells run today.

set(vestTot)

set() rolls over an existing stream; it never creates the first one. Governance must have created the initial stream and pointed dist at it (dist.vestId() != 0), otherwise the call reverts.

One call performs the whole rollover atomically:

  1. flush whatever the outgoing stream still owes the farm (dist.distribute()),
  2. retire it (vest.yank),
  3. create the replacement stream, beginning now, and restrict it (vest.create + vest.restrict),
  4. point the distribution contract at it (dist.file("vestId", …)).

Every call restarts the stream for a full vestTau and resets the cooldown, even if vestTot is unchanged.

There is normally a delay before the new rate fully applies, as the old remaining distribution is spread together with the new rewards.

Boundaries

Governance files each knob. A freshly deployed beam is inert: maxVestTot defaults to 0, so nothing can be executed until governance files it.

Param Unit Description
maxVestTot token decimals precision max total of a new stream
vestTau s duration of a new stream; between 1 second and 20 years
tau s cooldown between set() calls
toc unix ts last set() timestamp

The facilitator sets one number: how much to stream. vestTau is governance-only, so the rate a facilitator can reach is bounded by maxVestTot / vestTau, both ends governance-owned. Lowering vestTot is unbounded: at worst it starves the farm, which governance can revive, and the funds simply stay in the treasury.

Treasury funding is governance's job, not the beam's

The beam is not the treasury and cannot approve on its behalf, so — unlike the spell routine — it does not adjust the treasury's gem allowance to vest. It does not check it either. A pre-flight check would be worth little:

  • The allowance is a bookkeeping figure the treasury balance does not necessarily back.
  • DssVest draws unpaid progressively over vestTau, never vestTot at once, so requiring up-front coverage is stricter than the system needs.
  • The token already caps cumulative transfers at the allowance, on every distribution, with or without the beam looking.

The funding check that matters comes for free: set() flushes the outgoing stream first, which moves real tokens, so the call reverts if the treasury cannot cover what is currently due. Keeping the stream payable from there on is governance's job, exactly as it is when the balance runs low. The beam's own boundary is maxVestTot.

vest.cap() is a second, independent governance-owned rate ceiling that vest.create enforces. The beam is deliberately not a cap filer — raising cap would affect every stream of the vest, not just this farm's.

The farm's rewardsDuration is deliberately out of scope: re-rating the notification window is a structural decision for the full governance process.

Stopping the stream

A governance yank of the current stream does not, by itself, stop the beam: the next set() would create a fresh stream and reactivate the farm. When governance retires the stream, it should disable the beam in the same spell, by any of:

  • diss every facilitator, so no one can call set();
  • file("maxVestTot", 0), so no non-zero stream fits (and vest.create rejects a zero one);
  • file("tau", type(uint64).max) or file("toc", type(uint128).max) filing an unreachable cooldown
  • deny the beam on vest or on dist, so the rollover reverts.

RewardsBeamMom does both without the governance delay: stop() files tau to type(uint64).max, an unreachable cooldown, and yanks the current stream. Reviving the beam is a matter of filing tau back. What has accrued until then stays claimable, so the farm still receives it.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages