question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Swapping via Quickswap (Polygon/MATIC) chain shows insufficient funds

See original GitHub issue

Reports of insufficient funds even though there are funds here: https://www.reddit.com/r/brave_browser/comments/qvo5px/does_swapping_via_quickswap_polygonmatic_chain/

Steps to reproduce

  1. Ensure Polygon is added as a network. Screenshot 2021-11-19 at 6 33 51 AM
  2. Switch your network to Polygon, and make sure you have some MATIC in your account (ping @onyb if you need some).
  3. Go to Quickswap Exchange and connect your wallet.
  4. Perform a MATIC-USDC exchange, and confirm the transaction on the panel popup.
  5. Click on View on Block Explorer in this screenshot and wait for the transaction result in that page to be ready. Screen Shot 2021-11-18 at 9 09 58 PM

Expect Result

The transaction should be successful.

Actual Result

The transaction failed with this error Screenshot 2021-11-19 at 6 38 29 AM

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
darkdhcommented, Nov 19, 2021

In components/brave_wallet/renderer/brave_wallet_js_handler.cc We use gas price emptiness to determine using legacy tx or eip1559 tx but gas price is optional And there is no eip1559 support in polygon (verified by @onyb )

...
  } else if (method == kEthSendTransaction) {
    std::string from;
    auto tx_data =
        ParseEthSendTransactionParams(normalized_json_request, &from);
    if (tx_data && !tx_data->gas_price.empty()) {                   <<<<<<<<<< gas_price should be optional
      brave_wallet_provider_->AddAndApproveTransaction(
          std::move(tx_data), from,
          base::BindOnce(&BraveWalletJSHandler::OnAddAndApproveTransaction,
                         weak_ptr_factory_.GetWeakPtr(), std::move(id),
                         std::move(global_context), std::move(global_callback),
                         std::move(promise_resolver), isolate,
                         force_json_response));
    } else {
      from.clear();
      mojom::TxData1559Ptr tx_data_1559 =
          ParseEthSendTransaction1559Params(normalized_json_request, &from);
      if (!tx_data_1559)
        tx_data_1559 = mojom::TxData1559::New();
      brave_wallet_provider_->AddAndApprove1559Transaction(
          std::move(tx_data_1559), from,
          base::BindOnce(&BraveWalletJSHandler::OnAddAndApproveTransaction,
                         weak_ptr_factory_.GetWeakPtr(), std::move(id),
                         std::move(global_context), std::move(global_callback),
                         std::move(promise_resolver), isolate,
                         force_json_response));
    }
  } else if (method == kEthSign || method == kPersonalSign) {

We should check the network with EthJsonRpcController::GetIsEip1559 to decide use eip1559 or not

0reactions
srirambvcommented, Nov 23, 2021

Verification passed on

Brave 1.32.111 Chromium: 96.0.4664.45 (Official Build) (64-bit)
Revision 76e4c1bb2ab4671b8beba3444e61c0f17584b2fc-refs/branch-heads/4664@{#947}
OS Linux
  • Verified test plan from issue description
  • Verified able to swap tokens on Quickswap (Polygon/MATIC) Txhash
image image image image image image
Read more comments on GitHub >

github_iconTop Results From Across the Web

Insufficient MATIC to swap MATIC on QuickSwap : r/0xPolygon
I was able to get some Matic in my Polygon Metamask wallet by using rubic.exchange. I've bought some MATIC on Binance and transferred...
Read more >
How to fix "insufficient funds" error or greyed-out confirm button
You can remedy this by sending some of the necessary native token to that account in order to be able to make the...
Read more >
Issue with MATIC transactions - Swaps - MetaMask community
I go to quickswap and it says “connect to matic” on the top right page. ... the MATIC to the Matic/Polygon network using...
Read more >
Wallet <> Bridge FAQs - Polygon Wiki
Withdrawals and deposits on the Polygon network are cheap. What is to be understood is that the insufficient balance error can be cleared...
Read more >
Matic Bridge explained. Deposit funds from Ethereum to ...
Boom! You made it! Read: Matic Wallet · How to swap tokens using Quickswap? My balance shows 0.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found