DePayFi / widgets

💸 Payments directly into your wallet. DePay simplifies and improves Web3 Payments with the power of DeFi. Accept any token with on-the-fly conversion and state-of-the-art widgets.
https://depay.com
MIT License
96 stars 36 forks source link

Error: cannot estimate gas.... #66

Closed arefay closed 1 year ago

arefay commented 2 years ago

After connecting my Trust Wallet via Wallet connect, the widget correctly pulls up my balances for BNB and Safemoon.

Selecting "Safemoon" and hitting "Pay" shows the "Confirm transaction in Wallet" for a split second, then the widget resets back to just show "Pay". In the console the response is as follows:

error Error: cannot estimate gas; transaction may fail or may require manual gas limit [ See: https://links.ethers.org/v5-errors-UNPREDICTABLE_GAS_LIMIT ] (reason="execution reverted: \b�y�\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000 \u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000$TransferHelper: TRANSFER_FROM_FAILED\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000", method="estimateGas", transaction={"from":"0x48941578db618c657867b54AA89846C893e375b1","to":"0x0Dfb7137bC64b63F7a0de7Cb9CDa178702666220","value":{"type":"BigNumber","hex":"0x00"},"data":"0xb7d29a3500000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000000300000000000000000000000042981d0bfbaf196529376ee702f2a9eb9092fcb5000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c0000000000000000000000008ac76a51cc950d9822d68b83fe1ad97b32cd580d0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000002ec18d2b7000000000000000000000000000000000000000000000000000ff59ee833b3000000000000000000000000000000000000000000000000000000000000630e5976000000000000000000000000000000000000000000000000000000000000000200000000000000000000000048941578db618c657867b54aa89846c893e375b10000000000000000000000008c34fffee7cf20dfc51bfc2cde5d0f4a84af40e80000000000000000000000000000000000000000000000000000000000000002000000000000000000000000ac3ec4e420dd78ba86d932501e1f3867dbbfb77b0000000000000000000000008b127d169d232d5f3ebe1c3d06ce343fd7c1aa110000000000000000000000000000000000000000000000000000000000000000","accessList":null}, error={"code":3,"data":"0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008408c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000245472616e7366657248656c7065723a205452414e534645525f46524f4d5f4641494c45440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.6.8) at nv.makeError (index.bundle.js:52:177261) at nv.throwError (index.bundle.js:52:177381) at yM (index.bundle.js:60:121389) at SM.<anonymous> (index.bundle.js:60:130061) at Generator.throw (<anonymous>) at a3 (index.bundle.js:60:120502)

There's no message showing on the widget indicating that this issue happened, nor is the error accessible or reported via the:

critical(), or error: () methods on the Widget

10xSebastian commented 2 years ago

Starting investigation...

10xSebastian commented 2 years ago

SafeMoon is a so called token with transfer tax. That makes it ultimately a none erc-20/bep-20 token as transfer tax is not part of the standard and also incompatible with DePay. As transfer tax is also not standardized, there is no way to detect it. Which leads us with "unusable token" . Which are also impossible to detect, has the onchain error that happens upon estimating a potential transaction (what you've pasted) could came from all kinds of reasons including being specific to your sender address.

The widget resets to allow users to switch the means of payment to execute the payment.

I've removed safemoon from the expedited routing api, so it shouldn't show up as means of payment in the widget for you anymore.

How to manage "unusable/unsupported" tokens is constantly a topic but not mature enough yet to make a decision on a product level.