Questions tagged [uniswap]

Uniswap is a decentralized finance protocol that is used to exchange cryptocurrencies. Questions should relate to programming. General questions about Uniswap should be asked on https://ethereum.stackexchange.com

255 questions
3
votes
2 answers

How to check or know that a wallet has tokens in web3 python

I am trying to find out if its possible to know or check in python web3 if a certain bsc address has tokens or transactions. I can check if an address has bnb or bsc transactions using nonce = web3.eth.getTransactionCount(address) but what I want to…
3
votes
0 answers

Uniswap v2 getAmountsOut price for fractional value tokens

I want to get price of tokens like CAW, SHINJA, etc on blockchain and not using uniswap subgraph api. router_contract_obj = w3.eth.contract( address=Web3.toChecksumAddress(IUNISWAP_V2_ROUTER), abi=router_contract_abi ) prices = await…
AtiqGauri
  • 1,483
  • 13
  • 26
3
votes
3 answers

Python Uniswap Subgraph - Constant product formula

I'm trying to calculate the price impact on trades and am getting strange results. I am using uniswap v2 subgraph to get current data for WETH/USDC. def loadUni2(): query = """ { pairs ( first: 10 orderBy: volumeUSD …
cryptotheo
  • 151
  • 1
  • 7
3
votes
1 answer

Cannot assign theme in React

I need to compile a UniswapV2 fork, but it doesn't want to compile. The error is below. TypeScript error in /src/components/AccountDetails/index.tsx(230,28): Argument of type…
3
votes
2 answers

Check if an ERC-20 token is a scam / Honeypot

I'm looking for a way to get the buy and sell tax of a Token and check if it can be sold once bought. To do this, here's the method I thought about : 1-Simulate a Buy transaction on the DEX Router Contract 2-Simulate a Sell transaction on the DEX…
Omar6995
  • 63
  • 1
  • 2
  • 8
3
votes
1 answer

Interpreting Uniswap V3 prices

I am quite new to JavaScript and Uniswap. I am using Uniswap V3 to fetch the price from the DAI/USDC pool. My "main" function looks as follows: async function main() { const [immutables, state] = await Promise.all([ getPoolImmutables(), …
3
votes
1 answer

Uniswap V3 sqrtPrice for ETH/DAI and ETH/USDT, ETH/USDC vastly different

I use IUniswapV3PoolState.slot0 to return sqrtPriceX96 and tick for different pairs in Uniswap V3. The results are very reasonable for ETH/DAI, but it's quite different for ETH/USDT and ETH/USDC. This is not because of the order of the tokens, but…
Tian L
  • 49
  • 3
3
votes
1 answer

solidity delegatecall prevention doesn't works

I am a newbie studying Uniswap V3's github code. I came up with noDelegateCall.sol and I found out the way to prevent a contract to be delegatecalled from another cotract. As I tried to implement this, I caught up with the problem. pragma solidity…
SungJunEun
  • 53
  • 3
3
votes
3 answers

How to calculate Deposit Amounts for Adding Liquidity within Uniswap V3

Whilst adding liquidity to a new pool within Uniswap V3, I am trying to calculate the formula for the 'Deposit Amounts' on any given pair. For example, let's take the pair ETH/USDC Current Price: 2172.05 Set price Rangle -20% & +20% Min Price:…
TriCron
  • 141
  • 2
  • 11
2
votes
1 answer

Solidity: Functions that require a return value it doesn't return anything but still work

I was reading some functions of UniswapV2Router and I face the following code: function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external virtual override payable …
Edward
  • 23
  • 4
2
votes
1 answer

Uniswap V3: Calculating price series from tick

I am working through extracting price series from Uniswap V3 pools. I am following the previously discussed method of using ticks to get the price. Most of the time it works without an issue but I noticed there are some odd trades where you get…
Voerch
  • 51
  • 2
2
votes
0 answers

How to calculate maximum profitable trade amount when cross DEX arbitrage?

For example Token A costs 1.00$ on Uniswap and 1.05$ on Sushiswap. So I can buy Token A on Uniswap and sell on Sushiswap for profit. Let's suppose the next conditions: Uniswap reserve pool = 100 ETH / 100000 USDC. 1 ETH = 1000 USDC Sushiswap…
Serhii Zharkov
  • 496
  • 5
  • 22
2
votes
2 answers

Uniswap V2 why overflow is desired?

I'm analyzing Uniswap V2 core contracts, and have noticed a comment // overflow is desired Why overflow is desired? Because, from my point of view when overflow happens the next line if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) { never…
Nikita Duginets
  • 163
  • 1
  • 6
2
votes
2 answers

Uniswap v2 - How to get the amount of a token that a liquidity provider holds in a liquidity pool?

I have a collection of wallet addresses and I need to find the amount of a token that each of those addresses hold in some liquidity pools. Lets suppose the liquidity poll is for token A and B. So I need to find the amount of token A that each…
samman adhikari
  • 571
  • 1
  • 7
  • 17
2
votes
1 answer

UniswapV3 position minting algorithm can't get correct pool address based on params I've passed in

Uniswap V3 PoolAddress.computeAddress computes different address comparing to the one I get from UniswapV3poolFactory.getPool. And in my code it is ok, I can get pool address from this mapping, but uniswap contracts uses PoolAddress library in order…
1
2
3
16 17