{"id":29630911,"url":"https://github.com/donpushme/wager-bet","last_synced_at":"2025-10-09T23:15:36.013Z","repository":{"id":301557576,"uuid":"991964513","full_name":"donpushme/wager-bet","owner":"donpushme","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-29T16:24:28.000Z","size":734,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-19T23:28:35.577Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/donpushme.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-28T12:15:16.000Z","updated_at":"2025-05-29T16:24:32.000Z","dependencies_parsed_at":"2025-06-27T14:11:31.363Z","dependency_job_id":"6bc0619e-ecb8-4719-acc5-67d56f191929","html_url":"https://github.com/donpushme/wager-bet","commit_stats":null,"previous_names":["donpushme/wager-bet"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/donpushme/wager-bet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donpushme%2Fwager-bet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donpushme%2Fwager-bet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donpushme%2Fwager-bet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donpushme%2Fwager-bet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/donpushme","download_url":"https://codeload.github.com/donpushme/wager-bet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donpushme%2Fwager-bet/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266287824,"owners_count":23905461,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-21T11:07:08.539Z","updated_at":"2025-10-09T23:15:35.891Z","avatar_url":"https://github.com/donpushme.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# iPredict XYZ - Decentralized Prediction Markets\n\niPredict XYZ is a fully decentralized prediction market platform built on Solana. It allows anyone to create and trade on the outcomes of future events through a unique dual-token system.\n\n## 🚀 Features\n\n- **Permissionless Market Creation**: Any user can create prediction markets on any topic\n- **Dual-Token System**: Each market creates YES and NO tokens representing different outcomes\n- **On-Chain Order Book**: Fully decentralized order matching and price discovery\n- **Quick Buy**: Simplified market orders for easy position taking\n- **Instant Settlement**: Winners claim SOL immediately after resolution\n- **Low Fees**: Only 0.5% trading fees, powered by Solana's efficiency\n\n## 📁 Project Structure\n\n```\nipredict-xyz/\n├── programs/           # Solana smart contracts (Rust/Anchor)\n│   └── ipredict-xyz/   # Main program\n├── sdk/                # TypeScript SDK\n├── frontend/           # Next.js web application\n├── scripts/            # Deployment and utility scripts\n└── docs/               # Additional documentation\n```\n\n## 🛠️ Prerequisites\n\n- Node.js 18+ and npm\n- Rust and Cargo\n- Solana CLI tools\n- Anchor framework (v0.30.1)\n- A Solana wallet with SOL for deployment\n\n## 🏗️ Installation\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/your-repo/ipredict-xyz.git\ncd ipredict-xyz\n```\n\n2. Install all dependencies:\n```bash\nnpm run install:all\n```\n\n3. Build the project:\n```bash\nnpm run build\n```\n\n## 🚀 Deployment\n\n### Local Development\n\n1. Start a local Solana validator:\n```bash\nnpm run deploy:localnet\n```\n\n2. Initialize the platform:\n```bash\nnpm run init:platform -- --network localnet\n```\n\n3. Start the frontend:\n```bash\nnpm run dev\n```\n\n### Devnet Deployment\n\n1. Ensure you have Devnet SOL:\n```bash\nsolana airdrop 2 --url devnet\n```\n\n2. Deploy to Devnet:\n```bash\nnpm run deploy:devnet\n```\n\n### Mainnet Deployment\n\n⚠️ **Warning**: Mainnet deployment requires real SOL. Ensure you have thoroughly tested on Devnet first.\n\n```bash\nnpm run deploy:mainnet\n```\n\n## 🧪 Testing\n\n⚠️ **Note**: Test suite is not yet implemented. Coming soon.\n\nTest wager creation manually:\n```bash\nnpm run test:wager -- --network localnet\n```\n\n## 📖 How It Works\n\n### Creating a Market\n\n1. Users pay 1 SOL to create a new prediction market\n2. They define the question, description, and timeline\n3. The system creates YES and NO token mints\n4. Market becomes active at the specified opening time\n\n### Trading\n\n1. Users deposit SOL to mint equal amounts of YES and NO tokens\n2. They can trade these tokens on the order book\n3. Prices reflect the market's belief in the outcome probability\n4. Quick Buy allows instant market orders\n\n### Resolution\n\n1. Platform authority resolves markets based on real-world outcomes\n2. Winning token holders can claim 0.01 SOL per token\n3. Losing tokens become worthless\n\n## 🏗️ Architecture\n\n### Smart Contracts\n\n- **Platform**: Global configuration and fee management\n- **Wager**: Individual market logic and metadata\n- **Order Book**: Decentralized order matching engine\n- **Token System**: SPL token mints for YES/NO tokens\n\n### Key Instructions\n\n- `initialize_platform`: One-time platform setup\n- `create_wager`: Create a new prediction market\n- `deposit_and_mint`: Deposit SOL and receive equal YES/NO tokens\n- `place_order`: Place buy/sell orders (sell orders use escrow)\n- `cancel_order`: Cancel open orders and return escrowed tokens\n- `match_orders`: Execute matching orders (called by anyone)\n- `quick_buy`: Market buy with slippage protection\n- `resolve_wager`: Resolve market outcome (YesWon/NoWon/Draw)\n- `claim_winnings`: Burn winning tokens and claim SOL\n\n## 💻 SDK Usage\n\n```typescript\nimport { IpredictClient } from '@ipredict-xyz/sdk';\nimport { Connection, Keypair } from '@solana/web3.js';\nimport { Wallet } from '@coral-xyz/anchor';\n\n// Initialize client\nconst connection = new Connection('https://api.devnet.solana.com');\nconst wallet = new Wallet(keypair);\nconst client = new IpredictClient(connection, wallet);\n\n// Create a wager\nconst tx = await client.createWager({\n  name: \"Will Bitcoin reach $100k?\",\n  description: \"Resolves YES if BTC hits $100,000\",\n  openingTime: new BN(Date.now() / 1000),\n  closingTime: new BN(Date.now() / 1000 + 86400 * 30),\n  resolutionTime: new BN(Date.now() / 1000 + 86400 * 31),\n});\n```\n\n## 🎨 Frontend Features\n\n- Wallet integration (Phantom, Solflare, etc.)\n- Real-time market data\n- Order book visualization\n- Basic portfolio tracking\n- Market creation interface\n\n## 🔒 Security Considerations\n\n- All funds are held in program-controlled vaults\n- Order matching happens atomically on-chain\n- Open source and auditable\n\n⚠️ **Important**: This platform has not been audited. The following security features are pending:\n- Emergency pause mechanism\n- Admin controls for dispute resolution\n- Upgrade authority management\n\n## 📊 Fee Structure\n\n- Market Creation: 1 SOL (one-time)\n- Trading Fees: 0.5% total\n  - 0.25% to platform (platform fee recipient)\n  - 0.25% to deployer (deployer fee recipient)\n- No deposit/withdrawal fees\n- No maintenance fees\n- Token pricing: 100 tokens per SOL (0.01 SOL per token)\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 🔗 Links\n\n- Website: [ipredict.xyz](https://ipredict.xyz)\n- Documentation: [docs.ipredict.xyz](https://docs.ipredict.xyz)\n- Twitter: [@ipredictxyz](https://twitter.com/ipredictxyz)\n- Discord: [Join our community](https://discord.gg/ipredictxyz)\n\n## ⚠️ Disclaimer\n\nThis software is provided \"as is\" without warranty of any kind. Prediction markets may be regulated differently in various jurisdictions. Users are responsible for complying with local laws and regulations.\n\n## 🙏 Acknowledgments\n\nBuilt with:\n- [Anchor Framework](https://anchor-lang.com)\n- [Solana Web3.js](https://solana-labs.github.io/solana-web3.js)\n- [Next.js](https://nextjs.org)\n- [Tailwind CSS](https://tailwindcss.com)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdonpushme%2Fwager-bet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdonpushme%2Fwager-bet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdonpushme%2Fwager-bet/lists"}