V2 Fringe Finance Smart Contract Documentation
  • bToken
    • BErc20
    • BErc20Interface
    • BErc20Storage
    • BLendingToken
    • BToken
    • BTokenInterface
    • BTokenStorage
  • bondtroller
    • Bondtroller
    • BondtrollerV1Storage
    • BondtrollerV2Storage
    • BondtrollerV3Storage
    • BondtrollerV4Storage
    • BondtrollerV5Storage
  • interestRateModel
    • BaseJumpRateModelV2
    • InterestRateModel
    • JumpRateModelV3
  • interfaces
    • EIP20Interface
    • EIP20NonStandardInterface
    • IBErc20Token
    • IBLendingToken
    • IBPrimaryLendingPlatform
    • IComptroller
    • IPRJ
    • IPriceOracle
    • IPriceProviderAggregator
    • IPrimaryLendingPlatform
    • IPrimaryLendingPlatformLeverage
    • IPrimaryLendingPlatformLiquidation
    • ISimplePriceOracle
    • IUSDCTest
    • IWETH
    • IWstETH
  • mock
    • MockToken
    • MockWstETH
    • PRJ
    • WETH9
  • priceOracle
    • PriceOracle
    • PriceProviderAggregator
    • PriceProviderAggregatorPyth
    • priceproviders
      • ChainlinkPriceProvider
      • ChainlinkPriceProviderL2
      • ERC4626PriceProvider
      • LPPriceProvider
      • MutePriceProvider
      • PriceProvider
      • PythPriceProvider
      • UniswapV2PriceProvider
      • UniswapV2PriceProviderMock
      • UniswapV3PriceProvider
      • wstETHPriceProvider
      • wstETHPriceProviderL2
      • chainlink
        • AggregatorV3Interface
      • mute
        • IMuteSwitchPairDynamic
      • pyth
        • IPyth
        • PythStructs
      • uniswapV2
        • IUniswapV2Factory
        • IUniswapV2Pair
        • IUniswapV2Router02
        • SafeMath
        • UniswapV2Library
      • uniswapV3
        • v3-core
          • interfaces
            • IERC20Minimal
            • IUniswapV3Factory
            • IUniswapV3Pool
            • IUniswapV3PoolDeployer
            • pool
              • IUniswapV3PoolActions
              • IUniswapV3PoolDerivedState
              • IUniswapV3PoolEvents
              • IUniswapV3PoolImmutables
              • IUniswapV3PoolOwnerActions
              • IUniswapV3PoolState
          • libraries
            • TickMath
        • v3-periphery
          • libraries
            • OracleLibrary
  • primaryLendingPlatform
    • PrimaryLendingPlatformAtomicRepaymentCore
    • PrimaryLendingPlatformLeverageCore
    • PrimaryLendingPlatformLiquidationCore
    • PrimaryLendingPlatformModerator
    • PrimaryLendingPlatformProxyAdmin
    • PrimaryLendingPlatformV2Core
    • PrimaryLendingPlatformWrappedTokenGatewayCore
    • zksync
      • PrimaryLendingPlatformAtomicRepaymentZksync
      • PrimaryLendingPlatformLeverageZksync
      • PrimaryLendingPlatformLiquidationZksync
      • PrimaryLendingPlatformV2Zksync
      • PrimaryLendingPlatformWrappedTokenGatewayZksync
  • util
    • Asset
    • BondtrollerErrorReporter
    • CarefulMath
    • Errors
    • Exponential
    • ExponentialNoError
    • HomoraMath
    • TokenErrorReporter
  • paraswap
    • interfaces
      • IParaSwapAugustus
      • IParaSwapAugustusRegistry
Powered by GitBook
On this page
  • Overview
  • Functions info
  • liquidate (0xb44055fc)
  • liquidateFromModerator (0xc8359268)
  • getLiquidationAmountWithUpdatePrices (0x02dfa5d4)
  1. interfaces

IPrimaryLendingPlatformLiquidation

Overview

License: MIT

interface IPrimaryLendingPlatformLiquidation

Functions info

liquidate (0xb44055fc)

function liquidate(
    address _account,
    Asset.Info memory _prjInfo,
    Asset.Info memory _lendingInfo,
    uint256 _lendingTokenAmount,
    bytes32[] memory priceIds,
    bytes[] calldata updateData,
    bytes[] memory buyCalldata
)
    external
    payable
    returns (address[] memory assets, uint256[] memory assetAmounts)

The function to be called when a user wants to liquidate their position. Support liquidation with hot borrowing or not.

Parameters:

Name
Type
Description

_account

address

The address of the borrower

_prjInfo

struct Asset.Info

Information about the project token, including its address and type.

_lendingInfo

struct Asset.Info

Information about the lending token, including its address and type.

_lendingTokenAmount

uint256

The amount of lending tokens to be used for liquidation

priceIds

bytes32[]

An array of bytes32 price identifiers to update.

updateData

bytes[]

An array of bytes update data for the corresponding price identifiers.

buyCalldata

bytes[]

The calldata for buying the lending token from the exchange aggregator. If the calldata is empty, the liquidation will execute liquidation without hot borrowing.

liquidateFromModerator (0xc8359268)

function liquidateFromModerator(
    address _account,
    Asset.Info memory _prjInfo,
    Asset.Info memory _lendingInfo,
    uint256 _lendingTokenAmount,
    address liquidator,
    bytes32[] memory priceIds,
    bytes[] calldata updateData,
    bytes[] memory buyCalldata
)
    external
    payable
    returns (address[] memory assets, uint256[] memory assetAmounts)

The function to be called when a user wants to liquidate their position. Support liquidation with hot borrowing or not.

Parameters:

Name
Type
Description

_account

address

The address of the borrower

_prjInfo

struct Asset.Info

Information about the project token, including its address and type.

_lendingInfo

struct Asset.Info

Information about the lending token, including its address and type.

_lendingTokenAmount

uint256

The amount of lending tokens to be used for liquidation

liquidator

address

The address of the liquidator

priceIds

bytes32[]

An array of bytes32 price identifiers to update.

updateData

bytes[]

An array of bytes update data for the corresponding price identifiers.

buyCalldata

bytes[]

The calldata for buying the lending token from the exchange aggregator. If the calldata is empty, the liquidation will execute liquidation without hot borrowing.

getLiquidationAmountWithUpdatePrices (0x02dfa5d4)

function getLiquidationAmountWithUpdatePrices(
    address _account,
    address _projectToken,
    address _lendingToken,
    bytes32[] memory priceIds,
    bytes[] calldata updateData
) external payable returns (uint256 maxLA, uint256 minLA)

Returns the minimum and maximum liquidation amount for a given account, project token, and lending token after updating related token's prices.

Formula:

  • MinLA = min(MaxLA, MPA)

  • MaxLA = (LVR * CVc - THF * LVc) / (LRF * LVR - THF)

Parameters:

Name
Type
Description

_account

address

The account for which to calculate the liquidation amount.

_projectToken

address

The project token address.

_lendingToken

address

The lending token address.

priceIds

bytes32[]

An array of bytes32 price identifiers to update.

updateData

bytes[]

An array of bytes update data for the corresponding price identifiers.

Return values:

Name
Type
Description

maxLA

uint256

The maximum liquidation amount.

minLA

uint256

The minimum liquidation amount.

PreviousIPrimaryLendingPlatformLeverageNextISimplePriceOracle

Last updated 8 months ago