PowerMaker
  • PowerMaker Document Hub
  • Disclaimer
  • Resources
  • Quick Start
    • FAQ
    • Providing Liquidity
    • Tutorial: Perform a Trade
    • Tutorial: Providing Liquidity
    • Tutorial: Create a Market
  • Concepts
    • Power Perpetuals
      • PPT - Power Perpetual Token
    • Example Use Cases
      • Hedging Uniswap V3
  • Protocol
    • Overview
    • Capped Power Invariant
    • Understanding Returns
    • Security
    • Protocol Participants
    • Smart Contracts
      • Factory
      • Pair
      • ImmutableState
      • JumpRate
      • Lendgine
      • LendgineRouter
      • LiquidityManager
    • Deployed Contracts
  • Discord
  • Twitter
  • Github
Powered by GitBook
On this page
  • Code
  • Events
  • AddLiquidity
  • RemoveLiquidity
  • Collect
  • Errors
  • LivelinessError
  • AmountError
  • ValidationError
  • CollectError
  • Read-only functions
  • factory
  • weth
  • positions
  • State-changing functions
  • addLiquidity
  • removeLiquidity
  • collect
  1. Protocol
  2. Smart Contracts

LiquidityManager

PreviousLendgineRouterNextDeployed Contracts

Last updated 2 years ago

Code

Events

AddLiquidity

event AddLiquidity(
  address indexed from,
  address indexed lendgine,
  uint256 liquidity,
  uint256 size,
  uint256 amount0,
  uint256 amount1,
  address indexed to
);

Emitted when liquidity is added to a lendgine using this position manager.

RemoveLiquidity

event RemoveLiquidity(
  address indexed from,
  address indexed lendgine,
  uint256 liquidity,
  uint256 size,
  uint256 amount0,
  uint256 amount1,
  address indexed to
);

Emitted when liquidity is removed from a lendgine using this position manager.

Collect

event Collect(address indexed from, address indexed lendgine, uint256 amount, address indexed to);

Emitted when interest is collect from a position.

Errors

LivelinessError

error LivelinessError();

Occurs when a transaction is processed later than the deadline specified.

AmountError

error AmountError();

Occurs when output amounts aren't sufficient according to the specified minimums.

ValidationError

error ValidationError();

Occurs when a callback invocation is not valid because it is not called by a lendgine deployed by the PMMP factory.

CollectError

error CollectError();

Occurs when the amount of interest collect from the lendgine is not equal to the amount specified.

Read-only functions

factory

function factory() external view returns (address);

Returns the address of the PMMP factory this router is connected to.

weth

function weth() external view returns (address);

Returns the address of the Wrapped Ether contract.

positions

function positions(address owner, address lendgine) external view returns (uint256 size, uint256 rewardPerPositionPaid, uint256 tokensOwed);

Returns the makeup of a position.

State-changing functions

addLiquidity

function addLiquidity(AddLiquidityParams calldata params) external payable;

Adds liquidity to a lendgine with safety checks and records the position.

removeLiquidity

function removeLiquidity(RemoveLiquidityParams calldata params) external payable;

Removes liquidity from a lendgine with safety checks and updates the position.

collect

function collect(CollectParams calldata params) external payable returns (uint256 amount); 

Collects interest from a position with safety checks and accrues interest before collecting.

LiquidityManager.sol