How to earn by predicting the winning teams of World Cup Football

How to earn by predicting the winning teams of World Cup Football

Learn how to earn by playing the World Cup NFT Fantasy Game

😎 Welcome

Welcome, everyone! In this guide, we will be talking about what WC NFT Fantasy is, how to get started and some technical details on the project.

πŸ€” What is this project?

WC NFT Fantasy is a NFT prediction-based game that you can play to win. The game lets you pick 4 teams that you predict will win the FIFA World Cup 2022 in that order, and win the prize pool if you guessed it right!

If multiple people guessed the right answer, then the winner will be selected by True on-chain Randomness (Using Chainlink VRF).

You can visit this page if you want a quick overview to get started.

πŸ›οΈ What do I need before getting started?

You need a minimum of 4 Matic + gas fees to mint the first 4 teams and join the main prediction game.

1 Matic costs $0.87 at the time of writing (0.87 x 4 β‰ˆ $3.5).

πŸšΆβ€β™‚οΈ How do I enter the game?

  • Visit the website here.


  • Click on Connect Wallet at the top right of the website

ConnectWallet1

  • Click on your wallet to connect using your favourite wallet.

ConnectWallet2

If you don’t have a wallet and want to get started, click here to create a wallet. We recommend MetaMask.

If you don’t understand what web3 is, you can learn more here.

  • Once connected, you can click on the Mint button on the Header, or scroll down until you see the section to Mint.

MintSection

  • Using the two buttons below to navigate, select the teams that you want in the exact order that you predict they will win. For example, if I predict that the following teams will win :

1 - Brazil, 2 - Argentina, 3 - France, 4 - England

It would look like this :

Countries

You can click on the Delete Selection button if you want to change the order

  • Once you are sure of your selection, scroll down and click on the Mint button. After the section, this should pop up :

Confirmation

Insert the amount of Matic that you wish to bet on. Note that the minimum amount is 4 Matic (1 Matic per NFT x 4 NFTs).

  • After inserting the amount to mint, click on the button Confirm underneath and a confirmation from MetaMask (or your wallet) should pop up.

  • Confirm the popup to proceed with the transaction. In a little while, everything should be in order and you should have the NFTs.

  • Click on the Play Game button at the top of the website or go here to view your NFTs.

MainGame

On this page, you can view your NFTs, evolve your teams if eligible, swap teams if eligible, and deposit your prediction points after the game ends.

🀝 Swapping Teams

You swap teams when you feel another team has a chance than an existing selected team. Swapping is very limited, therefore, always be sure of the order that you choose to mint.

You can swap only between two teams at a given time. Assuming you minted the extra two teams that you can swap against, you can only perform the swap feature against the extra 2 teams in Round 32 and Round 16 of the game.

You can however swap from the main chosen 4 teams after each round announcement at Round 32, Round 16, Round 8, and Round 4 respectively.

SwapImage

In order to perform a swap, go into the Main Page.

πŸ€·β€β™€οΈ What do I do now?

Congrats! You have successfully entered the game. Now you have to watch the Football games and see how well you did your prediction.

πŸ₯‡ What is Upgrading/Evolving?

There are four rounds that the Football game goes through before announcing its winners. After each round, if your team is in the tournament, you can upgrade or evolve your NFT.

Since you can only upgrade if the chosen team is selected for the next round, upgrading will change your NFT to make it way cooler and worth more.

Evolve

Evolve Example : EvolveExample

This will cost some gas for the transaction since it will Mint you a new token.

⚽️ Games

This will give you a quick overview of the types of games that exist in WC NFT Fantasy. The opening of the Quiz and Number game will be announced by us on Twitter, so check out the Teams section in this guide to follow us for that update!

πŸ“ˆ Prediction

This is the main game that you predict the winning teams in their order and win the main prize if guessed correctly.

🧠 Quiz

This is a mini-game where you can win NFTs by answering the questions right (This may or may not be cool level 3 NFTs).

You can do the quiz here when it's opened.

πŸ‘€ Number Guessing

The Number Guess game is all about guessing a random number right to win a cool NFT if you do. This game will be available after the Quiz game mentioned above.

πŸ›  Technical Details

In this section, I will talk about the technical aspect of this project. This includes explanations of various technologies and techniques used, with links to frameworks/stacks used.

β˜€οΈ Frontend

We have used Next JS on the Front end, along with the following plugins :

  • Rainbowkit for Wallet handling and connection.
  • Axios to fetch queries from the Subgraph (explained later).
  • Ethers for EVM Interactions and conversions.
  • GSAP for handling animations.
  • Next-SEO for SEO Management within the website.
  • TailwindCSS for CSS consistency within the project.

All the frontend code van be viewed in this repository. Our frontend is more focused on UX (User Experience), therefore uses great UI (User Interface) and built in a way focused to make the users interact with the smart contract backend easier and smoother.

πŸŒ’ Backend

The backend in our project is quite complicated and has a lot of contracts and techniques used to make it possible. I will try my best to explain this as smoother as possible.

Summary

We have created 9 different contracts (A total of more than 15) for this game to work.

The main Prediction uses ERC1155 to build an upgradable contract.

Note that you cannot transfer NFTs until the tournament is completely over.

Here is a summary of each of those 9 contracts and how they work.

Note : You can click on any of the contract names to take you to view their code.

Tech Used

  • Hardhat - To compile, test and deploy into the network.

  • Chainlink Price Feed - Determine how much users pay for teams.

  • Chainlink VRF - Choose winners based on who predicted and the amount of points they scored.
  • Chainlink Keepers - Autocall functions when different rounds start in the World Cup.
  • Chainlink Adapters - Call the API to receive the players that are still in the World Cup.

  • IPFS - Stored and deployed the NFT Images and the NFT Metadata in a decentralized way so that they cannot get altered by anyone including us and, the data will always be publicly accessible.

  • Quicknode - We used Quicknode to deploy all our smart contracts on the network.

  • Polygon - Enables us to deploy contracts in L2 blockchain which helps handle traffic for the rush in the event of buying tickets.

All of the backend code can be viewed from our repository.

β›“ Subgraphs

We have used The Graph to query the data emitted from the events in the contract code and display them on the frontend.

You can view all of the files of the subgraph from our repository.

πŸ‘₯ Team

This project was made by 4 people for the Chainlink Hackathon.

You can check other projects we have done here.

πŸ“• Resources

❀️ Thank you

Thank you for reading this article. Suggestions and Feedback and very much welcome! Don't forget to like and share around if this helps.

Β