My Name Tag:
Not Available, login to update
Txn Hash | Method |
Block
|
From
|
To
|
Value | [Txn Fee] | ||
---|---|---|---|---|---|---|---|---|
0x079c8b0a488f00c734051900d44ef0c8f6a6e03c645e8960f1ac982aba2de9ad | Change Admin | 25616128 | 411 days 12 hrs ago | 0x9c259827aeb34c90a8c95ec2dad6ffcdbd88b388 | IN | Market Protocol: Chainlink Price Oracle V2 | 0 FTM | 0.00461563056 |
0x15b70cadb0a0a50ed61afae86d1233c36d6a509c287472610a7c3fcfcab2a91d | Set Price Feeds | 24876849 | 419 days 4 hrs ago | 0x9c259827aeb34c90a8c95ec2dad6ffcdbd88b388 | IN | Market Protocol: Chainlink Price Oracle V2 | 0 FTM | 0.128308998246 |
0xa9ccc64d3c9070941851e8719db699fc005770b6e54989e4233da23ba65b46fe | 0x60806040 | 24876346 | 419 days 5 hrs ago | 0x9c259827aeb34c90a8c95ec2dad6ffcdbd88b388 | IN | Create: ChainlinkPriceOracleV2 | 0 FTM | 0.271452281948 |
[ Download CSV Export ]
Latest 1 internal transaction
Parent Txn Hash | Block | From | To | Value | |||
---|---|---|---|---|---|---|---|
0xa9ccc64d3c9070941851e8719db699fc005770b6e54989e4233da23ba65b46fe | 24876346 | 419 days 5 hrs ago | 0x9c259827aeb34c90a8c95ec2dad6ffcdbd88b388 | Contract Creation | 0 FTM |
[ Download CSV Export ]
Contract Name:
ChainlinkPriceOracleV2
Compiler Version
v0.6.12+commit.27d51765
Optimization Enabled:
Yes with 1 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.6.12; import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "../external/compound/PriceOracle.sol"; import "../external/compound/CToken.sol"; import "../external/compound/CErc20.sol"; import "../external/chainlink/AggregatorV3Interface.sol"; import "./BasePriceOracle.sol"; /** * @title ChainlinkPriceOracleV2 * @notice Returns prices from Chainlink. * @dev Implements `PriceOracle`. */ contract ChainlinkPriceOracleV2 is PriceOracle, BasePriceOracle { using SafeMathUpgradeable for uint256; address public constant WETH = 0x74b23882a30290451A17c44f4F05243b6b58C76d; /** * @notice Maps ERC20 token addresses to ETH-based Chainlink price feed contracts. */ mapping(address => AggregatorV3Interface) public priceFeeds; /** * @notice Maps ERC20 token addresses to enums indicating the base currency of the feed. */ mapping(address => FeedBaseCurrency) public feedBaseCurrencies; /** * @notice Enum indicating the base currency of a Chainlink price feed. */ enum FeedBaseCurrency { ETH, USD } /** * @notice Chainlink ETH/USD price feed contracts. */ AggregatorV3Interface public constant ETH_USD_PRICE_FEED = AggregatorV3Interface(0x11DdD3d147E5b83D01cee7070027092397d63658); /** * @dev The administrator of this `MasterPriceOracle`. */ address public admin; /** * @dev Controls if `admin` can overwrite existing assignments of oracles to underlying tokens. */ bool public canAdminOverwrite; /** * @dev Constructor to set admin and canAdminOverwrite. */ constructor (address _admin, bool _canAdminOverwrite) public { admin = _admin; canAdminOverwrite = _canAdminOverwrite; } /** * @dev Changes the admin and emits an event. */ function changeAdmin(address newAdmin) external onlyAdmin { address oldAdmin = admin; admin = newAdmin; emit NewAdmin(oldAdmin, newAdmin); } /** * @dev Event emitted when `admin` is changed. */ event NewAdmin(address oldAdmin, address newAdmin); /** * @dev Modifier that checks if `msg.sender == admin`. */ modifier onlyAdmin { require(msg.sender == admin, "Sender is not the admin."); _; } /** * @dev Admin-only function to set price feeds. * @param underlyings Underlying token addresses for which to set price feeds. * @param feeds The Chainlink price feed contract addresses for each of `underlyings`. * @param baseCurrency The currency in which `feeds` are based. */ function setPriceFeeds(address[] memory underlyings, AggregatorV3Interface[] memory feeds, FeedBaseCurrency baseCurrency) external onlyAdmin { // Input validation require(underlyings.length > 0 && underlyings.length == feeds.length, "Lengths of both arrays must be equal and greater than 0."); // For each token/feed for (uint256 i = 0; i < underlyings.length; i++) { address underlying = underlyings[i]; // Check for existing oracle if !canAdminOverwrite if (!canAdminOverwrite) require(address(priceFeeds[underlying]) == address(0), "Admin cannot overwrite existing assignments of price feeds to underlying tokens."); // Set feed and base currency priceFeeds[underlying] = feeds[i]; feedBaseCurrencies[underlying] = baseCurrency; } } /** * @dev Internal function returning the price in ETH of `underlying`. */ function _price(address underlying) internal view returns (uint) { // Return 1e18 for WETH if (underlying == WETH) return 1e18; // Get token/ETH price from Chainlink AggregatorV3Interface feed = priceFeeds[underlying]; require(address(feed) != address(0), "No Chainlink price feed found for this underlying ERC20 token."); FeedBaseCurrency baseCurrency = feedBaseCurrencies[underlying]; if (baseCurrency == FeedBaseCurrency.ETH) { (, int256 tokenEthPrice, , , ) = feed.latestRoundData(); return tokenEthPrice >= 0 ? uint256(tokenEthPrice) : 0; } else if (baseCurrency == FeedBaseCurrency.USD) { (, int256 ethUsdPrice, , , ) = ETH_USD_PRICE_FEED.latestRoundData(); if (ethUsdPrice <= 0) return 0; (, int256 tokenUsdPrice, , , ) = feed.latestRoundData(); return tokenUsdPrice >= 0 ? uint256(tokenUsdPrice).mul(1e18).div(uint256(ethUsdPrice)) : 0; } } /** * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`). */ function price(address underlying) external override view returns (uint) { return _price(underlying); } /** * @notice Returns the price in ETH of the token underlying `cToken`. * @dev Implements the `PriceOracle` interface for Fuse pools (and Compound v2). * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`. */ function getUnderlyingPrice(CToken cToken) external override view returns (uint) { // Get underlying token address address underlying = CErc20(address(cToken)).underlying(); // Get price uint256 chainlinkPrice = _price(underlying); // Format and return price uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals()); return underlyingDecimals <= 18 ? uint256(chainlinkPrice).mul(10 ** (18 - underlyingDecimals)) : uint256(chainlinkPrice).div(10 ** (underlyingDecimals - 18)); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMathUpgradeable { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../../utils/ContextUpgradeable.sol"; import "./IERC20Upgradeable.sol"; import "../../math/SafeMathUpgradeable.sol"; import "../../proxy/Initializable.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable { using SafeMathUpgradeable for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ function __ERC20_init(string memory name_, string memory symbol_) internal initializer { __Context_init_unchained(); __ERC20_init_unchained(name_, symbol_); } function __ERC20_init_unchained(string memory name_, string memory symbol_) internal initializer { _name = name_; _symbol = symbol_; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal virtual { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } uint256[44] private __gap; }
// SPDX-License-Identifier: BSD-3-Clause pragma solidity 0.6.12; import "./CToken.sol"; interface PriceOracle { /** * @notice Get the underlying price of a cToken asset * @param cToken The cToken to get the underlying price of * @return The underlying asset price mantissa (scaled by 1e18). * Zero means the price is unavailable. */ function getUnderlyingPrice(CToken cToken) external view returns (uint); }
// SPDX-License-Identifier: BSD-3-Clause pragma solidity 0.6.12; /** * @title Compound's CToken Contract * @notice Abstract base for CTokens * @author Compound */ interface CToken { function admin() external view returns (address); function adminHasRights() external view returns (bool); function fuseAdminHasRights() external view returns (bool); function symbol() external view returns (string memory); function comptroller() external view returns (address); function adminFeeMantissa() external view returns (uint256); function fuseFeeMantissa() external view returns (uint256); function reserveFactorMantissa() external view returns (uint256); function totalReserves() external view returns (uint); function totalAdminFees() external view returns (uint); function totalFuseFees() external view returns (uint); function isCToken() external view returns (bool); function isCEther() external view returns (bool); function balanceOf(address owner) external view returns (uint); function balanceOfUnderlying(address owner) external returns (uint); function borrowRatePerBlock() external view returns (uint); function supplyRatePerBlock() external view returns (uint); function totalBorrowsCurrent() external returns (uint); function borrowBalanceStored(address account) external view returns (uint); function exchangeRateStored() external view returns (uint); function getCash() external view returns (uint); function redeem(uint redeemTokens) external returns (uint); function redeemUnderlying(uint redeemAmount) external returns (uint); }
// SPDX-License-Identifier: BSD-3-Clause pragma solidity 0.6.12; import "./CToken.sol"; /** * @title Compound's CErc20 Contract * @notice CTokens which wrap an EIP-20 underlying * @author Compound */ interface CErc20 is CToken { function underlying() external view returns (address); function liquidateBorrow(address borrower, uint repayAmount, CToken cTokenCollateral) external returns (uint); function borrow(uint borrowAmount) external returns (uint); function mint(uint mintAmount) external returns (uint); }
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); // getRoundData and latestRoundData should both raise "No data present" // if they do not have data to report, instead of returning unset values // which could be misinterpreted as actual reported values. function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); }
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.6.12; import "../external/compound/PriceOracle.sol"; /** * @title BasePriceOracle * @notice Returns prices of underlying tokens directly without the caller having to specify a cToken address. * @dev Implements the `PriceOracle` interface. * @author David Lucid <[email protected]> (https://github.com/davidlucid) */ interface BasePriceOracle is PriceOracle { /** * @notice Get the price of an underlying asset. * @param underlying The underlying asset to get the price of. * @return The underlying asset price in ETH as a mantissa (scaled by 1e18). * Zero means the price is unavailable. */ function price(address underlying) external view returns (uint); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../proxy/Initializable.sol"; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal initializer { __Context_init_unchained(); } function __Context_init_unchained() internal initializer { } function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity >=0.4.24 <0.8.0; import "../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /// @dev Returns true if and only if the function is running in the constructor function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
{ "metadata": { "bytecodeHash": "none" }, "optimizer": { "enabled": true, "runs": 1, "details": { "yul": false } }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_admin","type":"address"},{"internalType":"bool","name":"_canAdminOverwrite","type":"bool"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"NewAdmin","type":"event"},{"inputs":[],"name":"ETH_USD_PRICE_FEED","outputs":[{"internalType":"contract AggregatorV3Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"canAdminOverwrite","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"changeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"feedBaseCurrencies","outputs":[{"internalType":"enum ChainlinkPriceOracleV2.FeedBaseCurrency","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract CToken","name":"cToken","type":"address"}],"name":"getUnderlyingPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"underlying","type":"address"}],"name":"price","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"priceFeeds","outputs":[{"internalType":"contract AggregatorV3Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"underlyings","type":"address[]"},{"internalType":"contract AggregatorV3Interface[]","name":"feeds","type":"address[]"},{"internalType":"enum ChainlinkPriceOracleV2.FeedBaseCurrency","name":"baseCurrency","type":"uint8"}],"name":"setPriceFeeds","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50604051610be6380380610be68339818101604052604081101561003357600080fd5b508051602090910151600280546001600160a01b0319166001600160a01b039093169290921760ff60a01b1916600160a01b91151591909102179055610b688061007e6000396000f3fe608060405234801561001057600080fd5b506004361061008e5760003560e01c8063656b0fd11461009357806371f3245a146100af5780638f283970146101d95780639dcb511a146101ff578063ad5c464814610241578063aea9107814610249578063b0f0abe914610281578063cebae71d14610289578063f851a440146102d0578063fc57d4df146102d8575b600080fd5b61009b6102fe565b604080519115158252519081900360200190f35b6101d7600480360360608110156100c557600080fd5b810190602081018135600160201b8111156100df57600080fd5b8201836020820111156100f157600080fd5b803590602001918460208302840111600160201b8311171561011257600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561016157600080fd5b82018360208201111561017357600080fd5b803590602001918460208302840111600160201b8311171561019457600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295505050903560ff16915061030e9050565b005b6101d7600480360360208110156101ef57600080fd5b50356001600160a01b03166104bd565b6102256004803603602081101561021557600080fd5b50356001600160a01b031661057a565b604080516001600160a01b039092168252519081900360200190f35b610225610595565b61026f6004803603602081101561025f57600080fd5b50356001600160a01b03166105ad565b60408051918252519081900360200190f35b6102256105c0565b6102af6004803603602081101561029f57600080fd5b50356001600160a01b03166105d8565b604051808260018111156102bf57fe5b815260200191505060405180910390f35b6102256105ed565b61026f600480360360208110156102ee57600080fd5b50356001600160a01b03166105fc565b600254600160a01b900460ff1681565b6002546001600160a01b03163314610368576040805162461bcd60e51b815260206004820152601860248201527729b2b73232b91034b9903737ba103a34329030b236b4b71760411b604482015290519081900360640190fd5b6000835111801561037a575081518351145b6103b55760405162461bcd60e51b8152600401808060200182810382526038815260200180610a756038913960400191505060405180910390fd5b60005b83518110156104b75760008482815181106103cf57fe5b60200260200101519050600260149054906101000a900460ff16610444576001600160a01b0381811660009081526020819052604090205416156104445760405162461bcd60e51b8152600401808060200182810382526050815260200180610b0c6050913960600191505060405180910390fd5b83828151811061045057fe5b6020908102919091018101516001600160a01b038381166000908152808452604080822080546001600160a01b031916939094169290921790925560019283905290208054859260ff199091169083818111156104a957fe5b0217905550506001016103b8565b50505050565b6002546001600160a01b03163314610517576040805162461bcd60e51b815260206004820152601860248201527729b2b73232b91034b9903737ba103a34329030b236b4b71760411b604482015290519081900360640190fd5b600280546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc929181900390910190a15050565b6000602081905290815260409020546001600160a01b031681565b7374b23882a30290451a17c44f4f05243b6b58c76d81565b60006105b882610718565b90505b919050565b7311ddd3d147e5b83d01cee7070027092397d6365881565b60016020526000908152604090205460ff1681565b6002546001600160a01b031681565b600080826001600160a01b0316636f307dc36040518163ffffffff1660e01b815260040160206040518083038186803b15801561063857600080fd5b505afa15801561064c573d6000803e3d6000fd5b505050506040513d602081101561066257600080fd5b50519050600061067182610718565b90506000826001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156106ae57600080fd5b505afa1580156106c2573d6000803e3d6000fd5b505050506040513d60208110156106d857600080fd5b505160ff16905060128111156106fe576106f9826011198301600a0a6109ae565b61070f565b61070f826012839003600a0a610a14565b95945050505050565b60006001600160a01b0382167374b23882a30290451a17c44f4f05243b6b58c76d141561074e5750670de0b6b3a76400006105bb565b6001600160a01b0380831660009081526020819052604090205416806107a55760405162461bcd60e51b815260040180806020018281038252603e815260200180610aad603e913960400191505060405180910390fd5b6001600160a01b03831660009081526001602052604081205460ff16908160018111156107ce57fe5b141561085c576000826001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561080f57600080fd5b505afa158015610823573d6000803e3d6000fd5b505050506040513d60a081101561083957600080fd5b506020015190506000811215610850576000610852565b805b93505050506105bb565b600181600181111561086a57fe5b14156109a75760007311ddd3d147e5b83d01cee7070027092397d636586001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156108bf57600080fd5b505afa1580156108d3573d6000803e3d6000fd5b505050506040513d60a08110156108e957600080fd5b506020015190506000811361090457600093505050506105bb565b6000836001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561093f57600080fd5b505afa158015610953573d6000803e3d6000fd5b505050506040513d60a081101561096957600080fd5b50602001519050600081121561098057600061099c565b61099c8261099683670de0b6b3a7640000610a14565b906109ae565b9450505050506105bb565b5050919050565b6000808211610a01576040805162461bcd60e51b815260206004820152601a602482015279536166654d6174683a206469766973696f6e206279207a65726f60301b604482015290519081900360640190fd5b818381610a0a57fe5b0490505b92915050565b600082610a2357506000610a0e565b82820282848281610a3057fe5b0414610a6d5760405162461bcd60e51b8152600401808060200182810382526021815260200180610aeb6021913960400191505060405180910390fd5b939250505056fe4c656e67746873206f6620626f746820617272617973206d75737420626520657175616c20616e642067726561746572207468616e20302e4e6f20436861696e6c696e6b207072696365206665656420666f756e6420666f72207468697320756e6465726c79696e6720455243323020746f6b656e2e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7741646d696e2063616e6e6f74206f7665727772697465206578697374696e672061737369676e6d656e7473206f6620707269636520666565647320746f20756e6465726c79696e6720746f6b656e732ea164736f6c634300060c000a0000000000000000000000009c259827aeb34c90a8c95ec2dad6ffcdbd88b3880000000000000000000000000000000000000000000000000000000000000001
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000009c259827aeb34c90a8c95ec2dad6ffcdbd88b3880000000000000000000000000000000000000000000000000000000000000001
-----Decoded View---------------
Arg [0] : _admin (address): 0x9c259827aeb34c90a8c95ec2dad6ffcdbd88b388
Arg [1] : _canAdminOverwrite (bool): True
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000009c259827aeb34c90a8c95ec2dad6ffcdbd88b388
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000001
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Validator ID :
0 FTM
Amount Staked
0
Amount Delegated
0
Staking Total
0
Staking Start Epoch
0
Staking Start Time
0
Proof of Importance
0
Origination Score
0
Validation Score
0
Active
0
Online
0
Downtime
0 s
Address | Amount | claimed Rewards | Created On Epoch | Created On |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.