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
struct MarginlyParams params
discountedQuoteCollateral
uint256 discountedQuoteCollateral
Sum of all quote token in collateral
discountedQuoteDebt
uint256 discountedQuoteDebt
Sum of all quote token in debt
discountedBaseCollateral
uint256 discountedBaseCollateral
Sum of all base token collateral
discountedBaseDebt
uint256 discountedBaseDebt
Sum of all base token in debt
lastReinitTimestampSeconds
uint256 lastReinitTimestampSeconds
Timestamp of last reinit execution
baseCollateralCoeff
struct FP96.FixedPoint baseCollateralCoeff
Aggregate for base collateral time change calculations
baseDelevCoeff
struct FP96.FixedPoint baseDelevCoeff
Aggregate for deleveraged base collateral
baseDebtCoeff
struct FP96.FixedPoint baseDebtCoeff
Aggregate for base debt time change calculations
quoteCollateralCoeff
struct FP96.FixedPoint quoteCollateralCoeff
Aggregate for quote collateral time change calculations
quoteDelevCoeff
struct FP96.FixedPoint quoteDelevCoeff
Aggregate for deleveraged quote collateral
quoteDebtCoeff
struct FP96.FixedPoint quoteDebtCoeff
Accrued interest rate and fee for quote debt
initialPrice
struct FP96.FixedPoint initialPrice
Initial price. Used to sort key and shutdown calculations. Value gets reset for the latter one
emergencyWithdrawCoeff
struct FP96.FixedPoint emergencyWithdrawCoeff
Ratio of best side collaterals before and after margin call of opposite side in shutdown mode
Leverage
struct Leverage {
uint128 shortX96;
uint128 longX96;
}
systemLeverage
struct MarginlyPool.Leverage systemLeverage
positions
mapping(address => struct Position) positions
users positions
constructor
constructor() public
initializeMarginlyPool
function _initializeMarginlyPool(address _quoteToken, address _baseToken, bool _quoteTokenIsToken0, address _uniswapPool, struct MarginlyParams _params) internal
Initializes Marginly pool
initialize
function initialize(address _quoteToken, address _baseToken, bool _quoteTokenIsToken0, address _uniswapPool, struct MarginlyParams _params) external virtual
Initializes the pool
receive
receive() external payable
lock
modifier lock()
Protects against reentrancy
onlyFactoryOwner
modifier onlyFactoryOwner()
setParameters
function setParameters(struct MarginlyParams _params) external
Sets the pool parameters. May only be called by the pool owner
getBasePrice
function getBasePrice() public view returns (struct FP96.FixedPoint)
Get oracle price baseToken / quoteToken
getLiquidationPrice
function getLiquidationPrice() public view returns (struct FP96.FixedPoint)
Get TWAP price used in mc slippage calculations
shutDown
function shutDown(uint256 swapCalldata) external
Switch to emergency mode when collateral of any side not enough to cover debt
Parameters
swapCalldata
uint256
router calldata for splitting swap to reduce potential sandwich attacks impact
sweepETH
function sweepETH() external
Sweep ETH balance of contract
getHeapPosition
function getHeapPosition(uint32 index, bool _short) external view returns (bool success, struct MaxBinaryHeapLib.Node)
Used by keeper service
execute
function execute(enum CallType call, uint256 amount1, uint256 amount2, uint256 limitPriceX96, bool flag, address receivePositionAddress, uint256 swapCalldata) external payable
Parameters
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
function getTimestamp() internal view virtual returns (uint256)
Last updated