How 1 Line Of Code Destroyed $60 Million Worth Crypto Coins In 35 Mins
Just two days ago, a new decentralized cryptocurrency called YAM was revealed by its creators. On its first day, the crypto coin had a market cap of $60 million but a single line bug in the code cause the currency to collapse and YAM’s market cap went to zero in just 35 minutes.
YAM was a decentralized finance experiment so it used a governance system (for making protocol changes). It was based on yield farming protocol where tokens are supposed to keep parity with the U.S. dollar through loosening or contracting supply.
What Happened?
Around 6 PM UTC, on Wednesday, August 12, the team discovered a bug in the YAM rebasing contract that would mint far more YAM coins than it intended to sell. This resulted in a large amount of YAM being sent to the protocol reserve, explained the YAM project in a blog post.
“These tokens were owned by the governance contract itself, and therefore couldn’t vote. Because they exist and can’t vote, it’s impossible to ever meet the minimum voter participation. This means governance is permanently disabled, and all other tokens held by the governance contracts are permanently locked.”
In short, the coin lost control of its on-chain governance feature. The code hadn’t been properly audited given its relative newness and the bug caused the protocol to keep printing “dud” YAM tokens that ended up preventing token holders from making any governance decisions.
The Bug
The bug responsible for the above came from this line of code:
totalSupply = initSupply.mul(yamsScalingFactor);
But it was actually supposed to be something like this:
totalSupply = initSupply.mul(yamsScalingFactor).div(BASE);
The team says that nearly all of the $750,000 Curve tokens stored in the project’s treasury have been locked up by the code flaw. These assets intended to serve as a reserve currency to support the value of YAM tokens.
The Aftermath
All the efforts to regain control of the YAM treasury has failed. So co-founder of YAM, Brock Elmore tweeted an apology:
There were nearly 29 million YAM tokens in circulation. At one point, the project even managed to touch a market cap of about $525 million. Even now the currency appears to have about $29m value, that is if you can find any YAM buyers.
Anyway, the project announced a plan to migrate to YAM 2.0. You can find all the related details here.