From 36f63b5e1199f7da589780357e9a7772eac72e2f Mon Sep 17 00:00:00 2001 From: Jesus Lanchas Date: Thu, 20 Jun 2024 15:27:03 +0200 Subject: [PATCH] docs: add custom error natspec comments for SfrxETHOracle --- contracts/oracles/SFrxETHOracle.sol | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/contracts/oracles/SFrxETHOracle.sol b/contracts/oracles/SFrxETHOracle.sol index 5be8bb18..8baa7c69 100644 --- a/contracts/oracles/SFrxETHOracle.sol +++ b/contracts/oracles/SFrxETHOracle.sol @@ -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); @@ -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); @@ -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)"); @@ -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();