Skip to main content

Questions tagged [uniswapv2]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
3 views

Optimal arbitrage amount between uniswap V2 and V3

since we can get the optimal arbitrage amount by price impact formula between 2 uniswap v2 markets, how could i approach to calculate the optimal amount between an uniswap v2 - with constant product ...
Kjut Nikolas's user avatar
0 votes
0 answers
40 views

Uniswap V2 Quoting using reserves - getamountout methods

I have been having abit of issue with quoting on uniswap v2 based exchanges. I am extracting the reserves and using the formula. - univ2_formula = lambda amount_in, in_lq, out_lq: (out_lqamount_in0....
Codho's user avatar
  • 1
1 vote
0 answers
55 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
56 views

how do i open trading and sniping/buying token in same bundle

i saw a lot of people launch tokens after adding liquidity to uniswap and then snipe/buy the first few buys as a bundle ( they know in advance how much it will cost them so they disperse x amount of ...
EtherGeek's user avatar
0 votes
1 answer
24 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.
Tomislav Babić's user avatar
0 votes
0 answers
13 views

I have issues buying Base Coins. Error: Fail with error 'TransferHelper: TRANSFER_FROM_FAILED'

web3= Web3(Web3.HTTPProvider(alchemy)) #print(web3.is_connected()) #Instancia contrato uniswap uniswap_router_contract = web3.eth.contract(address=botuni, abi=abiBot) # Crear instancia del contrato ...
Enzo's user avatar
  • 1
0 votes
0 answers
54 views

Burn from Uniswap Pool on BUY transaction

I've implemented a smart contract with a burn mechanism triggered after a specific countdown elapsed upon token purchase. Despite successful deployment on the Sepolia testnet and functioning buy/sell ...
SolidityNewbie's user avatar
1 vote
0 answers
23 views

Using FlashSwap with Uniswap swapping functions like 'swapExactETHForTokens'

I tried taking a loan from Uniswapv2 Flash swap. After taking the loan successfully, I tried making a swap on the uniswap v2 using the swapExactTokensForTokens function then I got this error "...
Gregory's user avatar
  • 11
0 votes
1 answer
33 views

UniswapV2Router.sol addLiquidity() / UniswapV2Pair.sol mint() - Learning to read code

Can anyone explain to me what I fail to understand/misunderstand when reading the mint function of the UniswapV2Pair.sol contract after the addLiqudity function of the UniswapV2Router.sol initiates a ...
Leonardodawinci's user avatar
0 votes
0 answers
24 views

call function uniswapv2 swapExactETHForTokensSupportingFeeOnTransferTokens return UniswapV2: INVALID_TO

i call the following function in js : function swapForShare(uint amountOut) public { uint ethBalanceBefore = address(this).balance; require(ethBalanceBefore > 0, "Contract ...
rebwar's user avatar
  • 3
0 votes
0 answers
30 views

Cannot remove liquidity from Uniswap on Base Chain

I would like to seek assistance for this please. I think the LP for my token broke after renouncing the contract. No one was able to trade after the renounce. will give 0.05 eth to anyone who can help ...
Base Chain's user avatar
0 votes
0 answers
19 views

call swapExactTokensForETH in javascript

I have the following function in JavaScript: try { let tx = await router.connect(receiver).swapExactTokensForETH( tokenAmountToSwap, 0, [token.address, await router.WETH()],...
rebwar's user avatar
  • 3
1 vote
1 answer
62 views

How to precisely remove a specific amount of token0 or token1 liquidity from a Uniswap V2 Pair in Solidity

I need to remove an exact amount of token0 or token1 from a Uniswap V2 pair. To achieve this, I must calculate the amount of LP tokens to burn. The calculation formula is straightforward: Where: ...
CryptoBro's user avatar
0 votes
1 answer
45 views

Is it possible to recover non-reserve tokens accidentally sent to a Uniswap V2 Pair contract?

I'm trying to understand the operation and potential pitfalls of interacting with UniswapV2Pair contracts. I'm aware that if excess token0 or token1 are sent to a Pair contract, it may be possible to ...
opsec's user avatar
  • 1
-1 votes
1 answer
32 views

I updated Solidity to version to 0.6.12. Now the code is broken, how to fix?

How can I fix my code, the chainid is 9999.I tried changing chainId := chainid to chainId := chainid() but it doesn't work. Here is the whole code: pragma solidity 0.6.12; import './interfaces/...
Mr. arikodus's user avatar
0 votes
0 answers
27 views

uniswap v3 Calculate entrance price of a liqidity pool

for example I have added a liquidity on a uniswap v3 pool with this data: pair: CAKE-ETH min price: 1,074.54 max price: 1,118.39 cake amount: 116.752 eth amount: 0.077786 tick spacing: 200 now how ...
Sa SO_PO's user avatar
0 votes
0 answers
20 views

Downscaling liquidity tax according to ETH reserves for fair distribution without presale

So I wanted to try and solve the problems that arise when releasing a token with very low liquidity. Presaling should absolutely be avoided since holders always dump at the start. Assume 50 to 100% of ...
Ashraile's user avatar
  • 125
0 votes
2 answers
46 views

reserve0/reserve1 price is different compared to boughtTokensAmount/requiredWeiAmount

I would start with a sample on exact UniswapV2 pair SHIB/WETH (SushiSwap). I use local hardhat node and there's no possibility of 3-rd party effect on LP. I have this toSwapTokensAmount = ...
dvcr's user avatar
  • 3
0 votes
1 answer
135 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( "...
Moltea_'s user avatar
0 votes
1 answer
48 views

transaction reverted when calling swapExactETHForToken on uniswapRouter02

currently, I'm trying to swap eth for an erc20 token and the transaction gets reverted every time, not quite sure what I'm missing, i pre-approved some allowance for the router02 to spend on my behalf,...
yahdielo's user avatar
0 votes
1 answer
167 views

Transaction execution reverted on swapExactTokensForETH

I hope somebody can help I am trying to sell a token via Uniswap V2 Router02 (Token CA: 0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed) (This token is a legit one, there is no scam here), I have ...
duyanhhz's user avatar
1 vote
1 answer
377 views

Insufficient Liquidity after adding liquidity on Sepolia Uniswap V2

I created a token "TestMe" with 2 million tokens (18dec), minting the deployer address the whole stack. I used the "addLiquidityETH" function provided by uniswap router to add 500k ...
SolidityNewbie's user avatar
0 votes
1 answer
93 views

Insufficient Allowance ERC20 when adding liquidity to Uniswap V2 Pool

I am trying to create a contract with a Uniswap V2 Pair for my TestMe Token on Sepolia Testnet. Smart Contract: // SPDX-License-Identifier: MIT pragma solidity 0.8.24; import "lib/openzeppelin-...
SolidityNewbie's user avatar
0 votes
1 answer
432 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.
sahil's user avatar
  • 5
0 votes
0 answers
19 views

I cant sell this token, me3 contract below, anyway to sell?

/** *Submitted for verification at BscScan.com on 2024-04-13 */ // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.19; abstract contract Context { function _msgSender() internal view ...
Mohamad Alazawi's user avatar
0 votes
1 answer
49 views

Can someone explain the initialize function in UniswapV2 contract?

https://etherscan.io/address/0x1b5bea98cb56da56723db75f2c3b24f6119faf98#code function Initialize () external onlyOwner { require(!tradingOpen,"init already called"); ...
Lappazuronef187's user avatar
0 votes
1 answer
49 views

Large price discrepancy between swapExactTokensForTokens and official swap

I am testing performing swaps using solidity ^0.8.24 smart contracts with hardhat on Polygon and Quickswap exchange. But I am getting relatively large price discrepancies between my swap and one ...
SolTester's user avatar
1 vote
1 answer
208 views

Execution Reverted due to UniswapV2-Pair creation in constructor

I am new to Blockchain development, so bear with me. I successfully deployed my first contract, but if I try to add a Uniswap V2 Pair creation inside the constructor, I always get the error "...
SolidityNewbie's user avatar
0 votes
2 answers
193 views

UniSwapV2 Testnet Support

As you may be aware, the Goerli Testnet has been deprecated, and furthermore, UniSwapV2 is not supported on the Sepolia Testnet. What would be the recommended solution? Thank you in advance.
rebwar's user avatar
  • 3
0 votes
0 answers
15 views

Optimizing gas consumption for the Spit Swap smart contract

how to optimize gas consumption for Spit Swap? If I use the pool contract directly, can this significantly reduce gas consumption? SplitSwapV2.sol // SPDX-License-Identifier: GPL-3.0 pragma solidity &...
Brain King's user avatar
1 vote
0 answers
9 views

Misalignment between Uniswap V2 calculateSwapInput and calculateSwapOutput functions

I've written my own functions calculateSwapInput and calculateSwapOutput for liquidity pools, based off of the Uniswap v2 spec. My functions are below: // Calculates how much of one token we need to ...
713sean's user avatar
  • 111
0 votes
2 answers
91 views

uniswapRouter.getAmountsOut returns less value of token B than present in reverses when provide full amounts of token A

I have the next code to get familiar with uniswap mechanics: create pair contract get reserves invoke getAmountsOut and provide all UNI token reserves const pairAddress = await _V2Factory.getPair(...
dvcr's user avatar
  • 3
0 votes
2 answers
2k views

Does Uniswap allow testing swap on testnets?

I am testing my smart contract on goerli testnet. Everything is working. After I complete adding an LP when I want to test whether it is able to swap, the system keep showing "Insufficient ...
yaoyao's user avatar
  • 1
1 vote
1 answer
41 views

Swapping continuouly failing. only one become success with swapExactTokenForTokens

I have this function.I want to perform swap 3 times with the interval of 30 second using swapExactTokenForTokens.But only only one transaction get success.Others failing. Here is my Code. const ...
Ruwini Shashikala's user avatar
1 vote
1 answer
291 views

I am getting reason: 'invalid BigNumber value', Error. What is the reason?

wallet = ethers.Wallet.fromMnemonic(mnemonic) // console.log(wallet.address) const signer = wallet.connect(provider); // console.log(signer) const routerInstance = new ethers.Contract(routerAddress, ...
Ruwini Shashikala's user avatar
1 vote
0 answers
28 views

How can Retrieving Pending Transaction Reserves (reserve0 and reserve1) in Uniswap V2?

How can I retrieve the reserve0 and reserve1 values from Uniswap V2, not from already mined blocks, but specifically from transactions that are still pending?
PandaKungFuu's user avatar
0 votes
0 answers
55 views

Unable to Add Liquidity using uni swap V2 front end clone

I’m having error from the Uniswapv2 clone that I cloned following the below website instructions: https://www.covalenthq.com/docs/unified-api/guides/how-to-clone-uniswapv2-frontend/ The problem I’m ...
bature's user avatar
  • 1
1 vote
1 answer
113 views

Liquidity pool question (probably very dumb)

My company launched an ERC20 with a Uniswap LP a few years back (2020). They never did anything much with it, and now they want to pull the LP and be done with it. The problem is that nobody in the ...
user130599's user avatar
1 vote
1 answer
2k views

Uniswap V2 optimal arbitrage amount

Tried out whole week to find an answer somewhere for this question, but, nothing to see, unfortunately, Let suppose there are 2 USDT/WETH pairs, one on Uniswap and another one on any Uniswap v2 fork ( ...
Mar St's user avatar
  • 11
1 vote
0 answers
337 views

How can I run the Uniswap Dapp locally for sepolia testnet

I am trying to play around with the Uniswap contracts, by creating pools then swapping etc. The problem I'm facing is that Uniswap V2 doesn't support the sepolia network, V3 does. So when I interact ...
Zartaj Afser's user avatar
  • 5,305
0 votes
1 answer
206 views

Trouble making UniV2 swap on Sepolia with web3py

I'm using the below code to try and make a swap on Sepolia. I've got ETH in my wallet and have found a token that has had liquidity added. Depending what I set the minOutput to I get 'Fail with error '...
stooks's user avatar
  • 11
1 vote
1 answer
130 views

Python Web3 sign transaction without calling "build_transaction"

I need to sign two different transactions: token_contract = web3.eth.contract(address=web3.to_checksum_address(TOKEN_ADDRESS), abi=json.loads(erc20_abi)) approve_trx = token_contract.functions.approve(...
Francesco Stucci's user avatar
0 votes
1 answer
32 views

Vulnerable when using swapExactETHForTokens

I thought that setting block.timestamp to a deadline prevents MEV sandwich attacks.But my question is does it do the work well? address destinationAddress, uint256 minAmountOut ) ...
jacobs david's user avatar
1 vote
2 answers
404 views

What happens when we directly send tokens to Uniswap pair?

This is about Uni V2 pools. So usually we call the function addLiquidity to add liquidity, but the function decides how many tokens should be added depending on the reserves. What if we directly send ...
Solidity Nerd's user avatar
0 votes
1 answer
326 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 ...
Biruk Damte's user avatar
2 votes
0 answers
40 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 (...
Alexander Herranz's user avatar
0 votes
1 answer
47 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, ...
sy liu's user avatar
  • 1
1 vote
0 answers
267 views

cannot use array as type ptr as argument

I am using Go-Ethereum and I have the following error: abi: cannot use array as type ptr as argument But it does not make any since I don't pass an array. The arguments to routerABI.Pack function ...
pigfox's user avatar
  • 167
1 vote
2 answers
355 views

How to know base token from the pool

here is quick question. From uniswap pool, which one is base token? token0 or token1?
Biruk Damte's user avatar
4 votes
2 answers
4k 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 ...
Aniss Itaoui's user avatar