Questions tagged [uniswap]
Uniswap is a decentralized finance protocol that is used to exchange cryptocurrencies.
1,088
questions
0
votes
0
answers
29
views
How do I get the amount of asset i have on the pool?
I' am trying to retrieve the amount of token i have on my liquidity pool but i don't know how should i do it i've been trying to use the NonFungiblePositionManager but i can't use the token amount ...
0
votes
0
answers
12
views
Why are you able to swap eth to token lesser than specified amount in amountOutMinimum?
I am using Dai as an example for token address in constructor so when you call this function it should swap ether to Dai.
My question is why sending ether lesser than amountOutMinimum. It still able ...
0
votes
0
answers
19
views
Swap functions seems to not swap?
I have deployed a smart contract on a local network and I am trying to do swaps from a metamask account. I have allocated a quantity of tokens to the smart contract so it can use it using the approve ...
0
votes
0
answers
6
views
What are the fee used for? Who receives the fee for UniswapV3 ExactInputSingleParams
Why do we need the fee?
Isn't it specified that Uniswap will charge 0.30%?
Why do we need to specify a fee here and to who?
Can we set the fee to 0?
struct ExactInputSingleParams {
address ...
0
votes
1
answer
17
views
Whats in the mempool? Was wondering if there are listed properties that anyone can view it
If you send a transaction and it is in the mempool, what are the properties in the transaction of the memool?
I was wondering if you can get the address of the sender in the mempool. What else can be ...
1
vote
1
answer
51
views
Same block Swap before an Approval is allowed?
I had the understanding that Approval in the same block as a Swap had to have a higher gas price as to be processed before the Swap when the block is being produced; that's until I found blocks on the ...
0
votes
0
answers
101
views
Transaction Reverting with my smart contract
I am making a defi page using uniswap v2 router, but my transaction are reverting. Here is my swapToken.sol contract:-
Pls help me in this, to fix this issue.
Also link to the expolorer - https://...
0
votes
1
answer
17
views
How to Calculate SqrtPriceX96 for a Specific Percentage Change in Uniswap v3?
I am working with Uniswap v3 and need to calculate the sqrtPriceX96 value that is exactly 5% (or any other percentage) above or below the current pool price. I understand that each tick in Uniswap v3 ...
0
votes
1
answer
16
views
Which function to use for swapping eth against token on uniswap?
I use the following code to create the swap_transaction:
swap_transaction = router_contract.functions.swapETHForExactTokens(
0, [weth_address ,token_address], account_address, int(time.time())...
0
votes
0
answers
21
views
Does anyone know what uniswapRouterAddress and uniswap abi is on Sepolia network?
I am working on react native project, using v6 of ethers.js and infuria as my node.
I initiate the contract like this:
const uniswapRouterAddress = '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45';
...
0
votes
1
answer
105
views
Uniswap - swap between Sepolia and my own erc-20 token
I am working on a React-Native crypto application for fun, and I am trying to swap my Sepolia native token with my erc-20 token that I recently deployed on remix ide on the sepolia network using ...
0
votes
1
answer
31
views
quoteExactInputSingle is returning error
I'm working on solidity code that uses pancakeswapV3 quoter contract to call quoteExactInputSingle. Here is the code snippet
function AnalyseTnx(address tokenPath0,address tokenPath1,uint256 amtIn)...
0
votes
0
answers
9
views
Uniswap Allow USDT fee
I want to swap USDT to USDC, but Uniswap shows huge fees, especially Allow USDT (one time). Can someone explain why it happens and what to do?
0
votes
1
answer
48
views
getAmountIn equivalent of uniswapV3 or how to calculate it?
I was exploring uniswap V3 router, quoter and factory contracts, but it doesn't have getAmountIn function to calculate the minimum amount I must input to get the desired amount. On some thread, I ...
2
votes
0
answers
13
views
Uniswap/PancakeSwap automatically manage tokens with different amount of decimals (swap)?
I'm getting number results that do not make sense for me, when executing swap functions with USDT (in Uniswap V2 and PancakeSwap V2), and I noticed that USDT Token has only 6 decimals, instead of 18 (...
0
votes
1
answer
9
views
what will happen when two people execute removeLiquidity in uniswap v2?
According to the code of uniswap-v2/v2-periphery/contracts/UniswapV2Router02.sol in function removeLiquidity():
// **** REMOVE LIQUIDITY ****
function removeLiquidity(
address tokenA,
...
1
vote
0
answers
58
views
How do you sell an ERC20 Token for ETH with Uniswap Universal Router?
I'm attempting to swap ERC20 tokens for ETH with the Uniswap Unviersal Router.
When doing an ETH -> ERC20 swap everything works fine, but with the code below (Function where it is going wrong) ...
0
votes
1
answer
19
views
ETH and tokens sent mistakenly to an LP pair, can they be recovered?
so by mistake of my factory contract, it sent the token and ETH to the token uniswap v2 LP pair.
here is the lp pair contract: 0x6ee8924a4297f7dfdda32f4c8cc02688873a8c05
can they be recovered?
0
votes
0
answers
16
views
preventSwapBefore token contracts
I'm looking for a way to determine to determine tokens' contract private state variables such as _preventSwapBefore, or _reduceTaxAt, etc... Theese variables or often in token's contract, but in ...
0
votes
1
answer
15
views
How to parse the swap data of a certain wallet?
I am trying to parse swap data of a set of wallets:
I tried to do this by using logs of the transactions – they often include data about swaps, however there is no uniform way to parse it, because ...
2
votes
1
answer
102
views
What is the difference between sqrtPriceLimitX96 and amountOutMinimum for uniswap?
The sqrtPriceLimitX96 is just a price limit which cannot be exceeded by the trade.
At the same time, the amountOutMinimum appears to do the same thing in that you can achieve maximum price by taking:
...
1
vote
2
answers
37
views
How to know base token from the pool
here is quick question. From uniswap pool, which one is base token? token0 or token1?
4
votes
2
answers
454
views
Getting Uniswap v2 latest price and interpreting values using Python
When interacting with functions price0CumulativeLast and price1CumulativeLast of any smart contract on Uniswap V2 I keep getting incomprehensive values. I am not able to figure out how to extract the ...
0
votes
0
answers
33
views
Can you tell me, why addLiquidityETH is not working?
Can you tell me, why addLiquidityETH is not working? I'm trying to call her through etherscan.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/...
0
votes
1
answer
25
views
Used Uniswap to swap back assets to ETH in metamask wallet, but transaction is worth 0,00USD
I tried to swap ERC-20 asset to ETH that was sitting on a randomcoin that i used to trade before, but the transaction just vanished the ETH it was supposed to transfer.
Did i miss something in the ...
0
votes
0
answers
27
views
Generating input data with Ethers for low level call to Uniswap Router
I'm trying to generate the input data necessary to execute a low level contract call to the Uniswap SwapRouter.exactInput method.
I've done the same for the exactInputSingle successfully but can't get ...
0
votes
0
answers
14
views
Error when calling when calling `increaseLiquidity ` in nonFungiblePositionManager
I have failing tests when calling increaseLiquidity in nonFungiblePositionManager. decreaseLiquidity works as expected but increaseLiquidity is failing.
This is the code:
underlyingPositionManager....
1
vote
1
answer
55
views
Need Help Generating LP Contract Addresses using Uniswap V3 SDK
I'm in a bit of a coding jam, and could use some help understanding how to utilize the Uniswap V3 SDK to generate accurate Liquidity Pool Addresses. I have already gone through the uniswap ...
1
vote
1
answer
51
views
Calculating the price of a token in a Uniswap V3 pool gives different results depending on the pool
Based on the formula on this page i wrote this Solidity contract with a function to get the price of a Token in term of USDC(6 digits) inside a Uniswap V3 pool:
// SPDX-License-Identifier: MIT
pragma ...
0
votes
0
answers
32
views
Why is it reverted/cancelled?
Executions usually reverted (it transact, deduct fee but fail).
https://etherscan.io/tx/0x1ba2897733c8aacecad59593dd66ed333156645cb1c5d604a45524c9de34f91b
version = 2
provider = "https://mainnet....
0
votes
2
answers
36
views
Questioning about the _safeTransfer in the swap function of the UniswapV2 pair contract
I have a question about the _safeTransfer function in the swap function down below.
if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens
if (amount1Out &...
0
votes
1
answer
99
views
No commission comes from buying and selling on the Goerli network
Deployed the contract on the Goerli testnet via Remix. Added liquidity with the openTrading function. I buy tokens from another wallet through Uniswap, the purchase is successful, but the commission ...
0
votes
0
answers
84
views
How to programmatically auto-add liquidity on transaction (ERC20, BEP20), (Uniswap Pancakeswap), (V2, V3)
I've perused the liquidity docs on the relevant DEXes Uniswap and Pancakeswap, as well as on Github. I've found no good tutorials outlining how to add liquidity by code. It's like trying to complete a ...
0
votes
1
answer
32
views
ERC20 token with a uniswapV2 router address initialized in the constructor. I also have method to change the router address. but confused
I'm working on ERC20 token with a uniswapV2 router address initialized in the constructor. I also have method to change the router address. but I'm confused because when i create the new Pair with a ...
0
votes
0
answers
54
views
UniSwapV3 mint new position returned unexpected value
I’m working on a project calling UniSwap V3 contracts. I’ve read the whitepaper, docs and everything I can find online to solve this problem, but get nothing. So I’m here to seek help, not only to ...
0
votes
1
answer
37
views
minAmountOut onchain
When I use, for example, the Uniswap front-end to do a swap and I select my desired slippage, where is Uniswap calculating the minAmountOut variable that goes into the swap and takes into account this ...
0
votes
0
answers
11
views
Bot and whale protection
I would like to deploy a smart contract and add some liquidity on uniswap, but I'm afraid that some whales or bots will suck up all of my tokens as soon as the liquidity pool is created.
What is the ...
0
votes
1
answer
34
views
supplying liquidity + sniping own coin in same bundle
https://etherscan.io/tx/0x0d21d70e031089ab3e5b8083a84f122d5e995033c666dd7ce7cff982b5ba7c77
it looks like this transaction has Supply liquidity and swap Eth for its token all in one bundle.
can anyone ...
0
votes
2
answers
40
views
How to fetch tokens amountOut on different DEXes on BSC?
guys! I am new in DEX trading robots development and I ask you for help in understanding/explaining pretty basic and simple things to me.
First of all, I want to do the most basic thing we can imagine:...
0
votes
0
answers
24
views
swapping tokens on clipper dex with code
https://etherscan.io/address/0x655eDCE464CC797526600a462A8154650EEe4B77 This is the link to the Clipper exchange pool where you can swap weth/wbtc/usdt/usdc/dai. I've been trying to execute a swap ...
0
votes
1
answer
40
views
What is the correlation between "Hash" (Method ID) & "Name"
I was checking Etherscan and come across a deployed contract (Create contract), but the method id was 0x60a06040.
I then used https://openchain.xyz/signatures?query=0x60a06040 and found out that the ...
0
votes
2
answers
26
views
How do you calculate the number of tokens that are worth 1 eth before swapping in Uniswap pool?
I want to make a function for my token contract that allows me to swap a dynamic amount of tokens in exchange for 1 eth.
Is it possible to calculate how many tokens are worth 1 eth and then swap with ...
1
vote
0
answers
27
views
How is the derivation of the Constant Product AMM formula of Uniswap?
I was researching about Uniswap v1 and I found that the code is using the following formula to get the amount out of a swap:
Formula:
Reference to code
Everyone says that this formula is derived of ...
0
votes
0
answers
67
views
Unable to access the function in the contract using hardhat ethers
This is the smart contract code :-
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface IUniswapRouter {
function swapExactTokensForTokens(
uint amountIn,
uint ...
0
votes
0
answers
35
views
approve spender to swap
i'm trying to swap using 1inch aggregator api and when i try to swap, it says
"Not enough allowance. Amount: 4600000000000000. Allowance: 0. Spender: 0x1111111254eeb25477b68fb85ed929f73a960582&...
0
votes
1
answer
52
views
How can I find router addresses of decentralized exchanges
When I want to find router addresses like pancakeswap router (V2) or uniswap router, I can search them like pancakeswap router bscscan in Google or track transactions in bscscan.com to find them. Do ...
0
votes
1
answer
58
views
Tick range of negative tick - Uniswap v3
I am looking for a formula to calculate the tick range for a negative tick.
Ex1:
tick: -15
tickSpacing: 10
range: [-20, -10)
Ex2:
tick: -20
tickSpacing: 10
range: [-20, -10)
I was ...
0
votes
2
answers
119
views
UniswapV2Router: excessive_input_amount Error
I'm working on a TypeScript/JavaScript project where I'm using the UniswapV2Router for token swapping on the Ethereum network. However, I'm encountering an issue with the code, specifically with the ...
0
votes
1
answer
106
views
UniswapV3 Quoter throws error: contract runner does not support sending transactions (operation="sendTransaction", code=UNSUPPORTED_OPERATION)
I am working with the Quoter from Uniswap V3, here is the part of the function that challenges me:
...
// Reformat Amount In
if (!isNaN(amtIn)) {amtIn = amtIn.toString()}
let amountIn = ethers....
0
votes
1
answer
27
views
Dose contracts must be deployed?
I see js programmers compile and call solidity contract without actually deploying it using hardhat and/or similar tools. Do they really can use the contract without deploying on the chain(like swap ...