Skip to main content
4 votes
Accepted

What is the quote function in UniswapV2Library used for?

Both functions return the price of asset in an Uniswap pool which has token composition as specified by the reserveA and reserveB (or reserveIn and reserveOut) arguments. The quote function returns ...
kfx's user avatar
  • 1,750
2 votes
Accepted

Uniswap WETH_WBTC price is orders of magnitude off when using constant product market maker formula

I was getting a similar issue when looking at USDC and WETH and using ethers.js . This is how I was originally converting my Big Numbers: const reserve0 = Number(ethers.utils.formatUnits(reserves[0], ...
klevin's user avatar
  • 36
2 votes
Accepted

Curve AMM - How is fee calculated when adding liquidity?

Posting answer from Twitter Simple derivation for the multiplier. We want 2 things: Zero fee when all assets are added/removed in proportion to their balances (maintain same price) Adding/removing ...
tsknakamura's user avatar
2 votes
Accepted

uniswap price for pair

You're mistaken, Uniswap v3 does not use the formula x*y=k for real amounts of assets. It's a concentrated liquidity AMM and uses a concentrated liquidity formula. Read Uniswap v3 whitepaper. ...
kfx's user avatar
  • 1,750
1 vote
Accepted

Does the sqrtPricex96 on the Uniswap V3 swap-event represent the average price paid by the swapper, or the new price of the pool after swap?

sqrtPricesX96 for a evetn swaap is the price of the pool after swap Here a screenshot from uniswap doc: See docs from Uniswap https://docs.uniswap.org/contracts/v3/reference/core/interfaces/pool/...
Shigami's user avatar
  • 26
1 vote
Accepted

how to make a contract compatible with different ERC-20 Decimals

Look at how other contracts that deal with ERC20s do it, but you just have to call decimals() on that specific token and do all your calculations taking it into account, or ignore them altogether. ...
Foxxxey's user avatar
  • 4,457
1 vote
Accepted

Can someone explain Uniswap's v2 getAmountIn?

You can take a look at this calculation for the version of the contract: what is math for uniswap calculates the amountout and amountin why 997 and 1000 In addition, the contract's version also added +...
Yongjian P.'s user avatar
  • 4,308
1 vote

UniSwap v2 Subgraph return 0 for Volume in USD and ETH

Hopefully it will help someone who is looking for the answear. I've been facing the same issue and spent a couple of days figuring out the reason. So the issue is the addresses you provide all over ...
Oleg Kalenik's user avatar
1 vote

Swap exact ETH for min tokens not accurate?

If you're swapping tokens with hard coded tax inside on their smart contract (in your case 10%). The "minimum token" appearing on the website is wrong, because it is based on normal token ...
Lonewarp's user avatar
  • 151
1 vote

PancakeSwap charges a fee to mint LP according to their code?

I was able to get an answer on Telegram from PancakeSwap.
Axium7's user avatar
  • 139
1 vote

Is there a way to find out how much I earned in fees from just the UniswapPair V2 contract?

Assuming you are asking about Uniswap V3 - You can call positions: function positions(bytes32 key) external view returns ( uint128 _liquidity, ...
Connor Martin's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible