Polygon

使用 0x 協議 V4 估計氣體還原交易

  • March 1, 2022

每當我嘗試estimateGas使用ERC1155OrderPolygon Mumbai 和 Alchemy 時,我都會恢復交易。

let sellOrder = new ERC1155Order({
   direction: TradeDirection.SellNFT,
   maker: alice.address,
   taker: bob.address,
   expiry: expirationTimeTS,
   nonce: 11,
   erc20Token: WETHAddress,
   erc20TokenAmount: 1, 
   fees: [],
   erc1155Token: ERC1155Address, 
   erc1155TokenId: "22897246053033895809978563905910150239444766161035846617439399460178038358017",
   erc1155TokenProperties: [],
   erc1155TokenAmount: 1,
   chainId: 80001,
});

const contractWrappers = new ContractWrappers(provider, {chainId: 80001});
let zeroEx = contractWrappers.exchangeProxy;
let txValidate = await zeroEx.getERC1155OrderHash(sellOrder).estimateGasAsync({ from: bob.address });

在煉金術中,我得到了這個有效載荷:

{
 "method": "eth_estimateGas",
 "params": [
   {
     "data": "0x1de3a7ac00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000329f61caefea1df01c60d7d0eafd9cdae91c853c00000000000000000000000004ebdfca9c91d299dcb312d23e58ac0cdeef418e000000000000000000000000000000000000000000000000000000006384e91000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009c3c9283d3e44854697cd22d3faa240cfb032889000000000000000000000000000000000000000000000000002386f26fc10000000000000000000000000000000000000000000000000000000000000000018000000000000000000000000088b48f654c30e99bc2e4a1559b4dcf1ad93fa656329f61caefea1df01c60d7d0eafd9cdae91c853c0000000000000e0000000001000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000",
     "to": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
     "from": "0x04ebdfca9c91d299dcb312d23e58ac0cdeef418e"
   }
 ],
 "id": 42,
 "jsonrpc": "2.0"
}

和回應:

{
 "jsonrpc": "2.0",
 "id": 42,
 "error": {
   "code": 3,
   "message": "execution reverted",
   "data": "0x734e6e1c1de3a7ac00000000000000000000000000000000000000000000000000000000"
 }
}

您收到的還原錯誤是“NotImplementedError”。我不認為 ERC1155Orders 已經或將要部署到 Polygon Mumbai。Ropsten 是 0x 合約的首選測試網。

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