Questions tagged [uniswap]

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

Filter by
Sorted by
Tagged with
1
vote
0answers
67 views

Gas Estimation Error - Swap Contract

I'm working on developing a contract that automatically performs a swap and have been having an issue with the swap function. I finally got the contract deployed on Kovan, but have been getting the ...
1
vote
0answers
254 views

Removing LP from Uniswap/Pancake using seth and removeLiquidityWithPermit(). How is the correct hash for the permission signing calculated?

I'm trying to figure out how I can remove LPs from Uniswap/Pancakeswap using the function removeLiquidityWithPermit(address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 ...
1
vote
0answers
103 views

How would I collect fees from an liquidity pool on pancake swap?

I understand that to start collecting fees you need to add liquidity to a pool e.g. BNB/BUSD Liquidity pool. So I have a smart contract that uses the uniswapv2 interface to add liquidity to the BNB/...
1
vote
0answers
130 views

Is the Uniswap v2 0.3% trading fee calculated wrong?

I am digging into the details of how the token swapping fee is calculated and I cannot get a formula that reproduces the expected 0.3% fee. Let's say there's a USDT-ETH pool with: 1000 USDT 10 ETH k =...
1
vote
2answers
238 views

How to understand the Swap event payload?

I am trying to wrap my head around pancakeswap Swap event (which should be equivalent to uniswap). Here is an example transaction: 0xd809e359a4037eb5e2617769b93f8b7fa1e708c37019b02933e1845e33c99884 ...
1
vote
0answers
101 views

How do i get the amount of tokens received for a swap on Uniswap/Pancakeswap so i can exchange them back later

I have successfully used the swapExactTokensForTokens() and approve() functions on Pancakeswap with ethers js. Uniswap docs say that swapExactTokensForTokens() returns The input token amount and all ...
1
vote
0answers
61 views

Totally stumped with “INSUFFICIENT_LIQUIDITY_MINTED”

I have been at this now for about a day and a half an I'm totally lost. In advance, I'm sorry if this is a simple question - I'm new to solidity (although not new to programming, blockchain and crypto ...
1
vote
0answers
43 views

Fail with error 'UniswapV2Library: ZERO_ADDRESS' when trying to implement a swap

I am trying to implement a Ropsten Testnet swap via contract. This contract swaps Testnet DAI for a token I have created. Liquidity is added and swapping via the UI works. IUniswapV2Router02 private ...
1
vote
0answers
64 views

Uniswap WETH_WBTC price is orders of magnitude off when using constant product market maker formula

I am trying to calculate the value of an exchange on Uniswap using Web3js and methods from the Uniswap smart contract. This is the Uniswap contract address for the WETH (Wrapped Ether) : WBTC (Wrapped ...
1
vote
0answers
63 views

Uniswap V2 Swap Fee

On my calculation with formula X * Y = K and Swap Fee 0.3%, My Result Value of Input or Output Token Amount is nearly same as UniSwap V2 User Interface Estimated Amount. But Sometimes, My result is ...
1
vote
1answer
261 views

How to get same prices with Uniswap SDK & interacting directly with contract?

I am having difficulty understanding getting the price within the contract. So I created 2 different methods (one using SDK and other one using ethers.js) When I try the SDK, I get 3839.62 When I try ...
1
vote
0answers
180 views

Interfacing with Uniswap/Pancakeswap locally

I'm interacting with PancakeSwap for the first time, as I'm developing a token that interfaces with PancakeSwap. Ideally I'd like to iteratively test it without deploying to a live network. Must I ...
1
vote
1answer
481 views

How do gas fees work in UniSwap / other decentralized exchanges?

So, lately i've been doing research about gas fees and how they work. I got the most part but there's something I don't yet understand. The theory of gas fees in ETH is that whenever you do a ...
1
vote
0answers
264 views

How to calculate generated fees from uniswap?

I try to calculate how much fees I earned for each transaction by providing liquidity. In chunks I downloaded all swaps, mints and burns from the graph for my token pair. https://thegraph.com/explorer/...
1
vote
0answers
415 views

UniswapV2 removeLiquidity revert ds-math-sub-underflow

I am calling uniswapv2 remove liquidity but i am not able to get what values amountAmin and amountbmin will have . i am calling uniswapv2 router contract function for existing pool but i cant get how ...
1
vote
1answer
149 views

How to read uniswap TX input to find out what swap was made?

Look at this tx : https://etherscan.io/tx/0x9854f2249f86802cb0edcff0aa6747de6c49d89b0ba0dc2038b00372b949356b it says 0.3RTH send to uniswap and 6,447.815435380239985848 L3P got from uniswap. However ...
1
vote
0answers
126 views

Details of transactions of ERC20 tokens with special fees

Some ERC20 tokens have special rules that affect transactions like: burning certain % of every transaction, taxing some % of every transaction and redistributing it back to all token holders or ...
1
vote
0answers
203 views

Uniswap addLiquidity Error: “revert TransferHelper: TRANSFER_FROM_FAILED”

I'm having issues with the addLiquidity() call failing due to what likely seems to be an approval issue and producing the following error code: Internal JSON-RPC error. { "message": "VM ...
1
vote
0answers
29 views

Uniswap: How to find volatility tokens for trade? [closed]

Is there any API calls to find volatility tokens for trade on Uniswap?
1
vote
0answers
115 views

Why output value of Uniswap-2 SDK for token prices is different than those on its site?

I use fetchPairData method from uniswap-v2 SDK to quote two tokens conversion rates: const uniswapPair: Pair = await Fetcher.fetchPairData( new Token(ChainId.MAINNET, baseToken.address, 18), ...
1
vote
1answer
3k views

INSUFFICIENT_OUTPUT_AMOUNT error when attempting Uniswap swap from a contract

While I'm able to successfully swap ETH for DAI, I'm running into an INSUFFICIENT_OUTPUT_AMOUNT error when trying to swap DAI for ETH using swapExactTokensForETH, even with amountOutMin set to 0. I ...
1
vote
0answers
24 views

Is this diagram from Uniswap's documentation correct?

Denote respectively rA and rB the reserve of Token A and Token B. Let f = 1 - fee (i.e. 0.997) and x be the input amount. Then the price function of Uniswap v2 for a pair (A, B) is P(x) = (rB * x * f)/...
1
vote
0answers
138 views

Uniswap V2 removeLiquidity

I am able to add liquidity and remove liquidity on uniswap, but I am having trouble calculating the min values for the token pairs. For removing liquidity I am trying to get the amount of each token ...
1
vote
0answers
139 views

'dropped and replaced' ETH still missing

I have an ETH transaction that is listed as 'dropped and replaced' on Etherscan: https://etherscan.io/tx/0x98640241cd77a4c1301c8522851ec07508ac783239c643a4a3c13b1dc55d9ea1 On Uniswap it shows as ...
1
vote
1answer
594 views

Uniswap fork: remove liquidity error

I am trying to fork uniswap. And I have a problem when liquidity is removed. Problem in UniswapERC20. I don't know what's wrong. Step by step (repeatedly for Rinkeby and Ropsten): Copy Uniswap ...
1
vote
1answer
246 views

Retrieve Uniswap tx data in my solidity smart contract

As the title says, I have my Solidity smart contract and I am trying to import in ti some public data from the Uniswap contract. In particular I would like to have the tx data stored in my contract (...
1
vote
1answer
6k views

How to swap ETH to WETH on Uniswap

I'm trying to swap ETH to WETH tokens within contract, but cannot find any information how to do it. Can anybody help? Thanks!
1
vote
0answers
35 views

How do we calculate the USD price from a swap? [duplicate]

I'm looking at dextools for uniswap and it's showing the price for 1 UNI is USD 3.57238184. How does dextool calculate this? A manual calculation would be great An example: https://etherscan.io/tx/...
1
vote
0answers
2k views

Calculating annual percentage yield (apy) value for Uniswap pairs

I wants to calculate annual percentage yield for a token pair listed on uniswap like this. Is there any API which I can use to retrieve the value? How can it be directly calculated?
1
vote
0answers
348 views

What factory (UniswapV2Factory) shoud I use when deploy Sushiswap clone?

Hi I'm forking Sushiswap and about to deploy contract to mainnet. While I'm writing deploy_contract.js in Truffle. Which Factory shoud I use in my migration code? I saw several code example but ...
1
vote
0answers
485 views

UniswapV2 addLiquidityETH() reverting when trying to deploy to ganache locally

I'm trying to locally deploy a contract similar to sushiswap, but I keep getting a revert from addLiquidityETH(), no message other than VM Exception while processing transaction: revert //module....
1
vote
0answers
307 views

How can I handle the UniswapV2: LOCKED revert reason when calling swapETHForExactTokens on the Uniswap router2 contract

I have forked the eth mainnet onto my local machine using ganache cli and am trying to call the UNISWAP router2's SwapETHForExactTokens to swap eth for MEME tokens. I call the function from truffle ...
1
vote
2answers
273 views

What's the advantage of interacting with a smart contract from another smart contract (instead of just calling it using something like Web3.js)?

I've noticed there are lots of tutorials online that talk about deploying a smart contract that allows them to interact with other smart contracts e.g. deploying a smart contract to interact with ...
1
vote
0answers
523 views

How to deploy uniswap contract with open zeppelin?

I was following the quick start here which suggests to "Deploy the UniswapV2Factory" under the writing tests header. I'm using OpenZeppelin and have Ganache running but I wasn't able to ...
1
vote
1answer
166 views

Are Uniswap liquidity provider's fees timeweighted?

The common conception is that Uniswap LPs get more fees as they stay longer in the pool. I have been searching everywhere for a clear explanation of how fees work, and could not find information to ...
0
votes
1answer
313 views

I want learn smart contract trading [closed]

ALL I WANT learn about smart contract trading. I see on etherscan many bot making big money daily with smart contract. E.g I see bot are work single transaction swap weth to token to Eth In than bot ...
0
votes
2answers
113 views

Why swapping some tokens require more gas fees than others?

I noticed that swapping some tokens in Uniswap to exactly the same amount of ETH, at the same time, has much higher gas fees than other tokens. Why is this? Aren't the swap transactions identical for ...
0
votes
1answer
321 views

Issues with Uniswap V2 addLiquidityETH()

I've been learning how Solidity and Uniswap works. I found a smart contract that appeals to me enough to want to use it to learn more Solidity with. https://etherscan.io/address/...
0
votes
1answer
110 views

Uniswap V2 Contract question: Stack too deep [duplicate]

Could someone explain how this line of code (linked below) properly circumvents the "stack too deep" error? I was under the assumption that the "stack too deep" error meant the ...
0
votes
1answer
43 views

Testing Token with Uniswap liquidity provisioning using hardhat

I'm attempting to fork Safemoon (or really NotSafeMoon), and use it as a vehicle to learn smart contract development. (I've got a substantial amount of what you might call "Web 2.0" dev ...
0
votes
2answers
841 views

Uniswap - cancelled transactions and lost ETH

I started a swap on Uniswap and while it was processing, I started 2 more swaps. The first swap got stuck for hours so I first tried increasing the gas fee and then eventually, I tried to cancel it. ...
0
votes
1answer
108 views

What decides about the position in the block? [duplicate]

All these transactions happened within the single block: Source: https://etherscan.io/defi?q=0x8a40c222996f9f3431f63bf80244c36822060f12#dextracker Right now it is still possible to get to the initial ...
0
votes
1answer
212 views

How to get the price of a pair using only its symbol?

Is it possible to get the price of a pair using graphql for uniswap without knowing its id? I use this website to try things out: https://thegraph.com/explorer/subgraph/uniswap/uniswap-v2 For example, ...
0
votes
2answers
2k views

Uniswap V2 Router, Factory on Rinkeby testnet

Is it possible to use Uniswap V2 router on rinkeby? What is the contract address of a router? i found only factory contract address ?
0
votes
1answer
2k views

Uniswap Price Feed.- Get price of a Token in a Solidity contract

I am looking to retrieve the current price of a token from Uniswap. I have successfully used the ChainLink oracle api to get the price of BTC/USD, but I want to now integrate Uniswap price feeds. I ...
0
votes
2answers
590 views

Token swap amount difference between the amount from uniswap app and contract read

When I tried to swap 1BAT from DAI by using Uniswap App (https://app.uniswap.org/#/swap), I needed 0.325372DAI as this picture show. However, when I tried to calculate how much DAI I need to get 1BAT ...
0
votes
1answer
2k views

Uniswap V2's swapExactETHForTokens: How to know the number of tokens bought

I wrote the solidity function below to swap ether for other tokens on a Uniswap exchange. It works. function buyCryptoOnUniswap1(uint256 etherCost , address cryptoToken) public payable returns (...
0
votes
1answer
804 views

Uniswap V2 smart contract keeps getting reverted in JS

I'm trying to swap tokens using Uniswap v2 interface. The code of the contract is here. I'm able to deposit Eth to the contract and but I'm not able to invoke the swapEthForTokenWithUniswap() ...
0
votes
1answer
15 views

UniswapV2Router swapExactETHForTokens Fail with error 'EXPIRED' after deadline is reached

I am having a hard time creating a contract that uses the swapExactETHForTokens function. I intend to create a contract that receives ETH and then any user can swap those ETH for a specific token ...
0
votes
1answer
19 views

Why did I get such a low swap return on Uniswap?

I used Uniswap router to swap ether for Unisocks, but when I check the transactions details 0xfcba19d84b4f578fcff1dc2378b673af1c5fa54e422555f27fd2ac6b46fc21ae, I'm getting much less $SOCK's than what ...

1 2 3
4
5
9