Fixing the Foundation
Our move to active staking, the benefits of which Elton has described in Our Move to Active Staking, gives us an opportunity to address the technical issues that have been plaguing us since the beginning.
The current foundation of Noundles has several flaws that are holding us back. My main focus is to rebuild this foundation and eliminate the technical debt we’re carrying with us.
Many of you have been hungry for information on the technical progress and road ahead. So let’s start with the problems we’re trying to fix.
- Inflexible game mechanics
Smart contracts are pieces of code that are deployed to the blockchain. These smart contracts are visible for all to see, providing transparency into how tokens are earned, P2E games work, and collections are governed. Once a smart contract is deployed, it can not be changed. This is a significant shift from software development in web2, where code changes that introduce new features or fix bugs are often deployed to production every day.
This is why it’s important to build modular pieces of code, each contained in their own smart contract, that can be combined into an upgradable system where each part can be swapped out for an updated version.
The original Noundles contracts contain both the collection logic, which is responsible for keeping track of the ownership of each token, and the game logic. This tight coupling between the game and tokens means that we currently can’t change any of the game mechanics.
2. High gas consumption
Executing a transaction on the blockchain costs gas. Every transaction is made up of various operations that each consume a certain amount of gas. The most expensive operation by far is storing data. Storing a single number on-chain costs approximately 20,000 gas (around $3 with a gas price of 50 gwei and $3,000 ETH).
The current Noundles contracts are storing a lot of extra data that needs to be updated on every token transfer. As a result of this, transferring a Noundle costs over 170,000 gas, while this typically costs around 50,000–60,000 gas in other collections. Especially when a collection has a relatively low floor price, the gas overhead makes up a significant part of the cost to buy a token.
3. Contract logic bugs
One of the pieces of data that is stored by a typical NFT smart contract is the token balance of each address. While the Noundles contracts are built upon the OpenZeppelin ERC721 base contracts which already track these token balances, they have added their own balance counter which also gets updated on each transfer. While this counter is correctly updated in the regular transfer function, which is used by OpenSea, the safeTransfer function which is used by LooksRare and other newer marketplaces accidentally updates this counter twice. This results in incorrect token balances that affect your rainbow payout, but more importantly it can result in tokens getting stuck. If I have 2 tokens, and I sell one on LooksRare, my token balance will be 0 and I can no longer sell my final token, since operations that cause this balance counter to go negative will result in a failed transaction.
Because of this, we’ve had to disable sales on LooksRare in February. Unless we address this issue, we will not be able to sell our tokens through new platforms such as the Coinbase NFT marketplace.
While it is possible to work around the first two problems to a certain degree, there is no way to bypass the transfer logic bugs in our current contracts. This means that we have to move to new smart contracts if we want our collection to be compatible with new NFT marketplaces.
Instead of going through an explicit migration where you exchange your existing tokens for tokens in a new contract, we want to handle this transition implicitly as part of staking your tokens. This means that when you stake your existing tokens, they are automatically wrapped by a token in a new gas-efficient contract before being deposited into the staking contract. When you later unstake your tokens, you will receive the wrapped tokens.
One other change we want to introduce during our move to active staking is the way we track pending rainbow balances. The current approach, where these balances are tracked on-chain, contributes significantly to the gas cost of token transfers. With the move to active staking, this gas cost would be moved to the staking and unstaking actions, but we want to take this one step further and move the pending balances off-chain. Besides eliminating the gas cost of doing this on-chain, this gives us more flexibility to change the game mechanics around rainbow earnings. As an additional benefit, this opens up the door for gasless rainbow shop interactions in the future.
Making all these changes to our foundation is a big undertaking, and we have discussed ways that we can move forward from here in a faster, more visible way by breaking the project down into smaller milestones. This iterative approach will keep the community updated every step of the way, in addition to giving us enough time for the transition.
These steps include:
- Turning off passive staking (ETA 5/18).
This will result in the gas cost of token transfers becoming about 50% cheaper. One important thing to note is that, once we turn off passive staking, any unclaimed rainbows will be lost.
- Turning on active staking + gas-efficient new contracts. (ETA 5/25)
Once we deploy the new contracts, you will be able to wrap and stake your existing tokens in a single transaction. If you unstake your tokens, they will appear in one of three new collections, with Evil Noundles and Companions now in their own, separate collections.
- Enabling claims of rainbows earned through active staking. (ETA 6/1)
Once this last step is in place, you will be able to withdraw your pending rainbow balance that is earned through staking your tokens. You will not lose any rainbows from the time you stake until the time you can claim your rainbows.
Elton, Mr. Brightside and the Mod Squad will start informing the community about the need to claim rainbows so that everyone can get all of their Rainbows out. We’re excited to take this ambitious step forward for the good of the Noundles Project!
– 🌈 WKM