COMPLETED & RESOLVED) Bugs found for previous V2 Farm and Pools (V1 not affected)

*Note* the Original V1 farms are unaffected by these issues.

๐Ÿ”’Some funds are temporarily locked on MasterchefV2 and has to be unlocked (Right now they are SAFE on the Blockchain)๐Ÿ”’

Some users have unfortunately encountered problems when making withdrawals and deposits of tokens due to bugs found in our smart contract.

Here is an in-depth description:

First bug : Emergency withdraw results in lost funds


No one should use the Emergency Withdrawal function to release funds because using it will result in a loss of funds!

The reason: It subtracts the amount from the user before sending their tokens.

We can't stress it enough: No one should use this function for now!

Second bug: Calculation of the pending reward

Not every user were affected by this error but we have stopped the Masterchef rewards until we confirm that the proposed solution is adequate. We have however resumed emission rewards in order to allows users to unstake their funds.

A mathematical overflow does not allow any users to release their funds, and this happens because: amount*accSlimePerShare.div(1e12) is greater than user.rewardDebt This causes the contract calls to fail.

pending = user.amount.mul(pool.accslimePerShare).div(1e12).sub(user.rewardDebt) ;

To allow these funds to be released, no new deposits by the user should be made and it is necessary to increase the slimePerShare by one pool.

We will increase this slimePerShare parameter and we continue the rewards soon.

The next step for Slime Finance: ๐Ÿค”

We are confident that this solution will work but to ensure the highest level of certainty, we are working with other developers in the space and with our most recent auditor Solidity Finance. We expect an audit report this Wednesday.

If this solution works as expected, a new SmartChefv2 will be deployed and all these problems should be solved, without deposit fees and hopefully with a new audit. We will be making new announcements to keep everyone up to date and increase emissions to make up for the lost time. ๐Ÿ”œโœ”๏ธ

Meanwhile what you can do:

For those who previously had ZERO issues with unstaking, withdraw your stake as the harvest will be disabled, yield will be burned, emissions will be continued and send you the equivalent amount of harvest after the burn takes place, if you're not able to unstake please wait for our auditor to audit our to-be implemented solution or for further instruction. During unstaking: UNSTAKE the MAX amount, otherwise a timelock might be activated. This timelock duration is different for each user. Further details are explained in the next section. โš ๏ธPLEASE! DO NOT USE THE EMERGENCY WITHDRAWAL feature, OR ALL YOUR FUNDS WILL BE LOST!โš ๏ธ

The solutions explained ๐Ÿ’ก

First bug: Emegency Withdrawal

We have added a parameter before "update user amount", now the users will be able to obtain all their funds using the Emergency Withdrawal feature (Guide to be added for V2)

Second bug: Calculation of the pending reward

A bug on our withdraw function was found. This bug happened to specific users staking in few of the Pool/Farms that did a withdraw from their total staked amount. On the first attempt that a user withdraws funds, they are sent correctly, but the next withdraw timeframe will be bugged for a duration, and this duration is not the same for each user.

Users that withdraw a bigger amount vs the total will need wait more time to unstake the second time

When the bug is resolved, you will be able to remove all your tokens, and you MUST unstake ALL your amount staked, otherwise you will need wait again to unstake the remainder. The next time you are able to unstake may take a few hours, it depends of block/rate parameter, the amount a user left staked vs total, and pool.accslimePerShare, this parameters increase with each pool update, until this parameter is bigger than user.rewardDebt parameter, you cant unstake funds.

You can tell if your account on a specific pool is bugged by the following:

When you attempt to unstake and high fees amount is showed on your transaction, that means this will fail due to the bug.

To accelerate this process, we plan to increase the emission of SlimeV2/Block by a lot, and set deflation near 100% for all slimeV2 sent by the Master Chef contract. Thus all the harvested balance and slimeV2 withdrawals for slimeV2 Pool will be burned. For the second case, affected users will be reimbursed with 100% of their rightful tokens that were burned.

Recovering from these bugs and moving forward with V2

We will be whitelisting affected users to have 0% Deposit Fee on the new SmartChefv2 Contract

The new MasterChef (SmartChefv2) will check a user's previous deposit information and if the same user stakes in the same Pools that have been affected, ZERO fees will be applied This whitelist method will work for a specific duration which we will announce. After the announced duration is over, the normal Deposit Fees for the Farms and Pools will be applied on all new deposits.

We understand that it has not been a smooth launch of V2 for everyone but thank you for the strong support that you have shown towards making Slime Finance a better Defi project with a wonderful community๐Ÿ’™

Last updated