Pair

The pair smart contract is abstract and inherited by lendgine. They are separated for readability.

Code

Pair.sol

Events

Mint

event Mint(uint256 amount0In, uint256 amount1In, uint256 liquidity);

Emitted when liquidity is minted in the pair.

Burn

event Burn(uint256 amount0Out, uint256 amount1Out, uint256 liquidity, address indexed to);

Emitted when liquidity is burned in the pair.

Swap

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

Emitted when a swap occurs in the pair.

Errors

InvariantError

Occurs when an account takes an action and the resulting pair balances don't satisfy the invariant.

InsufficientOutputError

Occurs when the output of an actions is 0.

Read-only functions

reserve0

Returns the balance of the token0 reserves held in the automated market maker.

reserve1

Returns the balance of the token1 reserves held in the automated market maker.

totalLiquidity

Returns the total amount of liquidity currently held in the automated market maker.

invariant

Implements the capped power invariant and returns true if the invariant is satisfied by the parameters.

State-changing functions

swap

Swaps tokens. Sends the amounts out to the to address. A callback is called and data is passed back.

mint

Mints liquidity. A calback is called and data is passed back.

burn

Burns liquidity.

Last updated