Hot answers tagged

3

You'll first need the address of the contract for the pair whose price(s) you want to access. Two ways to do this: Find the addresses of the two tokens separately, and feed them into the UniswapV2Factory contract to get the address of the pair's contract; or... Go to Uniswap, enter the two tokens into the usual interface, then visit the "View Pair ...


3

Whoever provides the liquidity has the option to take his share of the liquidity out of the pool, at any time they want. Liquidity is never "sold off" as such, since Uniswap price is based on a bonding price curve. So the trading price simply changes between trades, reflecting which asset of the pair is bought more and which sold. There is also no &...


3

As you mentioned it seems they have a particular way of doing things, and I am not too familiar with Mdex, but I have worked with Uniswap's sub-graph implementation. This isn't necessarily a solution to your question but may help you get there. After looking into https://info.mdex.com I spotted that they use a similar approach to Uniswap's sub-graph. They ...


3

You will lose money. Here's why - Since most liquidity pools do not have external oracles to tell them the price ratio between two assets, they rely on participants providing the correct ratio. If you were to, as you say in your example, deposit 1 USDT and 1 ETH into a ETH/USDT pool, you would effectively be stating that you value 1 ETH to be worth 1 USDT. ...


2

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 swap/v1/quote for the actual swap. I believe this is how Matcha detects extreme slippage to know when to display a warning. You can also use another service (...


2

Pancake Swap uses the same formula as Uniswap, but they have a 0.2% fee instead of 0.3% fee, which affects the calculation.


2

There's no predefined order for transactions in a block. The only requirement is for transactions from the same address to be sorted by the transaction's nonce but transactions from different addresses can be in any order. In Ethereum mainnet miners will sort by gas price because they will get a larger reward. But it is not always the case, search for "...


1

Uniswap V2 oracle This will give you the average price of all the swaps that were made for an interval of blocks that you specify (the last 50 blocks, for instance). Positive Manipulation resistant. The manipulator would have to make bad and expensive swaps for most blocks of the chosen interval. If you choose a long interval, that would be very expensive ...


1

DEXes have long existed based on order books. Maybe the most famous one was (is) Etherdelta. It was kinda ok for years, but it was not very user-friendly and never gained enough users to make the trading liquid enough, except for many a few most popular pairs. If there is no liquidity in a marketplace, the price of the tokens fluctuates too much and you may ...


1

As Uniswap's fees are 0.3%, the constants 997 and 1000 are corresponding nominators and denominators to help calculate this. 3 / 1000 = 0.003 = 0.3%


1

The transaction failed because due to the higher gas price and being on the same block, it was executed before the liquidity was added. I was confusing the nonce with the block position.


1

Not possible. There is a maximum transaction complexity, the block "gasLimit", so nothing can run forever. There is also per-operation pricing, so you can't have thousands of nodes replicating your operation, for free, nor should you want to because the surveillance aspect of your app doesn't require that kind of confidence. The EVM is single-...


1

I dont know about the smart contract itself. ForkDelta is a fork of EtherDelta. The web interface is hosted at: https://forkdelta.github.io/ the Github repo is here: https://github.com/forkdelta although, I think this is just a fork of an interface for the smart contract, not a fork of the smart contract itself but it might give you somewhere to look.


Only top voted, non community-wiki answers of a minimum length are eligible