Lendgine

Inherits pair, jump rate, and immutable state.

Code

Pair.sol

Events

Mint

event Mint(address indexed sender, uint256 collateral, uint256 shares, uint256 liquidity, address indexed to);

Emitted when a power perpetual token (PPT) is minted.

Burn

event Burn(address indexed sender, uint256 collateral, uint256 shares, uint256 liquidity, address indexed to);

Emitted when a PPT is burned.

Deposit

event Deposit(address indexed sender, uint256 size, uint256 liquidity, address indexed to);

Emitted when liquidity is deposited.

Withdraw

Emitted when liquidity is withdrawn.

AccrueInterest

Emitted when interest is accrued.

AccruePositionInterest

Emitted when interested is accrued from a position.

Collect

Emitted when interest is collected from a liquidity position.

Errors

InputError

Occurs when invalid inputs are passed to any function.

CompleteUtilizationError

Occurs when liquidity is being withdraw either by a position being withdrawn or liquidity being borrowed but the liquidity is fully being borrowed.

InsufficientInputError

Occurs when not enough input is sent for how much output was specified.

InsufficientPositionError

Occurs when an accounts attempts to withdraw a larger position than they have.

Read-only functions

positions

Returns the makeup of a position.

totalPositionSize

Returns the total amount of liquidity positions minted multiplied by 1 ether.

totalLiquidityBorrowed

Returns the total amount of liquidity that is currently borrowed by PPT holders multiplied by 1 ether.

rewardPerPositionStored

Returns the current amount of interest that each liquidity position has earned since inception multiplied by 1 ether.

lastUpdate

Returns the last unix timestamp that the interest was accrued at.

convertLiquidityToShare

Converts amount of liquidity borrowed to shares of power perpetual tokens (PPT).

convertShareToLiquidity

Converts shares of PPTs to amount of liquidity borrowed.

convertCollateralToLiquidity

Converts collateral to liquidity.

convertLiquidityToCollateral

Converts liquidity to collateral.

State-changing functions

mint

Mints a PPT by providing token1 as collateral and borrowing a proportional amount of liquidity.

burn

Burns a power perpetual token (PPT) by minting the required liquidity and unlocking the collateral. The amount of PPT shares to be burned is specified by transferring that amount to this contract before calling it.

deposit

Provide liquidity to the underlying automated market maker.

withdraw

Withdraw liquidity from the underlying automated market maker.

accrueInterest

Accrues global interest by decreasing the total amount of liquidity owed by borrowers and rewarding lenders with the borrowers collateral.

accruePositionInterest

Accrues interest for the callers liquidity position.

collect

Collects the interest that has been gathered to the callers liquidity position.

Last updated