Staking
A position is one miner and one token. It holds three numbers: the amount staked, the time it was last settled, and the tribute already settled and waiting to be claimed. Everything on this page moves one of those three.
There are four calls. Three are yours. The fourth, poke, anyone can make for anyone.
| Call | Who | Settles | Moves | Event |
|---|---|---|---|---|
| stake | You | Your position in that token | The stock token, into the mine | Staked |
| unstake | You | Your position in that token | The stock token, back to you | Unstaked |
| claim | You | Every position you hold | WINZE, to you | Claimed |
| poke | Anyone | Every position of the named miner | Nothing | None |
You can run all of this without a wallet first, in the simulator.
In short
- Staking is two transactions: approve the stock token, then stake.
- Every call settles first, then does its work.
- Settlement writes tribute into claimable. It transfers nothing.
- Claim transfers, for every token at once, with no cooldown and no fee.
- Unstake is never refused for any reason except the amount.
Approve, then stake
A stock token is an ERC20. The mine pulls it in with transferFrom, so the mine needs an allowance before it can pull anything. That is two transactions: an approval on the stock token, then stake on the mine. The interface runs them as one flow and keeps the same label through both steps.
Inside the mine, a stake does this, in this order.
- Refuses an amount of zero.
- Refuses if the mine has not been handed its pool yet.
- Refuses if the pool is already exhausted.
- Refuses if the token is not listed.
- Reads the token price. Refuses if the price source does not answer.
- Settles the position you already have in that token, at that price.
- Adds the amount to your position and to the token total.
- Emits
Stakedwith the amount and its USD value. - Re-evaluates the level, emitting one
Halvingfor each level crossed. - Pulls the tokens in.
The token total goes up before the level is re-evaluated, so your own deposit counts toward the crossing it causes. If it takes the mine past a threshold, you stake at the old rate and finish the transaction at the new one.
What settlement does
The mine does not update every position every second. It settles a position when something touches it, and only then. Settlement pays the interval since the last settlement and moves it into claimable. It transfers nothing.
tribute = value of the position in $ now
x tribute per $ per second
x seconds since the last settlementThe interval is cut at every halving inside it and each piece is paid at the rate of its own epoch. The value of the position is read once, at the price of the moment of settlement, and that one value is used for the whole interval. That is an approximation, and risks says what it costs.
Settled tribute is added to the mine's minted counter at the same moment, so the pool runs down as tribute is settled, not as it is claimed.
How claimable accrues
At level 0 the tribute is 0.1 WINZE for every dollar, every day. A position worth $10,000 accrues 1,000 WINZE a day at level 0 and 500 at level 1. It accrues every second, not in a lump at midnight.
A halving inside an interval splits it. Take the same $10,000 position held for one day, with the crossing to level 1 landing exactly halfway through.
| Part of the day | Level | Tribute per $ per day | WINZE |
|---|---|---|---|
| First half | 0 | 0.1 | 499.999999999999999999 |
| Second half | 1 | 0.05 | 249.999999999999999999 |
| Settled for the day | 749.999999999999999998 |
Two figures exist at once. claimable on the position is what has been settled. pendingTribute is that plus everything accrued since, capped by what is left in the pool. The app shows the second one, and the counter moves it forward second by second between reads. The number on chain only moves when something settles.
Unstake
unstake settles the position, reduces it, emits Unstaked, re-evaluates the level and sends the token back. There is no lock, no cooldown and no fee. Unstaking part of a position leaves the rest accruing.
Unstaking does not touch claimable. Tribute settled before you left stays yours and is still claimable afterwards. Unstaking everything does not lower the level either: the level only moves deeper.
Unstake works when the token has been delisted, when its price source is broken, and after the pool is exhausted. It is the one action the mine never refuses for any reason other than the amount being zero or larger than the position.
Claim
claim settles every token you have ever staked, adds the claimable of each one, zeroes them, emits Claimed and transfers the WINZE. One call covers every token. There is no cooldown and no fee.
The WINZE is transferred out of the mine's own balance. It was minted once at deploy and has been sitting in the mine since. Nothing is minted at claim time.
Claiming with nothing settled and nothing pending reverts. After the pool is exhausted, claim still pays out everything that was settled before the end.
Poke
poke(user) is public. Anyone can call it for any address. It settles every position of that miner and re-evaluates the level. It transfers nothing and pays the caller nothing.
It exists for two reasons.
- A price rise can lift TVL past a threshold with no transaction behind it. The level only moves when someone touches the mine. A poke is the cheapest way to make it move.
- Settling writes a miner's accrued tribute into claimable at the price of that moment, which is also what fixes the price used for the interval.
Poking someone during a price source outage is safe. The settlement of the affected position is skipped and its last settled time is kept, so the interval is not consumed and nothing is lost.
Poking someone at a moment of the caller's choosing is not always harmless, because it fixes which price the interval settles at. That is in risks.
A delisted token
The owner can delist a token with delistToken. It emits TokenDelisted and blocks new stakes of that token. That is all it does.
- Positions in it keep accruing tribute at the current rate.
- It still counts in TVL, so it still counts toward the next level.
- Unstake, claim and poke are unaffected.
- The owner can list it again later.
Delisting is not a way to end a position. If you want out of a delisted token, unstake it.
What can go wrong
Every refusal is a named error, and the interface has one sentence for each. These are the ones a miner can meet. The full list is in contracts.
| Error | Raised when |
|---|---|
| ZeroAmount | Stake or unstake with an amount of zero. |
| NotListed | Stake a token the mine does not list, or one that has been delisted. |
| PriceUnavailable | Stake a token whose price source is not answering. Unstake and claim are unaffected. |
| InsufficientStake | Unstake more of a token than you have staked. |
| NothingToClaim | Claim with nothing settled and nothing pending. |
| MineExhausted | Stake after the pool has been paid out. Unstake and claim still work. |
| MineNotReady | Stake or claim before the mine has been handed its pool. Only possible during a deploy. |
| InsufficientAllowance | Stake before the approval covers the amount. The approve step comes first. |
| TransferFromFailed | The stock token refused to move into the mine. Check the balance and the approval. |
Network conditions read differently again. A dead node and the wrong network both produce a specific sentence and a single action, rather than a contract error.