4
votes
Trade resulting in incorrect ratio for value traded out-of and into
The contracts behaved as instructed. According to the transaction trace, this swap was executed for REV -> ETH with a minimum buy amount of 0.007388063175813944 ETH, where a return of less would ...
3
votes
Accepted
How to set up local 0x API testnet on dev machine?
Turns out this was a local issue (mismatch of networks, 0xAPI mainnet and dev was testnet).
In general this should be fine to fork mainnet in hardhat and execute against it. The only warning I would ...
2
votes
Accepted
Member "concat" not found or not visible after argument-dependent lookup
It fails because the compiler is looking for the concat function as a member of bytes type.
You can use concat as a regular function
return string(concat(bytes(api0xUrl),
concat(...
2
votes
Accepted
0x: Is it possible to fill an order from a smartcontract?
Your contract needs to approve the 0x ERC20Proxy to move your ERC20 tokens.
For example, take a look at the Forwarder contract which does this in the constructor.
2
votes
Accepted
How accurate are 0x gas estimations?
Different tokens can cost different amounts when transferred, i.e during a swap. 0xAPI doesn't know the gas cost of every token in existence.
0xAPI will perform a more accurate gas estimate for you ...
2
votes
Accepted
Quote received from 0x swap API returns no valid, unsigned transaction?
It's valid for most javascript web3 libraries, which typically ignore unused fields. YMMV with Python. It looks like you might just need to prune those excess fields.
2
votes
Accepted
2
votes
Accepted
How to calculate price impact on 0x API
There is no concept of "price impact" within API so currently the only way to do this is to (as you guessed) perform two requests: a swap/v1/price for a small fraction of the swap then a ...
2
votes
0x API Help: Order Routing
Unfortunately there is no way to route orders through specific pools at this time with the 0x API.
You can exclude liquidity sources with the excludedSources query parameter (e.g. excludedSources=...
2
votes
Decentralized Exchanges with Market Orders
Several different options and approaches to the creation of a Decentralized Exchange (DEX) exist. The approaches differ according to limitations in various contexts, and generally fall under two types ...
2
votes
How to submit a swap using EIP-1559 style?
Yes, only the gas price and the transaction type need to be changed, if you don't want to take the default one (web3 will send a type2/eip1559 tx by default) : you should add maxFeePerGas and ...
2
votes
BSC token swap API error with 0x.org
Based on the transaction tracing, it reverts because you did not approve an allowance to the 0x contract.
Simply call the approve function on the token with 0xDef1C0ded9bec7F1a1670819833240f027b25EfF ...
2
votes
Parse tranformations data
So long as you're only doing sells, you can try passing in shouldSellEntireBalance=true for each quote. This will try to sell the minimum of the taker's balance and allowance granted to the ...
2
votes
Approving tokens after flash loan
Yikes. Turns out this was happening since I wasn't paying back my flashloan. 🤦
2
votes
Accepted
Transaction failing due to "NotImplementedError"
The error is thrown because the data you input cannot be handled by the contract. The contract defines a mapping which maps the function selector (first 4 bytes of your data) to address that will ...
2
votes
what happened in this transaction?
This is quite puzzling. Here is what I have been able to find so far.
First, you swapped Eth for USDC with this tx. It completed successfully and you received the USDC.
Then, just 1 block after this ...
2
votes
0x Handling of tokens with less than 18 decimals
Do you definitely have the allowance on the makerToken set correctly? Can you post a fresh order in the question as text?
2
votes
Ether Lost During ERC 20 Conversion to 3X Short Bitcoin Token
0xAPI can find liquidity in various places and it shows the amount you receive in return.
This doesn't imply that the token has decent liquidity. It appears that this 3x Short Bitcoin (BEAR) token is ...
2
votes
Accepted
Is there an API to fetch collection-level NFT stats from 0x orders like floor price, total volume, etc?
At the moment we don't offer this; however, some recommended tools/thoughts from our Trader.xyz team:
(top pick) https://module.readme.io/reference/retrieve-collection-floor
and
https://api.reservoir....
2
votes
Funds stucked in smart contract
The funds are not stuck, they are now controlled only by the creator (0x97ce82ccb3d8d6a02c87799f1d8d8af4dad77a0e). You need to contact them, asking to call again the transferOwnership function.
In any ...
2
votes
Accepted
0x orders endpoint pagination
The endpoint is paginated and by default it returns page 1 with 20 orders. You can for instance change this behaviour setting the param page and perPage on the query: An example of fetching on page 2 ...
2
votes
Accepted
Is it possible to ask for a minimal depth for quotation and swap?
I believe what you asking is not possible as the 0x API tries always to find the best price, what is a workardound is you manually exclude the sources you don't want and just use for instance Uniswap, ...
2
votes
Accepted
0x protocol - Using the qoute endpoint without takerAddress parameter
You can fill a quote even if the taker address is not specified on the quote. Filling the taker address and passing it on the API call will trigger additional validation and a more accurate gas ...
2
votes
Get the token id from 0x number
Use BigNumber
hexText = "0x0000000000000000000000000000000000000000000000000000000000034797"
numb = new ethers.utils.BigNumber(hexText).toNumber()
console.log(numb)
JSFiddle example
1
vote
GET quote on polygon chain using 0x API
Found it
Prefix the chain name to the domain, in this case https://polygon.api.0x.org/
So this query will become
https://polygon.api.0x.org/swap/v1/quote?sellToken=...
1
vote
0x OrderBook API is not storing the orders
I'm unable to reproduce your issue. Could you please share more details about your API call?
Your issue is with the /sra/v4/orderbook endpoint, correct? Do you API calls return any error messages?
1
vote
API Key isn't UUID compliant Error
I was having the same errors as well after running:
Yarn install
Yarn build.
Facing the error as this thread mentioned when trying to execute "yarn db:migrate"
Stack trace:
yarn run v1.22....
1
vote
0x Swap Failed , brownie integration
What is on line 85? Is it actually failing on require(success, "FAIL");?
A couple things to look out for:
You should also be passing in either the value or protocolFee fields returned by ...
1
vote
0x v3 audit report sha1 hashes
The 3.0 branch would've contained any fixes suggested by the audit process. It seems like the Conensys Diligence doesn't declare the exact commit SHA which they audited but it is contained in the ...
1
vote
Accepted
is it possible to remapping directly from etherscan
You'll need to modify the compiler config from etherscan to get it to compile. remappings needs to point to your local installations of those dependencies. I'm not familiar with brownie, but depending ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
0x × 284web3js × 17
decentralized-exchange × 16
solidity × 14
swaps × 14
polygon × 12
ethers.js × 7
erc-20 × 6
pancakeswap × 6
transactions × 5
blockchain × 5
nft × 5
tokens × 4
signature × 4
bsc × 4
fees × 4
external-api × 4
contract-development × 3
contract-design × 3
ether × 3
contract-invocation × 3
etherscan × 3
python × 3
exchanges × 3
erc-1155 × 3