{
  "language": "Solidity",
  "sources": {
    "@venusprotocol/solidity-utilities/contracts/constants.sol": {
      "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity 0.8.13;\n\n/// @dev Base unit for computations, usually used in scaling (multiplications, divisions)\nuint256 constant EXP_SCALE = 1e18;\n\n/// @dev A unit (literal one) in EXP_SCALE, usually used in additions/subtractions\nuint256 constant MANTISSA_ONE = EXP_SCALE;\n\n/// @dev The approximate number of seconds per year\nuint256 constant SECONDS_PER_YEAR = 31_536_000;\n"
    },
    "@venusprotocol/solidity-utilities/contracts/validators.sol": {
      "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity 0.8.13;\n\n/// @notice Thrown if the supplied address is a zero address where it is not allowed\nerror ZeroAddressNotAllowed();\n\n/// @notice Thrown if the supplied value is 0 where it is not allowed\nerror ZeroValueNotAllowed();\n\n/// @notice Checks if the provided address is nonzero, reverts otherwise\n/// @param address_ Address to check\n/// @custom:error ZeroAddressNotAllowed is thrown if the provided address is a zero address\nfunction ensureNonzeroAddress(address address_) pure {\n    if (address_ == address(0)) {\n        revert ZeroAddressNotAllowed();\n    }\n}\n\n/// @notice Checks if the provided value is nonzero, reverts otherwise\n/// @param value_ Value to check\n/// @custom:error ZeroValueNotAllowed is thrown if the provided value is 0\nfunction ensureNonzeroValue(uint256 value_) pure {\n    if (value_ == 0) {\n        revert ZeroValueNotAllowed();\n    }\n}\n"
    },
    "contracts/interfaces/IStETH.sol": {
      "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity 0.8.13;\n\ninterface IStETH {\n    function getPooledEthByShares(uint256 _sharesAmount) external view returns (uint256);\n}\n"
    },
    "contracts/interfaces/OracleInterface.sol": {
      "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity 0.8.13;\n\ninterface OracleInterface {\n    function getPrice(address asset) external view returns (uint256);\n}\n\ninterface ResilientOracleInterface is OracleInterface {\n    function updatePrice(address vToken) external;\n\n    function updateAssetPrice(address asset) external;\n\n    function getUnderlyingPrice(address vToken) external view returns (uint256);\n}\n\ninterface TwapInterface is OracleInterface {\n    function updateTwap(address asset) external returns (uint256);\n}\n\ninterface BoundValidatorInterface {\n    function validatePriceWithAnchorPrice(\n        address asset,\n        uint256 reporterPrice,\n        uint256 anchorPrice\n    ) external view returns (bool);\n}\n"
    },
    "contracts/oracles/WstETHOracle.sol": {
      "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity 0.8.13;\n\nimport { OracleInterface } from \"../interfaces/OracleInterface.sol\";\nimport { IStETH } from \"../interfaces/IStETH.sol\";\nimport { ensureNonzeroAddress } from \"@venusprotocol/solidity-utilities/contracts/validators.sol\";\nimport { EXP_SCALE } from \"@venusprotocol/solidity-utilities/contracts/constants.sol\";\n\n/**\n * @title WstETHOracle\n * @author Venus\n * @notice This oracle fetches the price of wstETH asset\n */\ncontract WstETHOracle is OracleInterface {\n    /// @notice Address of stETH\n    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable\n    IStETH public immutable STETH;\n\n    /// @notice Address of wstETH\n    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable\n    address public immutable WSTETH_ADDRESS;\n\n    /// @notice Address of WETH\n    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable\n    address public immutable WETH_ADDRESS;\n\n    /// @notice Address of Resilient Oracle\n    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable\n    OracleInterface public immutable RESILIENT_ORACLE;\n\n    /// @notice Constructor for the implementation contract.\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor(address wstETHAddress, address wETHAddress, address stETHAddress, address resilientOracleAddress) {\n        ensureNonzeroAddress(wstETHAddress);\n        ensureNonzeroAddress(wETHAddress);\n        ensureNonzeroAddress(stETHAddress);\n        ensureNonzeroAddress(resilientOracleAddress);\n        WSTETH_ADDRESS = wstETHAddress;\n        WETH_ADDRESS = wETHAddress;\n        STETH = IStETH(stETHAddress);\n        RESILIENT_ORACLE = OracleInterface(resilientOracleAddress);\n    }\n\n    /**\n     * @notice Gets the price of wstETH asset\n     * @param asset Address of wstETH\n     * @return wstETH Price in USD scaled by 1e18\n     */\n    function getPrice(address asset) public view returns (uint256) {\n        if (asset != WSTETH_ADDRESS) revert(\"wrong wstETH address\");\n\n        // get stETH amount for 1 wstETH scaled by 1e18\n        uint256 stETHAmount = STETH.getPooledEthByShares(1 ether);\n\n        // price is scaled 1e18 (oracle returns 36 - asset decimal scale)\n        uint256 wethUSDPrice = RESILIENT_ORACLE.getPrice(WETH_ADDRESS);\n\n        // stETHAmount (for 1 wstETH) * wethUSDPrice (assuming 1stETH = 1 WETH) / 1e18\n        return (stETHAmount * wethUSDPrice) / EXP_SCALE;\n    }\n}\n"
    }
  },
  "settings": {
    "optimizer": {
      "enabled": true,
      "runs": 200,
      "details": {
        "yul": true
      }
    },
    "outputSelection": {
      "*": {
        "*": [
          "storageLayout",
          "abi",
          "evm.bytecode",
          "evm.deployedBytecode",
          "evm.methodIdentifiers",
          "metadata",
          "devdoc",
          "userdoc",
          "evm.gasEstimates"
        ],
        "": ["ast"]
      }
    },
    "metadata": {
      "useLiteralContent": true
    }
  }
}
