Overview
ETH Balance
ETH Value
$0.00Multichain Info
Latest 12 from a total of 12 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Create Market An... | 4873667 | 91 days ago | IN | 0 ETH | 0.00000116 | ||||
Create Market An... | 4873625 | 91 days ago | IN | 0 ETH | 0.00000115 | ||||
Create Market Wi... | 4374825 | 97 days ago | IN | 0 ETH | 0.00000033 | ||||
Create Market An... | 4374389 | 97 days ago | IN | 0 ETH | 0.00000117 | ||||
Create Market An... | 4373076 | 97 days ago | IN | 0 ETH | 0.00000119 | ||||
Create Market An... | 4373053 | 97 days ago | IN | 0 ETH | 0.0000012 | ||||
Create Market An... | 4372053 | 97 days ago | IN | 0 ETH | 0.0000012 | ||||
Create Market An... | 4371655 | 97 days ago | IN | 0 ETH | 0.00000119 | ||||
Create Market An... | 4179873 | 99 days ago | IN | 0 ETH | 0.00000116 | ||||
Create Market An... | 4179161 | 99 days ago | IN | 0 ETH | 0.0000012 | ||||
Create Market An... | 4178440 | 99 days ago | IN | 0 ETH | 0.0000012 | ||||
Create Market An... | 3943849 | 102 days ago | IN | 0 ETH | 0.00000119 |
Latest 25 internal transactions (View All)
Parent Transaction Hash | Block | From | To | ||||
---|---|---|---|---|---|---|---|
4873667 | 91 days ago | 0 ETH | |||||
4873667 | 91 days ago | 0 ETH | |||||
4873667 | 91 days ago | 0 ETH | |||||
4873667 | 91 days ago | 0 ETH | |||||
4873667 | 91 days ago | 0 ETH | |||||
4873667 | 91 days ago | 0 ETH | |||||
4873667 | 91 days ago | 0 ETH | |||||
4873667 | 91 days ago | 0 ETH | |||||
4873667 | 91 days ago | 0 ETH | |||||
4873667 | 91 days ago | 0 ETH | |||||
4873667 | 91 days ago | 0 ETH | |||||
4873667 | 91 days ago | 0 ETH | |||||
4873625 | 91 days ago | 0 ETH | |||||
4873625 | 91 days ago | 0 ETH | |||||
4873625 | 91 days ago | 0 ETH | |||||
4873625 | 91 days ago | 0 ETH | |||||
4873625 | 91 days ago | 0 ETH | |||||
4873625 | 91 days ago | 0 ETH | |||||
4873625 | 91 days ago | 0 ETH | |||||
4873625 | 91 days ago | 0 ETH | |||||
4873625 | 91 days ago | 0 ETH | |||||
4873625 | 91 days ago | 0 ETH | |||||
4873625 | 91 days ago | 0 ETH | |||||
4873625 | 91 days ago | 0 ETH | |||||
4374825 | 97 days ago | 0 ETH |
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.20; import {IERC4626} from "@openzeppelin/contracts/interfaces/IERC4626.sol"; import {IERC20Metadata} from "@openzeppelin/contracts/interfaces/IERC20Metadata.sol"; import {Math} from "@openzeppelin/contracts/utils/math/Math.sol"; import {IMorpho, MarketParams, Id} from "../lib/morpho-blue/src/interfaces/IMorpho.sol"; import {AggregatorV3Interface} from "./interfaces/AggregatorV3Interface.sol"; import {IMorphoOracleFactory} from "./interfaces/IMorphoOracleFactory.sol"; import {MarketParamsLib} from "morpho-blue/libraries/MarketParamsLib.sol"; import {IOracle} from "morpho-blue/interfaces/IOracle.sol"; import {VaultLib} from "morpho-blue-oracles/morpho-chainlink/libraries/VaultLib.sol"; import {IMorphoChainlinkOracleV2} from "morpho-blue-oracles/morpho-chainlink/interfaces/IMorphoChainlinkOracleV2.sol"; /// @title MorphoMarketFactory /// @author Steakhouse Financial /// @notice Contract for creating new markets on Morpho Blue with price oracle integration /// @dev This contract handles market creation with both new and existing oracles, supporting ERC4626 vaults /// @custom:security-contact [email protected] contract MorphoMarketFactory { using MarketParamsLib for MarketParams; using Math for uint256; using VaultLib for IERC4626; /// @notice The Morpho Blue protocol contract /// @dev Immutable reference to main Morpho protocol contract IMorpho public immutable morpho; /// @notice Factory contract for creating price oracles /// @dev Immutable reference to oracle factory that creates Chainlink-based oracles IMorphoOracleFactory public immutable oracleFactory; /// @notice Interest rate model contract address /// @dev Immutable reference to the IRM contract used for all markets created address public immutable irm; uint256 private constant EIGHT_DECIMALS = 10 ** 8; uint256 private constant EIGHTEEN_DECIMALS = 10 ** 18; uint256 private constant DEFAULT_CONVERSION_SAMPLE = EIGHT_DECIMALS; bytes32 public constant DEFAULT_SALT = bytes32(0); // The fixed value salt recommended in Morpho documentation uint256 private constant MAX_UINT256 = type(uint256).max; event MarketCreated( address indexed oracle, Id indexed marketId, address indexed marketCreator, address loanAsset, address collateralAsset, uint256 lltv, uint256 expectedPrice, uint256 actualPrice, uint256 error, uint256 allowedError ); error ExpectedPriceMustBeGreaterThanZero(); error OracleScaleFactorInvalid(uint256 scaleFactor); error PriceErrorExceedsAllowed(uint256 actualPrice, uint256 expectedPrice, uint256 error, uint256 allowedError); error FeedMustImplementLatestRoundData(); error FeedDecimalsMustBeGreaterThanZero(); error FeedMustImplementDecimals(); error ZeroAddressNotAllowed(); error UnsupportedChainId(); constructor() { if (block.chainid == 1) { morpho = IMorpho(0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb); oracleFactory = IMorphoOracleFactory(0x3A7bB36Ee3f3eE32A60e9f2b33c1e5f2E83ad766); irm = address(0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC); } else if (block.chainid == 8453) { // Base Mainnet morpho = IMorpho(0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb); oracleFactory = IMorphoOracleFactory(0x2DC205F24BCb6B311E5cdf0745B0741648Aebd3d); irm = address(0x46415998764C29aB2a25CbeA6254146D50D22687); } else if (block.chainid == 130) { // Unichain Mainnet morpho = IMorpho(0x8f5ae9CddB9f68de460C77730b018Ae7E04a140A); oracleFactory = IMorphoOracleFactory(0x43269546e1D586a1f7200a0AC07e26f9631f7539); irm = address(0x9a6061d51743B31D2c3Be75D83781Fa423f53F0E); } else if (block.chainid == 747474) { // Katana Mainnet morpho = IMorpho(0xD50F2DffFd62f94Ee4AEd9ca05C61d0753268aBc); oracleFactory = IMorphoOracleFactory(0x7D047fB910Bc187C18C81a69E30Fa164f8c536eC); irm = address(0x4F708C0ae7deD3d74736594C2109C2E3c065B428); } else { revert UnsupportedChainId(); } } function _createMorphoChainlinkOracle( address loanAsset, address collateralAsset, AggregatorV3Interface baseFeed1, AggregatorV3Interface baseFeed2, AggregatorV3Interface quoteFeed1, AggregatorV3Interface quoteFeed2, uint256 baseVaultConversionSample, uint256 quoteVaultConversionSample, bytes32 salt ) internal returns (IMorphoChainlinkOracleV2) { _validatePriceFeed(baseFeed1); _validatePriceFeed(baseFeed2); _validatePriceFeed(quoteFeed1); _validatePriceFeed(quoteFeed2); IERC4626 baseVault; IERC4626 quoteVault; uint256 baseTokenDecimals; uint256 quoteTokenDecimals; if (baseVaultConversionSample != 0 || _isERC4626(collateralAsset)) { baseVault = IERC4626(collateralAsset); baseTokenDecimals = IERC20Metadata(baseVault.asset()).decimals(); baseVaultConversionSample = baseVaultConversionSample == 0 ? DEFAULT_CONVERSION_SAMPLE : baseVaultConversionSample; } else { baseVault = IERC4626(address(0)); baseTokenDecimals = IERC20Metadata(collateralAsset).decimals(); baseVaultConversionSample = 1; } if (quoteVaultConversionSample != 0 || _isERC4626(loanAsset)) { quoteVault = IERC4626(loanAsset); quoteTokenDecimals = IERC20Metadata(quoteVault.asset()).decimals(); quoteVaultConversionSample = quoteVaultConversionSample == 0 ? DEFAULT_CONVERSION_SAMPLE : quoteVaultConversionSample; } else { quoteVault = IERC4626(address(0)); quoteTokenDecimals = IERC20Metadata(loanAsset).decimals(); quoteVaultConversionSample = 1; } IOracle oracle = oracleFactory.createMorphoChainlinkOracleV2( baseVault, baseVaultConversionSample, baseFeed1, baseFeed2, baseTokenDecimals, quoteVault, quoteVaultConversionSample, quoteFeed1, quoteFeed2, quoteTokenDecimals, salt ); return IMorphoChainlinkOracleV2(address(oracle)); } function _isERC4626(address token) internal view returns (bool) { // Gas limit in staticcall is necessary because otherwise a failed call consumes an indefinite amount of gas (bool success, ) = token.staticcall{gas: 10000}(abi.encodeWithSignature("asset()")); return success; } function _createMarketAndOracle( address loanAsset, address collateralAsset, uint256 lltv, AggregatorV3Interface baseFeed1, AggregatorV3Interface baseFeed2, AggregatorV3Interface quoteFeed1, AggregatorV3Interface quoteFeed2, uint256 baseVaultConversionSample, uint256 quoteVaultConversionSample, bytes32 salt, uint256 expectedPrice, uint256 allowedError ) internal returns (MarketParams memory) { IMorphoChainlinkOracleV2 oracle = _createMorphoChainlinkOracle( loanAsset, collateralAsset, baseFeed1, baseFeed2, quoteFeed1, quoteFeed2, baseVaultConversionSample, quoteVaultConversionSample, salt ); return _createMarketWithOracle(loanAsset, collateralAsset, lltv, address(oracle), expectedPrice, allowedError); } function _createMarketWithOracle( address loanAsset, address collateralAsset, uint256 lltv, address oracleAddress, uint256 expectedPrice, uint256 allowedError ) internal returns (MarketParams memory) { if (loanAsset == address(0) || collateralAsset == address(0)) { revert ZeroAddressNotAllowed(); } IMorphoChainlinkOracleV2 oracle = IMorphoChainlinkOracleV2(oracleAddress); (uint256 actualPrice, uint256 error) = _validateOraclePrice(oracle, expectedPrice, allowedError); MarketParams memory marketParams = MarketParams({ loanToken: loanAsset, collateralToken: collateralAsset, oracle: address(oracle), irm: irm, lltv: lltv }); morpho.createMarket(marketParams); emit MarketCreated( address(oracle), marketParams.id(), msg.sender, loanAsset, collateralAsset, lltv, expectedPrice, actualPrice, error, allowedError ); return marketParams; } /// @notice Creates a new market with a new oracle /// @dev Creates both a new Chainlink oracle and corresponding Morpho market /// @param loanAsset Address of the asset that can be borrowed /// @param collateralAsset Address of the asset used as collateral /// @param lltv Liquidation loan-to-value ratio in 18 decimals /// @param baseFeed1 Primary Chainlink price feed for collateral asset /// @param baseFeed2 Secondary Chainlink price feed for collateral asset (optional) /// @param quoteFeed1 Primary Chainlink price feed for loan asset /// @param quoteFeed2 Secondary Chainlink price feed for loan asset (optional) /// @param baseVaultConversionSample Sample size for ERC4626 vault conversion (if collateral is ERC4626) /// @param quoteVaultConversionSample Sample size for ERC4626 vault conversion (if loan asset is ERC4626) /// @param expectedPrice Expected price from oracle in 18 decimals /// @param allowedError Maximum allowed deviation from expected price in 18 decimals /// @return MarketParams The parameters of the created market /// @custom:security Validates oracle price against expected price within error bounds function createMarketAndOracle( address loanAsset, address collateralAsset, uint256 lltv, AggregatorV3Interface baseFeed1, AggregatorV3Interface baseFeed2, AggregatorV3Interface quoteFeed1, AggregatorV3Interface quoteFeed2, uint256 baseVaultConversionSample, uint256 quoteVaultConversionSample, uint256 expectedPrice, uint256 allowedError ) external returns (MarketParams memory) { return _createMarketAndOracle( loanAsset, collateralAsset, lltv, baseFeed1, baseFeed2, quoteFeed1, quoteFeed2, baseVaultConversionSample, quoteVaultConversionSample, DEFAULT_SALT, expectedPrice, allowedError ); } /// @notice Creates a new market with a new oracle using custom salt /// @dev Similar to createMarketAndOracle but allows specifying custom salt for oracle deployment /// @param loanAsset Address of the asset that can be borrowed /// @param collateralAsset Address of the asset used as collateral /// @param lltv Liquidation loan-to-value ratio in 18 decimals /// @param baseFeed1 Primary Chainlink price feed for collateral asset /// @param baseFeed2 Secondary Chainlink price feed for collateral asset (optional) /// @param quoteFeed1 Primary Chainlink price feed for loan asset /// @param quoteFeed2 Secondary Chainlink price feed for loan asset (optional) /// @param baseVaultConversionSample Sample size for ERC4626 vault conversion (if collateral is ERC4626) /// @param quoteVaultConversionSample Sample size for ERC4626 vault conversion (if loan asset is ERC4626) /// @param salt Custom salt for oracle deployment /// @param expectedPrice Expected price from oracle in 18 decimals /// @param allowedError Maximum allowed deviation from expected price in 18 decimals /// @return MarketParams The parameters of the created market /// @custom:security Validates oracle price against expected price within error bounds function createMarketAndOracle( address loanAsset, address collateralAsset, uint256 lltv, AggregatorV3Interface baseFeed1, AggregatorV3Interface baseFeed2, AggregatorV3Interface quoteFeed1, AggregatorV3Interface quoteFeed2, uint256 baseVaultConversionSample, uint256 quoteVaultConversionSample, bytes32 salt, uint256 expectedPrice, uint256 allowedError ) external returns (MarketParams memory) { return _createMarketAndOracle( loanAsset, collateralAsset, lltv, baseFeed1, baseFeed2, quoteFeed1, quoteFeed2, baseVaultConversionSample, quoteVaultConversionSample, salt, expectedPrice, allowedError ); } /// @notice Creates a new market with an existing oracle /// @dev Creates a Morpho market using an already deployed oracle /// @param loanAsset Address of the asset that can be borrowed /// @param collateralAsset Address of the asset used as collateral /// @param lltv Liquidation loan-to-value ratio in 18 decimals /// @param oracleAddress Address of existing oracle to use /// @param expectedPrice Expected price from oracle in 18 decimals /// @param allowedError Maximum allowed deviation from expected price in 18 decimals /// @return MarketParams The parameters of the created market /// @custom:security Validates oracle price against expected price within error bounds /// @custom:security Verifies oracle scale factor is within safe bounds function createMarketWithExistingOracle( address loanAsset, address collateralAsset, uint256 lltv, address oracleAddress, uint256 expectedPrice, uint256 allowedError ) external returns (MarketParams memory) { return _createMarketWithOracle(loanAsset, collateralAsset, lltv, oracleAddress, expectedPrice, allowedError); } function _validateOraclePrice( IMorphoChainlinkOracleV2 oracle, uint256 expectedPrice, uint256 allowedError ) internal view returns (uint256 actualPrice, uint256 error) { if (expectedPrice == 0 && allowedError != MAX_UINT256) { revert ExpectedPriceMustBeGreaterThanZero(); } uint256 scaleFactor = oracle.SCALE_FACTOR(); if (scaleFactor == 0 || scaleFactor >= 10 ** 50) { revert OracleScaleFactorInvalid(scaleFactor); } actualPrice = oracle.price(); if (actualPrice > expectedPrice) { error = EIGHTEEN_DECIMALS.mulDiv(actualPrice - expectedPrice, expectedPrice); } else { error = EIGHTEEN_DECIMALS.mulDiv(expectedPrice - actualPrice, expectedPrice); } if (error > allowedError) { revert PriceErrorExceedsAllowed(actualPrice, expectedPrice, error, allowedError); } } function _validatePriceFeed(AggregatorV3Interface feed) internal view { if (address(feed) == address(0)) return; try feed.latestRoundData() returns (uint80, int256, uint256, uint256, uint80) {} catch { revert FeedMustImplementLatestRoundData(); } try feed.decimals() returns (uint8 decimals) { if (decimals == 0) { revert FeedDecimalsMustBeGreaterThanZero(); } } catch { revert FeedMustImplementDecimals(); } } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title IOracle /// @author Morpho Labs /// @custom:contact [email protected] /// @notice Interface that oracles used by Morpho must implement. /// @dev It is the user's responsibility to select markets with safe oracles. interface IOracle { /// @notice Returns the price of 1 asset of collateral token quoted in 1 asset of loan token, scaled by 1e36. /// @dev It corresponds to the price of 10**(collateral token decimals) assets of collateral token quoted in /// 10**(loan token decimals) assets of loan token with `36 + loan token decimals - collateral token decimals` /// decimals of precision. function price() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; /// @dev From /// https://github.com/smartcontractkit/chainlink/blob/master/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); 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: GPL-2.0-or-later pragma solidity >=0.5.0; interface IERC4626 { function convertToAssets(uint256) external view returns (uint256); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; import {IERC4626} from "./IERC4626.sol"; import {IOracle} from "../../../lib/morpho-blue/src/interfaces/IOracle.sol"; import {AggregatorV3Interface} from "./AggregatorV3Interface.sol"; /// @title IMorphoChainlinkOracleV2 /// @author Morpho Labs /// @custom:contact [email protected] /// @notice Interface of MorphoChainlinkOracleV2. interface IMorphoChainlinkOracleV2 is IOracle { /// @notice Returns the address of the base ERC4626 vault. function BASE_VAULT() external view returns (IERC4626); /// @notice Returns the base vault conversion sample. function BASE_VAULT_CONVERSION_SAMPLE() external view returns (uint256); /// @notice Returns the address of the quote ERC4626 vault. function QUOTE_VAULT() external view returns (IERC4626); /// @notice Returns the quote vault conversion sample. function QUOTE_VAULT_CONVERSION_SAMPLE() external view returns (uint256); /// @notice Returns the address of the first base feed. function BASE_FEED_1() external view returns (AggregatorV3Interface); /// @notice Returns the address of the second base feed. function BASE_FEED_2() external view returns (AggregatorV3Interface); /// @notice Returns the address of the first quote feed. function QUOTE_FEED_1() external view returns (AggregatorV3Interface); /// @notice Returns the address of the second quote feed. function QUOTE_FEED_2() external view returns (AggregatorV3Interface); /// @notice Returns the price scale factor, calculated at contract creation. function SCALE_FACTOR() external view returns (uint256); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; import {IERC4626} from "../interfaces/IERC4626.sol"; /// @title VaultLib /// @author Morpho Labs /// @custom:contact [email protected] /// @notice Library exposing functions to price shares of an ERC4626 vault. library VaultLib { /// @dev Converts `shares` into the corresponding assets on the `vault`. /// @dev When `vault` is the address zero, returns 1. function getAssets(IERC4626 vault, uint256 shares) internal view returns (uint256) { if (address(vault) == address(0)) return 1; return vault.convertToAssets(shares); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; type Id is bytes32; struct MarketParams { address loanToken; address collateralToken; address oracle; address irm; uint256 lltv; } /// @dev Warning: For `feeRecipient`, `supplyShares` does not contain the accrued shares since the last interest /// accrual. struct Position { uint256 supplyShares; uint128 borrowShares; uint128 collateral; } /// @dev Warning: `totalSupplyAssets` does not contain the accrued interest since the last interest accrual. /// @dev Warning: `totalBorrowAssets` does not contain the accrued interest since the last interest accrual. /// @dev Warning: `totalSupplyShares` does not contain the additional shares accrued by `feeRecipient` since the last /// interest accrual. struct Market { uint128 totalSupplyAssets; uint128 totalSupplyShares; uint128 totalBorrowAssets; uint128 totalBorrowShares; uint128 lastUpdate; uint128 fee; } struct Authorization { address authorizer; address authorized; bool isAuthorized; uint256 nonce; uint256 deadline; } struct Signature { uint8 v; bytes32 r; bytes32 s; } /// @dev This interface is used for factorizing IMorphoStaticTyping and IMorpho. /// @dev Consider using the IMorpho interface instead of this one. interface IMorphoBase { /// @notice The EIP-712 domain separator. /// @dev Warning: Every EIP-712 signed message based on this domain separator can be reused on another chain sharing /// the same chain id because the domain separator would be the same. function DOMAIN_SEPARATOR() external view returns (bytes32); /// @notice The owner of the contract. /// @dev It has the power to change the owner. /// @dev It has the power to set fees on markets and set the fee recipient. /// @dev It has the power to enable but not disable IRMs and LLTVs. function owner() external view returns (address); /// @notice The fee recipient of all markets. /// @dev The recipient receives the fees of a given market through a supply position on that market. function feeRecipient() external view returns (address); /// @notice Whether the `irm` is enabled. function isIrmEnabled(address irm) external view returns (bool); /// @notice Whether the `lltv` is enabled. function isLltvEnabled(uint256 lltv) external view returns (bool); /// @notice Whether `authorized` is authorized to modify `authorizer`'s position on all markets. /// @dev Anyone is authorized to modify their own positions, regardless of this variable. function isAuthorized(address authorizer, address authorized) external view returns (bool); /// @notice The `authorizer`'s current nonce. Used to prevent replay attacks with EIP-712 signatures. function nonce(address authorizer) external view returns (uint256); /// @notice Sets `newOwner` as `owner` of the contract. /// @dev Warning: No two-step transfer ownership. /// @dev Warning: The owner can be set to the zero address. function setOwner(address newOwner) external; /// @notice Enables `irm` as a possible IRM for market creation. /// @dev Warning: It is not possible to disable an IRM. function enableIrm(address irm) external; /// @notice Enables `lltv` as a possible LLTV for market creation. /// @dev Warning: It is not possible to disable a LLTV. function enableLltv(uint256 lltv) external; /// @notice Sets the `newFee` for the given market `marketParams`. /// @param newFee The new fee, scaled by WAD. /// @dev Warning: The recipient can be the zero address. function setFee(MarketParams memory marketParams, uint256 newFee) external; /// @notice Sets `newFeeRecipient` as `feeRecipient` of the fee. /// @dev Warning: If the fee recipient is set to the zero address, fees will accrue there and will be lost. /// @dev Modifying the fee recipient will allow the new recipient to claim any pending fees not yet accrued. To /// ensure that the current recipient receives all due fees, accrue interest manually prior to making any changes. function setFeeRecipient(address newFeeRecipient) external; /// @notice Creates the market `marketParams`. /// @dev Here is the list of assumptions on the market's dependencies (tokens, IRM and oracle) that guarantees /// Morpho behaves as expected: /// - The token should be ERC-20 compliant, except that it can omit return values on `transfer` and `transferFrom`. /// - The token balance of Morpho should only decrease on `transfer` and `transferFrom`. In particular, tokens with /// burn functions are not supported. /// - The token should not re-enter Morpho on `transfer` nor `transferFrom`. /// - The token balance of the sender (resp. receiver) should decrease (resp. increase) by exactly the given amount /// on `transfer` and `transferFrom`. In particular, tokens with fees on transfer are not supported. /// - The IRM should not re-enter Morpho. /// - The oracle should return a price with the correct scaling. /// @dev Here is a list of properties on the market's dependencies that could break Morpho's liveness properties /// (funds could get stuck): /// - The token can revert on `transfer` and `transferFrom` for a reason other than an approval or balance issue. /// - A very high amount of assets (~1e35) supplied or borrowed can make the computation of `toSharesUp` and /// `toSharesDown` overflow. /// - The IRM can revert on `borrowRate`. /// - A very high borrow rate returned by the IRM can make the computation of `interest` in `_accrueInterest` /// overflow. /// - The oracle can revert on `price`. Note that this can be used to prevent `borrow`, `withdrawCollateral` and /// `liquidate` from being used under certain market conditions. /// - A very high price returned by the oracle can make the computation of `maxBorrow` in `_isHealthy` overflow, or /// the computation of `assetsRepaid` in `liquidate` overflow. /// @dev The borrow share price of a market with less than 1e4 assets borrowed can be decreased by manipulations, to /// the point where `totalBorrowShares` is very large and borrowing overflows. function createMarket(MarketParams memory marketParams) external; /// @notice Supplies `assets` or `shares` on behalf of `onBehalf`, optionally calling back the caller's /// `onMorphoSupply` function with the given `data`. /// @dev Either `assets` or `shares` should be zero. Most use cases should rely on `assets` as an input so the /// caller is guaranteed to have `assets` tokens pulled from their balance, but the possibility to mint a specific /// amount of shares is given for full compatibility and precision. /// @dev Supplying a large amount can revert for overflow. /// @dev Supplying an amount of shares may lead to supply more or fewer assets than expected due to slippage. /// Consider using the `assets` parameter to avoid this. /// @param marketParams The market to supply assets to. /// @param assets The amount of assets to supply. /// @param shares The amount of shares to mint. /// @param onBehalf The address that will own the increased supply position. /// @param data Arbitrary data to pass to the `onMorphoSupply` callback. Pass empty data if not needed. /// @return assetsSupplied The amount of assets supplied. /// @return sharesSupplied The amount of shares minted. function supply( MarketParams memory marketParams, uint256 assets, uint256 shares, address onBehalf, bytes memory data ) external returns (uint256 assetsSupplied, uint256 sharesSupplied); /// @notice Withdraws `assets` or `shares` on behalf of `onBehalf` and sends the assets to `receiver`. /// @dev Either `assets` or `shares` should be zero. To withdraw max, pass the `shares`'s balance of `onBehalf`. /// @dev `msg.sender` must be authorized to manage `onBehalf`'s positions. /// @dev Withdrawing an amount corresponding to more shares than supplied will revert for underflow. /// @dev It is advised to use the `shares` input when withdrawing the full position to avoid reverts due to /// conversion roundings between shares and assets. /// @param marketParams The market to withdraw assets from. /// @param assets The amount of assets to withdraw. /// @param shares The amount of shares to burn. /// @param onBehalf The address of the owner of the supply position. /// @param receiver The address that will receive the withdrawn assets. /// @return assetsWithdrawn The amount of assets withdrawn. /// @return sharesWithdrawn The amount of shares burned. function withdraw( MarketParams memory marketParams, uint256 assets, uint256 shares, address onBehalf, address receiver ) external returns (uint256 assetsWithdrawn, uint256 sharesWithdrawn); /// @notice Borrows `assets` or `shares` on behalf of `onBehalf` and sends the assets to `receiver`. /// @dev Either `assets` or `shares` should be zero. Most use cases should rely on `assets` as an input so the /// caller is guaranteed to borrow `assets` of tokens, but the possibility to mint a specific amount of shares is /// given for full compatibility and precision. /// @dev `msg.sender` must be authorized to manage `onBehalf`'s positions. /// @dev Borrowing a large amount can revert for overflow. /// @dev Borrowing an amount of shares may lead to borrow fewer assets than expected due to slippage. /// Consider using the `assets` parameter to avoid this. /// @param marketParams The market to borrow assets from. /// @param assets The amount of assets to borrow. /// @param shares The amount of shares to mint. /// @param onBehalf The address that will own the increased borrow position. /// @param receiver The address that will receive the borrowed assets. /// @return assetsBorrowed The amount of assets borrowed. /// @return sharesBorrowed The amount of shares minted. function borrow( MarketParams memory marketParams, uint256 assets, uint256 shares, address onBehalf, address receiver ) external returns (uint256 assetsBorrowed, uint256 sharesBorrowed); /// @notice Repays `assets` or `shares` on behalf of `onBehalf`, optionally calling back the caller's /// `onMorphoReplay` function with the given `data`. /// @dev Either `assets` or `shares` should be zero. To repay max, pass the `shares`'s balance of `onBehalf`. /// @dev Repaying an amount corresponding to more shares than borrowed will revert for underflow. /// @dev It is advised to use the `shares` input when repaying the full position to avoid reverts due to conversion /// roundings between shares and assets. /// @dev An attacker can front-run a repay with a small repay making the transaction revert for underflow. /// @param marketParams The market to repay assets to. /// @param assets The amount of assets to repay. /// @param shares The amount of shares to burn. /// @param onBehalf The address of the owner of the debt position. /// @param data Arbitrary data to pass to the `onMorphoRepay` callback. Pass empty data if not needed. /// @return assetsRepaid The amount of assets repaid. /// @return sharesRepaid The amount of shares burned. function repay( MarketParams memory marketParams, uint256 assets, uint256 shares, address onBehalf, bytes memory data ) external returns (uint256 assetsRepaid, uint256 sharesRepaid); /// @notice Supplies `assets` of collateral on behalf of `onBehalf`, optionally calling back the caller's /// `onMorphoSupplyCollateral` function with the given `data`. /// @dev Interest are not accrued since it's not required and it saves gas. /// @dev Supplying a large amount can revert for overflow. /// @param marketParams The market to supply collateral to. /// @param assets The amount of collateral to supply. /// @param onBehalf The address that will own the increased collateral position. /// @param data Arbitrary data to pass to the `onMorphoSupplyCollateral` callback. Pass empty data if not needed. function supplyCollateral(MarketParams memory marketParams, uint256 assets, address onBehalf, bytes memory data) external; /// @notice Withdraws `assets` of collateral on behalf of `onBehalf` and sends the assets to `receiver`. /// @dev `msg.sender` must be authorized to manage `onBehalf`'s positions. /// @dev Withdrawing an amount corresponding to more collateral than supplied will revert for underflow. /// @param marketParams The market to withdraw collateral from. /// @param assets The amount of collateral to withdraw. /// @param onBehalf The address of the owner of the collateral position. /// @param receiver The address that will receive the collateral assets. function withdrawCollateral(MarketParams memory marketParams, uint256 assets, address onBehalf, address receiver) external; /// @notice Liquidates the given `repaidShares` of debt asset or seize the given `seizedAssets` of collateral on the /// given market `marketParams` of the given `borrower`'s position, optionally calling back the caller's /// `onMorphoLiquidate` function with the given `data`. /// @dev Either `seizedAssets` or `repaidShares` should be zero. /// @dev Seizing more than the collateral balance will underflow and revert without any error message. /// @dev Repaying more than the borrow balance will underflow and revert without any error message. /// @dev An attacker can front-run a liquidation with a small repay making the transaction revert for underflow. /// @param marketParams The market of the position. /// @param borrower The owner of the position. /// @param seizedAssets The amount of collateral to seize. /// @param repaidShares The amount of shares to repay. /// @param data Arbitrary data to pass to the `onMorphoLiquidate` callback. Pass empty data if not needed. /// @return The amount of assets seized. /// @return The amount of assets repaid. function liquidate( MarketParams memory marketParams, address borrower, uint256 seizedAssets, uint256 repaidShares, bytes memory data ) external returns (uint256, uint256); /// @notice Executes a flash loan. /// @dev Flash loans have access to the whole balance of the contract (the liquidity and deposited collateral of all /// markets combined, plus donations). /// @dev Warning: Not ERC-3156 compliant but compatibility is easily reached: /// - `flashFee` is zero. /// - `maxFlashLoan` is the token's balance of this contract. /// - The receiver of `assets` is the caller. /// @param token The token to flash loan. /// @param assets The amount of assets to flash loan. /// @param data Arbitrary data to pass to the `onMorphoFlashLoan` callback. function flashLoan(address token, uint256 assets, bytes calldata data) external; /// @notice Sets the authorization for `authorized` to manage `msg.sender`'s positions. /// @param authorized The authorized address. /// @param newIsAuthorized The new authorization status. function setAuthorization(address authorized, bool newIsAuthorized) external; /// @notice Sets the authorization for `authorization.authorized` to manage `authorization.authorizer`'s positions. /// @dev Warning: Reverts if the signature has already been submitted. /// @dev The signature is malleable, but it has no impact on the security here. /// @dev The nonce is passed as argument to be able to revert with a different error message. /// @param authorization The `Authorization` struct. /// @param signature The signature. function setAuthorizationWithSig(Authorization calldata authorization, Signature calldata signature) external; /// @notice Accrues interest for the given market `marketParams`. function accrueInterest(MarketParams memory marketParams) external; /// @notice Returns the data stored on the different `slots`. function extSloads(bytes32[] memory slots) external view returns (bytes32[] memory); } /// @dev This interface is inherited by Morpho so that function signatures are checked by the compiler. /// @dev Consider using the IMorpho interface instead of this one. interface IMorphoStaticTyping is IMorphoBase { /// @notice The state of the position of `user` on the market corresponding to `id`. /// @dev Warning: For `feeRecipient`, `supplyShares` does not contain the accrued shares since the last interest /// accrual. function position(Id id, address user) external view returns (uint256 supplyShares, uint128 borrowShares, uint128 collateral); /// @notice The state of the market corresponding to `id`. /// @dev Warning: `totalSupplyAssets` does not contain the accrued interest since the last interest accrual. /// @dev Warning: `totalBorrowAssets` does not contain the accrued interest since the last interest accrual. /// @dev Warning: `totalSupplyShares` does not contain the accrued shares by `feeRecipient` since the last interest /// accrual. function market(Id id) external view returns ( uint128 totalSupplyAssets, uint128 totalSupplyShares, uint128 totalBorrowAssets, uint128 totalBorrowShares, uint128 lastUpdate, uint128 fee ); /// @notice The market params corresponding to `id`. /// @dev This mapping is not used in Morpho. It is there to enable reducing the cost associated to calldata on layer /// 2s by creating a wrapper contract with functions that take `id` as input instead of `marketParams`. function idToMarketParams(Id id) external view returns (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv); } /// @title IMorpho /// @author Morpho Labs /// @custom:contact [email protected] /// @dev Use this interface for Morpho to have access to all the functions with the appropriate function signatures. interface IMorpho is IMorphoBase { /// @notice The state of the position of `user` on the market corresponding to `id`. /// @dev Warning: For `feeRecipient`, `p.supplyShares` does not contain the accrued shares since the last interest /// accrual. function position(Id id, address user) external view returns (Position memory p); /// @notice The state of the market corresponding to `id`. /// @dev Warning: `m.totalSupplyAssets` does not contain the accrued interest since the last interest accrual. /// @dev Warning: `m.totalBorrowAssets` does not contain the accrued interest since the last interest accrual. /// @dev Warning: `m.totalSupplyShares` does not contain the accrued shares by `feeRecipient` since the last /// interest accrual. function market(Id id) external view returns (Market memory m); /// @notice The market params corresponding to `id`. /// @dev This mapping is not used in Morpho. It is there to enable reducing the cost associated to calldata on layer /// 2s by creating a wrapper contract with functions that take `id` as input instead of `marketParams`. function idToMarketParams(Id id) external view returns (MarketParams memory); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title IOracle /// @author Morpho Labs /// @custom:contact [email protected] /// @notice Interface that oracles used by Morpho must implement. /// @dev It is the user's responsibility to select markets with safe oracles. interface IOracle { /// @notice Returns the price of 1 asset of collateral token quoted in 1 asset of loan token, scaled by 1e36. /// @dev It corresponds to the price of 10**(collateral token decimals) assets of collateral token quoted in /// 10**(loan token decimals) assets of loan token with `36 + loan token decimals - collateral token decimals` /// decimals of precision. function price() external view returns (uint256); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; import {Id, MarketParams} from "../interfaces/IMorpho.sol"; /// @title MarketParamsLib /// @author Morpho Labs /// @custom:contact [email protected] /// @notice Library to convert a market to its id. library MarketParamsLib { /// @notice The length of the data used to compute the id of a market. /// @dev The length is 5 * 32 because `MarketParams` has 5 variables of 32 bytes each. uint256 internal constant MARKET_PARAMS_BYTES_LENGTH = 5 * 32; /// @notice Returns the id of the market `marketParams`. function id(MarketParams memory marketParams) internal pure returns (Id marketParamsId) { assembly ("memory-safe") { marketParamsId := keccak256(marketParams, MARKET_PARAMS_BYTES_LENGTH) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20Metadata} from "../token/ERC20/extensions/IERC20Metadata.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC4626.sol) pragma solidity ^0.8.20; import {IERC20} from "../token/ERC20/IERC20.sol"; import {IERC20Metadata} from "../token/ERC20/extensions/IERC20Metadata.sol"; /** * @dev Interface of the ERC4626 "Tokenized Vault Standard", as defined in * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626]. */ interface IERC4626 is IERC20, IERC20Metadata { event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares); event Withdraw( address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares ); /** * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing. * * - MUST be an ERC-20 token contract. * - MUST NOT revert. */ function asset() external view returns (address assetTokenAddress); /** * @dev Returns the total amount of the underlying asset that is “managed” by Vault. * * - SHOULD include any compounding that occurs from yield. * - MUST be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT revert. */ function totalAssets() external view returns (uint256 totalManagedAssets); /** * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal * scenario where all the conditions are met. * * - MUST NOT be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT show any variations depending on the caller. * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange. * - MUST NOT revert. * * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and * from. */ function convertToShares(uint256 assets) external view returns (uint256 shares); /** * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal * scenario where all the conditions are met. * * - MUST NOT be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT show any variations depending on the caller. * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange. * - MUST NOT revert. * * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and * from. */ function convertToAssets(uint256 shares) external view returns (uint256 assets); /** * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver, * through a deposit call. * * - MUST return a limited value if receiver is subject to some deposit limit. * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited. * - MUST NOT revert. */ function maxDeposit(address receiver) external view returns (uint256 maxAssets); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given * current on-chain conditions. * * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called * in the same transaction. * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the * deposit would be accepted, regardless if the user has enough tokens approved, etc. * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by depositing. */ function previewDeposit(uint256 assets) external view returns (uint256 shares); /** * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens. * * - MUST emit the Deposit event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * deposit execution, and are accounted for during deposit. * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not * approving enough underlying tokens to the Vault contract, etc). * * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token. */ function deposit(uint256 assets, address receiver) external returns (uint256 shares); /** * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call. * - MUST return a limited value if receiver is subject to some mint limit. * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted. * - MUST NOT revert. */ function maxMint(address receiver) external view returns (uint256 maxShares); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given * current on-chain conditions. * * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the * same transaction. * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint * would be accepted, regardless if the user has enough tokens approved, etc. * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by minting. */ function previewMint(uint256 shares) external view returns (uint256 assets); /** * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens. * * - MUST emit the Deposit event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint * execution, and are accounted for during mint. * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not * approving enough underlying tokens to the Vault contract, etc). * * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token. */ function mint(uint256 shares, address receiver) external returns (uint256 assets); /** * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the * Vault, through a withdraw call. * * - MUST return a limited value if owner is subject to some withdrawal limit or timelock. * - MUST NOT revert. */ function maxWithdraw(address owner) external view returns (uint256 maxAssets); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block, * given current on-chain conditions. * * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if * called * in the same transaction. * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though * the withdrawal would be accepted, regardless if the user has enough shares, etc. * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by depositing. */ function previewWithdraw(uint256 assets) external view returns (uint256 shares); /** * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver. * * - MUST emit the Withdraw event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * withdraw execution, and are accounted for during withdraw. * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner * not having enough shares, etc). * * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. * Those methods should be performed separately. */ function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares); /** * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault, * through a redeem call. * * - MUST return a limited value if owner is subject to some withdrawal limit or timelock. * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock. * - MUST NOT revert. */ function maxRedeem(address owner) external view returns (uint256 maxShares); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block, * given current on-chain conditions. * * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the * same transaction. * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the * redemption would be accepted, regardless if the user has enough shares, etc. * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by redeeming. */ function previewRedeem(uint256 shares) external view returns (uint256 assets); /** * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver. * * - MUST emit the Withdraw event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * redeem execution, and are accounted for during redeem. * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner * not having enough shares, etc). * * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed. * Those methods should be performed separately. */ function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) 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 a `value` amount of tokens 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 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // 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. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { 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. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // ? `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // ? `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; /// @dev From /// https://github.com/smartcontractkit/chainlink/blob/master/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); 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.8.0; import {IERC4626} from "../../lib/openzeppelin-contracts/contracts/interfaces/IERC4626.sol"; import {AggregatorV3Interface} from "./AggregatorV3Interface.sol"; import {IOracle} from "../../lib/morpho-blue/src/interfaces/IOracle.sol"; interface IMorphoOracleFactory { function createMorphoChainlinkOracleV2( IERC4626 baseVault, uint256 baseVaultConversionSample, AggregatorV3Interface baseFeed1, AggregatorV3Interface baseFeed2, uint256 baseTokenDecimals, IERC4626 quoteVault, uint256 quoteVaultConversionSample, AggregatorV3Interface quoteFeed1, AggregatorV3Interface quoteFeed2, uint256 quoteTokenDecimals, bytes32 salt ) external returns (IOracle oracle); }
{ "evmVersion": "shanghai", "libraries": {}, "metadata": { "appendCBOR": true, "bytecodeHash": "ipfs", "useLiteralContent": false }, "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "remappings": [ "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "ds-auth/=lib/dss-psm/lib/dss/lib/ds-token/lib/ds-auth/src/", "ds-math/=lib/dss-psm/lib/dss/lib/ds-token/lib/ds-math/src/", "ds-note/=lib/dss-psm/lib/dss/lib/ds-value/lib/ds-thing/lib/ds-note/src/", "ds-test/=lib/forge-std/lib/ds-test/src/", "ds-thing/=lib/dss-psm/lib/dss/lib/ds-value/lib/ds-thing/src/", "ds-token/=lib/dss-psm/lib/dss/lib/ds-token/src/", "ds-value/=lib/dss-psm/lib/dss/lib/ds-value/src/", "dss-interfaces/=lib/dss-psm/lib/dss-interfaces/src/", "dss-psm/=lib/dss-psm/src/", "dss/=lib/dss-psm/lib/dss/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "morpho-blue-oracles/=lib/morpho-blue-oracles/src/", "@morpho-blue-oracles/=lib/morpho-blue-oracles/", "morpho-blue/=lib/morpho-blue/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/", "@uniswap/v3-periphery/=lib/v3-periphery/", "@uniswap/v3-core/=lib/v3-core/", "@slipstream/=lib/slipstream/", "@ensdomains/=lib/slipstream/node_modules/@ensdomains/", "@nomad-xyz/=lib/slipstream/lib/ExcessivelySafeCall/", "@solidity-parser/=lib/slipstream/node_modules/solhint/node_modules/@solidity-parser/", "ExcessivelySafeCall/=lib/slipstream/lib/ExcessivelySafeCall/src/", "base64-sol/=lib/slipstream/lib/base64/", "base64/=lib/slipstream/lib/base64/", "halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/", "hardhat/=lib/slipstream/node_modules/hardhat/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "slipstream/=lib/slipstream/", "solidity-lib/=lib/slipstream/lib/solidity-lib/contracts/", "v3-core/=lib/v3-core/", "v3-periphery/=lib/v3-periphery/contracts/" ], "viaIR": true }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ExpectedPriceMustBeGreaterThanZero","type":"error"},{"inputs":[],"name":"FeedDecimalsMustBeGreaterThanZero","type":"error"},{"inputs":[],"name":"FeedMustImplementDecimals","type":"error"},{"inputs":[],"name":"FeedMustImplementLatestRoundData","type":"error"},{"inputs":[],"name":"MathOverflowedMulDiv","type":"error"},{"inputs":[{"internalType":"uint256","name":"scaleFactor","type":"uint256"}],"name":"OracleScaleFactorInvalid","type":"error"},{"inputs":[{"internalType":"uint256","name":"actualPrice","type":"uint256"},{"internalType":"uint256","name":"expectedPrice","type":"uint256"},{"internalType":"uint256","name":"error","type":"uint256"},{"internalType":"uint256","name":"allowedError","type":"uint256"}],"name":"PriceErrorExceedsAllowed","type":"error"},{"inputs":[],"name":"UnsupportedChainId","type":"error"},{"inputs":[],"name":"ZeroAddressNotAllowed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oracle","type":"address"},{"indexed":true,"internalType":"Id","name":"marketId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"marketCreator","type":"address"},{"indexed":false,"internalType":"address","name":"loanAsset","type":"address"},{"indexed":false,"internalType":"address","name":"collateralAsset","type":"address"},{"indexed":false,"internalType":"uint256","name":"lltv","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"expectedPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"actualPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"error","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"allowedError","type":"uint256"}],"name":"MarketCreated","type":"event"},{"inputs":[],"name":"DEFAULT_SALT","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"loanAsset","type":"address"},{"internalType":"address","name":"collateralAsset","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"},{"internalType":"contract AggregatorV3Interface","name":"baseFeed1","type":"address"},{"internalType":"contract AggregatorV3Interface","name":"baseFeed2","type":"address"},{"internalType":"contract AggregatorV3Interface","name":"quoteFeed1","type":"address"},{"internalType":"contract AggregatorV3Interface","name":"quoteFeed2","type":"address"},{"internalType":"uint256","name":"baseVaultConversionSample","type":"uint256"},{"internalType":"uint256","name":"quoteVaultConversionSample","type":"uint256"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256","name":"expectedPrice","type":"uint256"},{"internalType":"uint256","name":"allowedError","type":"uint256"}],"name":"createMarketAndOracle","outputs":[{"components":[{"internalType":"address","name":"loanToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"oracle","type":"address"},{"internalType":"address","name":"irm","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"}],"internalType":"struct MarketParams","name":"","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"loanAsset","type":"address"},{"internalType":"address","name":"collateralAsset","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"},{"internalType":"contract AggregatorV3Interface","name":"baseFeed1","type":"address"},{"internalType":"contract AggregatorV3Interface","name":"baseFeed2","type":"address"},{"internalType":"contract AggregatorV3Interface","name":"quoteFeed1","type":"address"},{"internalType":"contract AggregatorV3Interface","name":"quoteFeed2","type":"address"},{"internalType":"uint256","name":"baseVaultConversionSample","type":"uint256"},{"internalType":"uint256","name":"quoteVaultConversionSample","type":"uint256"},{"internalType":"uint256","name":"expectedPrice","type":"uint256"},{"internalType":"uint256","name":"allowedError","type":"uint256"}],"name":"createMarketAndOracle","outputs":[{"components":[{"internalType":"address","name":"loanToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"oracle","type":"address"},{"internalType":"address","name":"irm","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"}],"internalType":"struct MarketParams","name":"","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"loanAsset","type":"address"},{"internalType":"address","name":"collateralAsset","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"},{"internalType":"address","name":"oracleAddress","type":"address"},{"internalType":"uint256","name":"expectedPrice","type":"uint256"},{"internalType":"uint256","name":"allowedError","type":"uint256"}],"name":"createMarketWithExistingOracle","outputs":[{"components":[{"internalType":"address","name":"loanToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"oracle","type":"address"},{"internalType":"address","name":"irm","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"}],"internalType":"struct MarketParams","name":"","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"irm","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"morpho","outputs":[{"internalType":"contract IMorpho","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracleFactory","outputs":[{"internalType":"contract IMorphoOracleFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60e0604052346200005d576200001462000171565b6200001e62000063565b611d39620003a3823960805181818161064001526112af015260a05181818161058e0152610d36015260c0518181816102f1015261124c0152611d3990f35b62000069565b60405190565b5f80fd5b90565b90565b90565b6200008f62000089620000959262000070565b62000073565b6200006d565b90565b90565b620000b4620000ae620000ba9262000098565b62000073565b6200006d565b90565b90565b620000d9620000d3620000df92620000bd565b62000073565b6200006d565b90565b90565b620000fe620000f86200010492620000e2565b62000073565b6200006d565b90565b5f0190565b60018060a01b031690565b620001306200012a62000136926200010c565b62000073565b6200010c565b90565b620001449062000117565b90565b620001529062000139565b90565b620001609062000117565b90565b6200016e9062000155565b90565b466200018962000182600162000076565b916200006d565b145f14620001f057620001b073bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb62000147565b608052620001d2733a7bb36ee3f3ee32a60e9f2b33c1e5f2e83ad76662000163565b60a05273870ac11d48b15db9a138cf899d20f13f79ba00bc60c0525b565b4662000209620002026121056200009b565b916200006d565b145f1462000274576200023073bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb62000147565b60805262000252732dc205f24bcb6b311e5cdf0745b0741648aebd3d62000163565b60a0527346415998764c29ab2a25cbea6254146d50d2268760c0525b620001ee565b466200028c620002856082620000c0565b916200006d565b145f14620002f757620002b3738f5ae9cddb9f68de460c77730b018ae7e04a140a62000147565b608052620002d57343269546e1d586a1f7200a0ac07e26f9631f753962000163565b60a052739a6061d51743b31d2c3be75d83781fa423f53f0e60c0525b6200026e565b46620003116200030a620b67d2620000e5565b916200006d565b145f146200037b576200033873d50f2dfffd62f94ee4aed9ca05c61d0753268abc62000147565b6080526200035a737d047fb910bc187c18c81a69e30fa164f8c536ec62000163565b60a052734f708c0ae7ded3d74736594c2109c2e3c065b42860c052620002f1565b6200038562000063565b63c08c729760e01b8152806200039e6004820162000107565b0390fdfe60806040526004361015610013575b6106c5565b61001d5f3561008c565b80630e157ed61461008757806328e8fe7d146100825780633394e76d1461007d5780636ed1363814610078578063a1fbf4b614610073578063c7f7fb901461006e5763d8fbc8330361000e57610690565b610609565b610557565b6104be565b610418565b610335565b61029b565b60e01c90565b60405190565b5f80fd5b5f80fd5b60018060a01b031690565b6100b4906100a0565b90565b6100c0816100ab565b036100c757565b5f80fd5b905035906100d8826100b7565b565b90565b6100e6816100da565b036100ed57565b5f80fd5b905035906100fe826100dd565b565b610109906100ab565b90565b61011581610100565b0361011c57565b5f80fd5b9050359061012d8261010c565b565b90565b61013b8161012f565b0361014257565b5f80fd5b9050359061015382610132565b565b90916101808284031261020d5761016e835f84016100cb565b9261017c81602085016100cb565b9261018a82604083016100f1565b926101988360608401610120565b926101a68160808501610120565b926101b48260a08301610120565b926101c28360c08401610120565b926101d08160e085016100f1565b926101df8261010083016100f1565b9261020a6101f1846101208501610146565b936102008161014086016100f1565b93610160016100f1565b90565b61009c565b61021b906100ab565b9052565b610228906100da565b9052565b90608080610284936102445f8201515f860190610212565b61025660208201516020860190610212565b61026860408201516040860190610212565b61027a60608201516060860190610212565b015191019061021f565b565b9190610299905f60a0850194019061022c565b565b346102db576102d76102c66102b1366004610155565b9a99909998919897929796939695949561141f565b6102ce610092565b91829182610286565b0390f35b610098565b5f9103126102ea57565b61009c565b7f000000000000000000000000000000000000000000000000000000000000000090565b61031c906100ab565b9052565b9190610333905f60208501940190610313565b565b34610365576103453660046102e0565b6103616103506102ef565b610358610092565b91829182610320565b0390f35b610098565b91906101608382031261041357610383815f85016100cb565b9261039182602083016100cb565b9261039f83604084016100f1565b926103ad8160608501610120565b926103bb8260808301610120565b926103c98360a08401610120565b926103d78160c08501610120565b926103e58260e083016100f1565b926104106103f78461010085016100f1565b936104068161012086016100f1565b93610140016100f1565b90565b61009c565b346104555761045161044061042e36600461036a565b9998909897919796929695939561078f565b610448610092565b91829182610286565b0390f35b610098565b909160c0828403126104b957610472835f84016100cb565b9261048081602085016100cb565b9261048e82604083016100f1565b926104b661049f84606085016100cb565b936104ad81608086016100f1565b9360a0016100f1565b90565b61009c565b346104f5576104f16104e06104d436600461045a565b9493909392919261144b565b6104e8610092565b91829182610286565b0390f35b610098565b90565b5f1b90565b61051661051161051b926104fa565b6104fd565b61012f565b90565b6105275f610502565b90565b61053261051e565b90565b61053e9061012f565b9052565b9190610555905f60208501940190610535565b565b34610587576105673660046102e0565b61058361057261052a565b61057a610092565b91829182610542565b0390f35b610098565b7f000000000000000000000000000000000000000000000000000000000000000090565b90565b6105c76105c26105cc926100a0565b6105b0565b6100a0565b90565b6105d8906105b3565b90565b6105e4906105cf565b90565b6105f0906105db565b9052565b9190610607905f602085019401906105e7565b565b34610639576106193660046102e0565b61063561062461058c565b61062c610092565b918291826105f4565b0390f35b610098565b7f000000000000000000000000000000000000000000000000000000000000000090565b61066b906105cf565b90565b61067790610662565b9052565b919061068e905f6020850194019061066e565b565b346106c0576106a03660046102e0565b6106bc6106ab61063e565b6106b3610092565b9182918261067b565b0390f35b610098565b5f80fd5b601f801991011690565b634e487b7160e01b5f52604160045260245ffd5b906106f1906106c9565b810190811067ffffffffffffffff82111761070b57604052565b6106d3565b9061072361071c610092565b92836106e7565b565b61072f60a0610710565b90565b5f90565b5f90565b610742610725565b9060208080808086610752610732565b81520161075d610732565b815201610768610732565b815201610773610732565b81520161077e610736565b81525050565b61078c61073a565b90565b926107c09a989592969399979491996107a6610784565b509996909192939495966107b861051e565b98999a6107cf565b90565b6107cc906105cf565b90565b9661080d9b999296610805966107fc96849d9b94966107ec610784565b508b979091929394959697610af8565b929591926107c3565b9293946111e8565b90565b5f90565b5f90565b5f90565b61083061082b610835926104fa565b6105b0565b6100da565b90565b61084c610847610851926104fa565b6105b0565b6100a0565b90565b61085d90610838565b90565b610869906105b3565b90565b61087590610860565b90565b610881906105b3565b90565b61088d90610878565b90565b610899906105cf565b90565b5f80fd5b60e01b90565b60ff1690565b6108b5816108a6565b036108bc57565b5f80fd5b905051906108cd826108ac565b565b906020828203126108e8576108e5915f016108c0565b90565b61009c565b5f0190565b6108fa610092565b3d5f823e3d90fd5b61091661091161091b926108a6565b6105b0565b6100da565b90565b90565b61093561093061093a9261091e565b6105b0565b6100da565b90565b610946906105cf565b90565b90505190610956826100b7565b565b906020828203126109715761096e915f01610949565b90565b61009c565b90565b61098d61098861099292610976565b6105b0565b6100da565b90565b6109a26305f5e100610979565b90565b6109ad610995565b90565b6109b9906100ab565b90565b6109c5816109b0565b036109cc57565b5f80fd5b905051906109dd826109bc565b565b906020828203126109f8576109f5915f016109d0565b90565b61009c565b610a069061093d565b9052565b610a13906100da565b9052565b610a20906105cf565b90565b610a2c90610a17565b9052565b98969492909b9a99979593916101608a019c5f8b01610a4e916109fd565b60208a01610a5b91610a0a565b60408901610a6891610a23565b60608801610a7591610a23565b60808701610a8291610a0a565b60a08601610a8f916109fd565b60c08501610a9c91610a0a565b60e08401610aa991610a23565b6101008301610ab791610a23565b6101208201610ac591610a0a565b61014001610ad291610535565b565b610add906105cf565b90565b610ae9906105b3565b90565b610af590610ae0565b90565b9396909791959297610b08610810565b50610b1287611b49565b610b1b89611b49565b610b2488611b49565b610b2d86611b49565b610b35610814565b50610b3e610814565b50610b47610818565b50610b50610818565b5083610b64610b5e5f61081c565b916100da565b14158015611035575b5f14610f8657610b7c9061086c565b94610ba16020610b8b8861093d565b6338d52e0f90610b99610092565b9384926108a0565b82528180610bb1600482016108ed565b03915afa908115610f8157610bdb610bd6610bf1936020935f91610f54575b50610884565b610890565b63313ce56790610be9610092565b9384926108a0565b82528180610c01600482016108ed565b03915afa8015610f4f57610c1c915f91610f21575b50610902565b9380610c30610c2a5f61081c565b916100da565b145f14610f1c5750610c406109a5565b5b945b82610c56610c505f61081c565b916100da565b14158015610f0d575b5f14610e5f57610c6e9061086c565b97610c936020610c7d8b61093d565b6338d52e0f90610c8b610092565b9384926108a0565b82528180610ca3600482016108ed565b03915afa908115610e5a57610ccd610cc8610ce3936020935f91610e2d575b50610884565b610890565b63313ce56790610cdb610092565b9384926108a0565b82528180610cf3600482016108ed565b03915afa8015610e2857610d0e915f91610dfa575b50610902565b9280610d22610d1c5f61081c565b916100da565b145f14610df55750610d326109a5565b5b5b7f0000000000000000000000000000000000000000000000000000000000000000610d5e906105db565b9963b32cddf49897999b9690919293949596610d78610092565b9c8d9b610d858d9c6108a0565b8c5260048c019a610d959b610a30565b03815a6020945f91f1908115610df057610dbf91610dba915f91610dc2575b50610ad4565b610aec565b90565b610de3915060203d8111610de9575b610ddb81836106e7565b8101906109df565b5f610db4565b503d610dd1565b6108f2565b610d33565b610e1b915060203d8111610e21575b610e1381836106e7565b8101906108cf565b5f610d08565b503d610e09565b6108f2565b610e4d9150843d8111610e53575b610e4581836106e7565b810190610958565b5f610cc2565b503d610e3b565b6108f2565b979150610e9f6020610e89610e84610e7e610e795f610854565b61086c565b9b610884565b610890565b63313ce56790610e97610092565b9384926108a0565b82528180610eaf600482016108ed565b03915afa8015610f0857610eca915f91610eda575b50610902565b91610ed56001610921565b610d34565b610efb915060203d8111610f01575b610ef381836106e7565b8101906108cf565b5f610ec4565b503d610ee9565b6108f2565b50610f17816110cf565b610c5f565b610c41565b610f42915060203d8111610f48575b610f3a81836106e7565b8101906108cf565b5f610c16565b503d610f30565b6108f2565b610f749150843d8111610f7a575b610f6c81836106e7565b810190610958565b5f610bd0565b503d610f62565b6108f2565b949250610fc66020610fb0610fab610fa5610fa05f610854565b61086c565b98610884565b610890565b63313ce56790610fbe610092565b9384926108a0565b82528180610fd6600482016108ed565b03915afa801561103057610ff1915f91611002575b50610902565b92610ffc6001610921565b94610c43565b611023915060203d8111611029575b61101b81836106e7565b8101906108cf565b5f610feb565b503d611011565b6108f2565b5061103f816110cf565b610b6d565b5f90565b90565b61105f61105a61106492611048565b6105b0565b6100da565b90565b67ffffffffffffffff8111611085576110816020916106c9565b0190565b6106d3565b9061109c61109783611067565b610710565b918252565b606090565b3d5f146110c1576110b63d61108a565b903d5f602084013e5b565b6110c96110a1565b906110bf565b5f80916110da611044565b506110e661271061104b565b906110ef610092565b9061111c8261110d6004602083016338d52e0f60e01b8152016108ed565b602082018103825203836106e7565b60208201915192fa61112c6110a6565b5090565b61113a60a0610710565b90565b90611147906100ab565b9052565b90611155906100da565b9052565b5f91031261116357565b61009c565b611171906105cf565b90565b61117d9061012f565b90565b949290979695939160e08601985f870161119991610313565b602086016111a691610313565b604085016111b391610a0a565b606084016111c091610a0a565b608083016111cd91610a0a565b60a082016111da91610a0a565b60c0016111e691610a0a565b565b929490946111f4610784565b508361121061120a6112055f610854565b6100ab565b916100ab565b1480156113e9575b6113c65761122590610aec565b916112328386849161157b565b96909693856112a9836112a0611247856107c3565b6112977f00000000000000000000000000000000000000000000000000000000000000009161128e8a9561128561127c611130565b995f8b0161113d565b6020890161113d565b6040870161113d565b6060850161113d565b6080830161114b565b976112d37f0000000000000000000000000000000000000000000000000000000000000000610662565b91638c1358a28a843b156113c15761130a946112ff5f80946112f3610092565b988995869485936108a0565b835260048301610286565b03925af19081156113bc5761138a9361132892611390575b506107c3565b946113328a61140f565b9633989495999290919261137861137261136c7f4f42eb788d994d4dabcd08fd18b44385bfa0f3126a4c279a501e325fed037b8c9a611168565b9a611174565b9a611168565b9a611381610092565b97889788611180565b0390a490565b6113af905f3d81116113b5575b6113a781836106e7565b810190611159565b5f611322565b503d61139d565b6108f2565b61089c565b6113ce610092565b6342bcdf7f60e11b8152806113e5600482016108ed565b0390fd5b50856114056113ff6113fa5f610854565b6100ab565b916100ab565b14611218565b5f90565b60a09061141a61140b565b502090565b916114489b99979593919a98969492611436610784565b509a909192939495969798999a6107cf565b90565b91611468959391949261145c610784565b509490919293946111e8565b90565b5f1990565b9050519061147d826100dd565b565b9060208282031261149857611495915f01611470565b90565b61009c565b90565b6114b46114af6114b99261149d565b6105b0565b6100da565b90565b91906114cf905f60208501940190610a0a565b565b90565b6114e86114e36114ed926114d1565b6105b0565b6100da565b90565b611501670de0b6b3a76400006114d4565b90565b634e487b7160e01b5f52601160045260245ffd5b61152761152d919392936100da565b926100da565b820391821161153857565b611504565b6115726115799461156860609498979561155e608086019a5f870190610a0a565b6020850190610a0a565b6040830190610a0a565b0190610a0a565b565b929092611586610818565b5061158f610818565b50836115a361159d5f61081c565b916100da565b14806117df575b6117bc576115d260206115bc836107c3565b63ce4b5bbe906115ca610092565b9384926108a0565b825281806115e2600482016108ed565b03915afa9081156117b7575f91611789575b50806116086116025f61081c565b916100da565b148015611759575b61173357506020611623611639926107c3565b63a035b1fe90611631610092565b9384926108a0565b82528180611649600482016108ed565b03915afa90811561172e575f91611700575b50928361167061166a836100da565b916100da565b115f146116dd576116946116826114f0565b61168d868490611518565b8391611891565b925b836116a96116a3836100da565b916100da565b116116b2575050565b6116d99192508492936116c3610092565b948594638646292b60e01b86526004860161153d565b0390fd5b6116fa6116e86114f0565b6116f3838790611518565b8391611891565b92611696565b611721915060203d8111611727575b61171981836106e7565b81019061147f565b5f61165b565b503d61170f565b6108f2565b6117559061173f610092565b9182916314590f3f60e11b8352600483016114bc565b0390fd5b508061178261177c74446c3b15f9926687d2c40534fdb5640000000000006114a0565b916100da565b1015611610565b6117aa915060203d81116117b0575b6117a281836106e7565b81019061147f565b5f6115f4565b503d611798565b6108f2565b6117c4610092565b631fb80c6b60e21b8152806117db600482016108ed565b0390fd5b50826117fa6117f46117ef61146b565b6100da565b916100da565b14156115aa565b9061180c91026100da565b90565b634e487b7160e01b5f52601260045260245ffd5b61182f611835916100da565b916100da565b908115611840570490565b61180f565b9061185091036100da565b90565b90565b61186a61186561186f92611853565b6105b0565b6100da565b90565b90565b61188961188461188e92611872565b6105b0565b6100da565b90565b91909161189c610818565b506118a8818490611801565b916118b1610818565b505f198483098380821091030393846118d26118cc5f61081c565b916100da565b14611a6e57816118ea6118e4876100da565b916100da565b1115611a4b57611a48948261193992611a4295611905610818565b50099085821190039403936001836119265f611921879161081c565b611845565b1680809504960493805f03040190611801565b1791611a3c611a206119fc6119d86119b4611990611961600361195c8991611856565b611801565b61196b6002611875565b1861198a600261198561197f8b8590611801565b91611875565b611845565b90611801565b6119ae60026119a96119a38a8590611801565b91611875565b611845565b90611801565b6119d260026119cd6119c7898590611801565b91611875565b611845565b90611801565b6119f660026119f16119eb888590611801565b91611875565b611845565b90611801565b611a1a6002611a15611a0f878590611801565b91611875565b611845565b90611801565b91611a37611a316002928590611801565b91611875565b611845565b90611801565b90611801565b90565b611a53610092565b63227bc15360e01b815280611a6a600482016108ed565b0390fd5b50919050611a7c9250611823565b90565b69ffffffffffffffffffff1690565b611a9781611a7f565b03611a9e57565b5f80fd5b90505190611aaf82611a8e565b565b90565b611abd81611ab1565b03611ac457565b5f80fd5b90505190611ad582611ab4565b565b919060a083820312611b2857611aef815f8501611aa2565b92611afd8260208301611ac8565b92611b25611b0e8460408501611470565b93611b1c8160608601611470565b93608001611aa2565b90565b61009c565b611b41611b3c611b46926104fa565b6105b0565b6108a6565b90565b611b5281610a17565b611b6c611b66611b615f610854565b6100ab565b916100ab565b14611d0057611b9560a0611b7f83610a17565b63feaf968c90611b8d610092565b9384926108a0565b82528180611ba5600482016108ed565b03915afa9081611cd0575b50155f14611cc2576001611c9f576020611bcd611be3925b610a17565b63313ce56790611bdb610092565b9384926108a0565b82528180611bf3600482016108ed565b03915afa80915f92611c6f575b50155f14611c3557506001611c12575b565b611c1a610092565b638ea420e760e01b815280611c31600482016108ed565b0390fd5b611c47611c415f611b2d565b916108a6565b03611c1057611c54610092565b63dff4edbd60e01b815280611c6b600482016108ed565b0390fd5b611c9191925060203d8111611c98575b611c8981836106e7565b8101906108cf565b905f611c00565b503d611c7f565b611ca7610092565b6308787b4760e31b815280611cbe600482016108ed565b0390fd5b6020611bcd611be392611bc8565b611cf09060a03d8111611cf9575b611ce881836106e7565b810190611ad7565b50505050611bb0565b503d611cde565b5056fea264697066735822122042a251d19b48d13b5e6a3a6340b37209ca5035e2265442ee5693dfbbb463e9ae64736f6c63430008150033
Deployed Bytecode
0x60806040526004361015610013575b6106c5565b61001d5f3561008c565b80630e157ed61461008757806328e8fe7d146100825780633394e76d1461007d5780636ed1363814610078578063a1fbf4b614610073578063c7f7fb901461006e5763d8fbc8330361000e57610690565b610609565b610557565b6104be565b610418565b610335565b61029b565b60e01c90565b60405190565b5f80fd5b5f80fd5b60018060a01b031690565b6100b4906100a0565b90565b6100c0816100ab565b036100c757565b5f80fd5b905035906100d8826100b7565b565b90565b6100e6816100da565b036100ed57565b5f80fd5b905035906100fe826100dd565b565b610109906100ab565b90565b61011581610100565b0361011c57565b5f80fd5b9050359061012d8261010c565b565b90565b61013b8161012f565b0361014257565b5f80fd5b9050359061015382610132565b565b90916101808284031261020d5761016e835f84016100cb565b9261017c81602085016100cb565b9261018a82604083016100f1565b926101988360608401610120565b926101a68160808501610120565b926101b48260a08301610120565b926101c28360c08401610120565b926101d08160e085016100f1565b926101df8261010083016100f1565b9261020a6101f1846101208501610146565b936102008161014086016100f1565b93610160016100f1565b90565b61009c565b61021b906100ab565b9052565b610228906100da565b9052565b90608080610284936102445f8201515f860190610212565b61025660208201516020860190610212565b61026860408201516040860190610212565b61027a60608201516060860190610212565b015191019061021f565b565b9190610299905f60a0850194019061022c565b565b346102db576102d76102c66102b1366004610155565b9a99909998919897929796939695949561141f565b6102ce610092565b91829182610286565b0390f35b610098565b5f9103126102ea57565b61009c565b7f0000000000000000000000004f708c0ae7ded3d74736594c2109c2e3c065b42890565b61031c906100ab565b9052565b9190610333905f60208501940190610313565b565b34610365576103453660046102e0565b6103616103506102ef565b610358610092565b91829182610320565b0390f35b610098565b91906101608382031261041357610383815f85016100cb565b9261039182602083016100cb565b9261039f83604084016100f1565b926103ad8160608501610120565b926103bb8260808301610120565b926103c98360a08401610120565b926103d78160c08501610120565b926103e58260e083016100f1565b926104106103f78461010085016100f1565b936104068161012086016100f1565b93610140016100f1565b90565b61009c565b346104555761045161044061042e36600461036a565b9998909897919796929695939561078f565b610448610092565b91829182610286565b0390f35b610098565b909160c0828403126104b957610472835f84016100cb565b9261048081602085016100cb565b9261048e82604083016100f1565b926104b661049f84606085016100cb565b936104ad81608086016100f1565b9360a0016100f1565b90565b61009c565b346104f5576104f16104e06104d436600461045a565b9493909392919261144b565b6104e8610092565b91829182610286565b0390f35b610098565b90565b5f1b90565b61051661051161051b926104fa565b6104fd565b61012f565b90565b6105275f610502565b90565b61053261051e565b90565b61053e9061012f565b9052565b9190610555905f60208501940190610535565b565b34610587576105673660046102e0565b61058361057261052a565b61057a610092565b91829182610542565b0390f35b610098565b7f0000000000000000000000007d047fb910bc187c18c81a69e30fa164f8c536ec90565b90565b6105c76105c26105cc926100a0565b6105b0565b6100a0565b90565b6105d8906105b3565b90565b6105e4906105cf565b90565b6105f0906105db565b9052565b9190610607905f602085019401906105e7565b565b34610639576106193660046102e0565b61063561062461058c565b61062c610092565b918291826105f4565b0390f35b610098565b7f000000000000000000000000d50f2dfffd62f94ee4aed9ca05c61d0753268abc90565b61066b906105cf565b90565b61067790610662565b9052565b919061068e905f6020850194019061066e565b565b346106c0576106a03660046102e0565b6106bc6106ab61063e565b6106b3610092565b9182918261067b565b0390f35b610098565b5f80fd5b601f801991011690565b634e487b7160e01b5f52604160045260245ffd5b906106f1906106c9565b810190811067ffffffffffffffff82111761070b57604052565b6106d3565b9061072361071c610092565b92836106e7565b565b61072f60a0610710565b90565b5f90565b5f90565b610742610725565b9060208080808086610752610732565b81520161075d610732565b815201610768610732565b815201610773610732565b81520161077e610736565b81525050565b61078c61073a565b90565b926107c09a989592969399979491996107a6610784565b509996909192939495966107b861051e565b98999a6107cf565b90565b6107cc906105cf565b90565b9661080d9b999296610805966107fc96849d9b94966107ec610784565b508b979091929394959697610af8565b929591926107c3565b9293946111e8565b90565b5f90565b5f90565b5f90565b61083061082b610835926104fa565b6105b0565b6100da565b90565b61084c610847610851926104fa565b6105b0565b6100a0565b90565b61085d90610838565b90565b610869906105b3565b90565b61087590610860565b90565b610881906105b3565b90565b61088d90610878565b90565b610899906105cf565b90565b5f80fd5b60e01b90565b60ff1690565b6108b5816108a6565b036108bc57565b5f80fd5b905051906108cd826108ac565b565b906020828203126108e8576108e5915f016108c0565b90565b61009c565b5f0190565b6108fa610092565b3d5f823e3d90fd5b61091661091161091b926108a6565b6105b0565b6100da565b90565b90565b61093561093061093a9261091e565b6105b0565b6100da565b90565b610946906105cf565b90565b90505190610956826100b7565b565b906020828203126109715761096e915f01610949565b90565b61009c565b90565b61098d61098861099292610976565b6105b0565b6100da565b90565b6109a26305f5e100610979565b90565b6109ad610995565b90565b6109b9906100ab565b90565b6109c5816109b0565b036109cc57565b5f80fd5b905051906109dd826109bc565b565b906020828203126109f8576109f5915f016109d0565b90565b61009c565b610a069061093d565b9052565b610a13906100da565b9052565b610a20906105cf565b90565b610a2c90610a17565b9052565b98969492909b9a99979593916101608a019c5f8b01610a4e916109fd565b60208a01610a5b91610a0a565b60408901610a6891610a23565b60608801610a7591610a23565b60808701610a8291610a0a565b60a08601610a8f916109fd565b60c08501610a9c91610a0a565b60e08401610aa991610a23565b6101008301610ab791610a23565b6101208201610ac591610a0a565b61014001610ad291610535565b565b610add906105cf565b90565b610ae9906105b3565b90565b610af590610ae0565b90565b9396909791959297610b08610810565b50610b1287611b49565b610b1b89611b49565b610b2488611b49565b610b2d86611b49565b610b35610814565b50610b3e610814565b50610b47610818565b50610b50610818565b5083610b64610b5e5f61081c565b916100da565b14158015611035575b5f14610f8657610b7c9061086c565b94610ba16020610b8b8861093d565b6338d52e0f90610b99610092565b9384926108a0565b82528180610bb1600482016108ed565b03915afa908115610f8157610bdb610bd6610bf1936020935f91610f54575b50610884565b610890565b63313ce56790610be9610092565b9384926108a0565b82528180610c01600482016108ed565b03915afa8015610f4f57610c1c915f91610f21575b50610902565b9380610c30610c2a5f61081c565b916100da565b145f14610f1c5750610c406109a5565b5b945b82610c56610c505f61081c565b916100da565b14158015610f0d575b5f14610e5f57610c6e9061086c565b97610c936020610c7d8b61093d565b6338d52e0f90610c8b610092565b9384926108a0565b82528180610ca3600482016108ed565b03915afa908115610e5a57610ccd610cc8610ce3936020935f91610e2d575b50610884565b610890565b63313ce56790610cdb610092565b9384926108a0565b82528180610cf3600482016108ed565b03915afa8015610e2857610d0e915f91610dfa575b50610902565b9280610d22610d1c5f61081c565b916100da565b145f14610df55750610d326109a5565b5b5b7f0000000000000000000000007d047fb910bc187c18c81a69e30fa164f8c536ec610d5e906105db565b9963b32cddf49897999b9690919293949596610d78610092565b9c8d9b610d858d9c6108a0565b8c5260048c019a610d959b610a30565b03815a6020945f91f1908115610df057610dbf91610dba915f91610dc2575b50610ad4565b610aec565b90565b610de3915060203d8111610de9575b610ddb81836106e7565b8101906109df565b5f610db4565b503d610dd1565b6108f2565b610d33565b610e1b915060203d8111610e21575b610e1381836106e7565b8101906108cf565b5f610d08565b503d610e09565b6108f2565b610e4d9150843d8111610e53575b610e4581836106e7565b810190610958565b5f610cc2565b503d610e3b565b6108f2565b979150610e9f6020610e89610e84610e7e610e795f610854565b61086c565b9b610884565b610890565b63313ce56790610e97610092565b9384926108a0565b82528180610eaf600482016108ed565b03915afa8015610f0857610eca915f91610eda575b50610902565b91610ed56001610921565b610d34565b610efb915060203d8111610f01575b610ef381836106e7565b8101906108cf565b5f610ec4565b503d610ee9565b6108f2565b50610f17816110cf565b610c5f565b610c41565b610f42915060203d8111610f48575b610f3a81836106e7565b8101906108cf565b5f610c16565b503d610f30565b6108f2565b610f749150843d8111610f7a575b610f6c81836106e7565b810190610958565b5f610bd0565b503d610f62565b6108f2565b949250610fc66020610fb0610fab610fa5610fa05f610854565b61086c565b98610884565b610890565b63313ce56790610fbe610092565b9384926108a0565b82528180610fd6600482016108ed565b03915afa801561103057610ff1915f91611002575b50610902565b92610ffc6001610921565b94610c43565b611023915060203d8111611029575b61101b81836106e7565b8101906108cf565b5f610feb565b503d611011565b6108f2565b5061103f816110cf565b610b6d565b5f90565b90565b61105f61105a61106492611048565b6105b0565b6100da565b90565b67ffffffffffffffff8111611085576110816020916106c9565b0190565b6106d3565b9061109c61109783611067565b610710565b918252565b606090565b3d5f146110c1576110b63d61108a565b903d5f602084013e5b565b6110c96110a1565b906110bf565b5f80916110da611044565b506110e661271061104b565b906110ef610092565b9061111c8261110d6004602083016338d52e0f60e01b8152016108ed565b602082018103825203836106e7565b60208201915192fa61112c6110a6565b5090565b61113a60a0610710565b90565b90611147906100ab565b9052565b90611155906100da565b9052565b5f91031261116357565b61009c565b611171906105cf565b90565b61117d9061012f565b90565b949290979695939160e08601985f870161119991610313565b602086016111a691610313565b604085016111b391610a0a565b606084016111c091610a0a565b608083016111cd91610a0a565b60a082016111da91610a0a565b60c0016111e691610a0a565b565b929490946111f4610784565b508361121061120a6112055f610854565b6100ab565b916100ab565b1480156113e9575b6113c65761122590610aec565b916112328386849161157b565b96909693856112a9836112a0611247856107c3565b6112977f0000000000000000000000004f708c0ae7ded3d74736594c2109c2e3c065b4289161128e8a9561128561127c611130565b995f8b0161113d565b6020890161113d565b6040870161113d565b6060850161113d565b6080830161114b565b976112d37f000000000000000000000000d50f2dfffd62f94ee4aed9ca05c61d0753268abc610662565b91638c1358a28a843b156113c15761130a946112ff5f80946112f3610092565b988995869485936108a0565b835260048301610286565b03925af19081156113bc5761138a9361132892611390575b506107c3565b946113328a61140f565b9633989495999290919261137861137261136c7f4f42eb788d994d4dabcd08fd18b44385bfa0f3126a4c279a501e325fed037b8c9a611168565b9a611174565b9a611168565b9a611381610092565b97889788611180565b0390a490565b6113af905f3d81116113b5575b6113a781836106e7565b810190611159565b5f611322565b503d61139d565b6108f2565b61089c565b6113ce610092565b6342bcdf7f60e11b8152806113e5600482016108ed565b0390fd5b50856114056113ff6113fa5f610854565b6100ab565b916100ab565b14611218565b5f90565b60a09061141a61140b565b502090565b916114489b99979593919a98969492611436610784565b509a909192939495969798999a6107cf565b90565b91611468959391949261145c610784565b509490919293946111e8565b90565b5f1990565b9050519061147d826100dd565b565b9060208282031261149857611495915f01611470565b90565b61009c565b90565b6114b46114af6114b99261149d565b6105b0565b6100da565b90565b91906114cf905f60208501940190610a0a565b565b90565b6114e86114e36114ed926114d1565b6105b0565b6100da565b90565b611501670de0b6b3a76400006114d4565b90565b634e487b7160e01b5f52601160045260245ffd5b61152761152d919392936100da565b926100da565b820391821161153857565b611504565b6115726115799461156860609498979561155e608086019a5f870190610a0a565b6020850190610a0a565b6040830190610a0a565b0190610a0a565b565b929092611586610818565b5061158f610818565b50836115a361159d5f61081c565b916100da565b14806117df575b6117bc576115d260206115bc836107c3565b63ce4b5bbe906115ca610092565b9384926108a0565b825281806115e2600482016108ed565b03915afa9081156117b7575f91611789575b50806116086116025f61081c565b916100da565b148015611759575b61173357506020611623611639926107c3565b63a035b1fe90611631610092565b9384926108a0565b82528180611649600482016108ed565b03915afa90811561172e575f91611700575b50928361167061166a836100da565b916100da565b115f146116dd576116946116826114f0565b61168d868490611518565b8391611891565b925b836116a96116a3836100da565b916100da565b116116b2575050565b6116d99192508492936116c3610092565b948594638646292b60e01b86526004860161153d565b0390fd5b6116fa6116e86114f0565b6116f3838790611518565b8391611891565b92611696565b611721915060203d8111611727575b61171981836106e7565b81019061147f565b5f61165b565b503d61170f565b6108f2565b6117559061173f610092565b9182916314590f3f60e11b8352600483016114bc565b0390fd5b508061178261177c74446c3b15f9926687d2c40534fdb5640000000000006114a0565b916100da565b1015611610565b6117aa915060203d81116117b0575b6117a281836106e7565b81019061147f565b5f6115f4565b503d611798565b6108f2565b6117c4610092565b631fb80c6b60e21b8152806117db600482016108ed565b0390fd5b50826117fa6117f46117ef61146b565b6100da565b916100da565b14156115aa565b9061180c91026100da565b90565b634e487b7160e01b5f52601260045260245ffd5b61182f611835916100da565b916100da565b908115611840570490565b61180f565b9061185091036100da565b90565b90565b61186a61186561186f92611853565b6105b0565b6100da565b90565b90565b61188961188461188e92611872565b6105b0565b6100da565b90565b91909161189c610818565b506118a8818490611801565b916118b1610818565b505f198483098380821091030393846118d26118cc5f61081c565b916100da565b14611a6e57816118ea6118e4876100da565b916100da565b1115611a4b57611a48948261193992611a4295611905610818565b50099085821190039403936001836119265f611921879161081c565b611845565b1680809504960493805f03040190611801565b1791611a3c611a206119fc6119d86119b4611990611961600361195c8991611856565b611801565b61196b6002611875565b1861198a600261198561197f8b8590611801565b91611875565b611845565b90611801565b6119ae60026119a96119a38a8590611801565b91611875565b611845565b90611801565b6119d260026119cd6119c7898590611801565b91611875565b611845565b90611801565b6119f660026119f16119eb888590611801565b91611875565b611845565b90611801565b611a1a6002611a15611a0f878590611801565b91611875565b611845565b90611801565b91611a37611a316002928590611801565b91611875565b611845565b90611801565b90611801565b90565b611a53610092565b63227bc15360e01b815280611a6a600482016108ed565b0390fd5b50919050611a7c9250611823565b90565b69ffffffffffffffffffff1690565b611a9781611a7f565b03611a9e57565b5f80fd5b90505190611aaf82611a8e565b565b90565b611abd81611ab1565b03611ac457565b5f80fd5b90505190611ad582611ab4565b565b919060a083820312611b2857611aef815f8501611aa2565b92611afd8260208301611ac8565b92611b25611b0e8460408501611470565b93611b1c8160608601611470565b93608001611aa2565b90565b61009c565b611b41611b3c611b46926104fa565b6105b0565b6108a6565b90565b611b5281610a17565b611b6c611b66611b615f610854565b6100ab565b916100ab565b14611d0057611b9560a0611b7f83610a17565b63feaf968c90611b8d610092565b9384926108a0565b82528180611ba5600482016108ed565b03915afa9081611cd0575b50155f14611cc2576001611c9f576020611bcd611be3925b610a17565b63313ce56790611bdb610092565b9384926108a0565b82528180611bf3600482016108ed565b03915afa80915f92611c6f575b50155f14611c3557506001611c12575b565b611c1a610092565b638ea420e760e01b815280611c31600482016108ed565b0390fd5b611c47611c415f611b2d565b916108a6565b03611c1057611c54610092565b63dff4edbd60e01b815280611c6b600482016108ed565b0390fd5b611c9191925060203d8111611c98575b611c8981836106e7565b8101906108cf565b905f611c00565b503d611c7f565b611ca7610092565b6308787b4760e31b815280611cbe600482016108ed565b0390fd5b6020611bcd611be392611bc8565b611cf09060a03d8111611cf9575b611ce881836106e7565b810190611ad7565b50505050611bb0565b503d611cde565b5056fea264697066735822122042a251d19b48d13b5e6a3a6340b37209ca5035e2265442ee5693dfbbb463e9ae64736f6c63430008150033
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.