跳到主要内容

JBChainlinkV3PriceFeed

Git Source

Inherits: IJBPriceFeed

An IJBPriceFeed implementation that reports prices from a Chainlink AggregatorV3Interface.

State Variables

FEED

The Chainlink feed that prices are reported from.

AggregatorV3Interface public immutable FEED;

THRESHOLD

How many seconds old a Chainlink price update is allowed to be before considered "stale".

uint256 public immutable THRESHOLD;

Functions

constructor

constructor(AggregatorV3Interface feed, uint256 threshold);

Parameters

NameTypeDescription
feedAggregatorV3InterfaceThe Chainlink feed to report prices from.
thresholduint256How many seconds old a price update may be.

currentUnitPrice

Gets the current price (per 1 unit) from the feed.

function currentUnitPrice(uint256 decimals) public view virtual override returns (uint256);

Parameters

NameTypeDescription
decimalsuint256The number of decimals the return value should use.

Returns

NameTypeDescription
<none>uint256The current unit price from the feed, as a fixed point number with the specified number of decimals.

Errors

JBChainlinkV3PriceFeed_IncompleteRound

error JBChainlinkV3PriceFeed_IncompleteRound();

JBChainlinkV3PriceFeed_NegativePrice

error JBChainlinkV3PriceFeed_NegativePrice(int256 price);

JBChainlinkV3PriceFeed_StalePrice

error JBChainlinkV3PriceFeed_StalePrice(uint256 timestamp, uint256 threshold, uint256 updatedAt);