reNFT’s White-Elephant Code Breakdown

Naz
reNFTLabs
Published in
5 min readJan 6, 2021

--

We recently hosted a white elephant game. Going over the code and explaining the important bits would be neat and help players get a behind the scenes look.

Using truffle (I was a big fan) will waste a ton of your time when it comes to deploys. It works today, but tomorrow it will tell you that it won’t deploy. We have moved completely to hardhat.

For the skeleton of the project, we have used this: https://github.com/wighawag/template-ethereum-contracts. It has everything that you need for Solidity development. The final product is here: https://github.com/RENTFT/white-elephant-contracts.

Rules of the game are the following:

  • Players buy tickets before the deadline. Max number of players is set at 255
  • NFTs are loaded up into the contract; this version of the game supports ERC721s. Only whitelisted depositors can deposit. This is required to forbid external parties from spamming the contract with subpar NFTs.

--

--

Naz
reNFTLabs

I crave knowledge. Mathematical knowledge and then computer science.