Skip to content

Contracts

The mine is three contracts on each chain. Everything the rest of these docs describes is readable from them.

In short

  • WinzeToken is the ERC20. Fixed supply, no owner, no mint function.
  • WinzeMine holds the pool, the stakes, the levels and the rate history.
  • A price source gives the mine a USD price for each listed token.
  • Four actions, a set of free views, four owner calls.
  • The ABIs are below. The addresses land when the mine is deployed.

The three contracts

  • WinzeToken is the WINZE ERC20. Fixed supply, minted once at deploy, no owner and no mint function.
  • WinzeMine holds the pool, the stakes, the levels and the rate history. Every action and every view on this page is on it.
  • A price source gives the mine a USD price for each listed token. Either ManualPriceSource or ChainlinkPriceSource, behind the same interface. See prices.

The interface

Actions

Actions on the mine
FunctionWhat it does
stake(address token, uint256 amount)Settles, then adds to a position.
unstake(address token, uint256 amount)Settles, then removes from a position. Never blocked by a price or a delisting.
claim() returns (uint256)Settles every position of the caller and transfers the total.
poke(address user)Settles every position of a miner. Anyone can call.

Views

Views on the mine
FunctionWhat it returns
mineSummary()TVL, level, rate, next threshold, minted, left, exhausted, epoch count.
tvlUsd()Total value staked, USD 1e18. A token with no price counts as zero.
tributePerUsdPerDay()The current rate, per $ per day, 1e18.
currentRatePerUsdPerSecond()The current rate per second, 1e36.
thresholdFor(uint32 level)TVL at which a level starts. Pure.
rateForLevel(uint32 level)Rate per $ per second at a level. Pure.
nextLevelThreshold()Where the next halving is.
epochCount()How many rate epochs exist.
allEpochs()The full rate history, one entry per halving.
remaining()WINZE left in the pool.
listedTokens()Tokens that can be staked right now.
allTokens()Every token the mine has ever tracked, listed or not.
tokenInfo(address token)Listing, source, total staked, decimals, price, price time.
isStale(address token)True past seven days, or when the source will not answer.
pendingTribute(address user)Claimable plus unsettled, capped by the pool.
positionOf(address user, address token)Amount, USD value, tribute per day, claimable.
positionsOf(address user)Every position with a stake or claimable tribute.
minerSummary(address user)Staked value, tribute per day, claimable, token count.
All of these are free to read and batch friendly. The app calls them directly, with no indexer in between.

Owner only

Owner only
FunctionWhat it does
setWinze(address)One shot, before the mine opens. Requires the pool to be held.
listToken(address token, address src)Lists a token with its price source.
delistToken(address token)Blocks new stakes of a token. Nothing else.
setPriceSource(address token, address src)Repoints a token at another source.
Plus the Solady ownership functions. What these powers amount to is set out in risks.

Events

The full life of the mine is readable from these. The app reads Halving for the level history, and a miner's own Staked, Unstaked and Claimed for their history, from the deploy block.

Events
EventContract
Staked(address user, address token, uint256 amount, uint256 usdValue)WinzeMine
Unstaked(address user, address token, uint256 amount)WinzeMine
Claimed(address user, uint256 amount)WinzeMine
Halving(uint32 newLevel, uint256 newRate, uint256 tvlAtCross)WinzeMine
TokenListed(address token, address priceSource)WinzeMine
TokenDelisted(address token)WinzeMine
PriceSourceSet(address token, address priceSource)WinzeMine
Exhausted(uint256 minted)WinzeMine
WinzeSet(address winze)WinzeMine
PriceSet(address token, uint256 price1e18, uint256 updatedAt)ManualPriceSource
FeedSet(address token, address feed)ChainlinkPriceSource

Errors

Every error the contracts raise
ErrorContractRaised when
ZeroAmountWinzeMineAn amount of zero.
ZeroAddressWinzeMineA required address is the zero address.
NotListedWinzeMineThe token is not listed, or was never tracked.
AlreadyListedWinzeMineListing a token that is already listed.
InsufficientStakeWinzeMineUnstaking more than the position holds.
NothingToClaimWinzeMineClaiming with a total of zero.
MineNotReadyWinzeMineThe mine has not been handed its pool.
MineExhaustedWinzeMineStaking after the pool is spent.
WinzeAlreadySetWinzeMineThe pool was already handed over.
PoolNotFundedWinzeMineThe mine does not hold the full allocation.
InvalidTokenWinzeMineListing WINZE itself.
PriceUnavailableWinzeMineThe token's price source did not answer.
LengthMismatchManualPriceSourceTokens and prices are different lengths.
FeedNotSetChainlinkPriceSourceThe token has no feed.
InvalidAnswerChainlinkPriceSourceThe feed answered zero or below.
UnauthorizedSolady OwnableThe caller is not the owner or keeper.
ReentrancySoladyA nested call into the mine.
Every refusal is a named error rather than a string.

The ones a miner can actually meet, with what each one means in practice, are in staking.

ABIs

Each file is the ABI array from the Foundry build.

Robinhood Chain

Chain id 4663. The mine is not deployed there yet. The stock token addresses, the owner, the liquidity address and the treasury address are not published, and the deploy script refuses to run while any of them is still a placeholder.

When it is deployed, the addresses, the deploy block and the listed token set are written to the address book the app reads, and the verified source links open the contract tab of the Blockscout explorer.

Robinhood Chain testnet

Chain id 46630. Not deployed yet either. The testnet deploy uses the same scripts with the deployer standing in for the multisig.

Anvil

Chain id 31337. The local development chain, deployed by the seed script on a fresh Anvil, where the addresses are deterministic.

Anvil addresses
ContractAddress
WinzeMine0x5FbDB2315678afecb367f032d93F642f64180aa3
WinzeToken0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
Price source0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9
Deterministic on a fresh Anvil, from the seed script. Deploy block 0. A local development chain has no explorer, so there is nothing to link to.

The seed script also deploys four mock stock tokens, pushes prices for them and stakes enough from two wallets to sit just under the first threshold, so a developer can cross level 1 from the interface.