Questions tagged [uniswap]
Uniswap is a decentralized finance protocol that is used to exchange cryptocurrencies.
785
questions
-1
votes
0
answers
6
views
Token price in USD will changed when ETH price dump or pump?
If a token pair with ETH, You can check the chart on the Dextool or Dexsceen or whatever online chart site, But I have noticed, the token price only changed when the token buy and sell
ETH price ...
0
votes
0
answers
4
views
S.O.S. - BSC Pancakeswap Swap Event vs Eth Uniswap Swap Event
I have working code for listening on Uniswap for Swap().on, but this does not work for BSC. Any tips to get the same outcome? I think it might be specific to BSC, but not entirely sure. Thanks in ...
0
votes
0
answers
16
views
how to interact with uniswap quoter contract?
what I want to do is to get the quote of the exchange rate between wETH and wBTC in uniswap.
from brownie import interface, network, config, chain
from scripts.token_scripts import approve_token, ...
1
vote
2
answers
14
views
Testing Uniswap tutorial contracts on local testnet forked from mainnet
I'm following this tutorial to understand Uniswap v3 better:
https://docs.uniswap.org/protocol/guides/swaps/single-swaps
My contract:
pragma solidity ^0.7.6;
pragma abicoder v2;
import "@uniswap/...
0
votes
0
answers
20
views
Transaction on Uniswap -- how to find out what pair is being swapped (via web3.js)?
Given a transaction on Uniswap,
how to find out what pair is being swapped, and the amount of it? Namely, via web3.js/ethers.js
Is there relevant and sufficient information in the fields of a ...
0
votes
0
answers
9
views
Error indexing handleIncreaseLiquidity on a local graph-node on Token#get:decimals with message: "Value is not a BigInt"
Hi, I' m tring to deploy this subgraph to a local graph node that is connected to a local ethereum node on the goerli network.
The OS is xubuntu v21.10 .
The node is hyperledger besu v22.1.2.
The ...
0
votes
1
answer
26
views
SushiSwapRouter. getAmountsOut. 1inch / dai. Incorrect price
I'm interract with SushiSwapRouter at 0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F.
I want to know how much 1inch I get for 1 Dai, and how much Dai I get for 1 1inch.
1inch address ...
1
vote
1
answer
14
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 ...
1
vote
1
answer
237
views
Attack on ERC-777 smart contract and UniswapV2Pair resulting in 104 ETH liquidity drain
My ERC-777 smart contract (Schnoodle, symbol SNOOD) was attacked yesterday resulting in the entire liquidity in the UniswapV2Pair token being drained (104 ETH). The attack was by way of an attacker ...
0
votes
0
answers
11
views
Uniswap v2 remove liquidity ds-math-sub-underflow
I am testing an ERC20 token on hardhat and running into this error when trying to removeLiquidity. 'ds-math-sub-underflow'.
Currently testing this process:
Adding liquidity
swapping a few times
...
0
votes
1
answer
16
views
How can I use UniswapV2 to create my own LP tokens?
I'm new to DeFi and liquidity farming. I'm just trying to build a simple LP farming application for testing and I'm trying to generate some of my own LP tokens to be used as my reward tokens.
I'd like ...
0
votes
1
answer
39
views
Returned error: VM Exception while processing transaction: revert when i use UniswapV2router functions
I'm using my owned cloned UniswapV2 smart contracts(core+periphery) and deployed them using ganache network, so when i start testing functions, i started with createPair() function located in ...
0
votes
0
answers
16
views
How to calculate amountOutMin parameter in the UniswapV3 swapRouter.exactInputSingle() function using an onchain oracle?
Can someone tell me how to calculate the amountOutMin parameter in the swapRouter.exactInputSingle() function using an onchain oracle? I've got a working uniswapV3 oracle that can retrieve the price ...
0
votes
1
answer
34
views
How to get Sushiswap and Uniswap prices from API for WETH/DAI on KOVAN?
Where can I find APIs to query data of WETH/DAI Prices on Uniswap and Sushiswap? For the mainnet, there is thegraph.com where one can query price data with pre-defined GraphQL queries, but I can't ...
0
votes
0
answers
10
views
Liquidity Pool Addresses
I am looking to run some analytics on different liquidity pools in Curve, Uniswap and AAVE and for that I need their addresses. Is there any way I can get the list of pools and their contract ...
0
votes
0
answers
30
views
How to initialize a pool in uniswap v3?
function _initializePool(address tokenA, address tokenB, uint24 fee) external returns(address pool){
uint160 sqrtPriceX96 = uint160(Babylonian.sqrt(price) * 2 ** 96);
pool = ...
1
vote
2
answers
22
views
Is it necessary to our smart contract contains the codes of Sunswap or Uniswap in our contracts?
I'm a bit confused about listing my token in decentralized exchanges such as sunswap and uniswap.
Could anyone tell me the road of listing my token?
and describe if do we need to add codes such as ...
0
votes
1
answer
36
views
swapping tokens via uniswapv2router on kovan network. but transaction always fails
I was making a swapping contract where a user could swap tokens using uniswapv2router. I have taken example code from here - https://cryptomarketpool.com/how-to-swap-tokens-on-uniswap-using-a-smart-...
0
votes
1
answer
42
views
CREATE2 opcode offset and size
This is the UniswapV2Factory contract createPair function. I know that create2 opcode takes 4 arguments (value, offset , size , salt)
How add(bytecode,32) can give the offset ?
How mload(bytecode) can ...
0
votes
2
answers
60
views
Error: Transaction reverted: function call to a non-contract account when adding liquidity through UniswapV2Router
I've been testing around UniswapV2 using hardhat and I always get this error when I try to add liquidity through the addLiquidity function on UniswapV2Router.
For the test, I deployed mock tokens, ...
0
votes
1
answer
41
views
Why my transaction failed : error -3200
I'm trying to developp my first smart contract to make some arbitrage between DEX.
I started by using the code from :
https://github.com/pugzly/token_swap/blob/main/token_swap.sol
But when I execute ...
0
votes
0
answers
15
views
HOW TO SAVELY PROVIDE LIQUIDITY ON UNISWAP?
I created a token and wanted to provide a liquidity with all the tokens I have, but it seems like I need a lot of ethereum, does anyone know how to safely do it?
0
votes
0
answers
28
views
Uniswap V3 uses business source license BUSL-1.1, why doesn't more project use such?
Unlike the MIT license, this may limit the usage of the code for other projects for some time. Are there any benefits to use the MIT license than this?
0
votes
0
answers
20
views
How does token to token swap works in Uniswap?
I am reading the Uniswap explanation docs and encountered the following paragraph:
When interacting with a single Exchange contract, a user is able to
swap between Ether and a specific ERC20 token. ...
0
votes
0
answers
62
views
Mocking and testing UniswapV2's swapExactETHForTokens in brownie: VirtualMachineError: revert: Index out of range
I'm at a loss with one particular brownie test I wrote, that relies on a mock I've written for Uniswap V2's swapExactETHForTokens, the code of which can be found below:
In MockUniswapV2.sol:
import &...
0
votes
1
answer
53
views
about Swap tokens on Uniswap using a smart contract
I would like to build a bot (using VS code) that swaps ETH for other tokens and swap other tokens for ETH using a smart contract.I read the code in this article:https://cryptomarketpool.com/how-to-...
1
vote
0
answers
22
views
swapExactTokensForTokensSupportingFeeOnTransferTokens
According to Uniswap, we need to use swapExactTokensForTokensSupportingFeeOnTransferTokens for tokens that take a fee on transfer. My question is, when does this token fee paid? Also, how does this ...
0
votes
0
answers
29
views
StableSwap invariant and price computation
Having issue reproducing the price Curve.fi propose for swaping tokens.
Let's take tricrypto2 pool for example.
As I'm writing this, the actual balance of the pool is the following:
I'm trying to re-...
0
votes
1
answer
55
views
Uniswap Rinkeby Token Pairs Don't Exist
I am putting together a demo contract which swap some token pairs on Uniswap. I'm testing my contract on Rinkeby. I don't care which token pairs to run the demo on. I grabbed multiple token addresses ...
0
votes
1
answer
48
views
Initializing IUniswapV2Pair from msg.sender
The Uniswap V2 docs provide an example flashswap contract here. The doc says:
For the sake of example, let's assume that we're dealing with a DAI/WETH pair, where DAI is token0 and WETH is token1.
...
0
votes
2
answers
135
views
swapExactTokensForTokens estimateGas fails with execution reverted
I'm trying to swap a pair not having wbnb on pancakeswap. For ex. BUSD -> LUNA. As far as the pair doesn't have wbnb I use swapExactTokensForTokens (meanwhile WBNB -> BUSD with ...
0
votes
0
answers
98
views
[SOLVED]Uniswap addLiquidityETH failing with hardhat
I'm trying to fork the UniswapV2 contracts.
I've already deployed on Mumbai testnet the core and periphery contracts, these are the addresses:
Core: 0xeBF7c7d1b9704516d7e0660BE568945D0bBb1aAc
Router: ...
0
votes
1
answer
30
views
ETH not showing in Coinbase Wallet after using Uniswap
I used Uniswap to "swap" Boost Coin (was paid in this for assisting with the project) to ETH. To clarify, this was using the browser on Coinbase Wallet app, not regular coinable. When I look ...
0
votes
0
answers
153
views
Solidity: Transfer token including tax and sell tokens function
When sending tokens, a tax is applied and that tax is sent to the smartcontract address.
I want to immediately execute a command to swap the tax amount for ETH(native).
Can someone help me with a ...
0
votes
0
answers
185
views
Error: Transaction reverted: function returned an unexpected amount of data, Pancakeswap
I really need your guy's help as I'm stuck in this for a week. Actually, I'm implementing a swap function on pancakeswap, I'm following this documentation. I'm doing swapEthForExactTokens but getting ...
0
votes
0
answers
219
views
How to programmatically swap tokens using a smart contract with NodeJS and Solidity
I would like to build a bot (using VS code) that swaps ETH for other tokens and swap other tokens for ETH using a smart contract. I have used Remix IDE but I get errors that I can't fix. For example, &...
0
votes
1
answer
132
views
Uniswap V3: Fetching spot prices documentation seems incomplete
I'm working on V3 of Uniswap for the first time, and am trying to get the current price of a pool.
I'm using this tutorial page https://docs.uniswap.org/sdk/guides/fetching-prices, which certainly ...
0
votes
1
answer
110
views
Prices from Uniswap and SushiSwap inconstistent
I wrote a simple script in python to get real-time prices from both UniSwap V2 and SushiSwap.
The prices I am getting are inconsistent. I'm trying to get an estimate of USDT to USDC swap and the ...
0
votes
2
answers
26
views
Liquidity locking and ETH loose
When you provide liquidity to a liquidity pool, you add 2 different tokens and you get LP Token (liquidity pool tokens).
You can recover your 2 tokens amount when you give back your LP Tokens, ...
0
votes
1
answer
88
views
solidity transaction error, The called function should be payable if you send value and the value you send should be less than your current balance
I want to write a contract using router from uniswap. But when swapping 1 token to another, I get an error
The transaction has been reverted to the initial state.
Note: The called function should be ...
0
votes
1
answer
98
views
Having trouble executing swapExactTokensForTokens on a uniswap contract?
I am attempting to use brownie to execute a swap on Quickswap. But I keep getting a Dai/insufficient-balance error. Here is the traceback for the tx: https://dashboard.tenderly.co/tx/mumbai/...
0
votes
1
answer
22
views
AddLiquidity to Uniswap
I have been trying to addliquidity (Say DAI/WETH) on the Uniswap Rinkeby network to understand Uniswap better. I realized that it doesn't work well so I thought of deploying my contract on a forked ...
0
votes
0
answers
53
views
Uniswap V3 Oracle library: consult always crashes. Trying to get reliable oracle of Ethereum price in USDC
import "https://raw.githubusercontent.com/Uniswap/v3-periphery/main/contracts/libraries/OracleLibrary.sol";
function poolAddress() public view returns (address) {
return ...
0
votes
1
answer
32
views
0xAPI is failing to return best price for a token pair versus Sushiswap
We are using the 0xAPI to search price quotes on different exchanges for one of our native index tokens at Piedao (PLAY - 0x33e18a092a93ff21aD04746c7Da12e35D34DC7C4) vs. ETH.
The current quote for 1 ...
0
votes
0
answers
115
views
How to test out the flash loan arbitrage smart contract on BSC network?
I am in learning flash loan from PancakeSwap, I would like to know what is the better way to test out my flash loan arbitrage smart contract before deploying to BSC mainnet?
If I enter all real world ...
0
votes
2
answers
39
views
Why ERC-20 interface uses uint256 while Uniswap router uint?
ERC-20 token interface functions like balanceOf, allowance returns an uint256. While the functions of the Uniswap router interface take uint for the token amounts and returns uint[] in some cases.
My ...
1
vote
1
answer
66
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 ?
0
votes
0
answers
33
views
How do I write redistribution and reflection based tokens using Vyper?
I'm writing a redistribution of reflection based tokens using Vyper, I've added a _swapTokensForETH function to my code which acts to swap my coins for DAI via Uniswap, if I'm only doing transfer ...
0
votes
1
answer
32
views
ERC20 -> ERC20 Swapping liquidity pool
I want to write a system that will exchange any ERC20 for any other ERC20 registered in the system using Uniswap
I already wrote a contract for Ether swap in DAI and back with UniswapRouterV2
My ...
1
vote
2
answers
108
views
High Gas Flashbots Transaction
I'm trying to better understand flashbots impact on frontrunning. Can anyone help me understand why this sandwich attack tx from a Flashbots bundle would pay such a high gas price? Here is a similar ...