gateway icon indicating copy to clipboard operation
gateway copied to clipboard

Polygon - token approval fails due to gas price below minimum

Open rapcmia opened this issue 2 months ago • 1 comments

Describe the bug

When checking this issue https://github.com/hummingbot/gateway/issues/515, it seems had already fixed however now when approving tokens specifically in Polygon we are getting error that gas price below minimum

Will approve token to Permit2, then grant Universal Router (0x1095692a6237d83c6a72f3f5efedb9a670c49223) permission via Permit2
2025-09-29 22:18:55 | info |    Checking existing allowances for Universal Router flow
2025-09-29 22:18:55 | info |    ERC20 allowance (WPOL → Permit2): 115792089237316195423570985008687907853269984665640564039457584007913129639935
2025-09-29 22:18:55 | info |    Sufficient ERC20 allowance exists, skipping step 1
2025-09-29 22:18:56 | info |    Permit2 allowance: 0, expiration: 0, current time: 1759213136
2025-09-29 22:18:56 | info |    Skipped ERC20 approval, using dummy values
2025-09-29 22:18:56 | info |    Step 2: Calling Permit2.approve() to grant Universal Router permission
2025-09-29 22:18:57 | info |    Calling Permit2.approve(0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270, 0x1095692a6237d83c6a72f3f5efedb9a670c49223, 1461501637330902918203684832716283019655932542975, 1759385936)
2025-09-29 22:18:59 | error |   Error approving token: processing response error (body="{\"jsonrpc\":\"2.0\",\"id\":119,\"error\":{\"code\":-32000,\"message\":\"transaction gas price below minimum: gas tip cap 1500000000, minimum needed 25000000000\"}}\n", error={"code":-32000}, requestBody="{\"method\":\"eth_sendRawTransaction\",\"params\":[\"0x02f8f18189168459682f008507003c52ee82bc3494000000000022d473030f116ddee9f6b43ac78ba380b88487517c450000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12700000000000000000000000001095692a6237d83c6a72f3f5efedb9a670c49223000000000000000000000000ffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000068de1950c001a08670c80bbfcfa5ef97900c5504d4600ca492959758bed396b05d469f2f94b853a003a51f586bbe5f3c6dd82e2a4b5c28b8f5f7e5aec350c369bb37fcccb06ab477\"],\"id\":119,\"jsonrpc\":\"2.0\"}", requestMethod="POST", url="https://polygon-mainnet.infura.io/v3/508c69cdf6d5469a80c0d510481d4876", code=SERVER_ERROR, version=web/5.8.0)

Tested with POST /chains/ethereum/approve

curl -X 'POST' \
  'http://localhost:15888/chains/ethereum/approve' \
  -H 'Content-Type: application/json' \
  -d '{
  "network": "polygon",
  "address": "0x2f224d4b9429Fe2B2BE36840F951EAcD0A2eE460",
  "spender": "uniswap/router",
  "token": "WPOL",
  "amount": "100"
}' | jq


# response
{
  "statusCode": 500,
  "error": "InternalServerError",
  "message": "Failed to approve token: processing response error (body=\"{\\\"jsonrpc\\\":\\\"2.0\\\",\\\"id\\\":98,\\\"error\\\":{\\\"code\\\":-32000,\\\"message\\\":\\\"transaction gas price below minimum: gas tip cap 1500000000, minimum needed 25000000000\\\"}}\\n\", error={\"code\":-32000}, requestBody=\"{\\\"method\\\":\\\"eth_sendRawTransaction\\\",\\\"params\\\":[\\\"0x02f8f18189168459682f0085063940217e82bb9794000000000022d473030f116ddee9f6b43ac78ba380b88487517c450000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12700000000000000000000000001095692a6237d83c6a72f3f5efedb9a670c492230000000000000000000000000000000000000000000000056bc75e2d631000000000000000000000000000000000000000000000000000000000000068de1e93c080a0505b78303779733e29cd94f546434c1a5f04b7757087fd9f1e18b9ac00236438a03645f4ebccdd3bf70c4e12877342f8622e2cb9e08cd4666fe249d8026a40e790\\\"],\\\"id\\\":98,\\\"jsonrpc\\\":\\\"2.0\\\"}\", requestMethod=\"POST\", url=\"https://polygon-mainnet.infura.io/v3/508c69cdf6d5469a80c0d510481d4876\", code=SERVER_ERROR, version=web/5.8.0)"
}

Steps to reproduce

  1. Setup hummingbot + gateway
    • Use infura as rpcProvider then change from mainnet to polygon for defaultNetwork
    • Run gateway ping ethereum to confirm changes: Image
  2. Add polygon wallet and run gateway balance ethereum to confirm wallet is ok
  3. Run gateway approve uniswap/{router/amm} WPOL then observe error on gateway logs (another terminal)
  4. Optional: setup fastify and run endpoint POST /chains/ethereum/approve

Release version

dev-2.10.0

Type of installation

Source

Attach required files

logs_gateway_app_withFastify.log logs_gateway_app_withHummingbot.log

rapcmia avatar Sep 30 '25 07:09 rapcmia

i updated Polygon gas and token settings in this PR: https://github.com/hummingbot/gateway/pull/543.

Tested Polygon approvals and it worked:

2025-10-29 19:31:04 | info | 	Resolved connector uniswap/clmm to spender address: 0xC36442b4a4522E871399CD717aBDD847Ab11FE88
2025-10-29 19:31:09 | info | 	Loading tokens for ethereum/polygon using TokenService
2025-10-29 19:31:09 | info | 	Loaded 6 tokens for ethereum/polygon
2025-10-29 19:31:09 | info | 	Looking up spender address for connector: uniswap/clmm
2025-10-29 19:31:09 | info | 	Resolved connector uniswap/clmm to spender address: 0xC36442b4a4522E871399CD717aBDD847Ab11FE88
2025-10-29 19:31:09 | info | 	Approving maximum amount (MaxUint256) for WPOL
2025-10-29 19:31:10 | info | 	Approving 115792089237316195423570985008687907853269984665640564039457584007913129639935 tokens for spender 0xC36442b4a4522E871399CD717aBDD847Ab11FE88
2025-10-29 19:31:10 | warn | 	No cached EIP-1559 data available, calling estimateGasPrice()
2025-10-29 19:31:11 | info | 	Network RPC EIP-1559 fees: baseFee=41.6469 GWEI, priority=1.5000 GWEI
2025-10-29 19:31:11 | info | 	Using mixed EIP-1559 fees: baseFee=41.6469 GWEI (network), priority=30 GWEI (configured)
2025-10-29 19:31:11 | info | 	Constructed tx fees (multiplier=1): maxFeePerGas=71.6469 GWEI, maxPriorityFeePerGas=30.0000 GWEI
2025-10-29 19:31:11 | info | 	Estimated: 71.6469 GWEI for network polygon
2025-10-29 19:31:11 | info | 	Using newly fetched EIP-1559 pricing for polygon: maxFee=71.6469 GWEI, priority=30 GWEI

{
  "signature": "0x66c945a658c2c8fad89bef72026b9b5d6f78102d86946fe8017a3bea506703f5",
  "status": 1,
  "data": {
    "tokenAddress": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
    "spender": "0xC36442b4a4522E871399CD717aBDD847Ab11FE88",
    "amount": "115792089237316195423570985008687907853269984665640564039457.584007913129639935",
    "nonce": 52,
    "fee": "0.003309568041863785"
  }
}

fengtality avatar Oct 30 '25 03:10 fengtality