BTC stuck: “Fail with error ‘ds-math-sub-underflow’”

Hi everyone!

I am a complete newbie at programming with a big and urgent problem.
I am trying to (emergency) withdraw funds from a smart contract vault at BSC but I get “Fail with error ‘ds-math-sub-underflow’”.

Now the problem is, that it is quite a large amount that is stuck and the website is going to go offline next week.

The devs are nowhere to be found, but from some vaults funds have been able to get withdrawn by raising the gas fee drastically. But alas not from this one.

So I try my luck here with you guys that at least understand more than I do about communicating with smart contracts.

Does anyone have any idea what I can do? I know that you guys are enthusiasts happy to help – but if this gets solved there will be a reward as well.

Sincere regards
Zorro

Are you sure you aren’t trying to take more than there is in there? (since it says it is an underflow error)

Hello Kone,
Thanks for your reply!

Yes,I am dead sure. I have also tried to withdraw much less but the result is the same.

Could we get the link to the contract on a chain explorer?

i think this one
https://bscscan.com/address/0xc5A49b4CBe004b6FD55B30Ba1dE6AC360FF9765d#events

This is the right contract:

https://bscscan.com/address/0x33adbf5f1ec364a4ea3a5ca8f310b597b8afdee3#events

1 Like

And what function are you trying to call?

Last time I was trying to call withdraw function:

https://bscscan.com/tx/0x0fc8b75cc22642d7ff54a100070fd9c1aeea22a4cf94ab9fcecf4e751fb37e6b

I looked at the contract code and couldn’t find what could cause that error sorry :confused:

OK, thanks anyway for your effort!
Could it be related to the pid (which is 281)?

With other vaults a hefty raise of gas has been a solution.
But the strange thing is that when I try to raise the gas price and the gas limit here, it won’t take it: Metamask says it is going to charge 0.5 BNB ($225) but it does not charge more than 0.000769245 BNB ($0.36).

I really don’t see how raising gas would help, that’s pretty interesting. And I am pretty sure metamask does that automatically because it sees no point in paying that much if you can get through with much less.
Were the other contracts identical?

I don´t know if they were identical. I see now that amounts are being withdrawn from that contract all the time. My vault (281) is “retired” but other retired vaults have been withdrawable.

But for many vaults users were forced to pay up to $40 to get the funds out. Once I was greedy and tried with only $20 but that did not work, so I had to try again with $40. (Hence it became 60 in toto. :-()

Do you have a link to a contract that was emptied maybe?

Not going to lie though, if the others were already emptied and this one still hasn’t, then it might not be possible?

I tried to withdraw with help from the site farm.army, which show the vault and also log the response. It’s like greek to me but it seems to be related to gas in some way at least:

Detecting Web3…
Checking Accounts…
Checking Chain…
Estimate Transaction Gas…
Transaction error estimateGas: JsonRpcEngine: Response has no error or result for request:
{
“method”: “eth_estimateGas”,
“params”: [
{
“from”: “0x315ee1bf3198dc92c2a70be0be50e3c61eeee763”,
“data”: “0x958e2d310000000000000000000000000000000000000000000000000000000000000119”,
“to”: “0x33adbf5f1ec364a4ea3a5ca8f310b597b8afdee3”
}
],
“jsonrpc”: “2.0”,
“id”: 4175400079,
“origin”: “https://farm.army”,
“tabId”: 110
}
{
“request”: {
“method”: “eth_estimateGas”,
“params”: [
{
“from”: “0x315ee1bf3198dc92c2a70be0be50e3c61eeee763”,
“data”: “0x958e2d310000000000000000000000000000000000000000000000000000000000000119”,
“to”: “0x33adbf5f1ec364a4ea3a5ca8f310b597b8afdee3”
}
],
“jsonrpc”: “2.0”,
“id”: 4175400079,
“origin”: “https://farm.army”,
“tabId”: 110
}
}

Yeah, I am not sure then sorry, don’t know how you can get them out :frowning:

Yeah, I understand.
Thank you very much for trying!

1 Like

Can “EXECUTION REVERTED: DS-MATH-SUB-UNDERFLOW” be caused if the contract is trying to spend more than the allowance given by user?