Skip to content
Altacon-LabsPublic

About

RevMarket is an MIT-licensed, open-source prediction-market prototype built on Stellar using Rust/Soroban, React, Freighter and the Stellar JavaScript SDK.

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

RevMarket — Stellar prediction markets

RevMarket is a testnet Soroban prediction-market prototype built around a Rust contract, a React/Freighter frontend, and an operator-run settlement worker. It demonstrates binary event markets and price-based prediction markets using Stellar Asset Contract escrow, fixed close windows, authenticated resolution, proportional payouts, and refund paths.

This repository is intended for local development, contributor review, and verification workflows. It is not presented as an audited production system.

Quick links

Architecture

Path Purpose
contracts/market Soroban contract: market creation, staking, settlement, claims, and escrow accounting
shared Shared Stellar helpers and exact decimal encoding for contract calls
service Provider adapters, evidence policy, worker logic, and retry-oriented polling
backend Optional local API with signed public-key sessions and SQLite-backed activity data
frontend React app for market creation, staking, positions, claims, and wallet interaction
tests JavaScript and Rust verification for pricing, timing, payout, and worker behavior
docs Setup, deployment, limitations, review notes, and Wave-related planning

Trust model and scope

RevMarket is intentionally transparent about its safety boundaries:

  • one configured resolver key authorizes settlement outcomes
  • the contract enforces timing, state transitions, and evidence digest checks
  • worker/provider checks run off-chain and are not a substitute for a decentralized oracle
  • automation and delegated claim execution are explicitly not active by default

This is a testnet prototype, not a production-grade decentralized oracle or a fully trustless market system.

Prerequisites

  • Node.js 22+
  • npm 10+
  • Rust 1.99.1+
  • wasm32v1-none target for contract builds
  • native C linker for Rust tests
  • Stellar CLI for deployment workflows
  • on Windows: a current 64-bit GNU toolchain or MSVC build tools

Local setup

npm install
npm test
npm run build
npm run test:contracts
npm run build:contracts

Useful local commands:

npm run demo
npm run backend
npm run dev
npm run test:testnet

Frontend and backend

Run the backend and frontend as separate processes:

npm run backend
npm run dev

Then open the app at http://127.0.0.1:5173. The local activity backend keeps profile and reported activity data in SQLite and does not grant automated permissions or wallet authority.

Contract flow

The contract test suite exercises the real Soroban logic for:

  • create market
  • predict on both sides
  • request settlement
  • settle a market
  • claim payout/refund

The demo script uses fixture observations only and does not write to a live chain.

Testing

Run the project checks before submitting changes:

npm test
npm run build
npm run test:contracts
npm run build:contracts

Project-specific expectations:

  • financial logic must preserve escrow rules and payout integrity
  • authorization must reject wrong identities
  • settlement timing and refund paths must remain valid
  • UI and worker changes need meaningful validation, not just successful compilation

npm run test:testnet is an opt-in smoke test that deploys a temporary contract on Stellar testnet using temporary funded accounts. It is verification-focused and does not read a user's wallet or save secrets.

Deployment and verification

  • Deployed Testnet Contract ID: CACP6QFWWZ7BBMDXB5KHC6AAQKE3HBQ4MFFZNNAIJWYK7P6GXJAMLHIN
  • Network: Stellar Testnet (https://soroban-testnet.stellar.org)

Step-by-step Contract Deployment

  1. Build the WASM binary:

    rustup target add wasm32v1-none
    stellar contract build --manifest-path contracts/Cargo.toml
  2. Generate and fund a Testnet deployer account:

    stellar keys generate deployer --network testnet
    stellar keys fund deployer --network testnet
  3. Deploy with constructor parameters:

    stellar contract deploy \
      --wasm contracts/target/wasm32v1-none/release/revmarket.wasm \
      --source deployer \
      --network testnet \
      -- \
      --token CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC \
      --resolver deployer
  4. Create a prediction market via CLI:

    stellar contract invoke \
      --id CACP6QFWWZ7BBMDXB5KHC6AAQKE3HBQ4MFFZNNAIJWYK7P6GXJAMLHIN \
      --source deployer \
      --network testnet \
      -- create \
      --creator deployer \
      --question "[Crypto] Will Stellar XLM spot price be strictly above $0.35 USD at settlement?" \
      --description_cid "bafkreifdummycid" \
      --image_cid "bafkreifdummycid" \
      --kind '{"Price":["XLM","3500000"]}' \
      --closes_at $(($(date +%s) + 604800))
  5. Frontend Setup: In frontend/.env (and Vercel environment variables):

    VITE_CONTRACT_ID=CACP6QFWWZ7BBMDXB5KHC6AAQKE3HBQ4MFFZNNAIJWYK7P6GXJAMLHIN
    VITE_RPC_URL=https://soroban-testnet.stellar.org
    VITE_READ_ACCOUNT=<YOUR_DEPLOYER_PUBLIC_G_KEY>

Use docs/DEPLOYMENT.md for full configuration and docs/VERIFICATION.md for verification evidence expectations.

Do not use production funds. Keep all secrets in local environment files or secret managers and never commit them.

Contributor guidance

Please read CONTRIBUTING.md before proposing changes. For funded Wave work, follow the Drips assignment and issue guidance in docs/WAVE_GUIDE.md. A local issue draft or comment does not create an official assignment.

Security and operational notes

Read SECURITY.md, docs/LIMITATIONS.md, and docs/VERIFICATION.md before running production-like or public-network workflows.

Important rules:

  • never commit .env files or private keys
  • never store sensitive evidence in the repo
  • keep a single resolver worker per resolver account
  • preserve evidence storage across worker restarts
  • do not silently change settlement policy or trust assumptions

License

This project is licensed under the MIT License. See LICENSE for details.

About this repository

This repo contains the Stellar implementation only. Historical material is preserved outside the active project flow. The project is prepared for review, validation, and contributor-driven iteration, but it is not claimed to be fully production-hardened or externally audited.

About

RevMarket is an MIT-licensed, open-source prediction-market prototype built on Stellar using Rust/Soroban, React, Freighter and the Stellar JavaScript SDK.

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages