Comment on page
📝
Smart Contracts
There are 5 main contracts on the project. The code and transactions can be seen on PolygonScan on the links bellow.
Contract | Link |
---|---|
TournamentHub.sol | |
TournamentFunctions.sol | |
TournamentGenerator.sol | |
TournamentGeneratorLocked.sol | |
RoundGenerator.sol | |
MatchGenerator.sol |
The contract usage logic works with a tournament hub and four contract generators. The TournamentHub holds the information of all generators, the token to be used for voting, the data feed for the token price, the wallets for Public Goods withdrawal, fees, and jackpot, the administrative wallets, and the verification for all contracts generated in the project.
All contracts are equipped with a modifier called onlyProject, which verifies whether the sender is a project contract or not. The second modifier is onlyAdministrator, which checks whether the sender is a project administrator or not.
The Match, Round, and TournamentFunctions contracts were created to divide the processing of functions, so as not to encounter the blockchain's contract size limits. TournamentFunctions serves as an auxiliary to TournamentHub and Tournament. Some view functions contain redundancies, but they are necessary for the communication logic with the front-end.
There are two tournament generator contracts. The TournamentGenerator, which is a general tournament that accepts any standard ERC-721 NFT and allows any wallet to vote in the tournament. The second is the TournamentGeneratorLocked, which allows the tournament to be locked to a certain collection, both for deposit and for voting. At the moment, the project is using only the TournamentGenerator.
The compilation logic works by compiling and deploying the TournamentHub first, followed by TournamentFunctions, as well as all generators. Next, we inject the TournamentHub address into all generators and into TournamentFunctions to activate them. And then we insert the wallet addresses (fee, jackpot, and public goods) and the addresses of the generators' contracts and TournamentFunctions into the TournamentHub. Only then do we register the administrators and the random arrays to determine the randomization of Matches during the tournament.
Last modified 4mo ago