initializePriceAggregator
Parameters
| Name | Type | Description |
|---|---|---|
| _linkToken | address | LINK token address |
| _linkUsdPriceFeed | contract IChainlinkFeed | LINK/USD price feed address |
| _twapInterval | uint24 | TWAP interval (seconds) |
| _minAnswers | uint8 | answers count at which a trade is executed with median |
| _oracles | address[] | chainlink oracle addresses |
| _jobIds | bytes32[2] | chainlink job ids (market/lookback) |
| _collateralIndices | uint8[] | collateral indices |
| _gnsCollateralLiquidityPools | IPriceAggregator.LiquidityPoolInput[] | corresponding GNS/collateral liquidity pool values |
| _collateralUsdPriceFeeds | contract IChainlinkFeed[] | corresponding collateral/USD chainlink price feeds |
updateLinkUsdPriceFeed
Parameters
| Name | Type | Description |
|---|---|---|
| _value | contract IChainlinkFeed | new value |
updateCollateralUsdPriceFeed
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | collateral index |
| _value | contract IChainlinkFeed | new value |
updateCollateralGnsLiquidityPool
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | collateral index |
| _liquidityPoolInput | IPriceAggregator.LiquidityPoolInput | new values |
updateTwapInterval
Parameters
| Name | Type | Description |
|---|---|---|
| _twapInterval | uint24 | new value (seconds) |
updateMinAnswers
Parameters
| Name | Type | Description |
|---|---|---|
| _value | uint8 | new value |
addOracle
Parameters
| Name | Type | Description |
|---|---|---|
| _a | address | new value |
replaceOracle
Parameters
| Name | Type | Description |
|---|---|---|
| _index | uint256 | oracle index |
| _a | address | new value |
removeOracle
Parameters
| Name | Type | Description |
|---|---|---|
| _index | uint256 | oracle index |
setMarketJobId
Parameters
| Name | Type | Description |
|---|---|---|
| _jobId | bytes32 | new value |
setLimitJobId
Parameters
| Name | Type | Description |
|---|---|---|
| _jobId | bytes32 | new value |
getPrice
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | collateral index |
| _pairIndex | uint16 | pair index |
| _tradeId | ITradingStorage.Id | trade id |
| _orderId | ITradingStorage.Id | order id |
| _orderType | enum ITradingStorage.PendingOrderType | order type |
| _positionSizeCollateral | uint256 | position size (collateral precision) |
| _fromBlock | uint256 | block number from which to start fetching prices (for lookbacks) |
fulfill
Parameters
| Name | Type | Description |
|---|---|---|
| _requestId | bytes32 | request id |
| _priceData | uint256 | price data |
claimBackLink
getLinkFee
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | collateral index |
| _trader | address | trader address |
| _pairIndex | uint16 | pair index |
| _positionSizeCollateral | uint256 | position size in collateral tokens (collateral precision) |
getCollateralPriceUsd
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of collateral |
getUsdNormalizedValue
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of collateral |
| _collateralValue | uint256 | collateral value (collateral precision) |
getCollateralFromUsdNormalizedValue
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of collateral |
| _normalizedValue | uint256 | normalized value (1e18 USD) |
getGnsPriceUsd
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of collateral |
getGnsPriceUsd
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of collateral |
| _gnsPriceCollateral | uint256 | GNS/collateral price (1e10) |
getGnsPriceCollateralIndex
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of collateral |
getGnsPriceCollateralAddress
Parameters
| Name | Type | Description |
|---|---|---|
| _collateral | address | address of the collateral |
getLinkUsdPriceFeed
getTwapInterval
getMinAnswers
getMarketJobId
getLimitJobId
getOracle
Parameters
| Name | Type | Description |
|---|---|---|
| _index | uint256 | index of the oracle |
getOracles
getCollateralGnsLiquidityPool
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of collateral |
getCollateralUsdPriceFeed
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of collateral |
getPriceAggregatorOrder
Parameters
| Name | Type | Description |
|---|---|---|
| _requestId | bytes32 | index of collateral |
getPriceAggregatorOrderAnswers
Parameters
| Name | Type | Description |
|---|---|---|
| _orderId | ITradingStorage.Id | order id |
getChainlinkToken
getRequestCount
getPendingRequest
LinkUsdPriceFeedUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| value | address | new value |
CollateralUsdPriceFeedUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| collateralIndex | uint8 | collateral index |
| value | address | new value |
CollateralGnsLiquidityPoolUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| collateralIndex | uint8 | collateral index |
| newValue | struct IPriceAggregator.LiquidityPoolInfo | new value |
TwapIntervalUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| newValue | uint32 | new value |
MinAnswersUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| value | uint8 | new value |
OracleAdded
Parameters
| Name | Type | Description |
|---|---|---|
| index | uint256 | new oracle index |
| value | address | value |
OracleReplaced
Parameters
| Name | Type | Description |
|---|---|---|
| index | uint256 | oracle index |
| oldOracle | address | old value |
| newOracle | address | new value |
OracleRemoved
Parameters
| Name | Type | Description |
|---|---|---|
| index | uint256 | oracle index |
| oldOracle | address | old value |
JobIdUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| index | uint256 | index |
| jobId | bytes32 | new value |
LinkRequestCreated
Parameters
| Name | Type | Description |
|---|---|---|
| request | struct Chainlink.Request | link request details |
PriceRequested
Parameters
| Name | Type | Description |
|---|---|---|
| collateralIndex | uint8 | collateral index |
| pairIndex | uint256 | trading pair index |
| tradeId | struct ITradingStorage.Id | trader id |
| pendingOrderId | struct ITradingStorage.Id | pending order id |
| orderType | enum ITradingStorage.PendingOrderType | order type (market open/market close/limit open/stop open/etc.) |
| fromBlock | uint256 | block number from which to start fetching prices (for lookbacks) |
| isLookback | bool | true if lookback |
| job | bytes32 | chainlink job id (market/lookback) |
| linkFeePerNode | uint256 | link fee distributed per node (1e18 precision) |
| nodesCount | uint256 | amount of nodes to fetch prices from |
TradingCallbackExecuted
Parameters
| Name | Type | Description |
|---|---|---|
| a | struct ITradingCallbacks.AggregatorAnswer | aggregator answer data |
| orderType | enum ITradingStorage.PendingOrderType | order type |
PriceReceived
Parameters
| Name | Type | Description |
|---|---|---|
| orderId | struct ITradingStorage.Id | pending order id |
| pairIndex | uint16 | trading pair index |
| request | bytes32 | chainlink request id |
| priceData | uint256 | OrderAnswer compressed into uint256 |
| isLookback | bool | true if lookback |
| usedInMedian | bool | false if order already executed because min answers count was already reached |
LinkClaimedBack
Parameters
| Name | Type | Description |
|---|---|---|
| amountLink | uint256 | amount of LINK tokens claimed back |
