Skip to content
You are reading the development version documentation and some displayed features may not be available in the stable release. You can switch to stable version using the version box at screen bottom.
Last update: September 30, 2021

ConstantProductPool

Trident exchange pool template with constant product formula for swapping between an ERC-20 token pair.

The reserves are stored as bento shares. The curve is applied to shares as well. This pool does not care about the underlying amounts.

Functions

constructor

  function constructor(
  ) public

mint

  function mint(
  ) public returns (uint256 liquidity)

Mints LP tokens - should be called via the router after transferring bento tokens. The router must ensure that sufficient LP tokens are minted by using the return value.

burn

  function burn(
  ) public returns (struct IPool.TokenAmount[] withdrawnAmounts)

Burns LP tokens sent to this contract. The router must ensure that the user gets sufficient output tokens.

burnSingle

  function burnSingle(
  ) public returns (uint256 amountOut)

Burns LP tokens sent to this contract and swaps one of the output tokens for another

  • i.e., the user gets a single token out by burning LP tokens.

swap

  function swap(
  ) public returns (uint256 amountOut)

Swaps one token for another. The router must prefund this contract and ensure there isn’t too much slippage.

flashSwap

  function flashSwap(
  ) public returns (uint256 amountOut)

Swaps one token for another. The router must support swap callbacks and ensure there isn’t too much slippage.

updateBarFee

  function updateBarFee(
  ) public

Updates barFee for Trident protocol.

_getReserves

  function _getReserves(
  ) internal returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)

_balance

  function _balance(
  ) internal returns (uint256 balance0, uint256 balance1)

_update

  function _update(
  ) internal

_mintFee

  function _mintFee(
  ) internal returns (uint256 _totalSupply, uint256 computed)

_getAmountOut

  function _getAmountOut(
  ) internal returns (uint256 amountOut)

_transfer

  function _transfer(
  ) internal

_nonOptimalMintFee

  function _nonOptimalMintFee(
  ) internal returns (uint256 token0Fee, uint256 token1Fee)

This fee is charged to cover for swapFee when users add unbalanced liquidity.

getAssets

  function getAssets(
  ) public returns (address[] assets)

getAmountOut

  function getAmountOut(
  ) public returns (uint256 finalAmountOut)

getReserves

  function getReserves(
  ) public returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)

Events

Mint

  event Mint(
  )

Burn

  event Burn(
  )

Sync

  event Sync(
  )
Questions or feedback? You can discuss issues and obtain free support on Trident chat channel.
For SushiSwap community support, join the Discord Server None