How it works
  • SHORT INSIGHT
  • How UtyabSwap dex works!
    • swapping
    • fees
    • slippage & price impact
    • button
    • price chart
  • HOW TO CREATE A LIQUIDITY POOL
    • create a liquidity pool
    • deposit liquidity
  • dev
    • token verify
    • automated market maker
    • contracts/wallets
    • logos
  • SDK
    • getting started
    • how to swap
    • how to add liquidity
    • how to withdraw Liquidity
  • STAKING
    • liquidity staking
    • jetton staking
  • REFERRAL EARNINGS
    • referral
    • create a referral link
  • UTYAB
    • burn
  • SOCIALS & CONTACT
  • TERMS/POLICY
    • privacy policy
    • terms
Powered by GitBook
On this page
  1. dev

automated market maker

The getAmountOut function is a fundamental component of an Automated Market Maker (AMM), used to calculate the output amount of a token swap based on the input amount and the liquidity pool reserves. It leverages the constant product formula to ensure that swaps maintain the balance of reserves within the pool, enabling seamless and fast token exchanges.

fun getAmountOut(amountIn: int, reserveIn: int, reserveOut: int): int {
    return (amountIn * reserveOut) / (reserveIn + amountIn);
}

Previoustoken verifyNextcontracts/wallets

Last updated 5 months ago