PulseDelta is a decentralized prediction market platform built on BlockDAG that enables users to create, trade, and provide liquidity for prediction markets. The platform features a unique dual revenue model where both market creators and liquidity providers earn rewards from trading fees.
- Creator Rewards: Market creators earn 30% of trading fees from their markets
- LP Rewards: Liquidity providers earn 40% of trading fees from markets they support
- Protocol Revenue: 30% of fees go to protocol development
- Binary Markets: Yes/No prediction markets
- Multi-Outcome Markets: Multiple choice predictions
- Scalar Markets: Range-based predictions
- wDAG Collateral: Native DAG wrapped as ERC20 for trading
- AMM Pricing: Automated market maker with dynamic pricing
- Real-time P&L: Track potential profits from smart contract events
- Sports Betting UX: Focus on potential winnings, not losses
- LP Tokens: ERC20 tokens representing liquidity pool shares
- Fee Distribution: Automatic fee accrual to LP token holders
- Add/Remove Liquidity: Simple interface for liquidity management
User β BinaryMarketFactory β MarketBinary Contract
β
1. User sends DAG for initial liquidity
2. Factory converts DAG β wDAG
3. Creates MarketBinary with initial liquidity
4. Deploys YES/NO outcome tokens
5. Deploys LP token for liquidity providers
6. Market becomes tradeable
Trader β Market Contract β Outcome Tokens
β
1. Trader converts BDAG β wDAG
2. Approves market to spend wDAG
3. Calls buy() with outcome choice
4. Market calculates cost using AMM formula
5. Charges 1% fee (split: 30% protocol, 30% creator, 40% LP)
6. Mints outcome tokens to trader
7. Updates reserves (reduces supply, increases price)
8. Emits Bought event for tracking
LP β Market Contract β LP Tokens
β
1. LP sends DAG to addLiquidity()
2. Market converts DAG β wDAG
3. Mints LP tokens proportional to pool share
4. LP tokens accrue fees from trading
5. LP can removeLiquidity() to burn tokens
6. Receives wDAG + accumulated fees
Trading Fee (1%) β FeeRouter β Multiple Recipients
β
βββ 30% β Protocol Treasury
βββ 30% β Market Creator
βββ 40% β LP Pool (distributed to LP token holders)
Oracle β Market Contract β Winners
β
1. Market reaches endTime
2. Oracle provides final outcome
3. Market finalizes with winning outcome
4. Winners call redeem() to claim winnings
5. Winning tokens burned, wDAG distributed from pool
6. LP tokens retain value from accumulated fees
- Main prediction market contract
- Handles trading, pricing, and resolution
- Manages YES/NO outcome tokens
- Implements AMM pricing model
- Tracks participant count and volume
- Factory for creating binary markets
- Handles initial liquidity setup
- Manages market registration
- Provides market discovery functions
- Wrapped DAG token (ERC20)
- 1:1 conversion with native DAG
- Used as collateral for all markets
- Supports deposit/withdraw functions
- ERC20 token representing LP shares
- Tracks liquidity pool ownership
- Accrues fees from trading activity
- Enables add/remove liquidity functions
- Centralized fee distribution system
- Routes fees to creators, LPs, and protocol
- Tracks lifetime earnings per creator
- Manages fee claiming functions
- Factory for creating outcome tokens
- Ensures unique token addresses
- Manages token metadata
- OptimisticCryptoOracleAdapter.sol: Crypto price feeds
- SportsOptimisticOracleAdapter.sol: Sports event results
- TrendsOptimisticOracleAdapter.sol: Social trends data
- Market quality control system
- Community-driven market approval
- Prevents spam and low-quality markets
- TradeWidget.tsx: Main trading interface
- useTrading.ts: Trading logic and state management
- useTradingHistory.ts: Fetches trade history from contract events
- ProfitLossDisplay.tsx: Shows potential profits (sports betting UX)
- MarketCard.tsx: Market display component
- MarketList.tsx: Market browsing interface
- MarketCreationWizard.tsx: Market creation flow
- useFactory.ts: Factory contract interactions
- LiquidityPanel.tsx: LP management interface
- useLiquidity.ts: Liquidity provision logic
- lpDashboard.tsx: LP portfolio view
- HeroCarousel.tsx: Landing page carousel
- Navigation.tsx: Main navigation
- WDAGBalance.tsx: Balance display
- ThemeToggle.tsx: Dark/light mode
- Wagmi: Web3 state management
- TanStack Query: Data fetching and caching
- React Context: Theme and global state
- Local Storage: User preferences
- useMarket.ts: Market data fetching
- useFactory.ts: Factory interactions
- useTrading.ts: Trading operations
- useLiquidity.ts: Liquidity management
- useTradingHistory.ts: Trade history from events
- usePayouts.ts: Payout calculations
- BlockDAG: Native blockchain
- Solidity: Smart contract language
- Hardhat: Development environment
- OpenZeppelin: Security libraries
- Next.js: React framework
- TypeScript: Type safety
- Tailwind CSS: Styling
- Framer Motion: Animations
- Wagmi: Web3 integration
- Viem: Ethereum library
- Supabase: Metadata storage
- WalletConnect: Wallet integration
- React Toastify: Notifications
- Node.js 18+
- Yarn or npm
- BlockDAG wallet
- WalletConnect Project ID
- Clone the repository
git clone <repository-url>
cd PulseDelta- Install dependencies
# Frontend
cd frontend
yarn install
# Smart contracts
cd ../contracts/hardhat
yarn install- Environment setup
# Frontend (.env.local)
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=your_project_id
# Smart contracts (.env)
PRIVATE_KEY=your_private_key
RPC_URL=your_rpc_url- Start development
# Frontend
cd frontend
yarn dev
# Smart contracts
cd contracts/hardhat
npx hardhat compile
npx hardhat test- Deploy smart contracts
cd contracts/hardhat
npx hardhat run scripts/deploy.ts --network primordial- Update contract addresses
# Update frontend/src/lib/abiAndAddress.ts
# Update contract addresses after deployment- Build frontend
cd frontend
yarn build
yarn start- Navigate to
/create - Select market type (Binary/Multi/Scalar)
- Enter market details and outcomes
- Set end time and resolution deadline
- Provide initial liquidity (DAG)
- Submit for creation
- Browse markets at
/markets - Select a market to view details
- Choose outcome and amount
- Convert BDAG to wDAG (automatic)
- Approve market to spend wDAG
- Execute trade
- Navigate to market details page
- Go to Liquidity Panel
- Enter amount to add
- Receive LP tokens
- Earn fees from trading activity
- Remove liquidity anytime
- Creators: Claim fees from created markets
- LPs: Fees automatically accrue to LP tokens
- Traders: Claim winnings after market resolution
- Trading Fee: 1% of trade value
- Protocol Share: 30% (0.3%)
- Creator Share: 30% (0.3%)
- LP Share: 40% (0.4%)
- Market Creators: Earn from trading fees on their markets
- Liquidity Providers: Earn from providing liquidity
- Protocol: Sustainable development funding
- Traders: Profit from correct predictions
- wDAG: Utility token for trading
- LP Tokens: Represent liquidity pool shares
- Outcome Tokens: Represent market positions
- OpenZeppelin: Battle-tested libraries
- Access Control: Role-based permissions
- Reentrancy Protection: Prevents attack vectors
- Input Validation: Comprehensive checks
- Type Safety: TypeScript throughout
- Input Sanitization: XSS prevention
- Wallet Integration: Secure connection
- Error Handling: Graceful failures
- Binary market implementation
- Trading system
- LP system
- Fee distribution
- Frontend interface
- Multi-outcome markets
- Scalar markets
- Advanced trading features
- Mobile app
- API documentation
- Governance token
- Staking rewards
- Cross-chain support
- Institutional features
- Analytics dashboard
- Fork the repository
- Create feature branch
- Make changes
- Add tests
- Submit pull request
- Solidity: Follow OpenZeppelin patterns
- TypeScript: Strict type checking
- React: Functional components with hooks
- Testing: Comprehensive test coverage
MIT License - see LICENSE file for details
- Documentation: docs.pulsedelta.com
- Discord: discord.gg/pulsedelta
- Twitter: @PulseDelta
- GitHub: github.com/pulsedelta
- BlockDAG: For the underlying blockchain
- OpenZeppelin: For security libraries
- Wagmi: For Web3 integration
- Community: For feedback and contributions
Built with β€οΈ on BlockDAG
Β© 2024 PulseDelta. All rights reserved.