diff --git a/package.json b/package.json index a1e155f..507670e 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/ChainlinkPriceOracle.sol b/src/ChainlinkPriceOracle.sol index c08aa1f..970abf6 100644 --- a/src/ChainlinkPriceOracle.sol +++ b/src/ChainlinkPriceOracle.sol @@ -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) diff --git a/src/interfaces/IPriceOracle.sol b/src/interfaces/IPriceOracle.sol index 32f6b2f..5638d5a 100644 --- a/src/interfaces/IPriceOracle.sol +++ b/src/interfaces/IPriceOracle.sol @@ -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 */ diff --git a/src/interfaces/IVolatilityOracle.sol b/src/interfaces/IVolatilityOracle.sol index 5079250..8ad1923 100644 --- a/src/interfaces/IVolatilityOracle.sol +++ b/src/interfaces/IVolatilityOracle.sol @@ -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);