Skip to main content

Questions tagged [amm]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
40 views

How to compare liquidity between different DEX pools?

I'm interested in comparing how liquid DEX pools are, for example in order to find the pool that would have the least price impact when swapping from ETH to stablecoins. Looking at the token balances ...
kfx's user avatar
  • 1,630
3 votes
0 answers
28 views

How does Uniswap v3-core derive the look up table used in TickMath?

Background In TickMath.sol of v3-core codebase, getSqrtRatioAtTick(int24 tick) implements \sqrt{1.0001}^n with binary fixed point arithmetics in Q128 and down casts to Q96. With a lookup table of Q128 ...
scad's user avatar
  • 31
0 votes
0 answers
18 views

Does removing liquidity from a staked pancakeswap lp unstake it?

If I remove all the liquidity from a PancakeSwap V3 LP, I know it also collect the fees earned. But if that LP is staked in a farm, will removing the liquidity automatically unstake it and harvest the ...
sharip's user avatar
  • 1
1 vote
0 answers
56 views

How is the derivation of the Constant Product AMM formula of Uniswap?

I was researching about Uniswap v1 and I found that the code is using the following formula to get the amount out of a swap: Formula: Reference to code Everyone says that this formula is derived of ...
santipu_'s user avatar
1 vote
0 answers
49 views

How to setup routing in pancakeswap

Pancake V2 has this smart order routing(SOR) feature. I was wondering how to build this efficiently, so that I can do permutation and combinations on existing pairs and get their reserves, and thereby ...
Manav Notnani's user avatar
1 vote
1 answer
581 views

What is the quote function in UniswapV2Library used for?

What is the purpose of the quote function and how does it differ from getAmountOut?
Jolow's user avatar
  • 33
0 votes
1 answer
647 views

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?

sqrtPricex96 on a Uniswap V3 swap-event can be used to calculate the token1/token0 price. I'm not asking how to do this conversion. Instead I'm asking which token1/token0 price does this represent? ...
Geert-Jan's user avatar
  • 169
0 votes
2 answers
457 views

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

I'm making a tutorial about how to create an AMM ( Automated Market Maker ), but I have a problem with the decimals. Both tokens have different decimals, and when I want to transfer them, the ...
George Lopez's user avatar
0 votes
1 answer
995 views

Can someone explain Uniswap's v2 getAmountIn?

Code can be seen here: https://github.com/Uniswap/v2-periphery/blob/master/contracts/libraries/UniswapV2Library.sol#L53 What I don't understand is that if you use the constant product formula, you ...
U Avalos's user avatar
  • 113
0 votes
1 answer
109 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
1 answer
564 views

UniSwap v2 Subgraph return 0 for Volume in USD and ETH

I've forked Uniswap v2 contracts including WETH, and Deployed on Rinkeby. the functionality of Creating Pools, adding and removing liquidity works fine. Now to get the stats like TVL, Volume, 24hr ...
Muhammad Taqi's user avatar
0 votes
1 answer
87 views

Liquidity pool price and oracle price

I am trying to wrap my head around. I understand the concept of x*y=k vol. when we are calculating this we can get the price but there’s also an exchange price, say eth. That means the pool will have ...
hammies's user avatar
  • 105
2 votes
2 answers
378 views

Curve AMM - How is fee calculated when adding liquidity?

When adding liquidity to Curve AMM, fees are calculated by the following code _fee: uint256 = self.fee * N_COINS / (4 * (N_COINS - 1)) https://github.com/curvefi/curve-contract/blob/...
tsknakamura's user avatar
1 vote
2 answers
208 views

How would I create my own amm or exchange?

Good afternoon, I have a goal of making my own amm website similar to pancake swap or uniswap and I don't have great first place to start to break ground on actually developing, I have a some what of ...
Magnio's user avatar
  • 11
1 vote
1 answer
410 views

uniswap price for pair

If I go to https://app.uniswap.org/#/add/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2/3000?chain=mainnet I can see liquidity details for USDC-DAI It looks like ...
user1995187's user avatar
1 vote
0 answers
203 views

How to calculate annual percentage yield on an AMM?

A related question has been asked here but a satisfactory answer has not been provided. I understand that APY for x*y=k AMMs is a function of average volume(V), liquidity provided by LP(l), fee(f) and ...
MShakeG's user avatar
  • 1,723
0 votes
1 answer
259 views

How can I get all the holders of an LP token for a date range

Is there any api/contract call sample etc that can help me get a list of everyone who holds an LP token within a particular date range? I. E people who held it thro and never transferred it or sold it ...
Layinka's user avatar
  • 111
1 vote
0 answers
280 views

Looking for a price impact calculator

Looking for a calculator to work out price impact based on differing variables. Token start price Liquidity Total supply of tokens Buy amount Usd pair Cheers 🍻
Michael Kearney's user avatar
0 votes
2 answers
3k views

Swap exact ETH for min tokens not accurate?

Just swapped some tokens on an AMM. AMM said minimum I will receive was around 282 tokens, I really recevied around 254 tokens. I had slippage at 12% as the token I was trading takes 10% reflections. ...
May 's user avatar
  • 1
1 vote
1 answer
569 views

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

I am looking at the PancakeSwap contract for LP's and I noticed they charge a fee for creating LP's. No where in their documentation does it say there is a fee for depositing liquidity. What is ...
Picard78's user avatar
  • 139
1 vote
0 answers
148 views

Are all of these Dexes just frontend interface to coin swapping contracts? Uniswap, 1inch, balance defi-swap, shibaswap, etc

I'm still wrapping my head around all these swapping services like Uniswap, sushiswap, etc... Uniswap Sushiswap 1 Inch Balancer Defiswap Shibaswap Are all those above just front end interface to ...
Patoshi パトシ's user avatar
4 votes
0 answers
1k views

Uniswap V2 AmountIn Calculation Procedure

So, I was working on a project which heavily uses uniswap. I have to show the calculations and derivations of stuff that is happening inside uniswap. So, I was reading it's whitepaper, seeing it ...
Hokkyokusei's user avatar
0 votes
1 answer
417 views

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

Let's say I add liquidity to the ETH-USDT pool, then I remove liquidity some time later. In between that time, trades have happened and people have added and removed liquidity too. I only have what's ...
doctopus's user avatar
  • 315
1 vote
0 answers
719 views

Is the Uniswap v2 0.3% trading fee calculated wrong?

I am digging into the details of how the token swapping fee is calculated and I cannot get a formula that reproduces the expected 0.3% fee. Let's say there's a USDT-ETH pool with: 1000 USDT 10 ETH k =...
doctopus's user avatar
  • 315
2 votes
2 answers
547 views

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

I am trying to calculate the value of an exchange on Uniswap using Web3js and methods from the Uniswap smart contract. This is the Uniswap contract address for the WETH (Wrapped Ether) : WBTC (Wrapped ...
MikeG's user avatar
  • 123