This repository contains a demo for the WIP (World In Progress) contract, which simulates user activity in a decentralized citizenship-based governance system.
- Node.js (>= 16)
- pnpm
- Anvil (from Foundry)
-
Install dependencies:
pnpm install
-
Compile the contracts:
pnpm build
-
Run the test demo:
pnpm test-demo
pnpm build- Compile the contractspnpm deploy- Deploy to Celo networkpnpm demo- Run the demo with an existing contractpnpm test-demo- Deploy and run the demo on a local Anvil nodepnpm dev- Deploy and run the demo, then keep the node running for frontend developmentpnpm update-abi <address>- Update the frontend ABI with a specific contract address
The demo simulates:
- Multiple users from different countries
- Users submitting proposals and voting over multiple days
- Citizens earning governance tokens by receiving votes
You can customize the demo by setting environment variables:
NUM_DAYS- Number of days to simulate (default: 5)KEEP_RUNNING- Keep the Anvil node running after the demo completes (default: false)
- The demo first deploys all necessary contracts (WIP, DAODistribution, etc.)
- It registers multiple users from different countries
- Each user submits a daily proposal and votes on other proposals
- Time is advanced on the blockchain to simulate multiple days
- The voting logic follows the rules in the WIP contract:
- Same country votes cost score²
- Cross country votes cost score³
- Users must spend at least half their daily tokens
When you run pnpm test-demo or pnpm dev, the script automatically updates the frontend ABI file (frontend/app/content/abi.ts) with the newly deployed contract address. This ensures your frontend is always pointing to the latest deployment.
If you want to use a specific contract address, you can manually update the frontend:
pnpm update-abi 0x123...abcRunning pnpm dev will:
- Deploy the contracts to the local Anvil node
- Run the demo to populate it with data
- Update the frontend ABI file with the contract address
- Keep the node running so you can interact with it through the frontend