๐Ÿ‘“ ViewDataProvider

Contract with public view methods for getting data about Futures, Markets and Users.

Functions

activateMarket

function activateMarket(MarketId id) external;

Activates a market. Can only be called by contract owner.


deactivateMarket

function deactivateMarket(MarketId id) external;

Deactivates a market. Can only be called by contract owner.


getContractProvider

function getContractProvider() external view returns (IContractProvider);

Getter function for the ContractProvider address

Output values:

  • ContractProvider address


getMarketRiskParameters

function getMarketRiskParameters(
    MarketId marketId
) external view returns (IMarketStorage.RiskParameters memory);

Retrieves the risk parameters for a specified market

Output values:


getMarketRewardParameters

function getMarketRewardParameters(
    MarketId marketId
) external view returns (IMarketStorage.RewardParameters memory);

Retrieves the reward parameters for a specified market

Output values:


getFuturePauseConfiguration

function getFuturePauseConfiguration(
    FutureId futureId
) external view returns (IFutureStorage.PauseConfiguration memory);

Retrieves the pause configuration for a specified future.

Output values:


getMarketPauseConfiguration

function getMarketPauseConfiguration(
    MarketId marketId
) external view returns (IMarketStorage.PauseConfiguration memory);

Retrieves the pause configuration for a specified market.

Output values:


getProtocolFee

function getProtocolFee(
    MarketId marketId
) external view returns (UD60x18);

Retrieves the protocol fee amount accrued to the market

Output values:

  • uint256 protocol fee amount


allActiveMarketAddresses

function allActiveMarketsAddresses(
    uint offset, 
    uint limit
) external view returns (address[] memory);

Retrieves the addresses of all active markets. Contains pagination parameters for not bursting gas limits.

Output values:

  • address[] array of market addresses


allActiveMarketIds

function allActiveMarketsIds(
    uint offset, 
    uint limit
) external view returns (MarketId[] memory);

Retrieves the IDs of all active markets. Contains pagination parameters for not bursting gas limits.

Output values:


marketInfo

function marketInfo(
    MarketId id, 
    OraclePackage[] calldata oraclePackages
) external view returns (MarketInfo memory);

Retrieves comprehensive information about a specific market.

Output values:


futureInfo

function futureInfo(
    FutureId id, 
    OraclePackage[] calldata oraclePackages
) external view returns (FutureInfo memory);

Retrieves comprehensive information about a specific future.

Output values:


activeMarketsInfo

function activeMarketsInfo(
    uint offset,
    uint limit,
    ViewFloatIndexLogic.MarketOraclePackages[] calldata marketsOraclePackages
) external view returns (MarketInfo[] memory);

Retrieves comprehensive information for a range of active markets.

Output values:


futureIdsCloseToMaturityWithoutIndex

function futureIdsCloseToMaturityWithoutIndex(
    MarketId marketId,
    uint maturityBufferSeconds
) external view returns (FutureId[] memory);

Retrieves list of future info objects that will mature within maturityBufferSeconds seconds but do not have an index.

Output values:


futureInfoCloseToMaturityWithoutIndex

function futuresInfoCloseToMaturityWithoutIndex(
    MarketId marketId,
    uint maturityBufferSeconds
) external view returns (FutureInfoWithoutIndex[] memory);

Retrieves list of futures data that will mature within maturityBufferSeconds seconds but do not have an index.

Output values:


marginRequirement

function marginRequirement(
    MarketId marketId,
    address participant,
    OraclePackage[] calldata oraclePackages
) external view returns (UD60x18);

Calculates the margin requirement for a market participant

Output values:

  • uint256 The amount of margin required by the participant in this market


withdrawableMargin

function withdrawableMargin(
    MarketId marketId,
    address participant,
    OraclePackage[] calldata oraclePackages
) external view returns (UD60x18);

Calculates the withdrawable margin for a market participant

Output values:

  • uint256 The amount of margin that is withdrawable by the participant.


totalPosition

function totalPosition(
    FutureId futureId,
    address participant,
    OraclePackage[] calldata oraclePackages
) external view returns (TotalPosition memory);

Retrieves the total position of a given participant in a specified future.

Output values:

  • TotalPosition Object detailing the participant's position in the specified future


marginDetails

function marginDetails(
    MarketId marketId,
    address participant,
    OraclePackage[] calldata oraclePackages
) external view returns (ViewDataProviderLogic.MarginState memory);

Retrieves the margin details of a given participant in a specified market.

Output values:


marketPortfolio

function marketPortfolio(
    MarketId marketId,
    address participant,
    OraclePackage[] calldata oraclePackages
) external view returns (MarketPortfolio memory);

Retrieves the market portfolio details of a given participant.

Output values:


portfolioMarketIds

function portfolioMarketIds(
    address participant, 
    uint offset, 
    uint limit
) external view returns (MarketId[] memory);

Retrieves the market ids associated with a participant's portfolio. This function filters out markets that are not relevant for the participant's portfolio.

Output values:


portfolio

function portfolio(
    address participant,
    uint offset,
    uint limit,
    ViewFloatIndexLogic.MarketOraclePackages[] calldata marketsOraclePackages
) external view returns (MarketPortfolio[] memory);

Retrieves the market ids associated with a participant's portfolio. This function filters out markets that are not relevant for the participant's portfolio.

Output values:

  • MarketPortfolio[] Array of objects detailing the participant's market positions


checkForUnsettledMaturedFutures

function checkForUnsettledMaturedFutures(
    MarketId marketId, 
    address participant
) external view returns (bool);

Checks if a participant has any unsettled futures that have reached maturity in a specified market

Output values:

  • bool True if any of the participant's futures in the specified market have reached maturity and are unsettled. False otherwise.


makerLiquidityDistribution

function makerLiquidityDistribution(
    FutureId futureId,
    address maker,
    uint offset,
    uint limit
) external view returns (SD59x18 currentFutureRate, IntervalLiquidity[] memory intervals);

Retrieves maker's liquidity distribution details of a given future over a specified interval. offset and limit params can be used for pagination.

Output values:

  • uint256 currentFutureRate - The current rate of the future

  • IntervalLiquidity[] intervals - Array of liquidity provisions


poolLiquidityDistribution

function poolLiquidityDistribution(
    FutureId futureId,
    OraclePackage[] calldata oraclePackages,
    uint offset,
    uint limit
) external view returns (
    ProvisionDistribution memory provisionDistribution,
    SD59x18 currentFutureRate,
    IntervalLiquidity[] memory intervals
);

Retrieves the liquidity distribution details of a given future over a specified interval. offset and limit params can be used for pagination.

Output values:

  • ProvisionDistribution The total liquidity provision associated with the future

  • uint256 currentFutureRate - The current rate of the future

  • IntervalLiquidity[] intervals - Array of liquidity provisions


Structs

Documentation on the structs defined in this contract

IMarketStorage.RiskParameters

Parameters for configuring risk on a market.

struct RiskParameters {
    UD2x18 minNotional;
    UD2x18 liquidationThresholdDelta;
    UD2x18 marginThresholdDelta;
    UD2x18 marginThresholdTolerance;
    UD2x18 maxRateImpactPerTrade;
    SD1x18 hedgeMarginFactor;
    uint32 marginRequirementSecondsFloor;
    uint32 liquidationMarginRequirementSecondsFloor;
    uint32 maturityLockoutSeconds;
}

IMarketStorage.RewardParameters

Parameters for configuring rewards and fees of a market.

struct RewardParameters {
    UD2x18 transferOwnershipReward;
    UD2x18 positionLiquidationReward;
    UD2x18 provisionCancellationReward;
    UD2x18 lpPriceImpactFeeFactor;
    UD2x18 lpNotionalFeeFactor;
    UD2x18 minLpFee;
    UD2x18 protocolPriceImpactFeeFactor;
    UD2x18 protocolNotionalFeeFactor;
    UD2x18 minProtocolFee;
}

IFutureStorage.PauseConfiguration

Struct containing the pause state of different operations on a future

struct PauseConfiguration {
    bool trade;
    bool liquidityProvision;
    bool liquidityRemoval;
    bool liquidation;
    bool positionsOwnershipTransfer;
}

IMarketStorage.PauseConfiguration

Struct containing the pause state of different operations on a market

struct PauseConfiguration {
    bool withdraw;
    bool deposit;
}

MarketInfo

Struct containing Market and its futures data

struct MarketInfo {
    MarketDescriptor descriptor;
    FutureInfo[] futures;
    UD60x18 openInterest;
    UD60x18 totalLiquidityNotional;
}

MarketDescriptor

Struct containing market and its underlying token data.

struct MarketDescriptor {
    MarketId id;
    string sourceName;
    string instrumentName;
    string tag;
    uint16 version;
    address underlying;
    string underlyingName;
    uint8 underlyingDecimals;
    bool underlyingIsWrappedNativeToken;
    IRateMath.MathType rateMathType;
}

FutureInfo

Struct containing future and VAMM data.

struct FutureInfo {
    FutureId id;
    MarketId marketId;
    uint64 termStart;
    uint64 termLength;
    VAMMParams vAMMParams;
    UD60x18 totalLiquidityNotional;
    UD60x18 openInterest;
}

VAMMParams

Struct defining VAMM settings

struct VAMMParams {
    SD59x18 lowerBoundRate;
    SD59x18 currentFutureRate;
    SD59x18 upperBoundRate;
    UD60x18 intervalLength;
    uint intervalsCount;
}

ViewFloatIndexLogic.MarketOraclePackages

Struct defining OraclePackages for multiple markets

struct MarketOraclePackages {
    MarketId marketId;
    OraclePackage[] packages;
}

FutureInfoWithoutIndex

Struct containing Future and VAMM data without open interest.

struct FutureInfoWithoutIndex {
    FutureId id;
    MarketId marketId;
    uint64 termStart;
    uint64 termLength;
    VAMMParams vAMMParams;
    UD60x18 totalLiquidityNotional;
}

TotalPosition

Struct detailing a user's position in a future

struct TotalPosition {
  FixedAndFloatTokensPair.Value openPositionTokensPair;
  SD59x18 openPositionNotional;
  SD59x18 openPositionFloatTradeValue;
  FixedAndFloatTokensPair.Value takerOpenPositionTokensPair;
  SD59x18 takerOpenPositionNotional;
  SD59x18 takerOpenPositionFloatTradeValue;
  FixedAndFloatTokensPair.Value makerOpenPositionTokensPair;
  SD59x18 makerOpenPositionNotional;
  SD59x18 makerOpenPositionFloatTradeValue;
  BoundedProvisionInfo[] makerProvisions;
  RateBounds[] provisionsBounds;
  ProvisionDistribution overallProvisionsNotional;
  UD60x18 accruedLPFee;
  UD60x18 incurredFee;
  SD59x18 fee;
}

BoundedProvisionInfo

struct BoundedProvisionInfo {
  FixedAndFloatTokensPair.Value tokensPair;
  UD60x18 accruedLPFee;
  SD59x18 floatTradeValue;
  SD59x18 positionNotional;
  ProvisionDistribution provisionNotional;
}

RateBounds

Struct to define the rate limits

struct RateBounds {
  SD59x18 lower;
  SD59x18 upper;
}


ViewDataProviderLogic.MarginState

Struct containing details on the margin of a user

struct MarginState {
    Margin.Value margin;
    UD60x18 initialMarginThreshold;
    UD60x18 liquidationMarginThreshold;
    UD60x18 lpMarginThreshold;
    UD60x18 dv01;
    RiskDirection.Value riskDirection;
}

MarketPortfolio

Struct detailing a user's market positions

struct MarketPortfolio {
    MarketDescriptor descriptor;
    ViewDataProviderLogic.MarginState marginState;
    FutureInfo[] futures;
    FutureOpenPosition[] futureOpenPositions;
    MakerFutureProvisions[] futureMakerProvisions;
}

FutureOpenPosition

Struct detailing a user's open future

struct FutureOpenPosition {
    FutureId futureId;
    FixedAndFloatTokensPair.Value tokensPair;
    UD60x18 notional;
    ProfitAndLoss.Value profitAndLoss;
    SD59x18 requiredMargin;
    UD60x18 dv01;
    RiskDirection.Value riskDirection;
}

MakerFuturePositions

struct MakerFutureProvisions {
    FutureId futureId;
    ProvisionInfo[] provisions;
}

ProvisionInfo

Struct containing data on a liquidity provision.

struct ProvisionInfo {
    RateBounds bounds;
    ProvisionDistribution notional;
    SD59x18 requiredMargin;
    UD60x18 payerDv01;
    UD60x18 receiverDv01;
}

IntervalLiquidity

Struct declaring a notional amount of a liquidity provision in specified bounds

struct IntervalLiquidity {
  RateBounds bounds;
  UD60x18 notional;
}

Enums

IRateMath.MathType

Indicates the type of rate

enum MathType {
    LINEAR,
    COMPOUNDING
}

Last updated