Deposit
Flow
stake pulls USDG. If no settleable bets block the cutoff, shares mint immediately (Staked). Otherwise the USD sits in a per-staker queue (StakeQueued) and mints later:
- the next settle that clears the cutoff force-mints ready queues, or
- anyone can call
activateStake(staker)oncependingStakeReady(staker)is true.
availableBankroll. cancelPendingStake() returns it while the queue is still blocked. If public staking is disabled on the deployment, stake reverts StakingDisabled (deposits are operator-only); exits below still work for everyone.
Deposits are also gated by maxBankrollUsd (underwriting capital + queued deposits).
Withdraw - two steps
1
Request a tranche
Call
requestUnstake(principalAssets, earningsAssets) for a principal and/or earnings slice (at least one > 0), or requestUnstakeAll() for everything currently free. Each call opens a new tranche with its own requestId, timer, and epoch stamps - earlier tranches are untouched. For a single product “withdraw amount”, allocate earnings-first then principal so free earnings do not need a second request. Requested shares immediately stop underwriting new bets, but stay staked and loss-exposed until claim.2
Wait for unlock
A tranche unlocks on the earliest of:
- Settled watermark -
settledThroughCommitIdreaches the request epoch. - Clear scan - no settleable pre-request pending bets remain (refund-only leftovers do not block). This can unlock before the timer.
- Cooldown timer -
unstakeDelayelapses (default 1 hour) and the same clear-scan passes. Anyone can accelerate the watermark by draining leftover bets withsettleBets. A truncated scan stays blocked until those epochs are drained.
3
Claim
Call
claimStakerPrincipal(requestId, assets) for the principal leg (USDG) and/or claimStakerEarnings(requestId, assets, asChance, minChanceOut, affiliate) for the earnings leg. assets = 0 claims the whole remaining leg; partial claims leave the tranche active. cancelUnstakeRequest(requestId) aborts one tranche before claim.