core-artifacts
Version:
Consist artifacts of the maple protocol
310 lines • 623 kB
JSON
{
"id": "fac6bdbde11e7474b35d9e2fb4950a20",
"_format": "hh-sol-build-info-1",
"solcVersion": "0.6.11",
"solcLongVersion": "0.6.11+commit.5ef660b1",
"input": {
"language": "Solidity",
"sources": {
"contracts/core/chainlink-oracle/v1/ChainlinkOracle.sol": {
"content": "// SPDX-License-Identifier: AGPL-3.0-or-later // hevm: flattened sources of contracts/core/chainlink-oracle/v1/ChainlinkOracle.sol\npragma solidity =0.6.11 >=0.6.0 <0.8.0;\n\n////// contracts/core/globals/v1/interfaces/IMapleGlobals.sol\n/* pragma solidity 0.6.11; */\n\n/// @title MapleGlobals maintains a central source of parameters and allowlists for the Maple protocol.\ninterface IMapleGlobals {\n\n /**\n @dev Emits an event indicating the MapleGlobals contract was created.\n */\n event Initialized();\n\n /**\n @dev Emits an event indicating the validity of a Collateral Asset was set.\n @param asset The Collateral Asset to assign validity to.\n @param decimals The number of decimal places of `asset`.\n @param symbol The symbol of `asset`.\n @param valid The new validity status of `asset`.\n */\n event CollateralAssetSet(address asset, uint256 decimals, string symbol, bool valid);\n\n /**\n @dev Emits an event indicating the validity of a Liquidity Asset was set.\n @param asset The Liquidity Asset to assign validity to.\n @param decimals The number of decimal places of `asset`.\n @param symbol The symbol of `asset`.\n @param valid The new validity status of `asset`.\n */\n event LiquidityAssetSet(address asset, uint256 decimals, string symbol, bool valid);\n\n /**\n @dev Emits an event indicating the Oracle for an asset was set.\n @param asset The asset to update price for.\n @param oracle The new Oracle to use.\n */\n event OracleSet(address asset, address oracle);\n\n /**\n @dev This is unused.\n */\n event TransferRestrictionExemptionSet(address indexed exemptedContract, bool valid);\n\n /**\n @dev Emits an event indicating the validity of a Balancer Pool was set.\n @param balancerPool The address of Balancer Pool contract.\n @param valid The new validity status of a Balancer Pool.\n */\n event BalancerPoolSet(address balancerPool, bool valid);\n\n /**\n @dev Emits an event indicating a PendingGovernor was set.\n @param pendingGovernor The address of the new Pending Governor.\n */\n event PendingGovernorSet(address indexed pendingGovernor);\n\n /**\n @dev Emits an event indicating Governorship was accepted by a new account.\n @param governor The account that has accepted Governorship.\n */\n event GovernorAccepted(address indexed governor);\n\n /**\n @dev Emits an event indicating that some Governor controlled parameter was set.\n @param which The identifier of the parameter that was set.\n @param value The value the parameter was set to.\n */\n event GlobalsParamSet(bytes32 indexed which, uint256 value);\n\n /**\n @dev Emits an event indicating that some Governor controlled address was set.\n @param which The identifier of the address that was set.\n @param addr The address that was set.\n */\n event GlobalsAddressSet(bytes32 indexed which, address addr);\n\n /**\n @dev Emits an event indicating the protocol's paused state has been set.\n @param pause Whether the protocol was paused.\n */\n event ProtocolPaused(bool pause);\n\n /**\n @dev Emits an event indicating the GlobalAdmin was set.\n @param newGlobalAdmin The address of the new GlobalAdmin.\n */\n event GlobalAdminSet(address indexed newGlobalAdmin);\n\n /**\n @dev Emits an event indicating the validity of a Pool Delegate was set.\n @param poolDelegate The address of a Pool Delegate.\n @param valid Whether `poolDelegate` is a valid Pool Delegate.\n */\n event PoolDelegateSet(address indexed poolDelegate, bool valid);\n\n /**\n @dev The ERC-2222 Maple Token for the Maple protocol.\n */\n function mpl() external pure returns (address);\n\n /**\n @dev The Governor that is declared for governorship transfer. \n @dev Must be accepted for transfer to take effect. \n */\n function pendingGovernor() external view returns (address);\n\n /**\n @dev The Governor responsible for management of global Maple variables.\n */\n function governor() external view returns (address);\n\n /**\n @dev The MapleTreasury is the Treasury where all fees pass through for conversion, prior to distribution.\n */\n function mapleTreasury() external view returns (address);\n\n /**\n @dev The Global Admin of the whole network. \n @dev Has the power to switch off/on the functionality of entire protocol. \n */\n function globalAdmin() external view returns (address);\n\n /**\n @dev The amount of time a Borrower has to make a missed payment before a default can be triggered. \n */\n function defaultGracePeriod() external view returns (uint256);\n\n /**\n @dev The minimum amount of Pool cover that a Pool Delegate has to provide before they can finalize a Pool.\n */\n function swapOutRequired() external view returns (uint256);\n\n /**\n @dev The amount of time to allow a Borrower to drawdown on their Loan after funding period ends.\n */\n function fundingPeriod() external view returns (uint256);\n\n /**\n @dev The portion of drawdown that goes to the Pool Delegates and individual Lenders.\n */\n function investorFee() external view returns (uint256);\n\n /**\n @dev The portion of drawdown that goes to the MapleTreasury.\n */\n function treasuryFee() external view returns (uint256);\n\n /**\n @dev The maximum amount of slippage for Uniswap transactions.\n */\n function maxSwapSlippage() external view returns (uint256);\n\n /**\n @dev The minimum amount of LoanFDTs required to trigger liquidations (basis points percentage of totalSupply).\n */\n function minLoanEquity() external view returns (uint256);\n\n /**\n @dev The period (in secs) after which Stakers are allowed to unstake their BPTs from a StakeLocker.\n */\n function stakerCooldownPeriod() external view returns (uint256);\n\n /**\n @dev The period (in secs) after which LPs are allowed to withdraw their funds from a Pool.\n */\n function lpCooldownPeriod() external view returns (uint256);\n\n /**\n @dev The window of time (in secs) after `stakerCooldownPeriod` that an account has to withdraw before their intent to unstake is invalidated.\n */\n function stakerUnstakeWindow() external view returns (uint256);\n\n /**\n @dev The window of time (in secs) after `lpCooldownPeriod` that an account has to withdraw before their intent to withdraw is invalidated.\n */\n function lpWithdrawWindow() external view returns (uint256);\n\n /**\n @dev Whether the functionality of the entire protocol is paused.\n */\n function protocolPaused() external view returns (bool);\n\n /**\n @param liquidityAsset The address of a Liquidity Asset.\n @return Whether `liquidityAsset` is valid.\n */\n function isValidLiquidityAsset(address liquidityAsset) external view returns (bool);\n\n /**\n @param collateralAsset The address of a Collateral Asset.\n @return Whether `collateralAsset` is valid.\n */\n function isValidCollateralAsset(address collateralAsset) external view returns (bool);\n\n /**\n @param calc The address of a Calculator.\n @return Whether `calc` is valid.\n */\n function validCalcs(address calc) external view returns (bool);\n\n /**\n @dev Prevents unauthorized/unknown addresses from creating Pools.\n @param poolDelegate The address of a Pool Delegate.\n @return Whether `poolDelegate` is valid.\n */\n function isValidPoolDelegate(address poolDelegate) external view returns (bool);\n\n /**\n @param balancerPool The address of a Balancer Pool.\n @return Whether Maple has approved `balancerPool` for BPT staking.\n */\n function isValidBalancerPool(address balancerPool) external view returns (bool);\n\n /**\n @dev Determines the liquidation path of various assets in Loans and the Treasury. \n @dev The value provided will determine whether or not to perform a bilateral or triangular swap on Uniswap. \n @dev For example, `defaultUniswapPath[WBTC][USDC]` value would indicate what asset to convert WBTC into before conversion to USDC. \n @dev If `defaultUniswapPath[WBTC][USDC] == USDC`, then the swap is bilateral and no middle asset is swapped. \n @dev If `defaultUniswapPath[WBTC][USDC] == WETH`, then swap WBTC for WETH, then WETH for USDC. \n @param tokenA The address of the asset being swapped.\n @param tokenB The address of the final asset to receive.\n @return The intermediary asset for swaps, if any.\n */\n function defaultUniswapPath(address tokenA, address tokenB) external view returns (address);\n\n /**\n @param asset The address of some token.\n @return The Chainlink Oracle for the price of `asset`.\n */\n function oracleFor(address asset) external view returns (address);\n \n /**\n @param poolFactory The address of a Pool Factory.\n @return Whether `poolFactory` is valid.\n */\n function isValidPoolFactory(address poolFactory) external view returns (bool);\n\n /**\n @param loanFactory The address of a Loan Factory.\n @return Whether `loanFactory` is valid.\n */\n function isValidLoanFactory(address loanFactory) external view returns (bool);\n \n /**\n @param superFactory The core factory (e.g. PoolFactory, LoanFactory).\n @param subFactory The sub factory used by core factory (e.g. LiquidityLockerFactory).\n @return Whether `subFactory` is valid as it relates to `superFactory`.\n */\n function validSubFactories(address superFactory, address subFactory) external view returns (bool);\n \n /**\n @dev Sets the Staker cooldown period. \n @dev This change will affect the existing cool down period for the Stakers that already intended to unstake. \n @dev Only the Governor can call this function. \n @dev It emits a `GlobalsParamSet` event. \n @param newCooldownPeriod The new value for the cool down period.\n */\n function setStakerCooldownPeriod(uint256 newCooldownPeriod) external;\n\n /**\n @dev Sets the Liquidity Pool cooldown period. \n @dev This change will affect the existing cool down period for the LPs that already intended to withdraw. \n @dev Only the Governor can call this function. \n @dev It emits a `GlobalsParamSet` event. \n @param newCooldownPeriod The new value for the cool down period.\n */\n function setLpCooldownPeriod(uint256 newCooldownPeriod) external;\n\n /**\n @dev Sets the Staker unstake window. \n @dev This change will affect the existing window for the Stakers that already intended to unstake. \n @dev Only the Governor can call this function. \n @dev It emits a `GlobalsParamSet` event. \n @param newUnstakeWindow The new value for the unstake window.\n */\n function setStakerUnstakeWindow(uint256 newUnstakeWindow) external;\n\n /**\n @dev Sets the Liquidity Pool withdraw window. \n @dev This change will affect the existing window for the LPs that already intended to withdraw. \n @dev Only the Governor can call this function. \n @dev It emits a `GlobalsParamSet` event. \n @param newLpWithdrawWindow The new value for the withdraw window.\n */\n function setLpWithdrawWindow(uint256 newLpWithdrawWindow) external;\n\n /**\n @dev Sets the allowed Uniswap slippage percentage, in basis points. \n @dev Only the Governor can call this function. \n @dev It emits a `GlobalsParamSet` event. \n @param newMaxSlippage The new max slippage percentage (in basis points)\n */\n function setMaxSwapSlippage(uint256 newMaxSlippage) external;\n\n /**\n @dev Sets the Global Admin. \n @dev Only the Governor can call this function. \n @dev It emits a `GlobalAdminSet` event. \n @param newGlobalAdmin The new global admin address.\n */\n function setGlobalAdmin(address newGlobalAdmin) external;\n\n /**\n @dev Sets the validity of a Balancer Pool. \n @dev Only the Governor can call this function. \n @dev It emits a `BalancerPoolSet` event. \n @param balancerPool The address of Balancer Pool contract.\n @param valid The new validity status of a Balancer Pool.\n */\n function setValidBalancerPool(address balancerPool, bool valid) external;\n\n /**\n @dev Sets the paused/unpaused state of the protocol. \n @dev Only the Global Admin can call this function. \n @dev It emits a `ProtocolPaused` event. \n @param pause A boolean flag to switch externally facing functionality in the protocol on/off.\n */\n function setProtocolPause(bool pause) external;\n\n /**\n @dev Sets the validity of a PoolFactory. \n @dev Only the Governor can call this function. \n @param poolFactory The address of a PoolFactory.\n @param valid The new validity status of `poolFactory`.\n */\n function setValidPoolFactory(address poolFactory, bool valid) external;\n\n /**\n @dev Sets the validity of a LoanFactory. \n @dev Only the Governor can call this function. \n @param loanFactory The address of a LoanFactory.\n @param valid The new validity status of `loanFactory`.\n */\n function setValidLoanFactory(address loanFactory, bool valid) external;\n\n /**\n @dev Sets the validity of `subFactory` as it relates to `superFactory`. \n @dev Only the Governor can call this function. \n @param superFactory The core factory (e.g. PoolFactory, LoanFactory).\n @param subFactory The sub factory used by core factory (e.g. LiquidityLockerFactory).\n @param valid The new validity status of `subFactory` within context of `superFactory`.\n */\n function setValidSubFactory(address superFactory, address subFactory, bool valid) external;\n\n /**\n @dev Sets the path to swap an asset through Uniswap. \n @dev Only the Governor can call this function. \n @dev Set to == mid to enable a bilateral swap (single path swap). \n @dev Set to != mid to enable a triangular swap (multi path swap). \n @param from The address of the asset being swapped.\n @param to The address of the final asset to receive.\n @param mid The intermediary asset for swaps, if any.\n */\n function setDefaultUniswapPath(address from, address to, address mid) external;\n\n /**\n @dev Sets the validity of a Pool Delegate (those allowed to create Pools). \n @dev Only the Governor can call this function. \n @dev It emits a `PoolDelegateSet` event. \n @param poolDelegate The address to manage permissions for.\n @param valid The new validity status of a Pool Delegate.\n */\n function setPoolDelegateAllowlist(address poolDelegate, bool valid) external;\n\n /**\n @dev Sets the validity of an asset for collateral. \n @dev Only the Governor can call this function. \n @dev It emits a `CollateralAssetSet` event. \n @param asset The asset to assign validity to.\n @param valid The new validity status of a Collateral Asset.\n */\n function setCollateralAsset(address asset, bool valid) external;\n\n /**\n @dev Sets the validity of an asset for liquidity in Pools. \n @dev Only the Governor can call this function. \n @dev It emits a `LiquidityAssetSet` event. \n @param asset The asset to assign validity to.\n @param valid The new validity status a Liquidity Asset in Pools.\n */\n function setLiquidityAsset(address asset, bool valid) external;\n\n /**\n @dev Sets the validity of a calculator contract. \n @dev Only the Governor can call this function. \n @param calc The Calculator address.\n @param valid The new validity status of a Calculator.\n */\n function setCalc(address calc, bool valid) external;\n\n /**\n @dev Sets the investor fee (in basis points). \n @dev Only the Governor can call this function. \n @dev It emits a `GlobalsParamSet` event. \n @param _fee The fee, e.g., 50 = 0.50%.\n */\n function setInvestorFee(uint256 _fee) external;\n\n /**\n @dev Sets the treasury fee (in basis points). \n @dev Only the Governor can call this function. \n @dev It emits a `GlobalsParamSet` event. \n @param _fee The fee, e.g., 50 = 0.50%.\n */\n function setTreasuryFee(uint256 _fee) external;\n\n /**\n @dev Sets the MapleTreasury. \n @dev Only the Governor can call this function. \n @dev It emits a `GlobalsParamSet` event. \n @param _mapleTreasury A new MapleTreasury address.\n */\n function setMapleTreasury(address _mapleTreasury) external;\n\n /**\n @dev Sets the default grace period. \n @dev Only the Governor can call this function. \n @dev It emits a `GlobalsParamSet` event. \n @param _defaultGracePeriod The new number of seconds to set the grace period to.\n */\n function setDefaultGracePeriod(uint256 _defaultGracePeriod) external;\n\n /**\n @dev Sets the minimum Loan equity. \n @dev Only the Governor can call this function. \n @dev It emits a `GlobalsParamSet` event. \n @param _minLoanEquity The new minimum percentage of Loan equity an account must have to trigger liquidations.\n */\n function setMinLoanEquity(uint256 _minLoanEquity) external;\n\n /**\n @dev Sets the funding period. \n @dev Only the Governor can call this function. \n @dev It emits a `GlobalsParamSet` event. \n @param _fundingPeriod The number of seconds to set the drawdown grace period to.\n */\n function setFundingPeriod(uint256 _fundingPeriod) external;\n\n /**\n @dev Sets the the minimum Pool cover required to finalize a Pool. \n @dev Only the Governor can call this function. \n @dev It emits a `GlobalsParamSet` event. \n @param amt The new minimum swap out required.\n */\n function setSwapOutRequired(uint256 amt) external;\n\n /**\n @dev Sets a price feed's oracle. \n @dev Only the Governor can call this function. \n @dev It emits a `OracleSet` event. \n @param asset The asset to update price for.\n @param oracle The new Oracle to use for the price of `asset`.\n */\n function setPriceOracle(address asset, address oracle) external;\n\n /**\n @dev Sets a new Pending Governor. \n @dev This address can become Governor if they accept. \n @dev Only the Governor can call this function. \n @dev It emits a `PendingGovernorSet` event. \n @param _pendingGovernor The address of a new Pending Governor.\n */\n function setPendingGovernor(address _pendingGovernor) external;\n\n /**\n @dev Accept the Governor position. \n @dev Only the Pending Governor can call this function. \n @dev It emits a `GovernorAccepted` event. \n */\n function acceptGovernor() external;\n\n /**\n @dev Fetch price for asset from Chainlink oracles.\n @param asset The asset to fetch the price of.\n @return The price of asset in USD.\n */\n function getLatestPrice(address asset) external view returns (uint256);\n\n /**\n @dev Checks that a `subFactory` is valid as it relates to `superFactory`.\n @param superFactory The core factory (e.g. PoolFactory, LoanFactory).\n @param subFactory The sub factory used by core factory (e.g. LiquidityLockerFactory).\n @param factoryType The type expected for the subFactory. \n 0 = COLLATERAL_LOCKER_FACTORY, \n 1 = DEBT_LOCKER_FACTORY, \n 2 = FUNDING_LOCKER_FACTORY, \n 3 = LIQUIDITY_LOCKER_FACTORY, \n 4 = STAKE_LOCKER_FACTORY. \n */\n function isValidSubFactory(address superFactory, address subFactory, uint8 factoryType) external view returns (bool);\n\n /**\n @dev Checks that a Calculator is valid.\n @param calc The Calculator address.\n @param calcType The Calculator type.\n */\n function isValidCalc(address calc, uint8 calcType) external view returns (bool);\n\n /**\n @dev Returns the `lpCooldownPeriod` and `lpWithdrawWindow` as a tuple, for convenience.\n @return The value of `lpCooldownPeriod`.\n @return The value of `lpWithdrawWindow`.\n */\n function getLpCooldownParams() external view returns (uint256, uint256);\n\n}\n\n////// contracts/core/oracle/v1/interfaces/IOracle.sol\n/* pragma solidity 0.6.11; */\n\n/// @title Oracle is a price oracle feed.\ninterface IOracle {\n\n /**\n @dev Returns the price of the asset.\n */\n function getLatestPrice() external view returns (int256);\n\n}\n\n////// contracts/external-interfaces/IChainlinkAggregatorV3.sol\n/* pragma solidity 0.6.11; */\n\ninterface IChainlinkAggregatorV3 {\n\n function decimals() external view returns (uint8);\n function description() external view returns (string memory);\n function version() external view returns (uint256);\n\n // getRoundData and latestRoundData should both raise \"No data present\"\n // if they do not have data to report, instead of returning unset values,\n // which could be misinterpreted as actual reported values.\n\n function getRoundData(uint80 _roundId)\n external\n view\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n );\n\n function latestRoundData()\n external\n view\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n );\n\n}\n\n////// contracts/core/chainlink-oracle/v1/interfaces/IChainlinkOracle.sol\n/* pragma solidity 0.6.11; */\n\n/* import { IChainlinkAggregatorV3 } from \"../../../../external-interfaces/IChainlinkAggregatorV3.sol\"; */\n\n/* import { IMapleGlobals } from \"../../../globals/v1/interfaces/IMapleGlobals.sol\"; */\n/* import { IOracle } from \"../../../oracle/v1/interfaces/IOracle.sol\"; */\n\n/// @title ChainlinkOracle is a wrapper contract for Chainlink oracle price feeds that allows for manual price feed overrides.\ninterface IChainlinkOracle is IOracle {\n\n /**\n @dev Emits an event indicating that the price feed aggregator has changed from `_oldMedianizer` to `_newMedianizer`.\n @param _newMedianizer The new price feed aggregator.\n @param _oldMedianizer The old price feed aggregator.\n */\n event ChangeAggregatorFeed(address _newMedianizer, address _oldMedianizer);\n\n /**\n @dev Emits an event indicating that the price has been updated manually from `_oldPrice` to `_newPrice`.\n @param _oldPrice The old price.\n @param _newPrice The new price.\n */\n event SetManualPrice(int256 _oldPrice, int256 _newPrice);\n\n /**\n @dev Emits an event indicating whether manual price overriding is enabled.\n @param _override The state of manual price overriding.\n */\n event SetManualOverride(bool _override);\n\n /**\n @dev The Chainlink Aggregator V3 price feed.\n */\n function priceFeed() external view returns (IChainlinkAggregatorV3);\n\n /**\n @dev The MapleGlobals.\n */\n function globals() external view returns (IMapleGlobals);\n\n /**\n @dev The address of the asset token contract.\n */\n function assetAddress() external view returns (address);\n\n /**\n @dev Whether the price is manually overridden.\n */\n function manualOverride() external view returns (bool);\n\n /**\n @dev The manually overridden price.\n */\n function manualPrice() external view returns (int256);\n\n /**\n @return The latest price.\n */\n function getLatestPrice() external override view returns (int256);\n\n /**\n @dev Updates the aggregator address to `aggregator`. \n @dev Only the contract Owner can call this function. \n @dev It emits a `ChangeAggregatorFeed` event. \n @param aggregator The address of a Chainlink aggregator.\n */\n function changeAggregator(address aggregator) external;\n\n /**\n @return The address of the oracled currency (0x0 for ETH).\n */\n function getAssetAddress() external view returns (address);\n\n /**\n @return The denomination of the price.\n */\n function getDenomination() external pure returns (bytes32);\n\n /**\n @dev Sets a manual price. \n @dev Only the contract Owner can call this function. \n @dev This can only be used if manualOverride == true. \n @dev It emits a `SetManualPrice` event. \n @param _price Price to set.\n */\n function setManualPrice(int256 _price) external;\n\n /**\n @dev Sets manual override, allowing for manual price setting. \n @dev Only the contract Owner can call this function. \n @dev It emits a `SetManualOverride` event. \n @param _override Whether manual override price should be used.\n */\n function setManualOverride(bool _override) external;\n\n}\n\n////// lib/openzeppelin-contracts/contracts/GSN/Context.sol\n/* pragma solidity >=0.6.0 <0.8.0; */\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with GSN meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address payable) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes memory) {\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\n }\n}\n\n////// lib/openzeppelin-contracts/contracts/access/Ownable.sol\n/* pragma solidity >=0.6.0 <0.8.0; */\n\n/* import \"../GSN/Context.sol\"; */\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor () internal {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n}\n\n////// contracts/core/chainlink-oracle/v1/ChainlinkOracle.sol\n/* pragma solidity 0.6.11; */\n\n/* import { Ownable } from \"../../../../lib/openzeppelin-contracts/contracts/access/Ownable.sol\"; */\n\n/* import { IChainlinkAggregatorV3 } from \"../../../external-interfaces/IChainlinkAggregatorV3.sol\"; */\n\n/* import { IMapleGlobals } from \"../../globals/v1/interfaces/IMapleGlobals.sol\"; */\n\n/* import { IChainlinkOracle } from \"./interfaces/IChainlinkOracle.sol\"; */\n\n/// @title ChainlinkOracle is a wrapper contract for Chainlink oracle price feeds that allows for manual price feed overrides.\ncontract ChainlinkOracle is IChainlinkOracle, Ownable {\n\n IChainlinkAggregatorV3 public override priceFeed;\n IMapleGlobals public override globals;\n\n address public override immutable assetAddress;\n\n bool public override manualOverride;\n int256 public override manualPrice;\n\n /**\n @dev Creates a new Chainlink based oracle.\n @param _aggregator Address of Chainlink aggregator.\n @param _assetAddress Address of currency (0x0 for ETH).\n @param _owner Address of the owner of the contract.\n */\n constructor(address _aggregator, address _assetAddress, address _owner) public {\n require(_aggregator != address(0), \"CO:ZERO_AGGREGATOR_ADDR\");\n priceFeed = IChainlinkAggregatorV3(_aggregator);\n assetAddress = _assetAddress;\n transferOwnership(_owner);\n }\n\n function getLatestPrice() public override view returns (int256) {\n if (manualOverride) return manualPrice;\n (uint80 roundID, int256 price,,uint256 timeStamp, uint80 answeredInRound) = priceFeed.latestRoundData();\n\n require(timeStamp != 0, \"CO:ROUND_NOT_COMPLETE\");\n require(answeredInRound >= roundID, \"CO:STALE_DATA\");\n require(price != int256(0), \"CO:ZERO_PRICE\");\n return price;\n }\n\n function changeAggregator(address aggregator) external override onlyOwner {\n require(aggregator != address(0), \"CO:ZERO_AGGREGATOR_ADDR\");\n emit ChangeAggregatorFeed(aggregator, address(priceFeed));\n priceFeed = IChainlinkAggregatorV3(aggregator);\n }\n\n function getAssetAddress() external override view returns (address) {\n return assetAddress;\n }\n\n function getDenomination() external override pure returns (bytes32) {\n // All Chainlink oracles are denominated in USD.\n return bytes32(\"USD\");\n }\n\n function setManualPrice(int256 _price) public override onlyOwner {\n require(manualOverride, \"CO:MANUAL_OVERRIDE_NOT_ACTIVE\");\n emit SetManualPrice(manualPrice, _price);\n manualPrice = _price;\n }\n\n function setManualOverride(bool _override) public override onlyOwner {\n manualOverride = _override;\n emit SetManualOverride(_override);\n }\n\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers"
],
"": [
"ast"
]
}
}
}
},
"output": {
"contracts": {
"contracts/core/chainlink-oracle/v1/ChainlinkOracle.sol": {
"ChainlinkOracle": {
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "_aggregator",
"type": "address"
},
{
"internalType": "address",
"name": "_assetAddress",
"type": "address"
},
{
"internalType": "address",
"name": "_owner",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "_newMedianizer",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "_oldMedianizer",
"type": "address"
}
],
"name": "ChangeAggregatorFeed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "bool",
"name": "_override",
"type": "bool"
}
],
"name": "SetManualOverride",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "int256",
"name": "_oldPrice",
"type": "int256"
},
{
"indexed": false,
"internalType": "int256",
"name": "_newPrice",
"type": "int256"
}
],
"name": "SetManualPrice",
"type": "event"
},
{
"inputs": [],
"name": "assetAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "aggregator",
"type": "address"
}
],
"name": "changeAggregator",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "getAssetAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getDenomination",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "getLatestPrice",
"outputs": [
{
"internalType": "int256",
"name": "",
"type": "int256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "globals",
"outputs": [
{
"internalType": "contract IMapleGlobals",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "manualOverride",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "manualPrice",
"outputs": [
{
"internalType": "int256",
"name": "",
"type": "int256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "priceFeed",
"outputs": [
{
"internalType": "contract IChainlinkAggregatorV3",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bool",
"name": "_override",
"type": "bool"
}
],
"name": "setManualOverride",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "int256",
"name": "_price",
"type": "int256"
}
],
"name": "setManualPrice",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"evm": {
"bytecode": {
"linkReferences": {},
"object": "60a060405234801561001057600080fd5b50604051610bbb380380610bbb8339818101604052606081101561003357600080fd5b508051602082015160409092015190919060006100576001600160e01b0361012816565b600080546001600160a01b0319166001600160a01b038316908117825560405192935091600080516020610b9b833981519152908290a3506001600160a01b0383166100ea576040805162461bcd60e51b815260206004820152601760248201527f434f3a5a45524f5f41474752454741544f525f41444452000000000000000000604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b038516179055606082901b6001600160601b0319166080526101208161012c565b50505061022d565b3390565b61013d6001600160e01b0361012816565b6000546001600160a01b0390811691161461019f576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166101e45760405162461bcd60e51b8152600401808060200182810382526026815260200180610b756026913960400191505060405180910390fd5b600080546040516001600160a01b0380851693921691600080516020610b9b83398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60805160601c61092661024f6000398061020d52806103df52506109266000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063bae6d62b11610066578063bae6d62b1461019b578063c3124525146101b7578063e57f3e25146101bf578063f2fde38b146101e5576100ea565b80638da5cb5b146101835780638e15f4731461018b578063a2c9d63014610193576100ea565b80635f78445d116100c85780635f78445d1461014e578063670ab5e91461016b578063715018a614610173578063741bef1a1461017b576100ea565b80631ba46cfd146100ef5780631fc601c914610113578063359675011461012d575b600080fd5b6100f761020b565b604080516001600160a01b039092168252519081900360200190f35b61011b61022f565b60408051918252519081900360200190f35b61014c6004803603602081101561014357600080fd5b5035151561023a565b005b61014c6004803603602081101561016457600080fd5b50356102e5565b6100f76103dd565b61014c610401565b6100f76104a3565b6100f76104b2565b61011b6104c1565b61011b61066c565b6101a3610672565b604080519115158252519081900360200190f35b6100f7610682565b61014c600480360360208110156101d557600080fd5b50356001600160a01b0316610691565b61014c600480360360208110156101fb57600080fd5b50356001600160a01b03166107ae565b7f000000000000000000000000000000000000000000000000000000000000000081565b621554d160ea1b5b90565b6102426108a6565b6000546001600160a01b03908116911614610292576040805162461bcd60e51b815260206004820181905260248201526000805160206108d1833981519152604482015290519081900360640190fd5b60028054821515600160a01b810260ff60a01b199092169190911790915560408051918252517f04baa8606d8ce0d9f3ff26f474e838ccfdb363859c901d90d3e6a28011e6a9319181900360200190a150565b6102ed6108a6565b6000546001600160a01b0390811691161461033d576040805162461bcd60e51b815260206004820181905260248201526000805160206108d1833981519152604482015290519081900360640190fd5b600254600160a01b900460ff1661039b576040805162461bcd60e51b815260206004820152601d60248201527f434f3a4d414e55414c5f4f564552524944455f4e4f545f414354495645000000604482015290519081900360640190fd5b600354604080519182526020820183905280517f9adbc4d17189bdc20df3fce730fc450b08118a5cbfadf505324ae66d45a454299281900390910190a1600355565b7f000000000000000000000000000000000000000000000000000000000000000090565b6104096108a6565b6000546001600160a01b03908116911614610459576040805162461bcd60e51b815260206004820181905260248201526000805160206108d1833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6001546001600160a01b031681565b6000546001600160a01b031690565b600254600090600160a01b900460ff16156104df5750600354610237565b600080600080600160009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561053357600080fd5b505afa158015610547573d6000803e3d6000fd5b505050506040513d60a081101561055d57600080fd5b5080516020820151606083015160809093015191965094509092509050816105c4576040805162461bcd60e51b8152602060048201526015602482015274434f3a524f554e445f4e4f545f434f4d504c45544560581b604482015290519081900360640190fd5b8369ffffffffffffffffffff168169ffffffffffffffffffff161015610621576040805162461bcd60e51b815260206004820152600d60248201526c434f3a5354414c455f4441544160981b604482015290519081900360640190fd5b82610663576040805162461bcd60e51b815260206004820152600d60248201526c434f3a5a45524f5f505249434560981b604482015290519081900360640190fd5b50909250505090565b60035481565b600254600160a01b900460ff1681565b6002546001600160a01b031681565b6106996108a6565b6000546001600160a01b039081169116146106e9576040805162461bcd60e51b815260206004820181905260248201526000805160206108d1833981519152604482015290519081900360640190fd5b6001600160a01b038116610744576040805162461bcd60e51b815260206004820152601760248201527f434f3a5a45524f5f41474752454741544f525f41444452000000000000000000604482015290519081900360640190fd5b600154604080516001600160a01b038085168252909216602083015280517f766a6b8d2dc2bd8f9cf9c70fc734c08a8f6beec4ca859964ad0c0f60242edd6a9281900390910190a1600180546001600160a01b0319166001600160a01b0392909216919091179055565b6107b66108a6565b6000546001600160a01b03908116911614610806576040805162461bcd60e51b815260206004820181905260248201526000805160206108d1833981519152604482015290519081900360640190fd5b6001600160a01b03811661084b5760405162461bcd60e51b81526004018080602001828103825260268152602001806108ab6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b339056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a264697066735822122078d0171fdf827e3f80a5b9d7f121cf3d2367dc24760f22b8583882e555068e2364736f6c634300060b00334f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573738be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0",
"opcodes": "PUSH1 0xA0 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0xBBB CODESIZE SUB DUP1 PUSH2 0xBBB DUP4 CODECOPY DUP2 DUP2 ADD PUSH1 0x40 MSTORE PUSH1 0x60 DUP2 LT ISZERO PUSH2 0x33 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP DUP1 MLOAD PUSH1 0x20 DUP3 ADD MLOAD PUSH1 0x40 SWAP1 SWAP3 ADD MLOAD SWAP1 SWAP2 SWAP1 PUSH1 0x0 PUSH2 0x57 PUSH1 0x1 PUSH1 0x1 PUSH1 0xE0 SHL SUB PUSH2 0x128 AND JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB NOT AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP4 AND SWAP1 DUP2 OR DUP3 SSTORE PUSH1 0x40 MLOAD SWAP3 SWAP4 POP SWAP2 PUSH1 0x0 DUP1 MLOAD PUSH1 0x20 PUSH2 0xB9B DUP4 CODECOPY DUP2 MLOAD SWAP2 MSTORE SWAP1 DUP3 SWAP1 LOG3 POP PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP4 AND PUSH2 0xEA JUMPI PUSH1 0x40 DUP1 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x17 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x434F3A5A45524F5F41474752454741544F525F41444452000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB NOT AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP6 AND OR SWAP1 SSTORE PUSH1 0x60 DUP3 SWAP1 SHL PUSH1 0x1 PUSH1 0x1 PUSH1 0x60 SHL SUB NOT AND PUSH1 0x80 MSTORE PUSH2 0x120 DUP2 PUSH2 0x12C JUMP JUMPDEST POP POP POP PUSH2 0x22D JUMP JUMPDEST CALLER SWAP1 JUMP JUMPDEST PUSH2 0x13D PUSH1 0x1 PUSH1 0x1 PUSH1 0xE0 SHL SUB PUSH2 0x128 AND JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 DUP2 AND SWAP2 AND EQ PUSH2 0x19F JUMPI PUSH1 0x40 DUP1 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD DUP2 SWAP1 MSTORE PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F776E61626C653A2063616C6C6572206973206E6F7420746865206F776E6572 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND PUSH2 0x1E4 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x4 ADD DUP1 DUP1 PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE PUSH1 0x26 DUP2 MSTORE PUSH1 0x20 ADD DUP1 PUSH2 0xB75 PUSH1 0x26 SWAP2 CODECOPY PUSH1 0x40 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH1 0x40 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP1 DUP6 AND SWAP4 SWAP3 AND SWAP2 PUSH1 0x0 DUP1 MLOAD PUSH1 0x20 PUSH2 0xB9B DUP4 CODECOPY DUP2 MLOAD SWAP2 MSTORE SWAP2 LOG3 PUSH1 0x0 DUP1 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB NOT AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP3 SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE JUMP JUMPDEST PUSH1 0x80 MLOAD PUSH1 0x60 SHR PUSH2 0