Skip to content

Commit

Permalink
docs: add custom error natspec comments for SfrxETHOracle
Browse files Browse the repository at this point in the history
  • Loading branch information
chechu committed Jun 20, 2024
1 parent 28900dd commit 36f63b5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions contracts/oracles/SFrxETHOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ contract SFrxETHOracle is AccessControlledV8, OracleInterface {

/// @notice Constructor for the implementation contract.
/// @custom:oz-upgrades-unsafe-allow constructor
/// @custom:error ZeroAddressNotAllowed is thrown when `_sfrxEthFraxOracle` or `_sfrxETH` are the zero address
constructor(address _sfrxEthFraxOracle, address _sfrxETH) {
ensureNonzeroAddress(_sfrxEthFraxOracle);
ensureNonzeroAddress(_sfrxETH);
Expand All @@ -52,6 +53,7 @@ contract SFrxETHOracle is AccessControlledV8, OracleInterface {
* @notice Sets the contracts required to fetch prices
* @param _accessControlManager Address of the access control manager contract
* @param _maxAllowedPriceDifference Maximum allowed price difference
* @custom:error ZeroValueNotAllowed is thrown if `_maxAllowedPriceDifference` is zero
*/
function initialize(address _accessControlManager, uint256 _maxAllowedPriceDifference) external initializer {
ensureNonzeroValue(_maxAllowedPriceDifference);
Expand All @@ -63,6 +65,7 @@ contract SFrxETHOracle is AccessControlledV8, OracleInterface {
/**
* @notice Sets the maximum allowed price difference
* @param _maxAllowedPriceDifference Maximum allowed price difference
* @custom:error ZeroValueNotAllowed is thrown if `_maxAllowedPriceDifference` is zero
*/
function setMaxAllowedPriceDifference(uint256 _maxAllowedPriceDifference) external {
_checkAccessAllowed("setMaxAllowedPriceDifference(uint256)");
Expand All @@ -76,6 +79,10 @@ contract SFrxETHOracle is AccessControlledV8, OracleInterface {
* @notice Fetches the USD price of sfrxETH
* @param asset Address of the sfrxETH token
* @return price The price scaled by 1e18
* @custom:error InvalidTokenAddress is thrown when the `asset` is not the sfrxETH token (`SFRXETH`)
* @custom:error BadPriceData is thrown if the `SFRXETH_FRAX_ORACLE` oracle informs it has bad data
* @custom:error ZeroValueNotAllowed is thrown if the prices (low or high, in USD) are zero
* @custom:error PriceDifferenceExceeded is thrown if priceHigh/priceLow is greater than `maxAllowedPriceDifference`
*/
function getPrice(address asset) external view returns (uint256) {
if (asset != SFRXETH) revert InvalidTokenAddress();
Expand Down

0 comments on commit 36f63b5

Please sign in to comment.