Pool
This documentation covers Bunicorn-specific functionality. For ERC-20 functionality, see Pair (ERC-20).

Code

Address

Events

Mint

1
event Mint(address indexed sender, uint256 amount0, uint256 amount1);
Copied!
Emitted each time liquidity tokens are created via mint.

Burn

1
event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to);
Copied!
Emitted each time liquidity tokens are destroyed via burn.

Swap

1
event Swap(
2
address indexed sender,
3
uint256 amount0In,
4
uint256 amount1In,
5
uint256 amount0Out,
6
uint256 amount1Out,
7
address indexed to,
8
uint256 feeInPrecision
9
);
Copied!
Emitted each time a swap occurs via swap.

Sync

1
event Sync(uint256 vReserve0, uint256 vReserve1, uint256 reserve0, uint256 reserve1);
Copied!
Emitted each time reserves are updated via mint, burn, swap, or sync.

Read-Only Functions

MINIMUM_LIQUIDITY

1
function MINIMUM_LIQUIDITY() external pure returns (uint);
Copied!
Returns 1000 for all pairs.

factory

1
function factory() external view returns (address);
Copied!
Returns the factory address.

token0

1
function token0() external view returns (address);
Copied!
Returns the address of the pair token with the lower sort order.

token1

1
function token1() external view returns (address);
Copied!
Returns the address of the pair token with the higher sort order.

getReserves

1
function getReserves() external view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast);
Copied!
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

1
function kLast() external view returns (uint256);
Copied!
Returns the product of the reserves as of the most recent liquidity event.

State-Changing Functions

mint

1
function mint(address to) external returns (uint256 liquidity);
Copied!
Creates pool tokens, which are sent to the to address.
    Emits Mint, Sync, Transfer.

burn

1
function burn(address to) external returns (uint amount0, uint amount1);
Copied!
Destroys pool tokens.
    Emits Burn, Sync, Transfer.

swap

1
function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata callbackData) external;
Copied!
Swaps tokens.
    Emits Swap, Sync.

skim

1
function skim(address to) external;
Copied!
Gets actual token balances to match the reserve accounted balances reserve0 and reserve1.

sync

1
function sync() external;
Copied!
Syncs virtual and actual reserve accounted balances with actual token balances.
    Emits Sync.

Interface

1
pragma solidity 0.6.12;
2
3
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
4
5
import "./IBuniCornFactory.sol";
6
7
interface IBuniCornPool {
8
function mint(address to) external returns (uint256 liquidity);
9
10
function burn(address to) external returns (uint256 amount0, uint256 amount1);
11
12
function swap(
13
uint256 amount0Out,
14
uint256 amount1Out,
15
address to,
16
bytes calldata data
17
) external;
18
19
function sync() external;
20
21
function getReserves() external view returns (uint112 reserve0, uint112 reserve1);
22
23
function getTradeInfo()
24
external
25
view
26
returns (
27
uint112 _vReserve0,
28
uint112 _vReserve1,
29
uint112 reserve0,
30
uint112 reserve1,
31
uint256 feeInPrecision
32
);
33
34
function token0() external view returns (IERC20);
35
36
function token1() external view returns (IERC20);
37
38
function ampBps() external view returns (uint32);
39
40
function factory() external view returns (IBuniCornFactory);
41
42
function kLast() external view returns (uint256);
43
}
Copied!
Last modified 3mo ago