Pool API

Pool API description

MarginlyPool

factory

address factory

Returns address of Marginly factory

quoteToken

address quoteToken

Returns the address of quote token from pool

baseToken

address baseToken

Returns the address of base token from pool

uniswapPool

address uniswapPool

Returns the address of associated uniswap pool

mode

enum Mode mode

params

discountedQuoteCollateral

Sum of all quote token in collateral

discountedQuoteDebt

Sum of all quote token in debt

discountedBaseCollateral

Sum of all base token collateral

discountedBaseDebt

Sum of all base token in debt

lastReinitTimestampSeconds

Timestamp of last reinit execution

baseCollateralCoeff

Aggregate for base collateral time change calculations

baseDelevCoeff

Aggregate for deleveraged base collateral

baseDebtCoeff

Aggregate for base debt time change calculations

quoteCollateralCoeff

Aggregate for quote collateral time change calculations

quoteDelevCoeff

Aggregate for deleveraged quote collateral

quoteDebtCoeff

Accrued interest rate and fee for quote debt

initialPrice

Initial price. Used to sort key and shutdown calculations. Value gets reset for the latter one

emergencyWithdrawCoeff

Ratio of best side collaterals before and after margin call of opposite side in shutdown mode

Leverage

systemLeverage

positions

users positions

constructor

initializeMarginlyPool

Initializes Marginly pool

initialize

Initializes the pool

receive

lock

Protects against reentrancy

onlyFactoryOwner

setParameters

Sets the pool parameters. May only be called by the pool owner

getBasePrice

Get oracle price baseToken / quoteToken

getLiquidationPrice

Get TWAP price used in mc slippage calculations

shutDown

Switch to emergency mode when collateral of any side not enough to cover debt

Parameters

Name
Type
Description

swapCalldata

uint256

router calldata for splitting swap to reduce potential sandwich attacks impact

sweepETH

Sweep ETH balance of contract

getHeapPosition

Used by keeper service

execute

Parameters

Name
Type
Description

call

enum CallType

amount1

uint256

amount2

uint256

limitPriceX96

uint256

flag

bool

unwrapETH in case of withdraw calls or syncBalance in case of reinit call

receivePositionAddress

address

swapCalldata

uint256

getTimestamp

Last updated