Protocol
Contracts and security
What the code guarantees, and what you still trust.
The contracts are upgradeable through proxies, and upgrades are signed by the PrizeStreet owner key. Every upgrade, and every change of owner, is recorded on-chain as a public event.
| Contract | Role | Address |
|---|---|---|
| PrizeStreet | Registry. Launches the coins on The Stonks Exchange and holds prices, parameters and the $PSTREET rotation. Its owner functions (settings, the 24-hour timelock, the pause) run in its admin module, PrizeStreetAdmin, which it calls with delegatecall: they are called at the registry's address. Upgradeable by the PrizeStreet owner. | 0x83Ff52e90C08A2dDf4547BD27EFF275e28aB69c9 |
| PrizeVault | One per coin. Holds the pot and runs the draws. All vaults share one upgradeable implementation: an upgrade by the PrizeStreet owner applies to every vault at once. | On each coin's page |
| DrandVerifier | Verifies drand signatures on-chain. Not upgradeable: it can only be replaced, with 7 days' public notice. | 0x5a08D20b7f3b87666c0583Cf972a8967e43731fF |
| PstreetBuyback | Buys $PSTREET and burns it. Upgradeable by the PrizeStreet owner. | 0x8d46a64baf680Df31cf60Cc52151D8593d6821e4 |
| PoolSwapAdapter | Swaps ETH into the prize stocks and back, directly on approved Aerodrome pools. Not upgradeable: it can only be replaced, after the 24-hour delay below. | 0xd39c33321b604D896671D0BC325cd81364176987 |
Safeguards
- No vault has a withdraw function.
- Swaps run only on routes approved in advance, with a minimum set by Chainlink: 3% tolerance, 1% when markets are closed.
- The snapshot is committed before the randomness exists, can be vetoed by the PrizeStreet owner until then, and is settled with a Merkle proof. Every draw can be verified by anyone on its draw page.
- drand signatures are verified on-chain. Replacing the verifier takes 7 days' notice.
- The owner, operator, guardian, treasury and buyback addresses can never win.
- Stuck draws can be abandoned by anyone after 7 or 30 days, without moving any tokens.
Pause
The PrizeStreet owner can pause the protocol, and so can the guardian role, which the owner holds; only the owner can unpause it.
- A pause stops every way out of the funds: prize claims, ETH payouts and their requests, settling a winner, investing the pot, selling a leftover stock, opening a draw, launching a coin, and the $PSTREET buyback (buying, and sending its ETH to the pot).
- Fees keep being collected. A harvest during a pause pulls the fees into the vault and holds them; the first harvest after the pause pays every share as usual.
- These stay open, because nothing leaves a vault: returning an expired prize to the pot, committing a snapshot, delivering the drand randomness, resetting, vetoing or abandoning a draw, and adding ETH to a pot.
- Deadlines move with the pause. A winner's claim window, the ETH request deadline and the extra window after an ETH request all move later by the time the protocol was paused while they were running, so a pause never makes a prize expire. Each draw page shows the deadline with every pause counted.
Outflow caps
- A vault hands at most 25% of its pot's value to the swap adapter in one transaction, and at most 50% within any 24 hours, valued with Chainlink. This covers investing ETH into the prize stock and selling a leftover stock.
- Prizes reserved for winners are not part of the pot and never count towards the caps.
- Paying a winner in ETH is not capped: it sells only that winner's prize, already reserved and checked against Chainlink.
- The owner can set the caps between 5% and 50% per transaction and between 10% and 100% per 24 hours, never one transaction above the 24-hour cap, and only through the 24-hour timelock.
- A new pot that is all ETH is therefore invested over several transactions and days.
The 24-hour timelock
Owner changes that move a price source or where value can go are proposed on-chain first and can be executed only 24 hours later, for the following 7 days; after that they must be proposed again. Our indexer sends an alert for every proposal at once, and the protocol can be paused while one waits. A proposal can be cancelled until it is executed.
- Under the timelock: the operator, the treasury, the buyback, the swap adapter, the ETH/USD feed and its staleness limit, a prize stock (a new one, a new feed or staleness limit, or enabling it again), a new swap route, and the outflow caps.
- Immediate, because they only restrict: disabling a prize stock and forbidding a swap route.
- Immediate, within limits fixed in the contracts: the protocol fees (protocol share up to 20%, its split, the ETH payout fee up to 10%, the $PSTREET platform fee up to 30%), the draw parameters (buffer, slippage tolerance up to 10%, drand delay of at least 30 rounds, claim window of at least 1 day), the off-hours price age (up to 5 days) and slippage (up to 10%), the launch parameters, open launches, tickers, the $PSTREET rotation (between enabled stocks only), the guardian, releasing a stock, and the pause.
- The buyback's limits (
PstreetBuyback.setLimits) are set by the owner at once: the amount per buy has no maximum in the contract, the time between buys is at least 1 minute. Bought $PSTREET always goes to the burn address. - Before the first vault exists there is no pot to protect, so the deploy configures the registry directly; from the first vault on, every change above waits its 24 hours.
- Upgrades of the contracts are signed by the PrizeStreet owner and take effect at once; each one is a public on-chain event.
What you still trust
- The snapshot is computed off-chain by the keeper, which PrizeStreet's operator runs. It is published before the beacon; until then the PrizeStreet owner can veto it, and after the draw anyone can rebuild it from the chain and verify the draw on its draw page.
- The PrizeStreet owner owns the contracts. It can upgrade them, it sets price feeds, swap routes and the operator through the 24-hour timelock, and it sets fees, slippage tolerances and the buyback's limits at once. Changes that touch funds wait 24 hours in public, and every upgrade and every change of owner is a public on-chain event.
- The Stonks Exchange and the chain. PrizeStreet relies on The Stonks Exchange, Aerodrome, Chainlink, drand and Base. The Stonks Exchange's contracts can be upgraded by its owner, and its owner can reassign a coin's fees after a 24-hour notice on-chain; our indexer sends an alert as soon as such a change is proposed for one of our coins.