Skip to main content

IVault.sol

IVault

Interface for the Vault contract, responsible for managing positions and liquidity.

OnOpenPosition

event OnOpenPosition(address market, uint256 positionId, uint256 takerMargin, uint256 tradingFee, uint256 protocolFee)

Emitted when a position is opened.

  • Parameters:

    NameTypeDescription
    marketaddressThe address of the market.
    positionIduint256The ID of the opened position.
    takerMarginuint256The margin amount provided by the taker for the position.
    tradingFeeuint256The trading fee associated with the position.
    protocolFeeuint256The protocol fee associated with the position.

OnClaimPosition

event OnClaimPosition(address market, uint256 positionId, address recipient, uint256 takerMargin, uint256 settlementAmount)

Emitted when a position is claimed.

  • Parameters:

    NameTypeDescription
    marketaddressThe address of the market.
    positionIduint256The ID of the claimed position.
    recipientaddressThe address of the recipient of the settlement amount.
    takerMarginuint256The margin amount provided by the taker for the position.
    settlementAmountuint256The settlement amount received by the recipient.

OnAddLiquidity

event OnAddLiquidity(address market, uint256 amount)

Emitted when liquidity is added to the vault.

  • Parameters:

    NameTypeDescription
    marketaddressThe address of the market.
    amountuint256The amount of liquidity added.

OnSettlePendingLiquidity

event OnSettlePendingLiquidity(address market, uint256 pendingDeposit, uint256 pendingWithdrawal)

Emitted when pending liquidity is settled.

  • Parameters:

    NameTypeDescription
    marketaddressThe address of the market.
    pendingDeposituint256The amount of pending deposit being settled.
    pendingWithdrawaluint256The amount of pending withdrawal being settled.

OnWithdrawLiquidity

event OnWithdrawLiquidity(address market, uint256 amount, address recipient)

Emitted when liquidity is withdrawn from the vault.

  • Parameters:

    NameTypeDescription
    marketaddressThe address of the market.
    amountuint256The amount of liquidity withdrawn.
    recipientaddressThe address of the recipient of the withdrawn liquidity.

TransferKeeperFee

event TransferKeeperFee(uint256 fee, uint256 amount)

Emitted when the keeper fee is transferred.

  • Parameters:

    NameTypeDescription
    feeuint256The amount of the transferred keeper fee as native token.
    amountuint256The amount of settlement token to be used for paying keeper fee.

TransferKeeperFee

event TransferKeeperFee(address market, uint256 fee, uint256 amount)

Emitted when the keeper fee is transferred for a specific market.

  • Parameters:

    NameTypeDescription
    marketaddressThe address of the market.
    feeuint256The amount of the transferred keeper fee as native token.
    amountuint256The amount of settlement token to be used for paying keeper fee.

TransferProtocolFee

event TransferProtocolFee(address market, uint256 positionId, uint256 amount)

Emitted when the protocol fee is transferred for a specific position.

  • Parameters:

    NameTypeDescription
    marketaddressThe address of the market.
    positionIduint256The ID of the position.
    amountuint256The amount of the transferred fee.

onOpenPosition

function onOpenPosition(address settlementToken, uint256 positionId, uint256 takerMargin, uint256 tradingFee, uint256 protocolFee) external

Called when a position is opened by a market contract.

  • Parameters:

    NameTypeDescription
    settlementTokenaddressThe settlement token address.
    positionIduint256The ID of the opened position.
    takerMarginuint256The margin amount provided by the taker for the position.
    tradingFeeuint256The trading fee associated with the position.
    protocolFeeuint256The protocol fee associated with the position.

onClaimPosition

function onClaimPosition(address settlementToken, uint256 positionId, address recipient, uint256 takerMargin, uint256 settlementAmount) external

Called when a position is claimed by a market contract.

  • Parameters:

    NameTypeDescription
    settlementTokenaddressThe settlement token address.
    positionIduint256The ID of the claimed position.
    recipientaddressThe address that will receive the settlement amount.
    takerMarginuint256The margin amount provided by the taker for the position.
    settlementAmountuint256The amount to be settled for the position.

onAddLiquidity

function onAddLiquidity(address settlementToken, uint256 amount) external

Called when liquidity is added to the vault by a market contract.

  • Parameters:

    NameTypeDescription
    settlementTokenaddressThe settlement token address.
    amountuint256The amount of liquidity being added.

onSettlePendingLiquidity

function onSettlePendingLiquidity(address settlementToken, uint256 pendingDeposit, uint256 pendingWithdrawal) external

Called when pending liquidity is settled in the vault by a market contract.

  • Parameters:

    NameTypeDescription
    settlementTokenaddressThe settlement token address.
    pendingDeposituint256The amount of pending deposits being settled.
    pendingWithdrawaluint256The amount of pending withdrawals being settled.

onWithdrawLiquidity

function onWithdrawLiquidity(address settlementToken, address recipient, uint256 amount) external

Called when liquidity is withdrawn from the vault by a market contract.

  • Parameters:

    NameTypeDescription
    settlementTokenaddressThe settlement token address.
    recipientaddressThe address that will receive the withdrawn liquidity.
    amountuint256The amount of liquidity to be withdrawn.

transferKeeperFee

function transferKeeperFee(address settlementToken, address keeper, uint256 fee, uint256 margin) external returns (uint256 usedFee)

Transfers the keeper fee from the market to the specified keeper.

  • Parameters:

    NameTypeDescription
    settlementTokenaddressThe settlement token address.
    keeperaddressThe address of the keeper to receive the fee.
    feeuint256The amount of the fee to transfer as native token.
    marginuint256The margin amount used for the fee payment.
  • Return Values:

    NameTypeDescription
    usedFeeuint256The actual settlement token amount of fee used for the transfer.