0x

0x 報價 API 呼叫返回 makerAmount 等於 0

  • March 2, 2022

我正在嘗試執行此 API 呼叫:https ://polygon.api.0x.org/swap/v1/quote?buyToken=0x2e1AD108fF1D8C782fcBbB89AAd783aC49586756&sellToken=0x580a84c73811e1839f75d86d75d88cca0c24000004&sellAmount=0001

這是完整的返回值:

{
 "chainId": 137,
 "price": "0.816659249868949659",
 "guaranteedPrice": "0.808492657370260162",
 "estimatedPriceImpact": null,
 "to": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
 "data": "0x415565b0000000000000000000000000580a84c73811e1839f75d86d75d88cca0c241ff40000000000000000000000002e1ad108ff1d8c782fcbbb89aad783ac495867560000000000000000000000000000000000000000000000008ac7230489e8000000000000000000000000000000000000000000000000000070336de20ca8db9b00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000580a84c73811e1839f75d86d75d88cca0c241ff40000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a063000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000008ac7230489e8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000002517569636b53776170000000000000000000000000000000000000000000000000000000000000008ac7230489e800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000a5e0829caced8ffdd4de3c43696c57f7d7a678ff00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000580a84c73811e1839f75d86d75d88cca0c241ff40000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a063000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a0630000000000000000000000002e1ad108ff1d8c782fcbbb89aad783ac495867560000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000240ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000001142616c616e6365725632000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000070336de20ca8db9b00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000040000000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c80d34e5dd4d8f043557145598e4e2dc286b35fd4f000000000000000000000068000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000003000000000000000000000000580a84c73811e1839f75d86d75d88cca0c241ff40000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a063000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000000000000000000000000000000000000000000000000000869584cd00000000000000000000000010000000000000000000000000000000000000110000000000000000000000000000000000000000000000782b35e1ff621e96bb",
 "value": "0",
 "gas": "266000",
 "estimatedGas": "266000",
 "gasPrice": "40000000000",
 "protocolFee": "0",
 "minimumProtocolFee": "0",
 "buyTokenAddress": "0x2e1ad108ff1d8c782fcbbb89aad783ac49586756",
 "sellTokenAddress": "0x580a84c73811e1839f75d86d75d88cca0c241ff4",
 "buyAmount": "8166592498689496593",
 "sellAmount": "10000000000000000000",
 "sources": [
   {
     "name": "SushiSwap",
     "proportion": "0"
   },
   {
     "name": "QuickSwap",
     "proportion": "0"
   },
   {
     "name": "ComethSwap",
     "proportion": "0"
   },
   {
     "name": "Dfyn",
     "proportion": "0"
   },
   {
     "name": "mStable",
     "proportion": "0"
   },
   {
     "name": "Curve",
     "proportion": "0"
   },
   {
     "name": "DODO_V2",
     "proportion": "0"
   },
   {
     "name": "DODO",
     "proportion": "0"
   },
   {
     "name": "Curve_V2",
     "proportion": "0"
   },
   {
     "name": "WaultSwap",
     "proportion": "0"
   },
   {
     "name": "Polydex",
     "proportion": "0"
   },
   {
     "name": "ApeSwap",
     "proportion": "0"
   },
   {
     "name": "FirebirdOneSwap",
     "proportion": "0"
   },
   {
     "name": "Balancer_V2",
     "proportion": "0"
   },
   {
     "name": "KyberDMM",
     "proportion": "0"
   },
   {
     "name": "LiquidityProvider",
     "proportion": "0"
   },
   {
     "proportion": "1",
     "intermediateToken": "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063",
     "hops": [
       "QuickSwap",
       "Balancer_V2"
     ],
     "name": "MultiHop"
   },
   {
     "name": "JetSwap",
     "proportion": "0"
   },
   {
     "name": "IronSwap",
     "proportion": "0"
   },
   {
     "name": "Aave_V2",
     "proportion": "0"
   },
   {
     "name": "Uniswap_V3",
     "proportion": "0"
   },
   {
     "name": "Synapse",
     "proportion": "0"
   }
 ],
 "orders": [
   {
     "makerToken": "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063",
     "takerToken": "0x580a84c73811e1839f75d86d75d88cca0c241ff4",
     "makerAmount": "0",
     "takerAmount": "10000000000000000000",
     "fillData": {
       "tokenAddressPath": [
         "0x580a84c73811e1839f75d86d75d88cca0c241ff4",
         "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063"
       ],
       "router": "0xa5e0829caced8ffdd4de3c43696c57f7d7a678ff"
     },
     "source": "QuickSwap",
     "sourcePathId": "",
     "type": 0
   },
   {
     "makerToken": "0x2e1ad108ff1d8c782fcbbb89aad783ac49586756",
     "takerToken": "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063",
     "makerAmount": "8166592498689496593",
     "takerAmount": "115792089237316195423570985008687907853269984665640564039457584007913129639935",
     "fillData": {
       "poolId": "0x0d34e5dd4d8f043557145598e4e2dc286b35fd4f000000000000000000000068",
       "vault": "0xba12222222228d8ba445958a75a0704d566bf2c8"
     },
     "source": "Balancer_V2",
     "sourcePathId": "",
     "type": 0
   }
 ],
 "allowanceTarget": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
 "sellTokenToEthRate": "1.929673719382614526",
 "buyTokenToEthRate": "0"
}

問題是訂單 0makerAmount是 0,訂單 1takerAmount是一個非常大的數字:115792089237316195423570985008687907853269984665640564039457584007913129639935

我可以做些什麼來避免這種行為?(這似乎只在打開 Multihop 時發生,但這對我們來說不是一個理想的解決方案)

在這一點上,下面的值orders只是資訊和遺產。我們將在 0xAPI 的下一個主要版本中完全刪除它們。

執行交易所需的一切都在data欄位中進行編碼。

您是正確的,它發生在 MultiHop 中,其中MAX_UINT代表在 MultiHop 交易中間“賣出全部餘額”。

您打算如何使用這些值?

引用自:https://ethereum.stackexchange.com/questions/122878