addFeedFor
Contract: JBPrices
Interface: IJBPrices
- Step by step
- Code
- Errors
- Events
- Bug bounty
Add a price feed for a currency in terms of the provided base currency.
Current feeds can't be modified.
Definition
function addFeedFor(
uint256 _currency,
uint256 _base,
IJBPriceFeed _feed
) external override onlyOwner { ... }
- Arguments:
_currency
is the currency that the price feed is for._base
is the currency that the price feed is based on._feed
is theIJBPriceFeed
contract being added.
- Through the
onlyOwner
modifier, this function can only be accessed by the address that owns this contract. - The function overrides a function definition from the
IJBPrices
interface. - The function doesn't return anything.
Body
-
Make sure there isn't already a price feed set for the currency base pair.
// There can't already be a feed for the specified currency.
if (
feedFor[_currency][_base] != IJBPriceFeed(address(0)) ||
feedFor[_base][_currency] != IJBPriceFeed(address(0))
) revert PRICE_FEED_ALREADY_EXISTS();