IPriceAggregatorUtils
Interface for GNSPriceAggregator facet (inherits types and also contains functions, events, and custom errors)
initializePriceAggregator
Initializes price aggregator facet
Parameters
_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
corresponding GNS/collateral liquidity pool values
_collateralUsdPriceFeeds
contract IChainlinkFeed[]
corresponding collateral/USD chainlink price feeds
updateLinkUsdPriceFeed
Updates LINK/USD chainlink price feed
Parameters
_value
contract IChainlinkFeed
new value
updateCollateralUsdPriceFeed
Updates collateral/USD chainlink price feed
Parameters
_collateralIndex
uint8
collateral index
_value
contract IChainlinkFeed
new value
updateCollateralGnsLiquidityPool
Updates collateral/GNS liquidity pool
Parameters
_collateralIndex
uint8
collateral index
_liquidityPoolInput
new values
updateTwapInterval
Updates TWAP interval
Parameters
_twapInterval
uint24
new value (seconds)
updateMinAnswers
Updates minimum answers count
Parameters
_value
uint8
new value
addOracle
Adds an oracle
Parameters
_a
address
new value
replaceOracle
Replaces an oracle
Parameters
_index
uint256
oracle index
_a
address
new value
removeOracle
Removes an oracle
Parameters
_index
uint256
oracle index
setMarketJobId
Updates market job id
Parameters
_jobId
bytes32
new value
setLimitJobId
Updates lookback job id
Parameters
_jobId
bytes32
new value
getPrice
Requests price from oracles
Parameters
_collateralIndex
uint8
collateral index
_pairIndex
uint16
pair index
_tradeId
trade id
_orderId
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
Fulfills price request, called by chainlink oracles
Parameters
_requestId
bytes32
request id
_priceData
uint256
price data
claimBackLink
Claims back LINK tokens, called by gov fund
getLinkFee
Returns LINK fee for price request
Parameters
_collateralIndex
uint8
collateral index
_trader
address
trader address
_pairIndex
uint16
pair index
_positionSizeCollateral
uint256
position size in collateral tokens (collateral precision)
getCollateralPriceUsd
Returns collateral/USD price
Parameters
_collateralIndex
uint8
index of collateral
getUsdNormalizedValue
Returns USD normalized value from collateral value
Parameters
_collateralIndex
uint8
index of collateral
_collateralValue
uint256
collateral value (collateral precision)
getCollateralFromUsdNormalizedValue
Returns collateral value (collateral precision) from USD normalized value
Parameters
_collateralIndex
uint8
index of collateral
_normalizedValue
uint256
normalized value (1e18 USD)
getGnsPriceUsd
Returns GNS/USD price based on GNS/collateral price
Parameters
_collateralIndex
uint8
index of collateral
getGnsPriceUsd
Returns GNS/USD price based on GNS/collateral price
Parameters
_collateralIndex
uint8
index of collateral
_gnsPriceCollateral
uint256
GNS/collateral price (1e10)
getGnsPriceCollateralIndex
Returns GNS/collateral price
Parameters
_collateralIndex
uint8
index of collateral
getGnsPriceCollateralAddress
Returns GNS/collateral price
Parameters
_collateral
address
address of the collateral
getLinkUsdPriceFeed
Returns the link/usd price feed address
getTwapInterval
Returns the twap interval in seconds
getMinAnswers
Returns the minimum answers to execute an order and take the median
getMarketJobId
Returns the market job id
getLimitJobId
Returns the limit job id
getOracle
Returns a specific oracle
Parameters
_index
uint256
index of the oracle
getOracles
Returns all oracles
getCollateralGnsLiquidityPool
Returns collateral/gns liquidity pool info
Parameters
_collateralIndex
uint8
index of collateral
getCollateralUsdPriceFeed
Returns collateral/usd chainlink price feed
Parameters
_collateralIndex
uint8
index of collateral
getPriceAggregatorOrder
Returns order data
Parameters
_requestId
bytes32
index of collateral
getPriceAggregatorOrderAnswers
Returns order data
Parameters
_orderId
ITradingStorage.Id
order id
getChainlinkToken
Returns chainlink token address
getRequestCount
Returns requestCount (used by ChainlinkClientUtils)
getPendingRequest
Returns pendingRequests mapping entry (used by ChainlinkClientUtils)
LinkUsdPriceFeedUpdated
Emitted when LINK/USD price feed is updated
Parameters
value
address
new value
CollateralUsdPriceFeedUpdated
Emitted when collateral/USD price feed is updated
Parameters
collateralIndex
uint8
collateral index
value
address
new value
CollateralGnsLiquidityPoolUpdated
Emitted when collateral/GNS Uniswap V3 pool is updated
Parameters
collateralIndex
uint8
collateral index
newValue
struct IPriceAggregator.LiquidityPoolInfo
new value
TwapIntervalUpdated
Emitted when TWAP interval is updated
Parameters
newValue
uint32
new value
MinAnswersUpdated
Emitted when minimum answers count is updated
Parameters
value
uint8
new value
OracleAdded
Emitted when an oracle is added
Parameters
index
uint256
new oracle index
value
address
value
OracleReplaced
Emitted when an oracle is replaced
Parameters
index
uint256
oracle index
oldOracle
address
old value
newOracle
address
new value
OracleRemoved
Emitted when an oracle is removed
Parameters
index
uint256
oracle index
oldOracle
address
old value
JobIdUpdated
Emitted when market job id is updated
Parameters
index
uint256
index
jobId
bytes32
new value
LinkRequestCreated
Emitted when a chainlink request is created
Parameters
request
struct Chainlink.Request
link request details
PriceRequested
Emitted when a price is requested to the oracles
Parameters
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
Emitted when a trading callback is called from the price aggregator
Parameters
a
struct ITradingCallbacks.AggregatorAnswer
aggregator answer data
orderType
enum ITradingStorage.PendingOrderType
order type
PriceReceived
Emitted when a price is received from the oracles
Parameters
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
Emitted when LINK tokens are claimed back by gov fund
Parameters
amountLink
uint256
amount of LINK tokens claimed back
TransferAndCallToOracleFailed
SourceNotOracleOfRequest
RequestAlreadyPending
OracleAlreadyListed
InvalidCandle
WrongCollateralUsdDecimals
InvalidPoolType
Last updated