Emissions streams a fixed amount of STK to sUSDG stakers over a fixed schedule. The owner funds the contract with STK and calls start once; the rate is total divided by duration and never changes. Holders stake sUSDG here to earn, since reading raw balances would leak rewards on transfer. Seconds with no stake are skipped, not banked.
Emissions lets you:
- Stake sUSDG to earn streamed STK
- Unstake sUSDG at any time and harvest rewards
- Claim pending STK
- Read the schedule and pending rewards
Addresses per network. Every address is also on Addresses.
The source code is src/token/Emissions.sol on GitHub. The ABI is /abis/Emissions.json.
Write methods
start
Locks the schedule using the STK already held by the contract. Owner only, once. Reverts with AlreadyStarted, InvalidDuration for 0, and ZeroAmount if the STK balance or the resulting per-second rate is 0.
Owner only. Transfer the full STK allocation before calling; STK sent later is not streamed and cannot be withdrawn.
Floor(total / duration) is the rate. Remainder dust stays here forever.
Input parameters
stake
Harvests any pending STK, then pulls shares sUSDG from the caller and adds them to the stake. Works before start; rewards begin when the stream starts. Reverts with ZeroAmount for 0.
The caller must approve Emissions for the sUSDG shares.
Harvest first so a later stake cannot dilute an unpaid claim.
Input parameters
unstake
Harvests any pending STK, then returns shares sUSDG to the caller. Reverts with InsufficientStake above the staked balance and ZeroAmount for 0.
Input parameters
claim
Transfers all pending STK to the caller. Reverts with NotStarted before start and ZeroAmount when nothing is pending.
Read methods
pending
Returns the STK an account could claim right now, including the stream since the last accrual.
Input parameters
Return values
Events
Started
Fires once when the schedule is locked, with the total, duration, and rate.
Staked
Fires when an account stakes sUSDG.
Unstaked
Fires when an account withdraws sUSDG.
Claimed
Fires when STK is paid out, by claim or by the harvest inside stake and unstake.
Errors
ZeroAddress
A constructor address was zero.
NotOwner
Only the owner can start the stream.
AlreadyStarted
start was called twice.
NotStarted
claim was called before start.
ZeroAmount
An amount was zero, no STK was held at start, or nothing was pending.
InvalidDuration
The duration was 0.
InsufficientStake
The unstake amount exceeds the staked balance.