8
votes
Uniswap V2 Router, Factory on Sepolia Test Network
No, you cannot use it because
if we want to test our smart contract by deploying on Goerli then we use uniswap V2 Router address 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D but as we know Goerli faucet ...
8
votes
Accepted
Getting Uniswap v2 latest price and interpreting values using Python
Dev advocate at Chainstack here.
You can get prices directly from the Uniswap V2 pair contract, like you are attempting now, by analyzing the reserves of each token in the pair. The key to obtaining ...
3
votes
Uniswap V2 optimal arbitrage amount
Short answer
Plug these numbers in to calculate r, where
r = optimal amount in
x_a = reserve out of AMM A
y_a = reserve in of AMM A
x_b = reserve in of AMM B
y_b = reserve out of AMM B
f = fee (0.03%)...
3
votes
How can I get all tokens listed on `Sushiswap`
The SushiSwap subgraph provides a GraphQL API that you can query to get information about tokens, pairs, and other relevant data. You can find the SushiSwap subgraph URL on their official ...
3
votes
Accepted
How a price of a token is being calculated on uniswap & other dexes?
The price of anything is calculated against something else. Nothing has value by itself.
Remember the first time man traded a cow for a chicken. One gives a cow value in chickens. So the next time ...
3
votes
DEX Real-Time Data
You can use smart contract logs of emitted events to retrieve a stream of real-time logs emitted by the Uniswap smart contract.
You have two options:
Use the eth_newFilter method combined with ...
3
votes
What is the UniswapV2Factory address on the Sepolia network
Uniswap does not support sepolia for v2, so you won't be able to interact with it via uniswap frontend.
if you want to use Sepolia then you need to deploy uniswap on the Sepolia network and then use ...
2
votes
How a price of a token is being calculated on uniswap & other dexes?
The price is based on the balance of tokens in the pools reserves.
For "price" you can usually just divide one reserve by the other (v2 pools and many others).
To give a quote (real price ...
2
votes
Accepted
Help me make sense of this seeminlgly simple Uniswap V2 transaction, please
Ok so I think I figured it out, studying the token's source code, this is a common scheme to "cash out" taxes/fees charged on every token trade or transfer.
What are taxes/fees? Taxes/fees ...
2
votes
Getting Uniswap v2 latest price and interpreting values using Python
Here is an example how to get the last price on Uniswap v2 compatible DEXes using web3-ethereum-defi Python package.
The PairDetails class will do an automatic conversion of prices to human-readable, ...
2
votes
Accepted
How will liquidity be affected if I call ERC20 transfer() directly on a pair in Uniswap V2?
If you send X or Y, yes the pool will be changed:
Some one can call skim() to get the excess token amounts that don't align with reserve0 and reserve1
Some one can call sync() or perform a swap to ...
2
votes
What happens when we directly send tokens to Uniswap pair?
Uniswap V2 is using the reserve amounts for calculation, not token balances.
When you send the tokens directly to the pool's address, uniswap actually does not know you are doing this, because you are ...
2
votes
Accepted
How to know base token from the pool
Price in Uniswap pools is tracked in terms of token1/token0, so token1 is the numeraire token if that's what you're asking.
2
votes
Trouble making UniV2 swap on Sepolia with web3py
Because you use function swapETHForExactTokens, thus, you have to define "value" when build_transaction to send ETH with transaction. That why in the transaction hash you can see 0 at value ...
2
votes
Swapping continuouly failing. only one become success with swapExactTokenForTokens
"Error: nonce has already been used".
You need to update the nonce between each transaction.
Grab the nonce on the first occasion, and then increment the number when building the transaction ...
2
votes
Accepted
Execution Reverted due to UniswapV2-Pair creation in constructor
The UniswapV2Router02 address you're using is not available for the Sepolia testnet. Instead, the corresponding address for the Sepolia testnet is
0xC532a74256D3Db42D0Bf7a0400fEFDbad7694008.
...
1
vote
What happens when we directly send tokens to Uniswap pair?
Transferring tokens directly won't effect the price until you call either the sync or mint functions. That will update the reserves which will update the price.
That's ultimately how the token swaps ...
1
vote
How to know base token from the pool
There is no on-chain way to determine which token is a base token or which is a quote token if token0 and token1 are mapped to normal trading pairs.
The trading pair base-quote token order is a human-...
1
vote
"Error: Invalid Argument in getAmountsOut Function Call."
In your routerABI it seems that the type of routes is incorrect, it should be address.
const routerABI = [
"function getAmountsOut(uint amountIn, address[] memory routes) public view returns (...
1
vote
Accepted
UniswapV2's equivalent of getPair and other functions
Uniswap V3 factory has getPool function which takes two token addresses and the pool's fee (100, 500, 3000 or 10000) and returns address of the pool. Knowing the pool address you can get balances of ...
1
vote
Uniswap V2 Transfer Tax Math
Actually the formula in my question is correct. What I didn't realize is that a lot of contracts implement logic in transfer() whereby if the number of tokens (of itself) that the contract itself owns ...
1
vote
Help me make sense of this seeminlgly simple Uniswap V2 transaction, please
I can name a function jklh, then in that function I can put a call to make a swap on one pool, and then a call to make a swap on the other.
If I am a good bot designer I am likely not wasting gas on ...
1
vote
Help me make sense of this seeminlgly simple Uniswap V2 transaction, please
Answering your Question 2 Yes you are right the transaction happens twice i have also checked the transaction on Tenderly which debugs the transaction an d swap function has been triggered twice.
1
vote
Can someone tell me you to pass an array argument to external function in assembly/yul?
You have to encode it following the solidity ABI specification https://docs.soliditylang.org/en/v0.8.21/abi-spec.html.
path is array of variable length, you have to encode an offset within the ...
1
vote
DEX Real-Time Data
So I figured that the best way to get real-time data from uniswap v2 is to use WebSocket and subscribe to uniswap contract and read new data everytime new block is mined this is free and fast way of ...
1
vote
Finding IUniswapV2Callee in UniswapV2 clones for flashloans
Trident is not v2. Trident pools use the Bentobox contract to store liquidity. You can flashloan from Bentobox easily.
Here is an old example:
You call flashloan, Bento transfers you the token(s), ...
1
vote
Accepted
Abi encode / decode mystery additional 32 byte field Uniswap v2
"that guy" indicates where the data start, and it is hex 0x20 so data starts at byte 32. (it seems this appears only whenever there is any dynamic value)
word 1 is 0xa0, which is the offset ...
1
vote
Accepted
Combining getAmountsIn() and swapTokensForExactTokens() in UniswapV2Router: Can I Achieve Accurate Token Swap Without Slippage?
You can set slippage to zero by using the exact amount out at time of you calling.
But there is a good chance that on any active pool, a transaction mined before theirs will push price out of range.
...
1
vote
Accepted
Transaction fails on Etherscan but succeeds on Tenderly, why is that?
Goerli has been super unsteady un unreliable lately. Its gas prices have been through the roof.
Basically Goerli shouldn't be used anymore for testing dapps. Sepolia is the meant network for dapp ...
1
vote
How is Uniswap's way of calling the balanceOf function of an ERC20 gas optimized?
The "extcodesize check" is a check that decides whether the target address (token0 in this example) is a contract (non-zero code size) or a EOA (zero code size). Low level calls to EOA are ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
uniswapv2 × 92uniswap × 55
solidity × 32
uniswapv3 × 14
hardhat × 7
ethers.js × 6
liquidity × 6
erc-20 × 5
swaps × 5
flash-loans × 5
math × 5
arbitrage × 5
web3js × 4
tokens × 4
javascript × 4
web3.py × 4
pancakeswap × 4
decentralized-exchange × 4
sushiswap × 4
etherscan × 3
defi × 3
liquidity-provider × 3
sepolia × 3
go-ethereum × 2
blockchain × 2