Need Help ASAP. Smart Contract bug

Need Help ASAP. Smart Contract bug

could you be more precise? maybe share your code and tell us what the bug is?

1 Like

Hi, having problem with balance > ratio? on safemoon/reflect like token.

When interacting with smartcontracts which is excludedFromRewards.

Interacting with masterchef, if 2 accounts each staked some tokens, and started to earn rewards, 3 tokens per block, after some time and accumulation of rewards, when trying to withdraw/harvest/transfer ,it gets safeMath Overflow , its like the balance of masterchef is less than what is deposited?

another example, when i couldn’t do any action on masterchef i was going to try the presale contract.

with a new account i try to buy from the pre sale address with over 9 million tokens, but it let to buy only < 20k tokens over this it gets the error overflow, so i bought 15k with that account, then after this i was able to buy over 90k with another account.

masterchef still couldn’t do anything, so i send directly 10k tokens to it, then after this the user who bought 75k tokens was able to deposit, and others was able to withdraw etc, till the balance gets on a ratio which become buggy again.

In short, even with more balance than it has to pay, the system thinks it has less, it deny transfers.

I’m correctly minting with the current rate math thing to the masterchef, and it transferFromExcluded to user wallets, and user wallets TransferToExcluded, everything as it should.

i will share my contract on DM.

Masterchef doesnt natively accounts for the tax. Like if you deposit say 100 tokens to masterchef with a 5% tax, it’ll get only 95 tokens but it’ll still record that you deposited 100 tokens and will try to give you those 100 if you withdraw, which can lead to math errors. Did you account for the tax in your code?

1 Like

Hi, good thinking, yea I have excluded every tax with masterchef transactions, I have discovered that new minted tokens wasn’t coming with the rAmount, which is needed to send to users on rewards and withdraws. So I have changed the mint function to use getTvalues function and update both balances, then it fixed.