You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.
Hello, It is my first time testing the 0x API for limit orders.
Im creating some hardhat tasks to create and fill Limit Orders. Ive followed the tutorial fill_order_example but Im receiving this error `JSON RPC response has no result' I don't know why.
The exact message error is:
Error: JSON RPC response has no result
at Web3Wrapper.<anonymous> (<folder>/node_modules/@0x/web3-wrapper/src/web3_wrapper.ts:789:19)
at Generator.next (<anonymous>)
at fulfilled (<folder>/node_modules/@0x/web3-wrapper/lib/src/web3_wrapper.js:5:58)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
Below is the code of my task:
constutils=require('@0x/protocol-utils')const{ ContractWrappers, ERC20TokenContract }=require('@0x/contract-wrappers')constBigNumber=require('bignumber.js')constcontractAddresses=require('@0x/contract-addresses')task('fillLimitOrder','Fill Limit Order').addOptionalParam('gasmultiplier','gasmultiplier').setAction(async({ gasmultiplier =2},hre)=>{console.log('fillLimitOrder')// 1) Get Exchange Address for Polygon// 2) Approve Maker Token (CCB Token)// 3) Approve Taker Token (USDC)// 4) Fetch ordertxHash// 5) Use the number 4) to fill the orderconstCHAIN_ID=137constmarketTokenAddress='0x41d2f09f4899f16ed0ed86f8487018cc8c91f547'consttakerTokenAddress='0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174'constmarketTokenContract=awaithre.ethers.getContractAt('ERC20',marketTokenAddress)consttakerTokenContract=awaithre.ethers.getContractAt('ERC20',takerTokenAddress)constMAX_UINT=hre.ethers.MaxUint256constcontractWrappers=newContractWrappers(hre.ethers.provider,{chainId: CHAIN_ID})const[makerSigner,takerSigner]=awaithre.ethers.getSigners()consttakerAddress=awaittakerSigner.getAddress()console.log('takerAddress',takerAddress)constaddresses=contractAddresses.getContractAddressesForChainOrThrow(CHAIN_ID)constexchangeAddress=addresses.exchangeProxyconsole.log('approving maker token')awaitmarketTokenContract.approve(exchangeAddress,MAX_UINT)console.log('approving taker token')awaittakerTokenContract.connect(takerSigner).approve(exchangeAddress,MAX_UINT)constorder={sender: '0x0000000000000000000000000000000000000000',maker: '0x7e28184ebf20437051034232e7b9cbaa43d901d6',taker: '0x0000000000000000000000000000000000000000',takerTokenFeeAmount: '0',makerAmount: '1000000000000000000',takerAmount: '1000000',makerToken: '0x41d2f09f4899f16ed0ed86f8487018cc8c91f547',takerToken: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',salt: '1698147146829',verifyingContract: '0xdef1c0ded9bec7f1a1670819833240f027b25eff',feeRecipient: '0x0000000000000000000000000000000000000000',expiry: '1698150146',chainId: 137,pool: '0x0000000000000000000000000000000000000000000000000000000000000000'}constorderSignature={signatureType: 2,r: '0xe83f724835b9f932da5e08a749aab5ecf866b4febad9e0a4a0e43b67034f4c42',s: '0x767590a016cab96469d5513a91e1223fa0564c067242e17218562ea8f530c644',v: 28}consttakerAssetAmount=newBigNumber('100000')// get the protocol fee multiplier// protocol fee = multiplier * gasPrice * numOrdersconstprotocolFeeMultiplier=newBigNumber(awaitcontractWrappers.exchangeProxy.getProtocolFeeMultiplier().callAsync())constfeeData=hre.provider.getFeeData()console.log('feeData',feeData)constcalculateProtocolFee=(numOrders,multiplier)=>{returnmultiplier.times(feeData.gasPrice).times(numOrders)}// Fill the Order via 0x Exchange Proxy contracttry{consttxHash=awaitcontractWrappers.exchangeProxy.fillLimitOrder(order,orderSignature,takerAssetAmount).sendTransactionAsync({from: taker,value: calculateProtocolFee(1,protocolFeeMultiplier),gasPrice: feeData.gasPrice*2n})console.log(txHash)}catch(err){console.log(err)}})
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello, It is my first time testing the 0x API for limit orders.
Im creating some hardhat tasks to create and fill Limit Orders. Ive followed the tutorial fill_order_example but Im receiving this error `JSON RPC response has no result' I don't know why.
The exact message error is:
Below is the code of my task:
The text was updated successfully, but these errors were encountered: