Skip to content
@TruthStake

TruthStake

Prediction market platform with on-chain settlement, internal token and limit order book. Alternative (analog) to dying Predictit betting platform - polymarket

TruthStake

Prediction market platform with on-chain settlement, internal token and limit order book

About

TruthStake allows users to trade event outcomes through conditional tokens. The platform combines an off-chain backend for managing market catalog, users and orders with on-chain smart contracts for settlement, token exchange and market resolution

Architecture

USDT (external stablecoin)
        |
  TokenExchange (1:1 swap, 5% fee)
        |
  SystemToken (SYS, internal token)
        |
  MarketFactory (split/merge/resolve/redeem)
        |
  ConditionalTokens (ERC-1155 outcome tokens)
        |
  Exchange (on-chain limit order book)

Repositories

truthstake-api

Python backend (ASGI). Users, wallets, off-chain orders, market catalog, comments, notifications. PostgreSQL, JWT authorization, integration tests

truthstake-contracts

Solidity smart contracts (Hardhat). 6 contracts, all core ones with UUPS upgradeable proxy. Deploy scripts for local network and Sepolia, demo scenarios with trading and resolution. 31 tests

truthstake-web

SvelteKit + Tailwind frontend. Market catalog, trading, portfolio, leaderboard, deposit/withdrawal, profile, notifications. Connected to API and smart contracts

truthstake-admin

Admin panel built with SvelteKit + Tailwind. Dashboard with statistics, market and user management, category CRUD, Oracle for manual market resolution

Smart Contracts

Contract Purpose
MockUSDT Test ERC-20 (6 decimals), replaced with real USDT on mainnet
SystemToken Internal ERC-20, mint/burn through authorized minters (UUPS)
TokenExchange USDT to SYS swap at 1 to 1 rate, 5% fee (UUPS)
ConditionalTokens ERC-1155 outcome tokens with deterministic tokenId (UUPS)
MarketFactory Market lifecycle, split/merge/resolve/redeem, 5% fee (UUPS)
Exchange Limit order book, prices in basis points 0-10000 (UUPS)

Fees

TokenExchange charges 5% on each USDT to SYS swap (in USDT, sent to treasury). MarketFactory charges 5% on winning redeem (in SYS, sent to treasury). Both parameters are configurable by the owner, capped at 10%

Tech Stack

Backend — Python, ASGI, PostgreSQL, JWT, bcrypt

Contracts — Solidity, Hardhat, OpenZeppelin UUPS, TypeScript tests

Web Client — SvelteKit, TypeScript, Tailwind CSS, Lightweight-charts

Admin Panel — SvelteKit 2, Svelte 5, TypeScript, Tailwind CSS

Quick Start

Local development requires Node.js 18+, Python, Docker (for PostgreSQL)

  1. Start PostgreSQL and the backend from truthstake-api on port 8000
  2. Start Hardhat node and deploy contracts from truthstake-contracts
  3. Start the web client from truthstake-web on port 5173
  4. Optionally start the admin panel from truthstake-admin on port 5174

Detailed setup instructions for each component are available in the corresponding repository README

Popular repositories Loading

  1. .github .github Public

    1

Repositories

Showing 1 of 1 repositories

Top languages

Loading…

Most used topics

Loading…