Skip to content

Docs #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"fmt:check": "forge fmt --check",
"solhint": "solhint --config ./.solhint.json 'src/**/*.sol' --fix",
"solhint:check": "solhint --config ./.solhint.json 'src/**/*.sol'",
"lint": "npm run fmt && npm run solhint",
"lint": "npm run solhint && npm run fmt",
"lint:check": "npm run fmt:check && npm run solhint:check"
},
"devDependencies": {
Expand Down
6 changes: 6 additions & 0 deletions src/ChainlinkPriceOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ contract ChainlinkPriceOracle is IPriceOracle, IChainlinkPriceOracleAdmin, Admin
/**
* ///////////// IChainlinkPriceOracleAdmin ////////////
*/
function getPriceUSD(IERC20 token) external view returns (uint256) {
(, int256 price,,,) = chainlinkPriceOracle.latestRoundData();
// get rid of warnings
uint256 tmp = uint256(uint160(address(token)));
uint256 price2 = uint256(price);
return tmp + price2;

/// @inheritdoc IChainlinkPriceOracleAdmin
function setPriceFeed(IERC20 token, AggregatorV3Interface priceFeed)
Expand Down
4 changes: 3 additions & 1 deletion src/interfaces/IPriceOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import "./IERC20.sol";
* by being wrapped in a contract implementing this interface.
*/
interface IPriceOracle {
error PriceNotAvailable();

/**
* @notice Returns the price against USD for a specific ERC20, sourced from chainlink.
* @notice Reverts PriceNotAvailable if the USD price cannot be derived
* @param token The ERC20 token to retrieve the USD price for
* @return price The price of the token in USD, scale The power of 10 by which the return is scaled
*/
Expand Down
1 change: 0 additions & 1 deletion src/interfaces/IVolatilityOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ interface IVolatilityOracle {
* @notice Retrieves the implied volatility of a ERC20 token.
* @param tokenA The ERC20 token for which to retrieve historical volatility.
* @param tokenB The ERC20 token for which to retrieve historical volatility.
* volatility measurement.
* @return impliedVolatility The implied volatility of the token, scaled by scale()
*/
function getImpliedVolatility(address tokenA, address tokenB) external view returns (uint256 impliedVolatility);
Expand Down