Skip to content

Invalid Dfyn swap route on Polygon #588

@xykota

Description

@xykota

This route is proposed by Paraswap:

[
  {
    percent: 64,
    swaps: [
      {
        srcToken: '0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
        srcDecimals: 6,
        destToken: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
        destDecimals: 6,
        swapExchanges: [
          {
            exchange: 'QuickSwapV3',
            srcAmount: '22397446',
            destAmount: '22404106',
            percent: 100,
            poolAddresses: [ '0x7b925e617aefd7fb3a93abe3a701135d7a1ba710' ],
            data: {
              path: [
                {
                  tokenIn: '0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
                  tokenOut: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174'
                }
              ],
              gasUSD: '0.003357'
            }
          }
        ]
      }
    ]
  },
  {
    percent: 36,
    swaps: [
      {
        srcToken: '0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
        srcDecimals: 6,
        destToken: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',
        destDecimals: 18,
        swapExchanges: [
          {
            exchange: 'Dfyn',
            srcAmount: '12598564',
            destAmount: '17170688310077781158',
            percent: 100,
            poolAddresses: [ '0x9045b1762a0bc4BadD08eE7B1A55c3871DE9B7b4' ],
            data: {
              router: '0xf3938337F7294fEf84e9B2c6D548A93F956Cc281',
              path: [
                '0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
                '0x4c28f48448720e9000907bc2611f73022fdce1fa'
              ],
              factory: '0xE7Fb3e833eFE5F9c441105EB65Ef8b261266423B',
              initCode: '0xf187ed688403aa4f7acfada758d8d53698753b998a3071b06f1b777f4330eaf3',
              feeFactor: 10000,
              pools: [
                {
                  address: '0x9045b1762a0bc4BadD08eE7B1A55c3871DE9B7b4',
                  fee: 30,
                  direction: false
                }
              ],
              weth: '0x4c28f48448720e9000907bc2611f73022fdce1fa',
              gasUSD: '0.002772'
            }
          }
        ]
      },
      {
        srcToken: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',
        srcDecimals: 18,
        destToken: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
        destDecimals: 6,
        swapExchanges: [
          {
            exchange: 'QuickSwapV3',
            srcAmount: '17170688310077781158',
            destAmount: '12615940',
            percent: 100,
            poolAddresses: [ '0xae81fac689a1b4b1e06e7ef4a2ab4cd8ac0a087d' ],
            data: {
              path: [
                {
                  tokenIn: '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270',
                  tokenOut: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174'
                }
              ],
              gasUSD: '0.003357'
            }
          }
        ]
      }
    ]
  }
]

Notice the second 36% part suggests:

  • USDT to WETH (Dfyn, 0x4c28f4) on Dfyn
  • WMATIC (0xeee) to USDC.e on Quickswap V3

I suspect there is some confusion in how Dfyn is treating 0xeee as its own WETH in https://github.com/paraswap/paraswap-dex-lib/blob/2293ffa1728081314fb84c8c2e812c9898d11805/src/dex/uniswap-v2/dfyn.ts#L53-L87

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions