Skip to content

aji70/Tycoon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1,811 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฒ Tycoon โ€” Monopoly Tycoon on Chain

Overview

Tycoon is an exciting blockchain tycoon game inspired by the classic Monopoly board game, built on Base, Stacks, and Celo.
Players can buy, sell, and trade virtual properties, collect rent, build monopolies, and compete in a decentralized on-chain economy.

This project combines strategic gameplay with true ownership and transparent mechanics using smart contracts.

๐Ÿšง Currently in active development โ€” Frontend (React + Next.js) and smart contracts are being actively improved. Join the journey!

๐Ÿ“– For a complete technical reference of all game rules, formulas, and calculations, see GAME_MECHANICS.md.


How the game works

Game modes

  • Play vs AI โ€” You play against AI opponents. Create a game from Play with AI, choose settings (e.g. number of AI players), then start. Your wallet must be registered on-chain before playing.
  • Play vs Humans (PvP) โ€” Multiplayer with real players. One person creates a game (game settings, entry stake, number of players) and gets a 6-character game code. Others join by code (Join Room), enter the code, and are taken to the waiting room.

Getting into a game

  1. Connect your wallet (MetaMask, WalletConnect, etc.).
  2. Create or join a game
    • Create: Go to game settings, set player count, entry stake (USDC), and options โ†’ create โ†’ you get a game code and waiting room link.
    • Join: Go to Join Room, enter the 6-character code โ†’ if the game is PENDING, you go to the waiting room; if RUNNING and you're already a player, you go straight to the board.
  3. Waiting room (PvP)
    • See who's in and how many slots are filled.
    • Pick your token (e.g. ๐Ÿš—๐Ÿถ).
    • If there's an entry stake, approve USDC and Join (on-chain join + backend).
    • When all slots are filled, the game becomes RUNNING and everyone is taken to the game screen.

Playing a turn

  • Turn order is fixed (or random at start, depending on settings). The current player is indicated on the board/sidebar.
  • Roll the dice โ€” Only the current player can roll. You move that many spaces around the board.
  • Where you land:
    • Unowned property โ€” You may buy it (pay price to the bank) or decline (often leads to auction in some modes).
    • Owned by someone else โ€” Pay rent (based on the property and any houses/hotels).
    • Chance / Community Chest โ€” Draw a card; follow the effect (e.g. pay tax, move, get out of jail).
    • Tax / Go to Jail / etc. โ€” Follow the space rule.
  • During your turn you can trade with other players (or AI): propose or accept/counter offers (properties + cash). You can also develop (build), mortgage, or unmortgage your properties from the Players sidebar (My Empire, property actions).
  • End turn when you're done; play passes to the next player.

Money, bankruptcy & winning

  • Everyone starts with starting cash. You earn by passing Go, collecting rent, and selling/trading. You spend by buying properties, paying rent, taxes, development, and card effects.
  • If you can't pay what you owe (e.g. rent or tax), you can try to raise cash (mortgage, sell) or declare bankruptcy. When you go bankrupt, you're out; your assets go to the winner or the bank as per the rules.
  • When only one player is left (everyone else bankrupt), that player wins. The Victory modal appears; the winner can claim the prize on-chain and the game is marked FINISHED.

Summary flow

Connect wallet โ†’ (Register for AI) โ†’ Create or Join game
  โ†’ Waiting room (PvP: pick token, join with stake)
  โ†’ Game starts (RUNNING)
  โ†’ Take turns: Roll โ†’ Move โ†’ Buy / Pay rent / Card / etc. โ†’ Trade & property actions โ†’ End turn
  โ†’ Last player standing wins โ†’ Claim prize โ†’ Game over

๐Ÿงพ Key contracts

Detail Info
Contract Base Address 0xc6c2ccc0cA40d700DE2e5696f2a5e71dd838A1c4
Contract Celo Address Set via NEXT_PUBLIC_CELO (see Environment variables)
Contract Stacks Address ST81CZF1YK81CPAMS6PRS3GJSKK35MGZ2VWEPSEN.tyc
Networks Base | Celo | Stacks
Status โœ… Deployed โ€” functionality under development
ERC20 Base Address 0x8A867F46f1A0e8bA1AF573E83B26F86Aa23e07D3
ERC20 Celo Address Set via NEXT_PUBLIC_CELO_TOKEN (see below)

โš™๏ธ Environment variables

The frontend reads configuration from .env.local. Never commit secrets; use .env.example as a template and keep keys in .env.local (gitignored).

API & backend

Variable Description Example
NEXT_PUBLIC_API_URL Backend API base URL. For local dev use http://localhost:3001/api; for production use your deployed Railway (or other) URL. https://base-monopoly-production.up.railway.app/api

Base chain (optional)

Variable Description
NEXT_PUBLIC_BASE Main Tycoon game contract on Base.
NEXT_PUBLIC_BASE_REWARD Reward contract on Base.
NEXT_PUBLIC_BASE_TOKEN TYC (or reward) token contract on Base.
NEXT_PUBLIC_BASE_USDC USDC token contract on Base (entry stakes, payments).

Celo chain (main deployment)

These are the primary contract addresses used when the app runs on Celo. Set them in frontend/.env.local:

Variable Description Example value
NEXT_PUBLIC_CELO Main Tycoon game contract on Celo. Handles game state, turns, properties, and on-chain logic. 0xa40Cb493Cb72a8dcce28044b6CcfE63B8D90B914
NEXT_PUBLIC_CELO_TOKEN TYC (Tycoon) ERC-20 token on Celo. Used for in-game currency, rewards, and shop. Must be the token contract address, not the reward contract. 0x7b1bef6B8d836FEb5d545D3a9F0D966a28A63259
NEXT_PUBLIC_CELO_REWARD Reward contract on Celo. Manages reward distribution and claims. 0x18a9936b1cCc43096CB16450ff1Ee2ebc5Bce17d
NEXT_PUBLIC_CELO_USDC USDC stablecoin on Celo. Used for entry stakes, tournament fees, and real-money-denominated payments. 0xcebA9300f2b948710d2653dD7B07f33A8B32118C
NEXT_PUBLIC_CELO_AI_REGISTRY AI agent registry on Celo. Registers and resolves AI players for โ€œPlay vs AIโ€ games (e.g. ERC-8004 or custom registry). 0x73183cDD20fc3247686CFcF970A956a91561FAE2
NEXT_PUBLIC_CELO_TOURNAMENT_ESCROW_ADDRESS Tournament escrow contract on Celo. Holds entry fees and prize pool for PvP/tournament games; ensures funds are released according to game outcome. 0xd1B710e781a8aF0b4D5facf0f35384ACFB5FDabE

Note: The frontend may reference NEXT_PUBLIC_CELO_TYC or NEXT_PUBLIC_CELO_TOURNAMENT_ESCROW in code; ensure your .env.local keys match what frontend/constants/contracts.ts expects (e.g. alias NEXT_PUBLIC_CELO_TOKEN โ†’ TYC if required).

Wallet & auth

Variable Description
NEXT_PUBLIC_PROJECT_ID WalletConnect / App Kit project ID (e.g. from WalletConnect Cloud).
NEXT_PUBLIC_PRIVY_APP_ID Privy app ID for embedded wallet / social login.
NEXT_PUBLIC_PRIVY_CLIENT_ID (Optional) Privy client ID if using dashboard app client.

AI & agents

Variable Description
NEXT_PUBLIC_ERC8004_AGENT_ID ERC-8004 Agent Trust Protocol: your registered AI agent ID on Celo (used for identity/reputation).
ANTHROPIC_API_KEY Server-side only; used for AI opponent logic. Do not prefix with NEXT_PUBLIC_.

Observability

Variable Description
SENTRY_DSN / NEXT_PUBLIC_SENTRY_DSN Sentry DSN for error tracking (client and/or server).

NGN payments (Flutterwave) โ€” backend only

To accept Naira (NGN) for perk bundles in the Shop, set these in the backend .env (see backend/.env.example):

Variable Description
FLW_SECRET_KEY Your Flutterwave secret key from Dashboard โ†’ Settings โ†’ API Keys (use test key for development).
FLW_SECRET_HASH Optional but recommended: webhook secret from Dashboard โ†’ Settings โ†’ Webhooks. Used to verify that webhook callbacks are from Flutterwave.

Then in the Flutterwave dashboard, set your Webhook URL to https://your-backend-url/api/shop/flutterwave/webhook. After payment, users are redirected back to /shop and their bundle is fulfilled when the webhook is received.

Minimal Celo .env.local snippet (addresses only)

# --- API ---
NEXT_PUBLIC_API_URL=https://your-api.up.railway.app/api

# --- Celo contracts (from .env.local lines 12โ€“20) ---
NEXT_PUBLIC_CELO=0xa40Cb493Cb72a8dcce28044b6CcfE63B8D90B914
NEXT_PUBLIC_CELO_TOKEN=0x7b1bef6B8d836FEb5d545D3a9F0D966a28A63259
NEXT_PUBLIC_CELO_REWARD=0x18a9936b1cCc43096CB16450ff1Ee2ebc5Bce17d
NEXT_PUBLIC_CELO_USDC=0xcebA9300f2b948710d2653dD7B07f33A8B32118C
NEXT_PUBLIC_CELO_AI_REGISTRY=0x73183cDD20fc3247686CFcF970A956a91561FAE2
NEXT_PUBLIC_CELO_TOURNAMENT_ESCROW_ADDRESS=0xd1B710e781a8aF0b4D5facf0f35384ACFB5FDabE

โœจ Features (WIP)

  • ๐Ÿก Property ownership โ€” Iconic Monopoly properties as ERC-721 NFTs
  • ๐Ÿ’ฐ Rent & tycoon mechanics โ€” Earn passive income; upgrade for higher yields
  • ๐Ÿงพ On-chain events โ€” Dice rolls, Chance, Community Chest, Tax, Jail
  • ๐Ÿ“Š Interactive dashboard โ€” Real-time board with rotatable cards (e.g. Income Tax $200, Luxury Tax $100)
  • โ›ฝ Gas-efficient โ€” Leverages Base, Stacks, and Celo low fees
  • ๐Ÿ‘› Wallet integration โ€” MetaMask, WalletConnect ready

๐Ÿ”ฎ Upcoming

  • ๐Ÿ‘ฅ Multiplayer lobbies
  • ๐Ÿ† Leaderboards & tournaments
  • ๐ŸŒพ Yield farming integrations
  • ๐Ÿ—ณ DAO governance for expansions

๐Ÿ›  Tech stack

Layer Tools
Frontend React, Next.js, Tailwind CSS
Blockchain Solidity on Base, Stacks, Celo
Interactions ethers.js / viem; Basescan, Celoscan
UI Custom Monopoly board renderer (2D & 3D)

Live: tycoonworld.xyz ยท base-monopoly.vercel.app


๐Ÿ—บ Roadmap

  • โœ… Core smart contract deployment
  • โœ… Basic board UI (Chance, Community Chest, taxes)
  • โœ… NFT property minting
  • โœ… On-chain game logic (dice, turns)
  • โœ… UI/UX polish & mobile support
  • ๐Ÿ” Security audit & mainnet launch
  • ๐Ÿ› DAO & community governance

๐Ÿค Contributing

  • Fork the repo and submit PRs (UI, cards, logic).
  • Report issues via GitHub.
  • Open to collaborations!

๐Ÿ“ฌ Contact

  • Developer: Sabo Ajidokwu Emmanuel / @ajisabo2
  • Support: Email or Discord (TBD)

๐Ÿ›ก License

MIT License โ€” see LICENSE.

Built with โค๏ธ on Base, Stacks & Celo.
โ€œRoll the dice. Build your empire.โ€

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors