gateway icon indicating copy to clipboard operation
gateway copied to clipboard

Uniswap CLMM spender swap rouer mismatch issue.

Open yogesh-bansal opened this issue 2 months ago • 1 comments

Describe the bug

When I try to set allowance for USDC for a Base cahin Uniswap CLMM pool I use the command gateway approve uniswap/clmm USDC It successfully sets the allowance

2025-10-06 22:51:48 | info |    Getting available DEX connectors and networks
2025-10-06 22:51:48 | info |    Available connectors: jupiter, meteora, raydium, uniswap, 0x, pancakeswap
2025-10-06 22:51:48 | info |    Getting configuration for namespace: ethereum
2025-10-06 22:51:48 | info |    Getting configuration for namespace: ethereum
2025-10-06 22:51:48 | info |    Loading tokens for ethereum/base using TokenService
2025-10-06 22:51:48 | info |    Loaded 9 tokens for ethereum/base
2025-10-06 22:51:48 | info |    Getting configuration for namespace: ethereum-base
2025-10-06 22:51:48 | info |    Getting configuration for namespace: ethereum-base
2025-10-06 22:51:49 | info |    Using configured minimum gas price. Current: 0.00428582 GWEI, Minimum: 0.1 GWEI
2025-10-06 22:51:49 | info |    Estimated: 0.1 GWEI for network base
2025-10-06 22:51:52 | info |    Looking up spender address for connector: uniswap/clmm
2025-10-06 22:51:52 | info |    Resolved connector uniswap/clmm to spender address: 0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1
2025-10-06 22:51:55 | debug |   Token balance for USDC: 30000000
2025-10-06 22:51:58 | info |    Loading tokens for ethereum/base using TokenService
2025-10-06 22:51:58 | info |    Loaded 9 tokens for ethereum/base
2025-10-06 22:51:58 | info |    Looking up spender address for connector: uniswap/clmm
2025-10-06 22:51:58 | info |    Resolved connector uniswap/clmm to spender address: 0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1
2025-10-06 22:52:00 | info |    Approving 115792089237316195423570985008687907853269984665640564039457584007913129639935 tokens for spender 0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1
2025-10-06 22:52:01 | info |    Using EIP-1559 pricing: baseFee=0.003313672 GWEI, maxFee=1.506627344 GWEI, priority=1.5 GWEI
2025-10-06 22:52:07 | info |    Poll ethereum, signature 0x51acd8eaeefacd5069f80c94a5e9a3d0ca736d5d3830f306d712d37c53ef6fa3, status 1.

But when I try to actually swap the token using gateway swap uniswap/clmm IACS-USDC It requires the allowance set for another address SwapRouter02 0x2626664c2603336E57B271c5C0b26F421741e481

2025-10-06 22:54:32 | info |    Getting available DEX connectors and networks
2025-10-06 22:54:32 | info |    Available connectors: jupiter, meteora, raydium, uniswap, 0x, pancakeswap
2025-10-06 22:54:32 | info |    Getting configuration for namespace: ethereum
2025-10-06 22:54:38 | info |    Getting configuration for namespace: ethereum
2025-10-06 22:54:38 | info |    Finding clmm pool for IACS-USDC on base
2025-10-06 22:54:38 | info |    Resolved tokens: IACS (0x46e69Fa9059C3D5F8933CA5E993158568DC80EBf), USDC (0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913)
2025-10-06 22:54:38 | info |    Found clmm pool at 0xd4d742CC8f54083F914A37e6B0C7B68c6005a024
2025-10-06 22:54:38 | info |    formatSwapQuote: poolAddress=0xd4d742CC8f54083F914A37e6B0C7B68c6005a024, baseToken=IACS, quoteToken=USDC, amount=100, side=BUY, network=base
2025-10-06 22:54:38 | info |    Base token: IACS, address=0x46e69Fa9059C3D5F8933CA5E993158568DC80EBf, decimals=18
2025-10-06 22:54:38 | info |    Quote token: USDC, address=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913, decimals=6
2025-10-06 22:54:39 | info |    Quote result: estimatedAmountIn=0.026465, estimatedAmountOut=100
2025-10-06 22:54:39 | info |    Balance changes: baseTokenBalanceChange=100, quoteTokenBalanceChange=-0.026465
2025-10-06 22:54:39 | info |    Gas price from provider: 4135312
2025-10-06 22:54:39 | info |    Gas cost: 8.270624e-7 ETH
2025-10-06 22:54:39 | info |    Gas price in Gwei: 0.004135312
2025-10-06 22:54:39 | info |    Getting configuration for namespace: uniswap
2025-10-06 22:54:40 | info |    Using configured minimum gas price. Current: 0.004135312 GWEI, Minimum: 0.1 GWEI
2025-10-06 22:54:40 | info |    Estimated: 0.1 GWEI for network base
2025-10-06 22:54:43 | debug |   Token balance for IACS: 10000000000000000000000
2025-10-06 22:54:43 | debug |   Token balance for USDC: 30000000
2025-10-06 22:54:45 | info |    Loading tokens for ethereum/base using TokenService
2025-10-06 22:54:45 | info |    Loaded 9 tokens for ethereum/base
2025-10-06 22:54:45 | info |    Finding clmm pool for IACS-USDC on base
2025-10-06 22:54:45 | info |    Resolved tokens: IACS (0x46e69Fa9059C3D5F8933CA5E993158568DC80EBf), USDC (0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913)
2025-10-06 22:54:45 | info |    Found clmm pool at 0xd4d742CC8f54083F914A37e6B0C7B68c6005a024
2025-10-06 22:54:45 | info |    Base token: IACS, address=0x46e69Fa9059C3D5F8933CA5E993158568DC80EBf, decimals=18
2025-10-06 22:54:45 | info |    Quote token: USDC, address=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913, decimals=6
2025-10-06 22:54:45 | info |    Getting configuration for namespace: ethereum-base
2025-10-06 22:54:45 | info |    Getting configuration for namespace: ethereum-base
2025-10-06 22:54:45 | info |    Executing swap using SwapRouter02:
2025-10-06 22:54:45 | info |    Router address: 0x2626664c2603336E57B271c5C0b26F421741e481
2025-10-06 22:54:45 | info |    Pool address: 0xd4d742CC8f54083F914A37e6B0C7B68c6005a024
2025-10-06 22:54:45 | info |    Input token: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
2025-10-06 22:54:45 | info |    Output token: 0x46e69Fa9059C3D5F8933CA5E993158568DC80EBf
2025-10-06 22:54:45 | info |    Side: BUY
2025-10-06 22:54:45 | info |    Fee tier: 10000
2025-10-06 22:54:50 | debug |   Token balance for USDC: 30000000
2025-10-06 22:54:50 | info |    Current allowance: 0 USDC
2025-10-06 22:54:50 | info |    Amount needed: 0.026994 USDC
2025-10-06 22:54:50 | error |   Insufficient allowance for USDC
2025-10-06 22:54:51 | debug |   Token balance for IACS: 10000000000000000000000

What i am doing wrong to set the allowance?

Steps to reproduce

  1. gateway approve uniswap/clmm USDC
  2. gateway swap uniswap/clmm IACS-USDC

Release version

2.9.0

Type of installation

Docker

Attach required files

No response

yogesh-bansal avatar Oct 07 '25 06:10 yogesh-bansal

To swap with Uniswap CLMM, you need to approve the spender uniswap/clmm/swap instead of uniswap/clmm. This will approve the SwapRouter02 address, which is used for routing swaps to CLMM pools. The other spender is for adding liquidity to the pool.

This applies to Pancakewap too. I will try to design a more elegant soluion.

fengtality avatar Oct 30 '25 03:10 fengtality