Demo Video: https://youtu.be/znRGWdujCfk
Frontend deployed at: https://dao-automate.vercel.app/
Introduction
Royal is prediction game where user have to add randon number b/w 4-100 to the LINK/USD price feed and the winner will get the full pool bounty.
Contract Info -> The contract is deployed on Scroll sepolia
Contract Address: 0x46cDAe0d7c2f9421f494F6b378A4165dE98F06C5
Welcome to our decentralized application (dapp), where you can participate in an exciting prediction game! Here's how it works:
Club Creation: Any member can create a club. When creating a club, we fetch the current ETH/USD price from ChainLink and save it securely on the blockchain.
Club Opening: The club is open for 2 minutes, during which interested players can join and participate.
Prediction Proposal: Before the game deadline, players must propose the price they predict for a certain event. The game is open for 5 minutes.
Guessing Game: Players choose a number between 50 and 100. This number is then combined with the data feed fetched from ChainLink.
Reveal and Reward: At the end of the game, the smart contract reveals the combined data feed (summed with a random number). If a player's prediction matches or is closest to the revealed number, they win the full prize from the club pool.
## Note: The user have to deposit some eth to the club pool before craeting the proposal
ChainLink
I Usedd Price Feed in my project. User have to Guess a number b/w 50-100, then have to sum up with the pricefeed shown on their dashboard after that at the end of the smart contract will reveasl the winner.
Please refer this code to see how I used Price feed in my project -> https://github.com/Vikash-8090-Yadav/Royal/blob/main/Frontend/src/pages/createclub.jsx#L194
State Chnage -> if user won then he / she can claim full bonty prize (Only when won)
https://github.com/Vikash-8090-Yadav/Royal/blob/main/Frontend/src/pages/proposal.jsx#L208
Working flow
Dashboard
- Here user can see their dashboard, their clubs, balance and proposals and profile secttion as well
Create club (LINK USD Price fetched here)
- User can create club for prticular asset like ETH USD, LINK USD etc
Contribute to the club pool
Without donating to the club users can't participate in the game
Create prposal
After depositing to the club users can create their proposal for their Guessed price
Winner reveal after game ends
After the game deadline the winner declare
🛠️Technologies we used
| Technology | Description | Official Website |
|---|---|---|
| React.js | JavaScript library for building user interfaces, often used for server-rendered or statically-generated applications | React.js |
| Tailwind CSS | Utility-first CSS framework for building custom designs | Tailwind CSS |
| Solidity | Programming language used for smart contract development on the Ethereum blockchain | https://docs.soliditylang.org/ |
| LightHouse | Store file Secure, Reliable, & Lightning-Fast with Lighthouse. | https://www.lighthouse.storage/ |
| ChainLLink | Chainlink is the decentralized computing platform powering the verifiable web | https://chain.link/ |
What Next for Royal?
- ChainLink automation: I can use chainLink automation as well for the funds distribution to the winner but due to the lack of time I can't
- ChainLink function: I can use ChainLink function to check for the genuine users and avoid spams proposal
Challenges I faced
- while fetching the price feed and combining this with the dapp throws me lots of errors like price is not fteched properly and state chnange.
Restrictions
The Royal smart contract has some restrictions:
- Up to 99 members per club (in many jurisdictions, such as the USA and Chile, this is the maximum limit of club members for certain purposes and types of clubs).
- Only members can participate in club instances.
- Only members who contribute funds to a club have the right to create proposals.
Log in or sign up for Devpost to join the conversation.