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
  • LendgineCreated
  • Errors
  • SameTokenError
  • ZeroAddressError
  • DeployedError
  • ScaleError
  • Read-only functions
  • getLendgine
  • parameters
  • State-changing functions
  • createLendgine
  1. Protocol
  2. Smart Contracts

Factory

PreviousSmart ContractsNextPair

Last updated 2 years ago

Code

Events

LendgineCreated

  event LendgineCreated(
    address indexed token0,
    address indexed token1,
    uint256 token0Exp,
    uint256 token1Exp,
    uint256 indexed upperBound,
    address lendgine
  );

Emitted each time a new lendgine is created.

Errors

SameTokenError

error SameTokenError();

Emitted an account attempts to create a lendgine with two of the same tokens.

ZeroAddressError

error ZeroAddressError();

Emitted when an account attempts to create a lendgine with one of the token's addresses being 0.

DeployedError

error DeployedError();

Emitted when an account attempts to create a lendgine but that exact lendgine is already created.

ScaleError

error ScaleError();

Emitted when an account attempts to create a lendgine with a token scale that is invalid.

Read-only functions

getLendgine

  function getLendgine(
    address token0,
    address token1,
    uint256 token0Exp,
    uint256 token1Exp,
    uint256 upperBound
  )
    external
    view
    returns (address lendgine);

Returns the lendgine address for a given pair of tokens and upper bound. Returns 0 if the lendgine doesn't exist.

parameters

  function parameters()
    external
    view
    returns (address token0, address token1, uint128 token0Exp, uint128 token1Exp, uint256 upperBound);

Parameters used during lendgine creation, set transiently for on-chain computable create2 addresses.

State-changing functions

createLendgine

  function createLendgine(
    address token0,
    address token1,
    uint8 token0Exp,
    uint8 token1Exp,
    uint256 upperBound
  )
    external
    returns (address);

Deploys a lendgine with the supplied parameters. Transiently sets the parameters slots and clears them after creation.

Factory.sol