Skip to content

Research: reuse Aiva prize-draw contracts as VTornOracle/TournamentPool foundation #28

@0800tim

Description

@0800tim

Research issue. Tim asked the orchestrator to look at the Aiva blockchain prize-draw on this dev machine (growth-spurt-aiva-platform repo) and report whether VTorn's VStamp (doc 17) and VTornOracle (doc 21) can reuse contracts, oracles, or settlement patterns rather than building from scratch.

Short answer: yes, substantially. The Aiva prize-draw is directly applicable. Recommend forking it.

What Aiva already has

Path: clawdia/projects/growth-spurt-aiva-platform/contracts/prize-draw/

  • PrizeDraw.sol — Solidity 0.8.24 contract using Chainlink VRF V2.5 for verifiable randomness. Weighted-entry model with 9 configurable entry methods (purchase, referral signup, referral purchase, social share, follow, newsletter, review, daily check-in with streak multiplier, etc.). Status enum (Active | Closed | Drawn | Cancelled) with refund-on-cancel semantics. Reentrancy-guarded. Binary-search winner selection (O(log n) for large entry pools).
  • Foundry build + tests — 7/7 tests passing per the README. Includes deploy scripts for Arbitrum Sepolia (testnet) and Arbitrum One (mainnet).
  • Frontend — merchant-dashboard 4-step creation wizard already built; customer-portal viewer components already built.
  • Docsdocs/prize-draws/{FINAL-BUILD-SUMMARY,PRIZE-DRAW-STATUS,PRIZE-DRAW-SYSTEM-COMPLETE}.md with build status, integration notes, and the full PRIZE_DRAW_AIVA_SPEC.
  • MIT licensed.

Mapping to VTorn

VTorn need (per docs 17, 21) Aiva primitive Reuse strategy
Verifiable, biased-against-the-house tournament prize pools PrizeDraw contract with weighted entries Direct fork. Tune entry weights for VTorn (predictions placed, prediction IQ, referrals, clip shares, streak length).
Provably fair randomness for any random-component game Chainlink VRF V2.5 wrapper Import same VRFConsumerBaseV2Plus pattern.
Tournament-end settlement Closed → Drawn transition + winner selection Directly applicable.
Cancelled tournament refund Cancelled enum state already in the model Directly applicable.
L2 / low-fee deployment Arbitrum One target already set up Inherit. We don't have to re-decide chain.
VStamp (verifiable prediction receipt) (different shape — VStamp is per-prediction, not per-pool) NOT a direct reuse. VStamp is a separate small contract that signs (user, match, prediction, ts) and emits an event. Plan it adjacent to the prize-draw fork; share the deploy/audit pipeline.
VTornOracle (match-result oracle) (different shape — Aiva's oracle is for the draw RNG, not real-world results) NOT a direct reuse. VTornOracle reads canonical match results from a multi-source committee; design fresh per doc 21.

Proposed plan

  1. Fork: clone growth-spurt-aiva-platform/contracts/prize-draw/ into vtorn/contracts/tournament-pool/ (rename + retune; keep MIT). Substitute VTorn's entry-weight schedule (predictions, IQ, referrals, shares, streaks).
  2. Inherit deploy infra: copy Foundry layout + deploy scripts. Same Arbitrum testnet → mainnet path.
  3. Audit pipeline: pre-launch audit (Trail of Bits / OpenZeppelin / ConsenSys Diligence) is a separate, ~6–10 week effort per REVIEW.md. Don't ship to mainnet until that's done.
  4. VStamp (doc 17) and VTornOracle (doc 21): separate contracts, designed in parallel, shared audit + deploy pipeline. Not in the Aiva codebase today.

What this saves

  • ~2 weeks of contract design + Foundry setup + Chainlink integration.
  • A real audit-track-record: Aiva's contract has been written and tested; VTorn inherits that diligence.
  • Frontend reference: Aiva's wizard + customer-portal viewer components are React patterns we can crib for VTorn's tournament UI.

Out of scope for this issue

  • Actually doing the fork. That's a separate PR — call it feat(contracts): fork Aiva PrizeDraw as TournamentPool.
  • Audit kickoff. Tim's call when revenue justifies the audit spend.
  • Cross-platform points (Aiva tokens vs VTorn tokens) — separate design conversation; v0.1 keeps them disjoint.

Refs

  • clawdia/projects/growth-spurt-aiva-platform/contracts/prize-draw/
  • docs/17-vstamp-and-prediction-iq.md
  • docs/21-onchain-sweepstakes-oracle.md
  • tasks/BACKLOG.md P3 lane

Metadata

Metadata

Assignees

No one assigned

    Labels

    infraInfrastructure / ops

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions