๐Ÿ’ฌ Quoter contract

Contract for getting estimates or quotes for trades or LP operations, as well as to check for unhealthy positions that are ready to be liquidated.

getContractProvider

function getContractProvider() external view returns (IContractProvider);

Returns ContractProvider contract


quoteTrade

function quoteTrade(
    FutureId futureId,
    UD60x18 notional,
    address participant,
    OraclePackage[] calldata oraclePackages
) external view returns (TradeQuote memory);

Provides estimations for a trade with notional amount in a particular future. The quote is returned for both risk directions simultaneously.

Input parameters:

Parameter Name
Type
Description

futureId

Target Future identifier.

notional

uint256

Notional amount of the assumed trade.

participant

address

The address whose state will be used to calculate the quote for.

oraclePackages

An array of packages containing the latest known index for the market. Packages are provided by an Oracle service on demand.

Output values:


quoteLiquidityProvision

function quoteLiquidityProvision(
    FutureId futureId,
    UD60x18 notional,
    address participant,
    LiquidityOperation operation,
    SD59x18 lowerBound,
    SD59x18 upperBound,
    OraclePackage[] calldata oraclePackages
) external view returns (LiquidityProvisionQuote memory);

Provides estimations for liquidity provision in specified Futures market and bounds.

Input parameters:

Parameter Name
Type
Description

futureId

Future identifier.

notional

uint256

The face value of the future trade.

participant

address

The address to calculate the quote for.

operation

Either Provide or Remove

lowerBound

int256

Defines the lower point of the rate range. Format: fixed point signed 18-decimal number.

upperBound

int256

Defines the upper point of the rate range. Format: fixed point signed 18-decimal number.

oraclePackages

An array of packages containing the latest known index for the market. Packages are provided by an Oracle service on demand.

Output values:


quotePositionsOwnershipTransfer

function quotePositionsOwnershipTransfer(
    MarketId marketId,
    address owner,
    address liquidator,
    OraclePackage[] memory oraclePackages
) external view returns (UD60x18 transferAmount, UD60x18 depositAmount);

Provides estimations for positions ownership transfer operation being carried out for owner in specified Market.

Ensure that owner's positions are liquidatable by calling Quoter.isLiquidatable using owner as a participant.

Input parameters:

Parameter Name
Type
Description

marketId

Target Market identifier.

owner

address

Target owner of positions.

liquidator

address

Receiver of positions from the owner

oraclePackages

An array of packages containing the latest known index for the market. Packages are provided by an Oracle service on demand.

Output values:

  • uint256 transferAmount โ€” amount of collateral to be transferred from owner's margin account to liquidator as a reward;

  • uint256 depositAmount โ€” additional amount of collateral that is required to deposit to liquidator's margin account.


isLiquidatable

function isLiquidatable(
    MarketId marketId,
    address participant,
    OraclePackage[] memory oraclePackages
) external view returns (bool);

Returns true if participant's margin for marketId is below Liquidation Threshold and his positions can be liquidated or transferred.

Input parameters:

Parameter Name
Type
Description

marketId

Target Market identifier.

participant

address

The address to check

oraclePackages

An array of packages containing the latest known index for the market. Packages are provided by an Oracle service on demand.

Output values:

  • bool true if participant can be liquidated.


isProvisionCancellable

function isProvisionCancellable(
    MarketId marketId,
    address maker,
    OraclePackage[] memory oraclePackages
) external view returns (bool);

Returns true if maker's positions in a given marketId should be cancelled due to his margin being below Initial Margin Requirement.

Input parameters:

Parameter Name
Type
Description

marketId

Target Market identifier.

maker

address

The address to check

oraclePackages

An array of packages containing the latest known index for the market. Packages are provided by an Oracle service on demand.

Output values:

  • bool true if maker is below his margin requirement

Structs

Documentation of structs mentioned in this page

TradeQuote

Struct with quote data for a trade

struct TradeQuote {
    bool insufficientLiquidityForPayer;
    bool exceededRateImpactLimitForPayer;
    bool insufficientLiquidityForReceiver;
    bool exceededRateImpactLimitForReceiver;
    OneDirectionTradeQuote payerQuote;
    OneDirectionTradeQuote receiverQuote;
    IViewDataProvider.MarketPortfolio marketPortfolio;
}
Property name
Property Type
Description

insufficientLiquidityForPayer

bool

True if there is not enough provided liquidity to place a trade with the Payer risk direction

exceededRateImpactLimitForPayer

bool

True if the market rate shift exceeds the limiting value for given trade with the Payer risk direction

insufficientLiquidityForReceiver

bool

True if there is not enough provided liquidity to place a trade with the Receiver risk direction

exceededRateImpactLimitForReceiver

bool

True if the market rate shift exceeds the limiting value for given trade with the Receiver risk direction

payerQuote

Quote details for a trade with Payer direction

receiverQuote

Quote details for a trade with Receiver direction

marketPortfolio

Contains portfolio details os user


OneDirectionTradeQuote

Details on a trade quote on a particular direction (payer or receiver)

struct OneDirectionTradeQuote {
  TradeInfo tradeInfo;
  UD60x18 totalFutureOpenPositionNotional;
  UD60x18 totalFutureOpenPositionDv01;
  Margin.Value newMargin;
  UD60x18 newMarginThreshold;
  UD60x18 tradeNotionalDv01;
}
  • TradeInfo struct containing trade details

  • totalFutureOpenPositionNotional Total notional available for trades in this direction

  • totalFutureOpenPositionDv01 Dollar duration for total notional available in this direction

  • newMargin Details on user's margin state after this trade

  • newMarginThreshold Updated user's margin threshold

  • tradeNotionalDv01 Dollar duration for the trade's notional

Property name
Property Type
Description

tradeInfo

Trade details

totalFutureOpenPositionNotional

uint256

Total notional available for trades in this direction

totalFutureOpenPositionDv01

uint256

Dollar duration for total notional available in this direction

newMargin

Details on user's margin after this trade

newMarginThreshold

uint256

Updated user's margin threshold

tradeNotionalDv01

uint256

Dolar duration for the trade's notional


LiquidityProvisionQuote

Details on a quote for a liquidity provision.

struct LiquidityProvisionQuote {
    ProvisionDistribution totalFutureProvisionNotional;
    UD60x18 totalFutureProvisionPayerDv01;
    UD60x18 totalFutureProvisionReceiverDv01;
    UD60x18 newMarginThreshold;
    ProvisionDistribution newProvisionDistribution;
    UD60x18 newProvisionNotionalDv01;
    IViewDataProvider.MarketPortfolio marketPortfolio;
}
Property name
Property Type
Description

totalFutureProvisionNotional

Resulting total of provided notional

totalFutureProvisionPayerDv01

uint256

Resulting DV01 towards the Payer side for the participant after provision

totalFutureProvisionReceiverDv01

uint256

Resulting DV01 towards the Receiver side for the participant after provision

newMarginThreshold

uint256

Resulting margin requirements

newProvisionDistribution

Resulting amounts of provision on Payer & Receiver sides as well as total

newProvisionNotionalDv01

uint256

Resulting overall DV01

marketPortfolio

Contains portfolio details of user


Enums

LiquidityOperation

enum LiquidityOperation {
  PROVIDE,
  REMOVE
}

Defines the 2 options of maker operations: provide and remove liquidity

Last updated