|
{
|
|
"language": "Solidity",
|
|
"sources": {
|
|
"contracts/SmtPriceFeed.sol": {
|
|
"content": "//SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.7.0;\n\nimport \"@openzeppelin/contracts/math/SafeMath.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@chainlink/contracts/src/v0.7/interfaces/AggregatorV2V3Interface.sol\";\nimport \"./interfaces/IBPool.sol\";\nimport \"./interfaces/IBRegistry.sol\";\nimport \"./interfaces/IEurPriceFeedForSmtPriceFeed.sol\";\nimport \"./interfaces/IXTokenWrapper.sol\";\n\ninterface IDecimals {\n function decimals() external view returns (uint8);\n}\n\n/**\n * @title SmtPriceFeed\n * @author Protofire\n * @dev Contract module to retrieve SMT price per asset.\n */\ncontract SmtPriceFeed is Ownable {\n using SafeMath for uint256;\n\n // uint256 public constant decimals = 18;\n uint256 public constant ONE_BASE18 = 10**18;\n address public immutable USDC_ADDRESS;\n uint256 public immutable ONE_ON_USDC;\n\n /// @dev Address smtTokenAddress\n address public smtTokenAddress;\n /// @dev Address of BRegistry\n IBRegistry public registry;\n /// @dev Address of EurPriceFeed module\n IEurPriceFeedForSmtPriceFeed public eurPriceFeed;\n /// @dev Address of XTokenWrapper module\n IXTokenWrapper public xTokenWrapper;\n /// @dev price of SMT measured in WETH stored, used to decouple price querying and calculating\n uint256 public currentPrice;\n\n /**\n * @dev Emitted when `registry` address is set.\n */\n event RegistrySet(address registry);\n\n /**\n * @dev Emitted when `eurPriceFeed` address is set.\n */\n event EurPriceFeedSet(address eurPriceFeed);\n\n /**\n * @dev Emitted when `smtTokenAddress` address is set.\n */\n event SmtSet(address smtTokenAddress);\n\n /**\n * @dev Emitted when `xTokenWrapper` address is set.\n */\n event XTokenWrapperSet(address xTokenWrapper);\n\n /**\n * @dev Emitted when someone executes computePrice.\n */\n event PriceComputed(address caller, uint256 price);\n\n modifier onlyValidAsset(address _asset) {\n require(xTokenWrapper.xTokenToToken(_asset) != address(0), \"invalid asset\");\n _;\n }\n\n /**\n * @dev Sets the values for {registry}, {eurPriceFeed} {smtTokenAddress} and {xTokenWrapper} and {USDC_ADDRESS}.\n *\n * Sets ownership to the account that deploys the contract.\n *\n */\n constructor(\n address _registry,\n address _eurPriceFeed,\n address _smt,\n address _xTokenWrapper,\n address _usdcAddress\n ) {\n _setRegistry(_registry);\n _setEurPriceFeed(_eurPriceFeed);\n _setSmt(_smt);\n _setXTokenWrapper(_xTokenWrapper);\n\n require(_usdcAddress != address(0), \"err: _usdcAddress is ZERO address\");\n USDC_ADDRESS = _usdcAddress;\n uint8 usdcDecimals = IDecimals(_usdcAddress).decimals();\n ONE_ON_USDC = 10**usdcDecimals;\n }\n\n /**\n * @dev Sets `_registry` as the new registry.\n *\n * Requirements:\n *\n * - the caller must be the owner.\n * - `_registry` should not be the zero address.\n *\n * @param _registry The address of the registry.\n */\n function setRegistry(address _registry) external onlyOwner {\n _setRegistry(_registry);\n }\n\n /**\n * @dev Sets `_eurPriceFeed` as the new EurPriceFeed.\n *\n * Requirements:\n *\n * - the caller must be the owner.\n * - `_eurPriceFeed` should not be the zero address.\n *\n * @param _eurPriceFeed The address of the EurPriceFeed.\n */\n function setEurPriceFeed(address _eurPriceFeed) external onlyOwner {\n _setEurPriceFeed(_eurPriceFeed);\n }\n\n /**\n * @dev Sets `_smt` as the new Smt.\n *\n * Requirements:\n *\n * - the caller must be the owner.\n * - `_smt` should not be the zero address.\n *\n * @param _smt The address of the Smt.\n */\n function setSmt(address _smt) external onlyOwner {\n _setSmt(_smt);\n }\n\n /**\n * @dev Sets `_xTokenWrapper` as the new xTokenWrapper.\n *\n * Requirements:\n *\n * - the caller must be the owner.\n * - `_xTokenWrapper` should not be the zero address.\n *\n * @param _xTokenWrapper The address of the xTokenWrapper.\n */\n function setXTokenWrapper(address _xTokenWrapper) external onlyOwner {\n _setXTokenWrapper(_xTokenWrapper);\n }\n\n /**\n * @dev Sets `_registry` as the new registry.\n *\n * Requirements:\n *\n * - `_registry` should not be the zero address.\n *\n * @param _registry The address of the registry.\n */\n function _setRegistry(address _registry) internal {\n require(_registry != address(0), \"registry is the zero address\");\n emit RegistrySet(_registry);\n registry = IBRegistry(_registry);\n }\n\n /**\n * @dev Sets `_eurPriceFeed` as the new EurPriceFeed.\n *\n * Requirements:\n *\n * - `_eurPriceFeed` should not be the zero address.\n *\n * @param _eurPriceFeed The address of the EurPriceFeed.\n */\n function _setEurPriceFeed(address _eurPriceFeed) internal {\n require(_eurPriceFeed != address(0), \"eurPriceFeed is the zero address\");\n emit EurPriceFeedSet(_eurPriceFeed);\n eurPriceFeed = IEurPriceFeedForSmtPriceFeed(_eurPriceFeed);\n }\n\n /**\n * @dev Sets `_smt` as the new Smt.\n *\n * Requirements:\n *\n * - `_smt` should not be the zero address.\n *\n * @param _smtTokenAddress The address of the Smt.\n */\n function _setSmt(address _smtTokenAddress) internal {\n require(_smtTokenAddress != address(0), \"smtTokenAddress is the zero address\");\n emit SmtSet(_smtTokenAddress);\n smtTokenAddress = _smtTokenAddress;\n }\n\n /**\n * @dev Sets `_xTokenWrapper` as the new xTokenWrapper.\n *\n * Requirements:\n *\n * - `_xTokenWrapper` should not be the zero address.\n *\n * @param _xTokenWrapper The address of the xTokenWrapper.\n */\n function _setXTokenWrapper(address _xTokenWrapper) internal {\n require(_xTokenWrapper != address(0), \"xTokenWrapper is the zero address\");\n emit XTokenWrapperSet(_xTokenWrapper);\n xTokenWrapper = IXTokenWrapper(_xTokenWrapper);\n }\n\n /**\n * @dev Gets the price of `_asset` in SMT.\n *\n * @param _asset address of asset to get the price.\n */\n function getPrice(address _asset) external view onlyValidAsset(_asset) returns (uint256) {\n uint8 assetDecimals = IDecimals(_asset).decimals();\n return calculateAmount(_asset, 10**assetDecimals);\n }\n\n /**\n * @dev Gets how many SMT represents the `_amount` of `_asset`.\n *\n * @param _asset address of asset to get the amount.\n * @param _assetAmountIn amount of `_asset` should be on asset digits\n * response should be on base 18 as it represent xSMT which is base 18\n */\n function calculateAmount(address _asset, uint256 _assetAmountIn)\n public\n view\n onlyValidAsset(_asset)\n returns (uint256)\n {\n // get the xSmt to search the pools\n address xSMT = xTokenWrapper.tokenToXToken(smtTokenAddress);\n\n // if _asset is xSMT, don't modify the token amount\n if (_asset == xSMT) {\n return _assetAmountIn;\n }\n\n // get amount from the pools if the asset/xSMT pair exists\n // how many xSMT are needed to buy the entered qty of asset\n uint256 amount = getAvgAmountFromPools(_asset, xSMT, _assetAmountIn);\n\n // no pool with xSMT/asset pair\n // calculate base on xSMT/xUSDC pool and Asset/USD external price feed\n if (amount == 0) {\n // to get pools including the xUSDC / xSMT\n address xUSDC = xTokenWrapper.tokenToXToken(USDC_ADDRESS);\n\n // how many xSMT are needed to buy 1 xUSDC\n // response in base 18\n uint256 xUsdcForSmtAmount = getAvgAmountFromPools(xUSDC, xSMT, ONE_ON_USDC);\n require(xUsdcForSmtAmount > 0, \"no xUSDC/xSMT pool to get _asset price\");\n\n // get EUR price for asset for the entered amount (18 digits)\n uint256 eurAmountForAsset = eurPriceFeed.calculateAmount(_asset, _assetAmountIn);\n if (eurAmountForAsset == 0) {\n return 0;\n }\n\n uint256 eurPriceFeedDecimals = eurPriceFeed.RETURN_DIGITS_BASE18();\n // EUR/USD feed. It returs how many USD is 1 EUR.\n address eurUsdFeedAddress = eurPriceFeed.eurUsdFeed();\n\n // get how many USD is 1 EUR (8 digits)\n // convert the amount to 18 digits\n uint256 eurUsdDecimals = AggregatorV2V3Interface(eurUsdFeedAddress).decimals();\n int256 amountUsdToGetEur = AggregatorV2V3Interface(eurUsdFeedAddress).latestAnswer();\n if (amountUsdToGetEur == 0) {\n return 0;\n }\n uint256 amountUsdToGetEur18 = uint256(amountUsdToGetEur).mul(\n 10**(eurPriceFeedDecimals.sub(eurUsdDecimals))\n );\n\n // convert the eurAmountForAsset in USDC\n uint256 assetAmountInUSD = amountUsdToGetEur18.mul(eurAmountForAsset).div(ONE_BASE18);\n\n // having the entered amount of the asset in USD\n // having how much xSMT are needed to buy 1 USDC\n // multiply those qtys\n // the result should be how many xSMT are needed for the entered amount\n amount = assetAmountInUSD.mul(xUsdcForSmtAmount).div(ONE_BASE18);\n }\n return amount;\n }\n\n /**\n * @dev Gets SMT/USDC based on the last executiong of computePrice.\n *\n * To be consume by EurPriceFeed module as the `assetFeed` from xSMT.\n */\n function latestAnswer() external view returns (int256) {\n return int256(currentPrice);\n }\n\n /**\n * @dev Computes xSMT/xUSDC based on the avg price from pools containig the pair.\n *\n * To be consume by EurPriceFeed module as the `assetFeed` from xSMT.\n */\n function computePrice() public {\n // pools will include the wrapepd SMT and xUSDC\n // how much xUSDC are needed to buy xSmt\n currentPrice = getAvgAmountFromPools(\n xTokenWrapper.tokenToXToken(smtTokenAddress),\n xTokenWrapper.tokenToXToken(USDC_ADDRESS),\n ONE_BASE18\n );\n\n emit PriceComputed(msg.sender, currentPrice);\n }\n\n function getAvgAmountFromPools(\n address _assetIn,\n address _assetOut,\n uint256 _assetAmountIn\n ) internal view returns (uint256) {\n address[] memory poolAddresses = registry.getBestPoolsWithLimit(_assetIn, _assetOut, 10);\n\n uint256 totalAmount;\n uint256 totalQty = 0;\n uint256 singlePoolOutGivenIn = 0;\n for (uint256 i = 0; i < poolAddresses.length; i++) {\n singlePoolOutGivenIn = calcOutGivenIn(poolAddresses[i], _assetIn, _assetOut, _assetAmountIn);\n\n if (singlePoolOutGivenIn > 0) {\n totalQty = totalQty.add(1);\n totalAmount = totalAmount.add(singlePoolOutGivenIn);\n }\n }\n uint256 amountToReturn = 0;\n if (totalAmount > 0 && totalQty > 0) {\n amountToReturn = totalAmount.div(totalQty);\n }\n\n return amountToReturn;\n }\n\n function calcOutGivenIn(\n address poolAddress,\n address _assetIn,\n address _assetOut,\n uint256 _assetAmountIn\n ) internal view returns (uint256) {\n IBPool pool = IBPool(poolAddress);\n uint256 tokenBalanceIn = pool.getBalance(_assetIn);\n uint256 tokenBalanceOut = pool.getBalance(_assetOut);\n\n if (tokenBalanceIn == 0 || tokenBalanceOut == 0) {\n return 0;\n } else {\n uint256 tokenWeightIn = pool.getDenormalizedWeight(_assetIn);\n uint256 tokenWeightOut = pool.getDenormalizedWeight(_assetOut);\n uint256 amount = pool.calcOutGivenIn(\n tokenBalanceIn,\n tokenWeightIn,\n tokenBalanceOut,\n tokenWeightOut,\n _assetAmountIn,\n 0\n );\n return amount;\n }\n }\n}\n"
|
|
},
|
|
"@openzeppelin/contracts/math/SafeMath.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0;\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\n * checks.\n *\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\n * in bugs, because programmers usually assume that an overflow raises an\n * error, which is the standard behavior in high level programming languages.\n * `SafeMath` restores this intuition by reverting the transaction when an\n * operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n\n /**\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, \"SafeMath: addition overflow\");\n return c;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a, \"SafeMath: subtraction overflow\");\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) return 0;\n uint256 c = a * b;\n require(c / a == b, \"SafeMath: multiplication overflow\");\n return c;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b > 0, \"SafeMath: division by zero\");\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b > 0, \"SafeMath: modulo by zero\");\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n return a - b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryDiv}.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n return a % b;\n }\n}\n"
|
|
},
|
|
"@openzeppelin/contracts/access/Ownable.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0;\n\nimport \"../utils/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 () {\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 virtual 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"
|
|
},
|
|
"@chainlink/contracts/src/v0.7/interfaces/AggregatorV2V3Interface.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.7.0;\n\nimport \"./AggregatorInterface.sol\";\nimport \"./AggregatorV3Interface.sol\";\n\ninterface AggregatorV2V3Interface is AggregatorInterface, AggregatorV3Interface\n{\n}\n"
|
|
},
|
|
"contracts/interfaces/IBPool.sol": {
|
|
"content": "//SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.7.0;\n\n/**\n * @title IBPool\n * @author Protofire\n * @dev Balancer BPool contract interface.\n *\n */\ninterface IBPool {\n function getDenormalizedWeight(address token) external view returns (uint256);\n\n function getBalance(address token) external view returns (uint256);\n\n function calcOutGivenIn(\n uint256 tokenBalanceIn,\n uint256 tokenWeightIn,\n uint256 tokenBalanceOut,\n uint256 tokenWeightOut,\n uint256 tokenAmountIn,\n uint256 swapFee\n ) external pure returns (uint256 tokenAmountOut);\n}\n"
|
|
},
|
|
"contracts/interfaces/IBRegistry.sol": {
|
|
"content": "//SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.7.0;\n\n/**\n * @title IBRegistry\n * @author Protofire\n * @dev Balancer BRegistry contract interface.\n *\n */\n\ninterface IBRegistry {\n function getBestPoolsWithLimit(\n address fromToken,\n address destToken,\n uint256 limit\n ) external view returns (address[] memory);\n}\n"
|
|
},
|
|
"contracts/interfaces/IEurPriceFeedForSmtPriceFeed.sol": {
|
|
"content": "//SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.7.0;\n\n/**\n * @title IEurPriceFeedForSmtPriceFeed\n * @author Protofire\n * @dev Interface to be implemented by EurPriceFeed\n *\n */\ninterface IEurPriceFeedForSmtPriceFeed {\n /**\n * @dev Gets the return value digits\n */\n function RETURN_DIGITS_BASE18() external view returns (uint256);\n\n /**\n * @dev Gets the eurUsdFeed from EurPriceFeed\n */\n function eurUsdFeed() external view returns (address);\n\n /**\n * @dev Gets how many EUR represents the `_amount` of `_asset`.\n *\n * @param _asset address of asset to get the price.\n * @param _amount amount of `_asset`.\n */\n function calculateAmount(address _asset, uint256 _amount) external view returns (uint256);\n}\n"
|
|
},
|
|
"contracts/interfaces/IXTokenWrapper.sol": {
|
|
"content": "//SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.7.0;\n\n/**\n * @title IXTokenWrapper\n * @author Protofire\n * @dev XTokenWrapper Interface.\n *\n */\ninterface IXTokenWrapper {\n /**\n * @dev Token to xToken registry.\n */\n function tokenToXToken(address _token) external view returns (address);\n\n function xTokenToToken(address _token) external view returns (address);\n}\n"
|
|
},
|
|
"@openzeppelin/contracts/utils/Context.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\n\npragma 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"
|
|
},
|
|
"@chainlink/contracts/src/v0.7/interfaces/AggregatorInterface.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.7.0;\n\ninterface AggregatorInterface {\n function latestAnswer() external view returns (int256);\n function latestTimestamp() external view returns (uint256);\n function latestRound() external view returns (uint256);\n function getAnswer(uint256 roundId) external view returns (int256);\n function getTimestamp(uint256 roundId) external view returns (uint256);\n\n event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt);\n event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt);\n}\n"
|
|
},
|
|
"@chainlink/contracts/src/v0.7/interfaces/AggregatorV3Interface.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.7.0;\n\ninterface AggregatorV3Interface {\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 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 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"
|
|
}
|
|
},
|
|
"settings": {
|
|
"optimizer": {
|
|
"enabled": true,
|
|
"runs": 200
|
|
},
|
|
"outputSelection": {
|
|
"*": {
|
|
"*": [
|
|
"evm.bytecode",
|
|
"evm.deployedBytecode",
|
|
"devdoc",
|
|
"userdoc",
|
|
"metadata",
|
|
"abi"
|
|
]
|
|
}
|
|
},
|
|
"libraries": {}
|
|
}
|
|
} |