Bunicorn
Launch Testnet App
  • What is Bunicorn?
  • Introduction
    • AMM DEX
    • Liquidity Mining
    • NFT Collectibles
  • Getting Started
    • Wallets that Bunicorn supports
    • Get BEP20 Tokens
    • Connect your wallet
    • Bunicorn testnet 101
  • Bunicorn Exchange TUTORIAL
    • Tutorial for Trader
    • Tutorial for Liquidity Provider
      • Setup Proxy
      • Swap native BNB to WBNB to farm
      • How to Add Liquidity on Bunicorn
        • How to add liquidity to a Flexible pool?
        • How to add liquidity to a Stable Pool?
      • How to create a new Flexible pool?
        • How to Create a New Smart Pool
        • How to Create a New Shared Pool
      • How to Remove Liquidity
    • How to Join Token Play Farms
      • Stake LPs to Token Play Farm
      • Stake Single Asset $TOP
    • How to Join Ancient Buni NFT Farms
      • NFT Farm Ends. What should I do?
      • Stake LPs to Join the Ancient Buni Farm
      • Stake Single Asset
      • Harvest NFTs (Ancient Buni)
      • How to transfer Ancient BUNI NFTs to another address?
    • How to Join Bunicorn NFT Farms
      • Prestaking Farm Ends. What's next?
      • Stake LP to Join NFT Farms
      • Stake Single Asset
      • Harvest NFTs (Chest/Egg)
      • How to unlock ingame items from Chest/Egg NFTs
      • How to Transfer Egg/Chest NFTs to another address
    • Fee Structure
  • FAQ
    • What is a Flexible Pool?
    • What is a Stable Pool?
    • Can users create Stable pools themselves?
    • Are there any constraints for setting up a Bunicorn Flexible pool?
    • What are the advantages of a Stable Pool?
  • Glossary
  • SMART CONTRACTS
    • Flexible Pools
      • Exchange Proxy
      • Smart Order Router
      • On Chain Registry
      • Smart Pools
        • Overview
        • Configurable Rights Pool
        • Component Libraries
          • Rights Manager
      • Interfaces
      • Addresses
      • Events
      • API Index
    • Stable Pools
      • Pool Addresses
      • Swap Execution
      • Providing Liquidity
      • Flash Swaps
      • Contract Addresses
      • BuniCornRouter02
      • Pool
      • Pool (ERC-20)
      • Library
  • Subgraph API
    • Stable Pools
      • Entities
      • Sample queries
    • Flexible Pools
      • Entities
      • Sample queries
Powered by GitBook
On this page
  • Code
  • Address
  • Events
  • Mint
  • Burn
  • Swap
  • Sync
  • Read-Only Functions
  • MINIMUM_LIQUIDITY
  • factory
  • token0
  • token1
  • getReserves
  • kLast
  • State-Changing Functions
  • mint
  • burn
  • swap
  • skim
  • sync
  • Interface

Was this helpful?

  1. SMART CONTRACTS
  2. Stable Pools

Pool

PreviousBuniCornRouter02NextPool (ERC-20)

Last updated 3 years ago

Was this helpful?

This documentation covers Bunicorn-specific functionality. For ERC-20 functionality, see .

Code

Address

See .

Events

Mint

event Mint(address indexed sender, uint256 amount0, uint256 amount1);

Emitted each time liquidity tokens are created via mint.

Burn

event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to);

Emitted each time liquidity tokens are destroyed via burn.

Swap

event Swap(
  address indexed sender,
  uint256 amount0In,
  uint256 amount1In,
  uint256 amount0Out,
  uint256 amount1Out,
  address indexed to,
  uint256 feeInPrecision
);

Emitted each time a swap occurs via swap.

Sync

event Sync(uint256 vReserve0, uint256 vReserve1, uint256 reserve0, uint256 reserve1);

Emitted each time reserves are updated via mint, burn, swap, or sync.

Read-Only Functions

MINIMUM_LIQUIDITY

function MINIMUM_LIQUIDITY() external pure returns (uint);

Returns 1000 for all pairs.

factory

function factory() external view returns (address);

Returns the factory address.

token0

function token0() external view returns (address);

Returns the address of the pair token with the lower sort order.

token1

function token1() external view returns (address);

Returns the address of the pair token with the higher sort order.

getReserves

function getReserves() external view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast);

Returns the reserves of token0 and token1 used to price trades and distribute liquidity. Also returns the block.timestamp (mod 2**32) of the last block during which an interaction occured for the pair.

kLast

function kLast() external view returns (uint256);

Returns the product of the reserves as of the most recent liquidity event.

State-Changing Functions

mint

function mint(address to) external returns (uint256 liquidity);

Creates pool tokens, which are sent to the to address.

  • Emits Mint, Sync, Transfer.

burn

function burn(address to) external returns (uint amount0, uint amount1);

Destroys pool tokens.

  • Emits Burn, Sync, Transfer.

swap

function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata callbackData) external;

Swaps tokens.

  • Emits Swap, Sync.

skim

function skim(address to) external;

Gets actual token balances to match the reserve accounted balances reserve0 and reserve1.

sync

function sync() external;

Syncs virtual and actual reserve accounted balances with actual token balances.

  • Emits Sync.

Interface

pragma solidity 0.6.12;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import "./IBuniCornFactory.sol";

interface IBuniCornPool {
    function mint(address to) external returns (uint256 liquidity);

    function burn(address to) external returns (uint256 amount0, uint256 amount1);

    function swap(
        uint256 amount0Out,
        uint256 amount1Out,
        address to,
        bytes calldata data
    ) external;

    function sync() external;

    function getReserves() external view returns (uint112 reserve0, uint112 reserve1);

    function getTradeInfo()
        external
        view
        returns (
            uint112 _vReserve0,
            uint112 _vReserve1,
            uint112 reserve0,
            uint112 reserve1,
            uint256 feeInPrecision
        );

    function token0() external view returns (IERC20);

    function token1() external view returns (IERC20);

    function ampBps() external view returns (uint32);

    function factory() external view returns (IBuniCornFactory);

    function kLast() external view returns (uint256);
}
Pair (ERC-20)
BuniCornPool.sol
Pool Addresses