๐ ViewDataProvider
Contract with public view methods for getting data about Futures, Markets and Users.
Functions
activateMarket
Activates a market. Can only be called by contract owner.
Parameter Name | Type | Description |
---|---|---|
id | Market identifier. |
deactivateMarket
Deactivates a market. Can only be called by contract owner.
Parameter Name | Type | Description |
---|---|---|
id | Market identifier. |
getContractProvider
Getter function for the ContractProvider address
Output values:
ContractProvider address
getMarketRiskParameters
Retrieves the risk parameters for a specified market
Parameter Name | Type | Description |
---|---|---|
id | Market identifier. |
Output values:
getMarketRewardParameters
Retrieves the reward parameters for a specified market
Parameter Name | Type | Description |
---|---|---|
id | Market identifier. |
Output values:
getFuturePauseConfiguration
Retrieves the pause configuration for a specified future.
Parameter Name | Type | Description |
---|---|---|
futureId | Future identifier |
Output values:
getMarketPauseConfiguration
Retrieves the pause configuration for a specified market.
Parameter Name | Type | Description |
---|---|---|
marketId | Market identifier |
Output values:
getProtocolFee
Retrieves the protocol fee amount accrued to the market
Parameter Name | Type | Description |
---|---|---|
marketId | Market identifier |
Output values:
uint256
protocol fee amount
allActiveMarketAddresses
Retrieves the addresses of all active markets. Contains pagination parameters for not bursting gas limits.
Parameter Name | Type | Description |
---|---|---|
offset |
| Number of items to skip |
limit |
| Number of items to return |
Output values:
address[]
array of market addresses
allActiveMarketIds
Retrieves the IDs of all active markets. Contains pagination parameters for not bursting gas limits.
Parameter Name | Type | Description |
---|---|---|
offset |
| Number of items to skip |
limit |
| Number of items to return |
Output values:
MarketId
[]
array of market identifiers
marketInfo
Retrieves comprehensive information about a specific market.
Parameter Name | Type | Description |
---|---|---|
id | Market identifier | |
oraclePackages | An array of packages containing the latest known index for the market. Packages are provided by an Oracle service on demand. |
Output values:
MarketInfo struct with market data
futureInfo
Retrieves comprehensive information about a specific future.
Parameter Name | Type | Description |
---|---|---|
id | Future identifier | |
oraclePackages | An array of packages containing the latest known index for the market. Packages are provided by an Oracle service on demand. |
Output values:
FutureInfo
struct with market data
activeMarketsInfo
Retrieves comprehensive information for a range of active markets.
Parameter Name | Type | Description |
---|---|---|
offset |
| Number of items to skip |
limit |
| Number of items to return |
marketsOraclePackages | An array of packages containing the latest known index for the market. and the marketId. Packages are provided by an Oracle service on demand. |
Output values:
MarketInfo
[]
array of structs with market data
futureIdsCloseToMaturityWithoutIndex
Retrieves list of future info objects that will mature within maturityBufferSeconds
seconds but do not have an index.
Parameter Name | Type | Description |
---|---|---|
marketId | Market identifier | |
maturityBufferSeconds |
| Time to maturity to be considered. If set to 0 it will return futures that have already matured. |
Output values:
FutureId
[]
Array of future identifiers
futureInfoCloseToMaturityWithoutIndex
Retrieves list of futures data that will mature within maturityBufferSeconds
seconds but do not have an index.
Parameter Name | Type | Description |
---|---|---|
marketId | Market identifier | |
maturityBufferSeconds |
| Time to maturity to be considered. If set to 0 it will return futures that have already matured. |
Output values:
FutureInfoWithoutIndex
[]
Array of objects with future data
marginRequirement
Calculates the margin requirement for a market participant
Parameter Name | Type | Description |
---|---|---|
marketId | Market identifier | |
participant |
| Address of the participant |
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
The amount of margin required by the participant in this market
withdrawableMargin
Calculates the withdrawable margin for a market participant
Parameter Name | Type | Description |
---|---|---|
marketId | Market identifier | |
participant |
| Address of the participant |
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
The amount of margin that is withdrawable by the participant.
totalPosition
Retrieves the total position of a given participant in a specified future.
Parameter Name | Type | Description |
---|---|---|
futureId | Future identifier | |
participant |
| Address of the participant |
oraclePackages | An array of packages containing the latest known index for the market. Packages are provided by an Oracle service on demand. |
Output values:
TotalPosition
Object detailing the participant's position in the specified future
marginDetails
Retrieves the margin details of a given participant in a specified market.
Parameter Name | Type | Description |
---|---|---|
marketId | Market identifier | |
participant |
| Address of the participant |
oraclePackages | An array of packages containing the latest known index for the market. Packages are provided by an Oracle service on demand. |
Output values:
ViewDataProviderLogic.MarginState
Object detailing the participant's margin state in the specified market
marketPortfolio
Retrieves the market portfolio details of a given participant.
Parameter Name | Type | Description |
---|---|---|
marketId | Market identifier | |
participant |
| Address of the participant |
oraclePackages | An array of packages containing the latest known index for the market. Packages are provided by an Oracle service on demand. |
Output values:
MarketPortfolio
Object detailing the participant's market positions.
portfolioMarketIds
Retrieves the market ids associated with a participant's portfolio. This function filters out markets that are not relevant for the participant's portfolio.
Parameter Name | Type | Description |
---|---|---|
participant |
| Address of the participant |
offset |
| Number of items to skip |
limit |
| Number of items to return |
Output values:
MarketId
[]
Array of market identifiers
portfolio
Retrieves the market ids associated with a participant's portfolio. This function filters out markets that are not relevant for the participant's portfolio.
Parameter Name | Type | Description |
---|---|---|
participant |
| Address of the participant |
offset |
| Number of items to skip |
limit |
| Number of items to return |
marketsOraclePackages | An array containing the latest known index per market. Packages are provided by an Oracle service on demand. |
Output values:
MarketPortfolio
[]
Array of objects detailing the participant's market positions
checkForUnsettledMaturedFutures
Checks if a participant has any unsettled futures that have reached maturity in a specified market
Parameter Name | Type | Description |
---|---|---|
marketId | Market identifier | |
participant |
| Address of the participant |
Output values:
bool
True if any of the participant's futures in the specified market have reached maturity and are unsettled. False otherwise.
makerLiquidityDistribution
Retrieves maker's liquidity distribution details of a given future over a specified interval. offset
and limit
params can be used for pagination.
Parameter Name | Type | Description |
---|---|---|
futureId | Future identifier | |
maker |
| Address of the maker |
offset |
| Number of items to skip |
limit |
| Number of items to return |
Output values:
uint256
currentFutureRate - The current rate of the futureIntervalLiquidity
[]
intervals - Array of liquidity provisions
poolLiquidityDistribution
Retrieves the liquidity distribution details of a given future over a specified interval. offset
and limit
params can be used for pagination.
Parameter Name | Type | Description |
---|---|---|
futureId | Future identifier | |
oraclePackages | An array of packages containing the latest known index for the market. Packages are provided by an Oracle service on demand. | |
offset |
| Number of items to skip |
limit |
| Number of items to return |
Output values:
ProvisionDistribution
The total liquidity provision associated with the futureuint256
currentFutureRate - The current rate of the futureIntervalLiquidity
[]
intervals - Array of liquidity provisions
Structs
Documentation on the structs defined in this contract
IMarketStorage.RiskParameters
Parameters for configuring risk on a market.
Property name | Property Type | Description |
---|---|---|
minNotional |
| Minimum notional amount when providing liquidity to a market |
liquidationThresholdDelta |
| Parameter for calculating liquidation thresholds of users trading futures in this market |
marginThresholdDelta |
| Parameter for calculating margin thresholds of users trading futures in this market |
marginThresholdTolerance |
| Parameter used to create a buffer between user's margin and withdrawable amount. |
maxRateImpactPerTrade |
| Maximum allowed rate change per trade |
hedgeMarginFactor |
| Factor used for computing cross margin effects of positions in opposite directions to calculate margin requirements |
marginRequirementSecondsFloor |
| Minimum time to maturity used in margin requirement calculations |
liquidationMarginRequirementSecondsFloor |
| Minimum time to maturity used in liquidation margin calculations |
maturityLockoutSeconds |
| Number of seconds from maturity after which the future is not tradable anymore |
IMarketStorage.RewardParameters
Parameters for configuring rewards and fees of a market.
Property name | Property Type | Description |
---|---|---|
transferOwnershipReward |
| Percentage of liquidated user's margin given as a reward to the liquidator on liquidation by novation |
positionLiquidationReward |
| Percentage of liquidated user's margin given as a reward to the liquidator on position liquidation |
provisionCancellationReward |
| Percentage of maker's margin given to caller on provision cancellations |
lpPriceImpactFeeFactor |
| Parameter for adjusting maker fee of a trade according to its price impact |
lpNotionalFeeFactor |
| Parameter for adjusting maker fee of a trade according to its notional amount |
minLpFee |
| Minimum maker fee per trade |
protocolPriceImpactFeeFactor |
| Parameter for adjusting protocol fee of a trade according to its price impact |
protocolNotionalFeeFactor |
| Parameter for adjusting protocol fee of a trade according to its notional amount |
minProtocolFee |
| Minimum protocol fee per trade |
IFutureStorage.PauseConfiguration
Struct containing the pause state of different operations on a future
Property name | Property Type | Description |
---|---|---|
trade |
| If true, trading is paused in this future |
liquidityProvision |
| If true, liquidity provisions are paused in this future |
liquidityRemoval |
| If true, liquidity removals are paused in this future |
liquidation |
| If true, liquidations are paused in this future |
positionOwnershipTransfer |
| If true, liquidations by novation are paused in this future |
IMarketStorage.PauseConfiguration
Struct containing the pause state of different operations on a market
Property name | Property Type | Description |
---|---|---|
withdraw |
| If true, withdraws are paused in this market |
deposit |
| If true, deposits are paused in this market |
MarketInfo
Struct containing Market and its futures data
Property name | Property Type | Description |
---|---|---|
descriptor | Market data | |
futures | Futures data | |
openInterest |
| The total notional value held by market participants in open futures in this market |
totalLiquidityNotional |
| Total notional available for trading with market liquidity |
MarketDescriptor
Struct containing market and its underlying token data.
Property name | Property Type | Description |
---|---|---|
id | Market identifier. | |
sourceName |
| Market source name |
instrumentName |
| Market instrument name |
tag |
| Market tag |
version |
| Market version counter |
underlying |
| Address of underlying ERC20 token |
underlyingName |
| Name of underlying |
underlyingDecimals |
| Decimals of underlying |
underlyingIsWrappedNativeToken |
| True if underlying is an ERC20 of the chain's native token |
rateMathType | Type of interest rate |
FutureInfo
Struct containing future and VAMM data.
Property name | Property Type | Description |
---|---|---|
id | Future identifier | |
marketId | Market identifier | |
termStart |
| Timestamp where the future started |
termLength |
| Number of seconds between termStart and maturity |
vAMMParams | Market version counter | |
totalLiquidityNotional |
| Notional amount for all liquidity available on this future |
openInterest |
| The total notional value held by market participants in this future |
VAMMParams
Struct defining VAMM settings
Property name | Property Type | Description |
---|---|---|
lowerBoundRate |
| Future lowest possible rate |
currentFutureRate |
| Current future rate |
upperBoundRate |
| Future highest possible rate |
intervalLength |
| Distance between 2 intervals. Set in percent of the rate, e.g: |
intervalsCount |
| Number of intervals in the VAMM |
ViewFloatIndexLogic.MarketOraclePackages
Struct defining OraclePackages for multiple markets
Property name | Property Type | Description |
---|---|---|
marketId | Market identifier | |
packages | An array of packages containing the latest known index for the market. Packages are provided by an Oracle service on demand. |
FutureInfoWithoutIndex
Struct containing Future and VAMM data without open interest.
Property name | Property Type | Description |
---|---|---|
id | Future identifier | |
marketId | Market identifier | |
termStart |
| Timestamp where the future started |
termLength |
| Number of seconds between termStart and maturity |
vAMMParams | Market version counter | |
totalLiquidityNotional |
| Notional amount for all liquidity available on this future |
TotalPosition
Struct detailing a user's position in a future
Property name | Property Type | Description |
---|---|---|
openPositionTokensPair | Amounts of fixed and float tokens across all open positions | |
openPositionNotional |
| Total notional in open positions |
openPositionFloatTradeValue |
| Total value of the floating leg of a user's all open positions. Sum of |
takerOpenPositionsTokensPair | Amounts of fixed and float tokens across all open positions as taker | |
takerOpenPositionNotional |
| Total notional in positions open as taker |
takerOpenPositionFloatTradeValue |
| Total value of the floating leg of a user's open positions as taker |
makerOpenPositionsTokensPair | Amounts of fixed and float tokens across all open positions as maker | |
makerOpenPositionNotional |
| Total notional in positions open as maker |
makerOpenPositionFloatTradeValue |
| Total value of the floating leg of a user's open positions as maker |
makerProvisions | Details info on each provision | |
provisionsBounds | Array of bounds in user's LP positions | |
overallProvisionsNotional | Distribution of all provided liquidity between payer and receiver sides | |
accruedLPFee |
| Total LP fee accrued by an user |
incurredFee |
| Total fee incurred by an user doing trades |
fee |
| Difference between |
BoundedProvisionInfo
Property name | Property Type | Description |
---|---|---|
tokensPair | Amount of fixed and float tokens | |
accruedLPFee |
| Amount of LP fees accrued by user |
floatTradeValue |
| Value of floating leg of a provision using last available index |
|
| Total notional of a LP position |
| Distribution of a provision between payer and receiver sides |
RateBounds
Struct to define the rate limits
Property name | Property Type | Description |
---|---|---|
lower |
| Lower rate limit |
upper |
| Upper rate limit |
ViewDataProviderLogic.MarginState
Struct containing details on the margin of a user
Property name | Property Type | Description |
---|---|---|
margin | User's margin state | |
initialMarginThreshold |
| Initial margin requirement |
liquidationMarginThreshold |
| Liquidation margin limit. User can be liquidated when his margin falls below this threshold |
lpMarginThreshold |
| Liquidation margin limit for LPs. LPs can be liquidated or have their positions canceled if their margin falls below this threshold |
dv01 |
| Dollar duration |
riskDirection | Risk direction |
MarketPortfolio
Struct detailing a user's market positions
Property name | Property Type | Description |
---|---|---|
descriptor | Market data | |
marginState | User margin | |
futures | User's futures data | |
futureOpenPositions | User's open futures data | |
futureMakerProvisions | User's future provisions on the market |
FutureOpenPosition
Struct detailing a user's open future
Property name | Property Type | Description |
---|---|---|
futureId | Future identifier | |
tokensPair | Amount of fixed and float tokens in position | |
notional |
| Face value of the position |
profitAndLoss | Position P&L | |
requiredMargin |
| Amount of margin required for this position |
dv01 |
| Dollar duration of this position |
riskDirection | Trade direction |
MakerFuturePositions
Property name | Property Type | Description |
---|---|---|
futureId | Future identifier | |
provisions | Array of liquidity provisions |
ProvisionInfo
Struct containing data on a liquidity provision.
Property name | Property Type | Description |
---|---|---|
bounds | Provision rate bounds | |
notional | Notional amount of the liquidity provided | |
requiredMargin |
| Margin required for this provision |
|
| Dollar duration in Payer direction |
|
| Dollar duration in Received direction |
IntervalLiquidity
Struct declaring a notional amount of a liquidity provision in specified bounds
Property name | Property Type | Description |
---|---|---|
bounds | Lower and upper bounds of a maker position | |
notional |
| Notional amount of maker position |
Enums
IRateMath.MathType
Indicates the type of rate
Last updated