A long night in the Very Nifty gallery

Very Nifty
6 min readOct 31, 2020

--

TLDR: we tweaked in production the $muse reward formula cause of a typo, but luck is still on our side.

Very Nifty was created by two internet friends. We are on an awesome adventure since 3 weeks. As you may guess, building an innovative project in a really fast environment (blockchain & NFT) is tough but we are still running after avoiding lots of critical mistakes and some smaller ones. We learn the hard way while trying to innovate and provide a fair and fun experience to the players.

We’re not a company, we didn’t raise any money or sold anything, we’re just two humans spread across the world building together to explore new ways to give life and value to NFTs. We currently spent way more time and Ether for gas fee than what we earn but we’re so excited by the adventure, this project and the community around it so we keep going.

Here is the tale of one of the most stressful night I had:

This Friday, around 11 pm my time, it was time to launch the new update for Very Nifty (0.420). You can learn more about what the update is about here:

The work this night was supposed to be:

  • Sending the transaction to edit the muse insuance parameters
  • Finish exporting the new vNFT images and publishing them
  • Sending all 200 emails to the people selected for the airdrop

But it didn’t went as smooth as expected and I (Jules) will share how it went.

Sending the transaction was supposed to be easy, we’re sending transactions every day and the code affected by the new economic change was really small and simple yet it affects the core economy of Very Nifty.

The plan was to send a transaction that calls a function with 4 parameters. The parameters are number affecting the formulas that change how level and reward of a given vNFT is computed.

So we casually decide to do it and update the parameters as it was supposed to be the shortest task. The previous values were 2, 2, 6, 7 we were supposed to call the function editCurves with values 2, 2, 1, 6. The two first parameters affects the level calculation, the 2 last one affects the daily reward calculation.

Few minutes after, we notice that every vNFT got their level nearly multiplied by 4:

We then started a hunt for what could have go wrong? It’s late, been 3 weeks of non stop working dealing with community management, game mechanics ideas, development, design, dealing with fud, dealing with some awesome community members..

The race is on to find what went wrong, we look the code, send again the transaction, try changing parameters to see how things get affected, watch the code again… The code is short, it was written in last minute before launch [literally 10 minutes before deployment]:

While looking for the bug, everything got confusing as the Telegram channel makes your phone vibrate every 3 seconds, no time to read, and the pressure adds up while the game econonomy is basically fucked up and even setting back the original parameters is not working. Every minute that passes feels super fast and super slow at the same time…

We dive into the code more, Etherscan (that suddenly give some 403 error at the wrong timing), write code to reproduce, use debugger to see what is happening when sending new transaction. At this time we feel the error can come from the square root function implementation, a variable that is shared somewhere else in the contract storage, anywhere and even our brains..

It’s been more than an hour things went wrong, we have doubts on how to interact with the community, should we pause? should we continue fixing as fast as possible? Is this the end of the adventure?

At this time, we try to relax a few seconds, thinking about the problem with a clear mind. Luckily we remember about Tenderly: a tool that enables to debug smart contract more easily. From there we take a more scientific approach, reseting all variables to 0 then putting the values to see how the contract storage changes:

We notice that the variable are set at the correct value, but not all. Getting back to the code on Etherscan and then:

The font on Etherscan makes the error even more obvious, I copy pasted a line but forgot to change a letter in the last minute. It means that the reward formula will always been stuck with divided by 7.

Relieved, we check back our Google sheets and find out that changing the formula to 2/7 instead of the original 1/6 is acceptable for the game mechanics. We agree, Adam launches the transaction. We refresh the pages and everything seems fine!

That’s how we changed the formula while finding a bug introduced by a typo.

We decided to tell this story openly without any filters to share our side of the story and remind everyone that the project is still in beta. The initial contract, website and mechanics were built in a week. Even if we put our best into the project, some mistakes happens.

Luckily we are able to live with this little typo and continue working on the game and new exciting features and mechanics for the future.

This hour was tiring but it was only the first task we were supposed to do, it took 1h30 instead of 5 minutes, it’s already late and after a few minute break of know people on telegram and discord about the change in formula, we’re back at exporting the new images, uploading and testing if everything goes good!

Adam then goes with an awesome courage, on a 200 email sending spree by hand to the people selected for the airdrop while I start handling the Telegram full of people asking questions about the airdrop distribution. Luckily I have an awesome partner that didn’t blame me for the code typo and is always supportive, positive and fair.

It’s then past 4 am..

And a community member famous for his memes named Squiz send his last creation titled “airdrop2.png” that sum up the evening pretty good… time to go to bed!

--

--