Skip to content
← selected work

Earlier · UpDown

UpDown

A prediction market on token prices, where rounds resolve offchain and settle on-chain through a merkle root.

Period
2023
Role
Smart contract engineer and development lead
Commits authored
44
Source
Private

The problem

Paying out a betting round on-chain normally means writing a result for every position it holds, so settlement gets more expensive the more people play. Resolution had to happen offchain without asking anyone to trust that the operator paid out honestly.

What I did

  • Coordinated the development across contracts, frontend and backend.
  • Wrote the round lifecycle: epoch-based rounds across several tokens, with minimum and maximum bet sizes and a betting window that closes before the round resolves.
  • Settled offchain results through one merkle root per epoch. Users claim against a proof, so the contract never stores a payout per position and anyone can verify their own.
  • Fed prices in through Supra’s pull oracle, verifying the proof on-chain before the price is used.
  • Made the contracts upgradeable, with pausing, reentrancy guards, and separate admin and operator roles.
  • Split each settled round between the treasury and a staking pool.
  • Assisted on the frontend and backend around it.

Stack

SolidityFoundrySupra OracleMerkle proofs