relevant tag icon
Juicebox Price Normalizer
copy icon
Juicebox
• version 1.0.0
Finance
Utility
Aggregator
Audited

Juicebox Price Normalizer

Audited

Manage and normalizes ETH price feeds.

*Visit desktop site to download or deploy

Version

1.0.0

Creator

Juicebox

Last Publish

11/23/2022
Any contract you deploy is yours.
Fully owned and controlled by your wallet.
Documentation
Source Code
getETHPriceFor(uint256) :
This function retrieves the ETH price for a given currency. It first checks if the currency is 0, in which case it returns 10 to the power of the targetDecimals. It then retrieves the AggregatorV3Interface feed for the given currency and checks if it is not equal to address 0. If it is not, it retrieves the latest round data from the feed and returns the price multiplied by the feedDecimalAdjuster for the given currency. (autogenerated documentation)
addFeed(uint256) :
This function adds a new feed to the Prices contract. It takes in two parameters, an AggregatorV3Interface _feed and a uint256 _currency. It first checks that the _currency is greater than 0, and that the feedFor[_currency] is not already set. It then checks that the decimals of the _feed is less than or equal to the targetDecimals. If all of these checks pass, it sets the feedFor[_currency] to the _feed, and sets the feedDecimalAdjuster[_currency] to 10**(targetDecimals - _decimals). Finally, it emits an AddFeed event with the _currency and _feed as parameters. (autogenerated documentation)

Get Cookin'
share iconShare

copy iconDownload Source
copy iconnpx cookbookdev i juicebox-price-normalizer
copy icon

Last Publish

11/23/2022

Version

1.0.0

Creator

Juicebox

Cookbook is free.
Any contract you deploy is yours.
Your contract is owned and controlled by you.