Skip to main content

All Questions

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

How to solve invalid input params issue for uniswap v2 router 'addLiquidity' method

Can you tell if I am wrong about any of the arguments used for the addLiquidity. I am using wagmi and ethers. Error Caused by: InvalidInputRpcError: Missing or invalid parameters. Double check you ...
Abu Sayeed Mondal's user avatar
0 votes
0 answers
80 views

How to Ensure Custom Tax is Applied on Token Swaps in Solidity Smart Contract?

I'm developing a smart contract for a token (FMYNT) using Solidity on the Binance Smart Chain testnet, integrated with PancakeSwap testnet. I've implemented a custom 5% tax feature for buy and sell ...
Awais Ahmad's user avatar
0 votes
0 answers
81 views

Simple code example to implement tax on sell/buy transactions for a token on Uniswap DEX causing "Your swap is expected to fail.." error

I am trying to implement a sell/buy tax on transactions for my token when users trade on Uniswap DEX. My token's smart contract includes a tax deduction mechanism that functions correctly on EtherScan ...
Awais Ahmad's user avatar
0 votes
1 answer
27 views

Projects you made [closed]

Which projects you made that get you to expert level in solidity? I'm trying to be a smart contract dev. with solidity and wanna see which ones you made so I could benefit from it.
seojunchian's user avatar
1 vote
2 answers
161 views

Do I have to pay twice for network fee?

I'm very new in crypto world and right now I'm trying to swap this coin but as you can see in the screenshot the ETH gas fee (Uniswap) is only $15 but once I tried to confirm transaction at my wallet ...
andrel58's user avatar
2 votes
0 answers
639 views

How to Calculate Arbitrage Optimal amount in, in Uniswap v3 pools?

Let us assume that there is an arbitrage opportunity in uniswap v3 pools.Now I want to take a flash loan to make a swap in uniswap v3 pools.My doubt is how can I calculate the optimal amount in for ...
kumar's user avatar
  • 71
1 vote
1 answer
1k views

What would happen if you allocated 100% of a token's supply to a DEX liquidity pool?

So we all know what happens when there is no liquidity at all; it's impossible to buy or sell a token with no liquidity. But what would happen in the reverse scenario; if 100% of a token's supply was ...
Ashraile's user avatar
  • 125
0 votes
0 answers
62 views

Subgraph Link for Uniswap V2 on BSC?

I'm looking for the SubGraph Api endpoint to interact with UniswapV2 on the Binance Smart Chain (BSC). Can anyone provide the specific link or information on how to access it? I appreciate any ...
adam mr's user avatar
  • 141
0 votes
1 answer
34 views

Is it safe to use block.timestamp when swapping erc20 tokens?

I have a swapping function in my smart contract and for the deadline I am using block.timestamp. The swap function can only be called by the owner of the contract. Is this a safe way of working with ...
guiflam's user avatar
  • 11
0 votes
0 answers
149 views

How to calculate expected token amount out in a UniswapV3 swap

Accounting for slippage, is there a good way of reading data from a UniswapV3 pair and estimate how many tokens will be received when performing a swap (accounting for slippage)? I couldn't think of a ...
Rudi's user avatar
  • 1
0 votes
1 answer
91 views

How to decode internal transaction in mempool

i'm researching on how mev works. I know that they are watching all pending transactions, then define function that is swap on dex and calculate amount to do sandwitch. However, when user do a swap, ...
dang.pm.IT's user avatar
1 vote
0 answers
31 views

How to swap ETH for another token and send this token to another wallet using only one transaction for both actions?

Please, tell me, is it possible to do it using Uniswap V2 router (via smart-contract or dapps)
misha s's user avatar
  • 11
0 votes
3 answers
869 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 ...
Mahdi Karami's user avatar
1 vote
0 answers
173 views

Can we rely on 1inch Swap API price feeds

It is not clear to me how 1inch swagger API is getting the prices from different dexes. Can we rely on them? As they are not open-sourced. I tried using the aggregator but faced this issue RPC timeout ...
Saikat Karmakar's user avatar
1 vote
0 answers
29 views

Uniswap: Why is there an intermediary when swapping?

I am trying to understand why sometimes when a wallet buys a token the Uniswap pool sends the token through an intermediary address before it gets sent to the buyer. Here's an example of such ...
Martin's user avatar
  • 11
0 votes
0 answers
160 views

How to calculate "amountOutMin" on some DEX-es?

There's a function in a contract on HOT-protocol exchange sendToL2( uint256 chainId, address recipient, uint256 amount, uint256 amountOutMin, uint256 deadline, address relayer, uint256 relayerFee ) ...
Kyell's user avatar
  • 91
0 votes
1 answer
187 views

Need Guidance on Handling a Paused Token pair in Uniswap : extract ETH from pair

I currently have a token pair (Token A and ETH) listed on Uniswap DEX. However, Token A's smart contract has been paused by its issuer, rendering this token immovable at the moment. Now, I'm aiming to ...
Jorney's user avatar
  • 1
0 votes
1 answer
163 views

Need help in flash loan arbitrage project

I am creating a flash loan arbitrage project, where i am using uniswap v3 for first swap, do i need to add code for adding liquidity too? I wrote code just for swap. I know without liquidity we can't ...
Hacek 's user avatar
  • 677
0 votes
1 answer
343 views

Added liquidity on Uniswap but haven't got the LP token

This is the first time I have added Liquidity to uniswap in Matic/DAI pair at 0.3% reward. But when I have added the liquidity uniswap doesn't provide me the LP token which represents that I have ...
Rishabh Raghwendra's user avatar
1 vote
1 answer
136 views

Can't understand what "First arguments makes this function a method of mapping(int16 => uint256)." means here

function nextInitializedTickWithinOneWord( mapping(int16 => uint256) storage self, int24 tick, int24 tickSpacing, bool lte ) internal view returns (int24 next, bool initialized) { ...
Hacek 's user avatar
  • 677
0 votes
1 answer
42 views

Did I understood Uniswap's `amountSpecifiedRemaining` correctly?

I am following uniswapV3 development book. I have a confusion from one of its chapters. The struct is: struct SwapState { uint256 amountSpecifiedRemaining; uint256 amountCalculated; ...
Hacek 's user avatar
  • 677
-1 votes
1 answer
76 views

I need help on this code

I have few question: 1. bool zeroForOne = params.tokenIn < params.tokenOut; This code means: if params.tokenIn is less than params.tokenOut then make zeroForOne true, am i right? 2. There is a ...
Hacek 's user avatar
  • 677
2 votes
1 answer
20 views

Query on typecasting in solidity

I am following uniswap v3 development book. We have a code: pool = address( new UniswapV3Pool{ salt: keccak256(abi.encodePacked(tokenX, tokenY, tickSpacing)) }() ); My question is, ...
Hacek 's user avatar
  • 677
1 vote
1 answer
18 views

Understanding Conditional Ternary Operator Logic in This Code Snippet

( _zeroForOne ? step.sqrtPriceNextX96 < _sqrtPriceLimitX96 : step.sqrtPriceNextX96 > _sqrtPriceLimitX96 ...
Hacek 's user avatar
  • 677
2 votes
1 answer
24 views

Help me to understand it

if ( _zeroForOne ? _sqrtPriceLimitX96 > _slot0.sqrtPriceX96 || _sqrtPriceLimitX96 < TickMath.MIN_SQRT_RATIO : _sqrtPriceLimitX96 &...
Hacek 's user avatar
  • 677
1 vote
2 answers
22 views

Tell me if i understood this line properly

function update( mapping(int24 => Tick.Info) storage _self, int24 _tick, int128 _liquidityDelta, bool _upper ) internal returns(bool flipped){ ... ...
Hacek 's user avatar
  • 677
2 votes
1 answer
133 views

I have doubts related to liquidity calculation of uniswapV3

q96 = 2**96 def price_to_sqrtp(p): return int(math.sqrt(p) * q96) sqrtp_low = price_to_sqrtp(4545) sqrtp_cur = price_to_sqrtp(5000) sqrtp_upp = price_to_sqrtp(5500) def liquidity0(amount, pa, pb)...
Hacek 's user avatar
  • 677
1 vote
2 answers
265 views

I did not understand why q96 used here in uniswapV3 development book

This code is from Uniswap v3 development book: sqrtp_low = price_to_sqrtp(4545) sqrtp_cur = price_to_sqrtp(5000) sqrtp_upp = price_to_sqrtp(5500) def liquidity0(amount, pa, pb): if pa > pb: ...
Hacek 's user avatar
  • 677
1 vote
1 answer
292 views

Confused in understanding on tick range in uniswap

we know in uniswap v3 the tick range is [−887272,887272]. My question is, is this for each price range or total of all price ranges should be in this tick range??
Hacek 's user avatar
  • 677
1 vote
0 answers
33 views

Help me to understand pricing range formula in uniswap v3

I understood this: But i could not understand how this came: Help me to understand this formula.
Hacek 's user avatar
  • 677
0 votes
3 answers
2k views

What is Ticks on Uniswap?

I'm a very beginner in dex protocol. Can someone explain to me what is a uniswap Tick? Many thanks.
adam mr's user avatar
  • 141
1 vote
1 answer
371 views

Tiny Uniswap amounts cause enormous price impact

When exchanging the smallest possible amount of USDC/WETH - 0.000001 USDC - on Uniswap V3 the price impact soars to 99.95%. Is this accurate, or is this an error in price impact estimation? Why is ...
Voy's user avatar
  • 123
0 votes
1 answer
302 views

When TWAP is used in uniswap?

TWAP is the average price of an asset in a given time period. However, I am confused about when it is used. When I use the Uniswap app to swap tokens, I do not pass any time variables. How does ...
Yilmaz's user avatar
  • 1,715
1 vote
1 answer
558 views

Why hardhat is not checking events args in tests

I have a deposit function, similar as of DEXs, which mints some LPs on deposit. function deposit() public payable returns (uint256) { uint256 ethReserve = address(this).balance - msg.value; ...
Rishabh Raghwendra's user avatar
1 vote
1 answer
121 views

Does sandwich attack work if there are TWO attackers?

In this scenerio, could both attackers turn a profit from this attack? I imagine it would work, but I want to be certain. Tx No. Description Tx0 Attacker 1 trades A for B Tx1 Attacker 2 trades A ...
Dani's user avatar
  • 11
0 votes
2 answers
718 views

How to calculate virtual (50/50 & x*y=k) reserves of UniSwap V3 Pair?

I know how to get balances of each token from a pair, and if I'm not mistaken - those balances of tokens is indeed a real reserves. Also, L is stored in contract info, but I doubt one thing - this L ...
Chenky's user avatar
  • 21
0 votes
2 answers
3k views

How to get the virtual and real reserves from a Uniswap V3 pair?

I need help with math of Uniswap V3 virtual and real reserves. Need to find the true reserves of a pair. Example: let's say we have this DAI/WETH pair: 0x60594a405d53811d3BC4766596EFD80fd545A270 ...
Chenky's user avatar
  • 21
1 vote
0 answers
104 views

Is there an API to create/remove Liquidity Pools on different DEXes?

I'm looking for a way to automate liquidity allocation into the most profitable pools, for this, I need the ability to create/remove liquidity pools on the most popular DEXes. At a low level to do ...
vach's user avatar
  • 111
0 votes
1 answer
62 views

What happens to LPs if liquidity of uniswap extinguish?

I have a doubt that if an LP provided its tokens to the uniswap pool but someone else in the world swapped and took all of the tokens from the pool so how can he/she withdraw its tokens? Will it get ...
Rishabh Raghwendra's user avatar
0 votes
1 answer
113 views

How to do Snapshot and extract Token Balances for Holders of UniV2Pair?

Trying to figure out how to get all addresses and balances of all holders for both token0 and token1 from a UniPair and make a snapshot for all individual balances. What I'm interested in is: ...
Liberalite's user avatar
0 votes
2 answers
629 views

How can i calculate the unclaimed amount from Uniswap v3 position

How can i calculate the unclaimed amount from Uniswap v3 position( with any addresses) like https://app.apy.vision/
Long's user avatar
  • 41
1 vote
1 answer
445 views

How can i calculate depositedAmount0 and depositedAmount1 from given liquidity Uniswapv3

How can i calculate depositedAmount0 and depositedAmount1 from given liquidity Uniswapv3
Long's user avatar
  • 41
0 votes
1 answer
192 views

Decrease or sweep token is not approved uniswapV3?

I call a transaction to increase liquidity on UniswapV3 with NonfungiblePositionManager contract to a position that i don't own. Here is the txn hash on goerli: ...
Long's user avatar
  • 41
5 votes
3 answers
3k views

Why MINIMUM_LIQUIDITY is used in DEX like Uniswap?

What is the MINIMUM_LIQUIDITY value used for? Why did they chose this numerical value? uint256 public constant MINIMUM_LIQUIDITY = 10**3; Why should it be burned? The mint function in the ...
nulltogeek's user avatar
1 vote
1 answer
443 views

How to determine whether a pending tx is a result of a swap in Uniswap?

Let's say I'm quering mempool, that is, pending transactions. How can I then filter out those that are the result of swaps made via Uniswap of certain liquidity pools? Let's say there're 10 liquidity ...
Nicholas E. Harding's user avatar
1 vote
1 answer
331 views

Uniswap exchanges at wrong price?

The current state of WETH-DAI pool on Ropsten is (33796288305479532646, 31012471784612084535765) with it 0.01% fee. So, 1 WETH = 917 DAI. Why Uniswap exchanges the pair at 1 WETH : 494 DAI ?
notooth's user avatar
  • 103
3 votes
3 answers
537 views

Sandwich Attack: Why do they use so high gas fees on sells?

I am currently watching into vulnerabilities and different threats for DEXes. I found some sandwich attacks or front running, that use moderate-high Gas Fees on Buy and crazy high Gas fees on the sell....
Stevie's user avatar
  • 56
1 vote
2 answers
218 views

Uniswap V1 Factory contract with ethers.js not working

I have tried the following code to get exchange address of DAI(0x6B175474E89094C44Da98b954EedeAC495271d0F). But it's giving some strange error. Any idea what's going wrong? (I have verified the ...
Rushank Savant's user avatar
0 votes
0 answers
27 views

How can i get & Store all Pancakeswap chart deta?

I want to create my own dex! Not forking, in smart contract i added some new system,so now i want to know how can i store chart deta and show this on Front, Daily / monthly chart anyone have idea how ...
SayedEx's user avatar
0 votes
1 answer
538 views

Is there a grid trading option for Ethereum DEX'es like uniswap and sushiswap?

Currently DEX'es like uniswap and sushiswap can only do basic swap orders, but is there a service or way to do grid trading using these types of DEX'es? Or is there another L2 that can do this? ...
Patoshi パトシ's user avatar