Questions tagged [uniswap]

Uniswap is a decentralized finance protocol that is used to exchange cryptocurrencies.

Filter by
Sorted by
Tagged with
14
votes
3answers
9k views

How to infer token price from ethereum blockchain UniSwap data?

I would like (if possible) to infer a token price from the blockchain using UniSwap data. After reading the following article, I understood that it is feasible: https://blocklytics.org/blog/uniswap-...
7
votes
1answer
55k views

Why is it so expensive to trade on Uniswap with MetaMask? ($50 fee)

The best quote that the Uniswap fox found for swapping 1 ETH for UNI token right now has a $50+ estimated transaction fee (max $80) inclusive of a 0.875% MetaMask fee. Even if I change the swap to a ...
6
votes
1answer
6k views

How to get a token pair's uniswap trade history?

What I am trying to do is this :- Given an pair (say DAI/ETH pair), i want to display the latest 10-15 trades (buy, sell, add to pool and remove from pool) and also display a graph of price for that ...
6
votes
2answers
781 views

Deploy pre compiled bytecode using truffle migrations deployer api

I want to deploy pre-compiled Smart Contract bytecode using Truffle migrations. Specifically, it is the Uniswap V2 Factory contract. In the Uniswap V2 documentation there is a cliffhanger, where they ...
6
votes
1answer
451 views

Computing the Uniswap V3 pair price from Q64.96 number

I am trying to compute a Uniswap v3 pool prize. I can get the square root price of Q64.96 number as uint160 (e.g., 1234217676608908277512433764 - value of DAI/ETH pool (price at that time around 1 ETH ...
5
votes
1answer
10k views

How do fronrunning and sniper bots work?

If you ever traded in defi, you probably have seen coins getting sniped at the very second of their launch and drastically inflating the prices. I assume these bots are written in js, ad using web3 ...
5
votes
1answer
6k views

How do I claim my earned Liquidity Provider fees?

I provided some tokens in a Liquidity Pool for some time, and now Uniswap says I accumulated about 130$ worth of ETH and PRQ on the provider fees. How do I claim these 0.113 WETH and 111 PRQ? There ...
5
votes
1answer
2k views

I got “sandwich attacked” on my transaction

I see a new kind of arbitrage bot today. As per my research we call that "sandwich attack" ... Here how the user proceed : I buy for 7.8ETH of a token, and it look like a bot is buying ...
5
votes
1answer
3k views

Get Uniswap Exchange Rate of any Token with Web3

I need to get the exchange rate for every token on Uniswap with Web3 like Uniswap itself which they then display on their web interface on app.uniswap.org like this: So when I enter to swap the ...
4
votes
1answer
1k views

What does the function “abi.encodeWithSelector(bytes4 selector, …) returns (bytes memory)” do exactly?

I tried to edit this function according to my smart contract but I couldn't understand this function. I read the docs already. can someone explain this to me with more details and examples? Thank you.
4
votes
1answer
26k views

How to manually approve a token for swap on Uniswap (direct contract interaction)

I want to approve token spending on Uniswap for a token I don't own. Uniswap UI won't let me do that (instead it displays a gray out button "insufficient balance"). Seems the only option ...
4
votes
2answers
16k views

Swap tokens back to ether on Uniswap V2 Router 02 (Sell tokens)

I am trying to do the reverse action of what I did in this question: Basically sell/swap some arbitrary token and receive ether on Uniswap V2 using IUniswapV2Router02. Here is what I have done: ...
4
votes
1answer
333 views

How to understand uniswaps events?

I could not find any explanation about this so I'm reverse engineering it, the 3rd tx is the most interesting, If you look at this transaction https://etherscan.io/tx/...
4
votes
1answer
2k views

Can't call “addLiquidityETH” Uniswap function from my contract

I'm a newbie, have been learning Solidity for 6 months now. I have been trying to fix this problem for couple of months but still got no hope. I'm trying to learn how to add liquidity to Uniswap by ...
4
votes
2answers
12k views

Uniswap transaction fails with TransferHelper: TRANSFER_FROM_FAILED

I am trying to send a transaction using the Etherscan write contract tool at the following address: https://kovan.etherscan.io/address/0x7a250d5630b4cf539739df2c5dacb4c659f2488d#writeContract The ...
4
votes
1answer
4k views

How to get token prices with UNISWAP API

I am using uniswap python api to get live token prices. I am using all the variation of the built-in functions. However, it does not give me the right value. HERE IS MY CODE address = "...
4
votes
1answer
2k views

How much UNI can I earn if I become a liquidity provider?

Say I have 10 ETH and 1000 USDC and I want to become a liquidity provider on uniswap. How much UNI can I earn per day and month? And as a liquidity provider, do I lose my 10 ETH or USDC as I'm not ...
4
votes
1answer
3k views

Why is my @uniswap/sdk DAI/USDT price impact at 100 and returning incorrect prices?

Following the documentation here: https://uniswap.org/docs/v2/javascript-SDK/pricing/ I have been able to replicate the results using WETH, and I have decided to have a go at getting a similar result ...
4
votes
1answer
141 views

What is the best way to use uniswap without router?

I just bought a scam token. The liquidity pool is still there but I couldn't sell because I couldn't approve the token in Uniswap. When I try to approve, the error "execution reverted: ERC20: ...
3
votes
4answers
2k views

Uniswap addLiquidity function transaction revert

I try addLiquidity function but I result get transaction revert. I set deadline = block.timestamp and I use remix. Why transaction is revert? I found the problem line and specified it in code. I think ...
3
votes
1answer
40 views

How is uniswap/sushiswap distributing their fees?

As i know, Sushiswap is collecting a 0.3% fee that is then divided into two parts 0.25% goes to LP providers 0.05% goes to treasury for burn note, 0.5% isn't indicated but I suppose that's the case ...
3
votes
1answer
228 views

Double Flash Loan

Looking into Flash Loans, is it possible to take out TWO at once (aave/dydx/uniswap)? How would you go about doing this? Here is what I'm thinking of, but it seems too complicated: Contract 1 takes a ...
3
votes
1answer
1k views

How much liquidity to provide to Uniswap?

So you deployed your brand new ERC20 token to Uniswap. I understand you need to provide liquidity for your token pair in Uniswap so people can start buying your token. Now, what I'm trying to wrap my ...
3
votes
1answer
689 views

Fees distributed to token holders at point of sale

With the recent increase in deflationary 'meme tokens', which I won't name on here, I've noticed that whilst holding these tokens not only is the total supply increasing but a percentage of the fee, ...
3
votes
1answer
2k views

How to query Uniswap api in order to get the pair ID of a chosen token?

I am using the Uniswap v2 api subgraph but I am running into a bit of an issue that I cannot resolve. Basically I want to query the api to get the latest token swaps of a chosen token and Eth. Using ...
3
votes
1answer
7k views

How does Uniswap calculate price impact without fee on the swap page?

Context: We are creating a smart contract which integrates Uniswap DEX for swapping Tokens to ETH. We need to make sure one swap does not impact the token price more than 3%. We are in need to write a ...
3
votes
3answers
3k views

How to select a different Metamask address when using Uniswap?

I want to use Uniswap with my hardware wallet. So I go into my Metamask wallet, connect to my hardware wallet, I see my coin balance, then I open Uniswap. The trouble is that Uniswap is showing an ...
3
votes
1answer
2k views

What token address do I use if I want to sell an ERC20 token on a different exchange? Its original address or its address on the other exchange

I really need help with this one to avoid logic errors. I am on the Kovan testnet. I bought 4 units of DAI token on Uniswap exchange(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D) for 0.111 Ether and ...
3
votes
1answer
30 views

How to understand the constant product formula?

Let's use this transaction as an example. Here 1 BUSD was transferred to Zombie / BUSD LP in exchange for 172054109197 Zombie tokens. (3511308350 (2%) Zombie tokens were burned as part of the ...
3
votes
1answer
1k views

Uniswap v2 pair before liquidity add

I have a token contract and I want to add liquidity to Uniswap (mytoken + ETH). Before that, I would like to know the pair address in order to set it in my contract. Is it possible to create a pair on ...
3
votes
1answer
2k views

Fast way of checking if my ethereum addresses can claim UNI tokens from uniswap? [closed]

I have quite a number of addresses in eth and is there a way to check if my address can claim uni without having to sign in with each individual account using uniswap?
3
votes
3answers
903 views

How can I get wrapped Ether on Rinkeby?

The rinkeby faucet only seems to have an option for ether. I'd like some weth so I can test Uniswap v2. Anyone know where I can get some? Thanks!
3
votes
0answers
20 views

What is the deposit amount when creating liquidity pool?

I am trying to create a test liquidity pool using mock token on Uniswap. I've been trying to find out how is this deposit amount calculated and what does it exactly mean? Doesn't matter what is the ...
3
votes
0answers
272 views

Burning Uniswap LP tokens

There has been something bothering me about LP tokens and I can’t seem to find the answer. Say I make my own token and raise $1000 in ETH in presales (less gas fees). Then say I want to add my ...
3
votes
1answer
87 views

Uniswap GUI on forked mainnet

I have created a forked mainnet in Ganache which is working well using the CLI. However I would like to have access to the UNISWAP GUI. If I open Uniswap and change my metamask settings to localhost, ...
3
votes
1answer
962 views

How can I fetch current pair prices through uniswap-v2 API?

I need to quote online prices of different token pairs through uniswap-v2 API. As the below picture shows, I tend to pass token pair (maybe with base token desired amount) to the API and get all price ...
2
votes
2answers
286 views

UniSwap V3 API : How to track **unclaimed fees** programmatically?

I have invested in UniSwap-V3 Liquidity Pool. And how to track unclaimed fees programmatically? I plan to have server-backend API fetch data to track unclaimed fees ($27.92 in picture) I have tried ...
2
votes
2answers
147 views

How to hide transactions from mempool?

I am testing out blocknative's mempool explorer (https://explorer.blocknative.com) and noticed a lot of pending transactions are actually already confirmed by the time it picks them up, which I can ...
2
votes
2answers
740 views

Are Uniswap tokens LP tokens?

I am new to DeFi. I have read that: LP token is an ERC-20 token you get in return for providing liquidity on Uniswap. You can think of it as a sort of IOU coupon or a receipt. In essence, the amount ...
2
votes
1answer
7k views

How can I calculate the gas fee of a swap on Uniswap?

According to gas tracker on Etherscan the average gas price is 212 gwei and the average Uniswap swap estimate is $70.26 which implies that the gas fee is around 201101. To my knowledge swap gas fee is ...
2
votes
2answers
175 views

Calculate deposit amount when adding to a liquidity pool in Uniswap v3

Suppose: The price of an A/B token pair is price_now The user wants to provide liquidity in the range price_low to price_high such that price_low < price_now < price_high The user supplies X ...
2
votes
1answer
182 views

Implementing AMM DEX similar to Uniswap/SushiSwap

I’m new to blockchain development and have been interested in the Uniswap/sushiswap/pancakeswap/etc. projects for some time. I’m trying to build my own project as a learning exercise. I’ve deployed ...
2
votes
3answers
166 views

how is it possible to send 5 successful, consecutive transactions at the same time?

I just witnessed something amazing that I didn't think was possible before. I was under the assumption if that you try to submit consecutive transactions, the latest transaction with the highest nonce ...
2
votes
1answer
401 views

Uniswap ETH to Tokens to ETH swap function

UniswapV2Router02.sol has 2 interesting functions which i'd love to combine swapExactETHForTokens and swapExactTokensForETH. Basic idea is arbitrage from ETH to tokens and back to ETH. As far I ...
2
votes
1answer
251 views

How is Uniswap Liquidity added?

I bet this is a simple answer, but I'm just unable to fully understand. Uniswap has liquidity. It can be added. But what function does it uses? the Transfer() one from the contract ? I'm trying to ...
2
votes
1answer
1k views

Adjust slippage tolerance in Uniswap programatically

I've been able to do swaps through Uniswap's peripheral smart contract Router 02 by calling any of the functions such as: function swapTokensForExactTokens( uint amountOut, uint amountInMax, ...
2
votes
1answer
315 views

What is the sequence of events when a transaction is made on Uniswap?

I elect to swap 100 UNI for 700 USDC on UniSwap, but with a low gas fee. In 1 hour, the price of 1 UNI has dropped significantly. would the pending transaction still swap for 700 USDC (as long as ...
2
votes
1answer
68 views

Question about the best Uniswap path

How the best path is calculated ? Is it a fonction in the smart contract or on the website ? Because I checked the function swapExactETHForTokens and the path need to be set by the function caller. ...
2
votes
1answer
74 views

How to distinguish buy and sell?

I'm building a smart contract to learn solidity and I'm wondering how I can distinguish buy and sell functionalities. I want the contract to do different functionalities on a buy and other ...
2
votes
1answer
472 views

uniswap solidity contract: swapExactTokensForTokens Failed in my own smart contract

I am using sushiswap to transfer weth to dai. Everything goes fine when I use web3.js to call swapExactTokensForTokens directory. However, thing goes wrong when I try to include the ...

1
2 3 4 5
7