Smart contracts have great power to absorb money like a black hole. Almost 400$ Million is gone due to a bug in the smart contract of YAM. What was the bug that cause all the destruction?

=> Could there be any handle mechanism by Solidity or some kind of approval mechanism before deploying smart contract?

Some high-level information:

We have found a bug in the rebasing contract, please read below. All funds in staking contract are safe, as this is an unrelated part of the protocol. User YAM balances are also unaffected. — Yam Finance (@YamFinance) August 12, 2020

In the case of this bug, an excess of YAM tokens would be printed, causing a larger supply to dilute the intended price, meaning that the value of each YAM token would decrease — hurting investors. Additionally, this larger supply of YAM tokens would make it more difficult for the community to contribute to governance, as more YAM tokens would be needed to make changes. This would make the code unable to be modified, so bugs such as these would persist.


They wrote SAVE YAM! 🍠 with details of the error

totalSupply = initSupply.mul(yamsScalingFactor);

should have been:

totalSupply = initSupply.mul(yamsScalingFactor).div(BASE);

Line on github: https://github.com/yam-finance/yam-protocol/blob/767e3a4a6918b6fb6100ad6bb356164408f5d82f/contracts/token/YAM.sol#L340

  • Will the burned tokens would be saved on the version-2 or all the invested money is gone? – alper Aug 19 '20 at 13:58
  • 1
    @alper Sorry, but I don't know the migration plan details. From the original bug report the investor funds were not affected directly (only by the price drop), the locked tokens were in the governance contract. From their post on medium it seems you have to explicitly migrate to the new contracts, so I'd suppose locked tokens will not be migrated or there will be a different mechanism. – Ismael Aug 19 '20 at 18:28
  • 1
    yamv2 is avaible (coingecko.com/en/coins/yam-v2) same idea but in market with new tokens that are not migrates from yam. – alper Aug 20 '20 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.