plutus-use-cases-1.2.0.0: Collection of smart contracts to develop the plutus/wallet interface
Safe HaskellNone
LanguageHaskell2010

Plutus.Contracts.Uniswap.Pool

Synopsis

Documentation

calculateInitialLiquidity :: Amount A -> Amount B -> Amount Liquidity Source #

The initial liquidity is 'ceil( sqrt(x*y) )' where x is the amount of 'Coin A' and y the amount of 'Coin B'. See Eq. 13 of the Uniswap v2 paper.

checkSwap :: Amount A -> Amount B -> Amount A -> Amount B -> Bool Source #

A swap is valid if the fee is computed correctly, and we're swapping some positive amount of A for B. See: https://uniswap.org/whitepaper.pdf Eq (11) (Page 7.)

lpTicker :: LiquidityPool -> TokenName Source #

Generate a unique token name for this particular pool; based on the tokens it exchanges. This should be such that looking for a pool exchanging any two tokens always yields a unique name.