Questions tagged [uniswapv3]
The uniswapv3 tag has no usage guidance.
251
questions
1
vote
1
answer
82
views
How to swap a token on UniswapV3 in python
Question:
I've been able to successfully write scripts for swapping tokens on Uniswap V2, but I'm facing challenges when trying to swap tokens on Uniswap/PancakeSwap V3. Specifically, I am trying to ...
1
vote
0
answers
23
views
Uniswap v3 unclaimed rewards calculation is off
I'm creating a statistics app for tracking my positions on uniswap.
As you can see below I have 0.019 unclaimed ETH rewards. However, when I try to reproduce this in my statistics app, I get 0.016 ...
0
votes
0
answers
46
views
Calculating Uniswap V3 pool address in Python
I'm trying to use Python to calculate the pool address of two tokens based on the Uniswap V3 Solidity code provided here.
Here's my Python code:
from web3 import Web3
from eth_abi.packed import ...
1
vote
0
answers
26
views
calculating liquidityLockedToken amount for uniswap V3 pool
I tried to analysis pool information and I want to make a result like below.
pools-uniswap
I wrote the code below by referring to the uniswap sdk documentation.
import JSBI from "jsbi";
...
0
votes
0
answers
16
views
How to custom chain to uniswap interface v3 with swap token?
I encountered an issue when customizing the chain and received the error:
{
"detail": ""tokenInChainId" must be one of [1, 5, 10, 56, 137, 324, 8453, 42161, 42220, 43114, ...
0
votes
1
answer
18
views
Uniswapv3 fetch tick with negative index is always empty
While fetching ticks, I noticed that I always get empty results for negative ticks (ticks with negative index). I must be missing something or be misunderstanding the way ticks work, as I cannot ...
0
votes
1
answer
12
views
Uniswap Swapping
I have a problem swapping on uniswap. I want to swap token but when I select token I want to swap it says "not enough liquidity". Can anyone help me. It is quite some money in stake. Thanks.
0
votes
0
answers
9
views
Create liquidity calculation issue
In a mint position function
The calculated input is more higher while it popup in metamask.
For example , Same like uniswap calcluation I give the pair token0 = 100 , token1 = 112.068 same like ...
0
votes
1
answer
26
views
How do you get price in UniswapV3?
Seriously I'm on this for like two weeks or more and please help me I'm going crazy. I want to get the price with smart contract not js way that can be handled with sdk I know but How do I do it in my ...
0
votes
0
answers
13
views
Does anyone here used uniswap sepolia?
I want to swap with usdc but dont know how. It says tokens loaded by local storage. How I'm gonna add to it?
BEWARE: The Uniswap interface uses localStorage to remember your settings, such as which ...
0
votes
1
answer
30
views
UNISWAP LIQUIDITY NIGHTMARE
I am trying to create uniswap V3 pool. token0 is always 490_000_000 * 1e18 tokens , token1 is changeable , between 1 -100 WETH ( WETH is also 18 decimals)
function createPool(
address ...
2
votes
1
answer
118
views
Uniswap V3 - calculate optimal amounts to provide liquidity
I have a Uniswap V3 pool of "token A" and "token B".
Holding 1,000 of token A, and 1,000 of token B on a wallet.
Current tick in the pool is 50,000, marking the price of ~148 ...
0
votes
0
answers
14
views
How to Calculate or Estimate Swap Output on Uniswap V3 Pools Using Solidity
I'm working on a project involving Uniswap V3 and need assistance with calculating or estimating the output of a swap operation within a V3 pool using Solidity
1
vote
1
answer
9
views
Purpose of Timestamp Assignment in UniswapV3's Observation Growth
When I studying UniswapV3's price oracle, I found that new observations are assigned a timestamp of 1 when observation.grow() is called. This assignment appears to indicate that the new observations ...
1
vote
1
answer
110
views
How can I get the "official" WETH which is different from wrapping from Uniswap on Sepolia testnet?
I am trying to make a bid on some NFT assets. I have Sepolia ETH from faucets. I also wrapped the Sepolia ETH into WETH using Uniswap. However, Opensea doesn't seem to recognize that WETH.
This is the ...
0
votes
0
answers
50
views
How to Calculate Optimal Input Amount for Arbitrage in V3 Pool
I'm looking to optimize my arbitrage strategy involving V3 pools . Specifically, I want to determine the most efficient input amount of tokens to maximize profit.
Could you provide guidance or point ...
0
votes
2
answers
45
views
Encountered an unknown dumb error during Uniswap V3 contract swap invocation, completely clueless
I wrote a contract myself to perform a simple swap on the BSC testnet using Uniswap V3. Specifically, I want to swap WBNB for BUSD, and I have hardcoded the parameters for clarity. I assure that the ...
0
votes
1
answer
87
views
How do get the swap path for multi pool swaps uniswap v3
I want to be able to make dynamic multi pools swaps in my smart contract. My plan is to use the exactInput function found here: https://github.com/Uniswap/v3-periphery/blob/main/contracts/interfaces/...
0
votes
1
answer
224
views
Uniswap v3 QuoterV2 not returning amountOut
I have been trying to get a quote for two addresses using the Uniswap V3 QuoterV2 contract but I keep getting an error of:
TypeError: Cannot read properties of undefined (reading '...
0
votes
0
answers
36
views
Uniswap router V3 exactOutputSingle failing without proper error
I need to make a swap with Javascript web3.js and uniswap V3 router (for testing I use BSC)
Here my code
import Web3 from 'web3';
import config from './components/config.js';
import BigNumber from '...
0
votes
0
answers
26
views
Uniswap v3 IQuoter / IQuoterV2 return nothing
I'm trying to get Uniswap v3 IQuoter.quoteExactInputSingle() or IQuoterV2.quoteExactInputSingle()in Arbitrum / Base networks in my solidity contract. In both cases Remix show me that decoded output is ...
0
votes
1
answer
47
views
Having issues swapping brett on base with my web3.py script
Here is my current code (not including abi because its gonna be to long)
#Addresses
PERMIT_ADDRESS = '0x000000000022D473030F116dDEE9F6B43aC78BA3'
BRETT_ADDRESS = '...
2
votes
2
answers
270
views
cannot estimate gas of route swap with Uniswap v3
I'm currently trying to process a swap with Uniswap v3 by forking the example of the documentation (https://docs.uniswap.org/sdk/v3/guides/swaps/routing). I'm swapping on Base Mainnet (chain id: 8453)
...
0
votes
0
answers
59
views
Order of tokens in Uniswap V3 pool price
I am trying to get a token price from the Uniswap V3 pool. The Uniswap V3 contract provides a slot0 field where the rate is written in two ways. (documentation)
using sqrtPriceX96 and using tick
Then ...
0
votes
0
answers
29
views
After implementing UniswapV3 swap logic in Web3.py, I get a lot of logic errors saying "execution reverted: SPL"
I tried to do a Swap on UniswapV3 with the following code in Web3.py.
As a flow, output the value of amount_out_min in quoteExactInputSingle function -> get the pool impact after the swap in ...
0
votes
0
answers
49
views
Uniswap v3 Mainnet vs Sepolia EvmError: Revert
I'm struggling to solve EvmError: Revert, while calling createAndInitializePoolIfNecessary function on Uniswap v3 NonfungiblePositionManager contract. I have wrote function that contains this code:
...
1
vote
1
answer
373
views
Issue swapping with Universal Router smart contract on Base Chain
Here is my current code. In the past I have used ISwapRouter with v2 liqudity. In this case I am trying to execute a swap on base chain with v3 liqudity but base chain does not have a swap router ...
0
votes
0
answers
32
views
how to calculate the tick from price ? Uniswap v3
This is USDC/ETH pool with 0.05% poolfee. I am planning to get the price range from users (lower price and higher price ) but if the user provide lower price as 0.00025991932 and higher price is 0....
1
vote
0
answers
34
views
How to get uniswap v3 price tick?
I am planning to get the price range from users (lower price and higher price ) but if the user provide lower price as 0.00029991932 and higher price is 0.00033985099 then how can I get the lower tick ...
0
votes
0
answers
42
views
How to fetch the amount of tokens pooled into Uniswap V3 pool
I would like to fetch the amount of USDC.e (or any other token) pooled into the Uniswap v3 pool on Arbitrum using Node.js.
I figured out how to fetch the current split when the price is in the range, ...
0
votes
0
answers
16
views
Mint new position not working for all existing pairs
I am using uniswap v3 mintNewPosition to mint new liquidity position .So i called mintNewPosition() function mentioned in https://docs.uniswap.org/contracts/v3/guides/providing-liquidity/mint-a-...
0
votes
0
answers
63
views
Uniswap OLD revert after swap
I am initializing new pool, and have a contract that allows doing swap on it utilizing TWAP Oracle. I have tested the TWAP and in tests it needed 1 second delay to return correct quotes, until doing a ...
0
votes
1
answer
62
views
How to abi.encodeWithSignature the function which contains structure as the parameter in solidity?
I want to call Uniswap's collect function which is in NonFungiblePositionManager contract using delegatecall. But the collect function takes the structure as the parameter.
Here is the collect ...
0
votes
1
answer
184
views
Call Swap from Uniswap V3 pool contract instead of through router
I am trying to call swap method from UniswapV3Pool contract, Kindly guide me step by step to call this method. ETCSwap (Ethereum Classic DEX) is using this approach, they are directly interact with ...
0
votes
1
answer
359
views
how to call execute sell function in uniswap v3?
I have called function buy and sell with uniswap v3 and transaction is failed. How to call
I use web3py and call to
def sell_token(web3 : Web3 , chain, wallet_address, address_token, token_abi, ...
0
votes
1
answer
94
views
UniversalRouter execution reverteed BASE chain
I'm trying to use UniversalRouter to swap WETH to token, this is how i'm doing it:
//from - WETH, to - test token
const contract = new ethers.Contract(
"...
0
votes
1
answer
340
views
Uniswap V2 Router, Factory on amoy Test Network
what is the address of uniswap router on amoy test network as currenty uniswap doesn't support amoy network.
1
vote
1
answer
26
views
How do I properly call the transferTokens() function?
This first contract creates a liqudity pool for the two tokens on sepolia test net
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
// Using npm package imports for a Hardhat or Truffle ...
1
vote
1
answer
493
views
Transaction got reverted Uniswap Universal Router
I want to programmatically swap using Uniswap Universal Router, but the transaction always gets reverted
Here is my code:
const ethers = require("ethers");
const { abi: V3SwapRouterABI } = ...
0
votes
1
answer
115
views
What is the difference (in terms of calculation) between tokens pricing while swapping vs while adding liquidity in Uniswap V3?
In Uniswap V3, getting different prices of 1 WETH to USDC while swapping and adding liquidity, potentially because of fees and other contributing factors.
Swap
Add Liquidity
Programmatically, I'm ...
0
votes
1
answer
108
views
How to Compute Nearest Lower and Higher Initializable Ticks in Uniswap V3?
I am developing applications interacting with Uniswap V3 pools and need to calculate the nearest lower and higher ticks that are initializable given a specific tick and tick spacing. In Uniswap V3, ...
0
votes
1
answer
38
views
what is the best way to get the amount of token1 i can get for 1 token0 in a pool
async function getPoolData() {
const provider = await new ethers.JsonRpcProvider("http://127.0.0.1:8545/");
const signers = await provider.getSigner();
console.log("Pass 1");
...
0
votes
2
answers
52
views
how to find how much usdc should i want to add if i need to add 1 eth. How to calculate this?
when we want to add liqudity in uniswap you should need to add two tokens so if i need to add eth and usdc then i need to add eth and usdc curresponding to the eth which we add. so my doubt is how to ...
0
votes
1
answer
153
views
How can I get the correct pair price from Uniswap v3 pool?
Code showing me token price in wrong format. How to solve it?
From the code I got:
1 WETH = -3.30628482e-9 USDC
1 USDC = -302454281.60057910558352924961 WETH
But the real/expected values were:
1 ...
0
votes
0
answers
30
views
Uniswap V3 transaction on Optimism reverted with "err32" error
I was attempting to interact with a Uniswap V3 pool contract on the Optimism network, but encountered a transaction failure with an 'err32' error. The transaction reverted with the warning:
Warning! ...
1
vote
0
answers
47
views
Observations in TWAP Uniswap
In Uniswap v3's TWAP oracle, how often are observations stored in the observations array of each pool (assuming the array's cardinality has been increased several times already)?
Is it on every swap?
...
0
votes
0
answers
49
views
Why nextInitializedTickWithinOneWord() returns the same tick provided when there are other initialized ticks to the right
ticks intialized 85176,85177,85175
(...
0
votes
0
answers
25
views
sender doesn't have enough funds to send tx
i am trying to create a uniswap pool but when i am testing my smart contract i am getting an error .
import { expect } from "chai";
import { ethers, network } from "hardhat";
...
0
votes
0
answers
22
views
Does removing liquidity from a staked pancakeswap lp unstake it?
If I remove all the liquidity from a PancakeSwap V3 LP, I know it also collect the fees earned.
But if that LP is staked in a farm, will removing the liquidity automatically unstake it and harvest the ...
0
votes
0
answers
41
views
Uniswap V3 protocol tick price conversions
Right now, I'm delving into the mathematics and corresponding code of the Uniswap v3 protocol, and I've stumbled upon this function. Despite scouring numerous documents and forums, I haven't found any ...