The Customer Pitch Are you a Polyfarm, Matic Mike, or Evil Club Lord holder? This dapp allows you to enter your beloved NFT(s) into battle, for 10 $EGG with a chance to take home ~350 $EGGs! A complete randomization, anyone has the chance to take home the pot, but having a higher power level will slightly increase your chances, so don't forget to juice up with some $HGH!
How to Enter Enter by selecting your NFT from the dropdown, selecting 0-5 $HGH for a power boost (1-10 power levels per $HGH, these will be burned fro the supply), and clicking enter royale.
Once entered, you can "Watch Battle" which will start once the queue pops. The initial queue size starts at 50 max, but will lower to a minimum of 15 if over an hour passes without the queue filling up.
Stats are saved for NFTs on-chain, and will be available after the first person enters the new queue.
The Payouts 70% to First Place 20% to Second Place 10% to Third Place
a 5% royalty will be automatically deducted from every royales pot for Matic Mike (the developer of this mini game).
Problems It Solves What's been created is a powerful tool to collaborate with multiple projects in a unique way, bringing new communities together by the power of competition. I also did this specifically with Polyfarm in mind as their devs are currently working on phase 2 of their project, and this provides a nice interim game while they work on their next portion. It also brings utility to projects that otherwise may not have much utility, because the royale contract itself is compatible with any ERC721 compliant token.
The Project The project is as it sounds, a rolling battle royale queue living 100% on chain, with multi-contract support. Technically, it can support any ERC721 and 2 ERC20s at a time, 1 for burning to add additional power to your NFT while entering the royale, and 1 that is used as the currency to be used to enter / win the royale.
The project is a revamp of a previous version which was a singular dance royale contract only supporting my own NFT Project (Matic Mike), and 1 ERC20 token ($HGH). For this hackathon I decided to extend the functionality as well as revamp the rolling system to be more secure and prevent against potentially spying on rolls before the queue has popped (to determine whether or not you should bother entering).
For this contract, I am using my ERC721 contracts, Matic Mike & Evil Club Lords, which are the first fully on-chain metadata and graphics NFT on the polygon chain (as far as I'm aware). For a test case of the new contract being able to extend to other projects, I am using the other fully on chain project on polygon, Polyfarm Foxes & Hens (what a funny combo, pixelated gym bros and farm animals).
Along with the contract, I've created a completely custom user interface for selecting NFTs to add to the queue, adding extra "juice" to the power level, and displaying how many are in queue and royale history (watch previous royales).
The actual viewing of the royale and stats have also been created to pull in new NFTs in the dynamic pull. The stats have been modified to act more as a singular project, but I have been working outside of this hackathon event on an analytics contract to be able to pull from multiple different royales and compile analytics. This is to be used on the Matic Mike NFTs as it returns stats from royales into traits to display on aftermarkets such as opensea, tofunft, etc.
This submission is specifically a major overhaul of the battle royale system to allow multiple projects, different ERC20s, and the front-end UI for supporting such.
Future Plans There is hardcoded contract endpoints in the front-end code for time constraints of this weekend. Ideally I would like to be able to dynamically pull the ERC721s eligible for the royale and auto populate the NFT selection, battle royale view, and stats without having to code for specific projects (ie. Matic Mike, Evil Club Lords, and Polyfarm used in this submission).
There is no API, no IPFS, just pure blockchain and web3, using NFTs that are 100% on chain. It can support any ERC721 and ERC20, whether or not their metadata is on or off-chain.
Seeds, rolls, reentrancy and preventing exploits.
A random seed is provided by chainlink every entry and stored for the entrant. To prevent anyone from spying on seeds to determine all rolls prior to the start of the contest, I've created an additional chainlink call that acts as a global seed modifier on the last all. All rolls are generated on the last call after all seeds have been modified.
For rentrancy protection, I have had multiple peers review the order of operations used and we're all in agreement that we have no concern of rentrancy.
Because VRF acts as a commit / reveal, we don't need to worry much about any flashbots exploits. The seeds and rolls are also determined on the final entry.