Pundit Protocol is a prediction and subscription dApp deployed on X Layer Testnet. Users can submit match predictions, subscribe to pundits, and view on-chain accuracy stats.
X Layer Testnet:
REGISTRY_ADDRESS=0x6FB454e649376482AF54b1d7B4E2615C6b853fC4
TRACKER_ADDRESS=0xAaA41edfd73A45D734bF13264cBe7413c611d2f7
SUBSCRIPTION_ADDRESS=0x7b0d4E922916AEa5cDE60f93b07920168DC18Bb9- Solidity
- Hardhat
- React
- Vite
- TypeScript
- Ethers.js
- X Layer Testnet
- Vercel
pundit-protocol/
contracts/
contracts/
PredictionRegistry.sol
AccuracyTracker.sol
PunditSubscription.sol
scripts/
deploy.js
hardhat.config.ts
frontend/
src/
App.tsx
protocol.ts
App.css
index.css
package.json
DEPLOYMENT.md
README.mdStores match predictions from pundits.
Main functions:
submitPredictiongetPunditPredictiongetPredictionsForMatchhasPredicted
Tracks prediction accuracy after matches are resolved.
Main functions:
resolveMatchgradePunditgetAccuracystats
Lets pundits set monthly subscription prices and lets users subscribe.
Main functions:
setSubscriptionPricesubscribeisSubscribedwithdrawEarningspunditMonthlyPrice
Network Name: X Layer Testnet
Chain ID: 1952
Hex Chain ID: 0x7a0
RPC URL: https://testrpc.xlayer.tech/terigon
Native Currency: OKB
Explorer: https://www.okx.com/web3/explorer/xlayer-testThe frontend is a protocol control panel that supports:
- Connect wallet
- Switch or add X Layer Testnet
- Submit match predictions
- Load match predictions
- Set pundit subscription price
- Subscribe to a pundit
- Check subscription access
- Resolve matches
- Grade pundits
- View accuracy stats
- Withdraw earnings
- Smooth section reveal animations
Clone the repository:
git clone https://github.com/YOUR_USERNAME/pundit-protocol.git
cd pundit-protocolInstall frontend dependencies:
cd frontend
npm installRun the frontend:
npm run devOpen:
http://127.0.0.1:5173Build the frontend:
npm run buildInstall contract dependencies:
cd ../contracts
npm installCreate a .env file inside contracts/:
PRIVATE_KEY=your_wallet_private_key
XLAYER_RPC_URL=https://testrpc.xlayer.techCompile contracts:
npx.cmd hardhat compileDeploy to X Layer Testnet:
npx.cmd hardhat run scripts\deploy.js --network xlayerNever commit your .env file or private key.
Hardhat stores ABI data inside contract artifacts after compilation.
Artifact files:
contracts/artifacts/contracts/PredictionRegistry.sol/PredictionRegistry.json
contracts/artifacts/contracts/AccuracyTracker.sol/AccuracyTracker.json
contracts/artifacts/contracts/PunditSubscription.sol/PunditSubscription.jsonPowerShell example:
(Get-Content .\artifacts\contracts\PredictionRegistry.sol\PredictionRegistry.json | ConvertFrom-Json).abiThe frontend uses compact human-readable ABIs in:
frontend/src/protocol.tsFrom the project root:
cd C:\Users\USER\pundit-protocol
git init
git add .
git commit -m "Initial Pundit Protocol app"
git branch -M main
git remote add origin https://github.com/YOUR_USERNAME/pundit-protocol.git
git push -u origin mainIf Git asks for your identity:
git config --global user.name "YOUR_NAME"
git config --global user.email "YOUR_EMAIL"If you see Vercel 404: NOT_FOUND, check that Vercel is building the frontend folder and serving dist.
- Push the project to GitHub.
- Open Vercel.
- Import the GitHub repository.
- Set the root directory to:
frontend- Use these settings:
Framework Preset: Vite
Install Command: npm install
Build Command: npm run build
Output Directory: dist- Deploy.
If the project was already imported with the wrong settings:
- Open the Vercel project dashboard.
- Go to
Settings. - Go to
Build and Development Settings. - Set
Root Directorytofrontend. - Redeploy from the latest commit.
Install the Vercel CLI:
npm install -g vercel
vercel loginDeploy from the frontend folder:
cd C:\Users\USER\pundit-protocol\frontend
vercelDeploy to production:
vercel --prod- Keep private keys out of GitHub.
- The frontend should only contain public contract addresses and ABI data.
- Users need testnet OKB to submit transactions.
resolveMatchcan only be called by the owner ofAccuracyTracker.- If contracts are redeployed, update the addresses in
frontend/src/protocol.ts.
MIT