More Info
Private Name Tags
Multichain Info
No addresses found
Latest 25 from a total of 432 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Withdraw Collate... | 22178588 | 17 days ago | IN | 0 ETH | 0.00012131 | ||||
Repay | 22178585 | 17 days ago | IN | 0 ETH | 0.00009532 | ||||
Withdraw Collate... | 22155616 | 20 days ago | IN | 0 ETH | 0.00005726 | ||||
Withdraw Collate... | 22155609 | 20 days ago | IN | 0 ETH | 0.00003961 | ||||
Repay | 22155605 | 20 days ago | IN | 0 ETH | 0.00004087 | ||||
Repay | 22155571 | 20 days ago | IN | 0 ETH | 0.00004418 | ||||
Repay | 22155563 | 20 days ago | IN | 0 ETH | 0.00004418 | ||||
Repay | 22155482 | 20 days ago | IN | 0 ETH | 0.00004523 | ||||
Repay | 22155473 | 20 days ago | IN | 0 ETH | 0.00006185 | ||||
Withdraw Collate... | 22152204 | 20 days ago | IN | 0 ETH | 0.00013431 | ||||
Repay | 22152198 | 20 days ago | IN | 0 ETH | 0.00010896 | ||||
Withdraw Collate... | 22150933 | 21 days ago | IN | 0 ETH | 0.00012194 | ||||
Withdraw Collate... | 22146804 | 21 days ago | IN | 0 ETH | 0.00008353 | ||||
Withdraw Collate... | 22146803 | 21 days ago | IN | 0 ETH | 0.00015422 | ||||
Withdraw Collate... | 22146802 | 21 days ago | IN | 0 ETH | 0.0001585 | ||||
Supply Collatera... | 22146794 | 21 days ago | IN | 0 ETH | 0.00010326 | ||||
Withdraw Collate... | 22146765 | 21 days ago | IN | 0 ETH | 0.00009176 | ||||
Withdraw Collate... | 22146764 | 21 days ago | IN | 0 ETH | 0.00017477 | ||||
Supply Collatera... | 22146758 | 21 days ago | IN | 0 ETH | 0.00012573 | ||||
Borrow | 22143388 | 22 days ago | IN | 0 ETH | 0.00010565 | ||||
Repay | 22143383 | 22 days ago | IN | 0 ETH | 0.00002501 | ||||
Repay | 22143140 | 22 days ago | IN | 0 ETH | 0.00021232 | ||||
Borrow | 22143133 | 22 days ago | IN | 0 ETH | 0.00026603 | ||||
Supply Collatera... | 22143129 | 22 days ago | IN | 0 ETH | 0.0001506 | ||||
Repay | 22134944 | 23 days ago | IN | 0 ETH | 0.00021485 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
IMFMoneyMarkets
Compiler Version
v0.8.25+commit.b61c2a91
Optimization Enabled:
Yes with 999999 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; import { Id, IIMFMoneyMarketsStaticTyping, IIMFMoneyMarketsBase, MarketParams, Position, Market } from "./interfaces/IIMFMoneyMarkets.sol"; import { IIMFMoneyMarketsLiquidateCallback, IIMFMoneyMarketsRepayCallback, IIMFMoneyMarketsSupplyCallback, IIMFMoneyMarketsSupplyCollateralCallback, IIMFMoneyMarketsFlashLoanCallback } from "./interfaces/IIMFMoneyMarketsCallbacks.sol"; import {IIrm} from "./interfaces/IIrm.sol"; import {IERC20} from "./interfaces/IERC20.sol"; import {IMoney} from "./interfaces/IMoney.sol"; import {IOracle} from "./interfaces/IOracle.sol"; import "./libraries/ConstantsLib.sol"; import {UtilsLib} from "./libraries/UtilsLib.sol"; import {EventsLib} from "./libraries/EventsLib.sol"; import {ErrorsLib} from "./libraries/ErrorsLib.sol"; import {MathLib, WAD} from "./libraries/MathLib.sol"; import {SharesMathLib} from "./libraries/SharesMathLib.sol"; import {MarketParamsLib} from "./libraries/MarketParamsLib.sol"; import {SafeTransferLib} from "./libraries/SafeTransferLib.sol"; /// @title IMFMoneyMarkets /// @author Morpho Labs /// @author An IMFer /// @notice The IMFMoneyMarkets contract. contract IMFMoneyMarkets is IIMFMoneyMarketsStaticTyping { using MathLib for uint128; using MathLib for uint256; using UtilsLib for uint256; using SharesMathLib for uint256; using SafeTransferLib for IERC20; using MarketParamsLib for MarketParams; /* IMMUTABLES */ /// @inheritdoc IIMFMoneyMarketsBase bytes32 public immutable DOMAIN_SEPARATOR; /* STORAGE */ /// @inheritdoc IIMFMoneyMarketsBase address public owner; /// @inheritdoc IIMFMoneyMarketsStaticTyping mapping(Id => mapping(address => Position)) public position; /// @inheritdoc IIMFMoneyMarketsStaticTyping mapping(Id => Market) public market; /// @inheritdoc IIMFMoneyMarketsStaticTyping mapping(Id => MarketParams) public idToMarketParams; /// Interest rate receiptient address public interestRecipient; /* CONSTRUCTOR */ /// @param newOwner The new owner of the contract. constructor(address newOwner, address _interestRecipient) { require(newOwner != address(0), ErrorsLib.ZERO_ADDRESS); DOMAIN_SEPARATOR = keccak256(abi.encode(DOMAIN_TYPEHASH, block.chainid, address(this))); owner = newOwner; interestRecipient = _interestRecipient; emit EventsLib.SetOwner(newOwner); } /* MODIFIERS */ /// @dev Reverts if the caller is not the owner. modifier onlyOwner() { require(msg.sender == owner, ErrorsLib.NOT_OWNER); _; } /* ONLY OWNER FUNCTIONS */ /// @inheritdoc IIMFMoneyMarketsBase function setOwner(address newOwner) external onlyOwner { require(newOwner != owner, ErrorsLib.ALREADY_SET); owner = newOwner; emit EventsLib.SetOwner(newOwner); } /// @inheritdoc IIMFMoneyMarketsBase function setInterestRecipient(address _newInterestRecipient) external onlyOwner { require(_newInterestRecipient != address(0), ErrorsLib.ZERO_ADDRESS); interestRecipient = _newInterestRecipient; emit EventsLib.SetInterestRecipient(_newInterestRecipient); } /// @inheritdoc IIMFMoneyMarketsBase function setMarketPause(MarketParams memory marketParams, bool pause) external onlyOwner { Id id = marketParams.id(); market[id].isPaused = pause; } /// @inheritdoc IIMFMoneyMarketsBase function createMarket(MarketParams memory marketParams) external onlyOwner { Id id = marketParams.id(); // require(isIrmEnabled[marketParams.irm], ErrorsLib.IRM_NOT_ENABLED); // require(isLltvEnabled[marketParams.lltv], ErrorsLib.LLTV_NOT_ENABLED); require(market[id].lastUpdate == 0, ErrorsLib.MARKET_ALREADY_CREATED); // Safe "unchecked" cast. market[id].lastUpdate = uint128(block.timestamp); idToMarketParams[id] = marketParams; emit EventsLib.CreateMarket(id, marketParams); // Call to initialize the IRM in case it is stateful. if (marketParams.irm != address(0)) IIrm(marketParams.irm).borrowRate(marketParams, market[id]); } /* BORROW MANAGEMENT */ /// @inheritdoc IIMFMoneyMarketsBase function borrow(MarketParams memory marketParams, uint256 assets, uint256 shares, address receiver) external returns (uint256, uint256) { Id id = marketParams.id(); require(market[id].lastUpdate != 0, ErrorsLib.MARKET_NOT_CREATED); require(!market[id].isPaused, ErrorsLib.MARKET_PAUSED); require(UtilsLib.exactlyOneZero(assets, shares), ErrorsLib.INCONSISTENT_INPUT); require(receiver != address(0), ErrorsLib.ZERO_ADDRESS); _accrueInterest(marketParams, id); if (assets > 0) { shares = assets.toSharesUp(market[id].totalBorrowAssets, market[id].totalBorrowShares); } else { assets = shares.toAssetsDown(market[id].totalBorrowAssets, market[id].totalBorrowShares); } position[id][msg.sender].borrowShares += shares.toUint128(); market[id].totalBorrowShares += shares.toUint128(); market[id].totalBorrowAssets += assets.toUint128(); uint256 collateralPrice = IOracle(marketParams.collateralTokenOracle).price(); require(_isHealthy(marketParams, id, msg.sender, collateralPrice), ErrorsLib.INSUFFICIENT_COLLATERAL); emit EventsLib.Borrow(id, msg.sender, msg.sender, receiver, assets, shares); IMoney(marketParams.loanToken).mint(receiver, assets); return (assets, shares); } /// @inheritdoc IIMFMoneyMarketsBase function repay(MarketParams memory marketParams, uint256 assets, uint256 shares, bytes calldata data) external returns (uint256, uint256) { Id id = marketParams.id(); require(market[id].lastUpdate != 0, ErrorsLib.MARKET_NOT_CREATED); require(!market[id].isPaused, ErrorsLib.MARKET_PAUSED); require(UtilsLib.exactlyOneZero(assets, shares), ErrorsLib.INCONSISTENT_INPUT); _accrueInterest(marketParams, id); if (assets > 0) shares = assets.toSharesDown(market[id].totalBorrowAssets, market[id].totalBorrowShares); else assets = shares.toAssetsUp(market[id].totalBorrowAssets, market[id].totalBorrowShares); position[id][msg.sender].borrowShares -= shares.toUint128(); market[id].totalBorrowShares -= shares.toUint128(); market[id].totalBorrowAssets = UtilsLib.zeroFloorSub(market[id].totalBorrowAssets, assets).toUint128(); // `assets` may be greater than `totalBorrowAssets` by 1. emit EventsLib.Repay(id, msg.sender, msg.sender, assets, shares); if (data.length > 0) IIMFMoneyMarketsRepayCallback(msg.sender).onIMFMoneyMarketsRepay(assets, data); IERC20(marketParams.loanToken).safeTransferFrom(msg.sender, address(this), assets); IMoney(marketParams.loanToken).shred(address(this), assets); return (assets, shares); } /* COLLATERAL MANAGEMENT */ /// @inheritdoc IIMFMoneyMarketsBase function supplyCollateral(MarketParams memory marketParams, uint256 assets, bytes calldata data) external { Id id = marketParams.id(); require(market[id].lastUpdate != 0, ErrorsLib.MARKET_NOT_CREATED); require(!market[id].isPaused, ErrorsLib.MARKET_PAUSED); require(assets != 0, ErrorsLib.ZERO_ASSETS); // Don't accrue interest because it's not required and it saves gas. position[id][msg.sender].collateral += assets.toUint128(); emit EventsLib.SupplyCollateral(id, msg.sender, msg.sender, assets); if (data.length > 0) { IIMFMoneyMarketsSupplyCollateralCallback(msg.sender).onIMFMoneyMarketsSupplyCollateral(assets, data); } IERC20(marketParams.collateralToken).safeTransferFrom(msg.sender, address(this), assets); } /// @inheritdoc IIMFMoneyMarketsBase function withdrawCollateral(MarketParams memory marketParams, uint256 assets, address receiver) external { Id id = marketParams.id(); require(market[id].lastUpdate != 0, ErrorsLib.MARKET_NOT_CREATED); require(!market[id].isPaused, ErrorsLib.MARKET_PAUSED); require(assets != 0, ErrorsLib.ZERO_ASSETS); require(receiver != address(0), ErrorsLib.ZERO_ADDRESS); _accrueInterest(marketParams, id); position[id][msg.sender].collateral -= assets.toUint128(); uint256 collateralPrice = IOracle(marketParams.collateralTokenOracle).price(); require(_isHealthy(marketParams, id, msg.sender, collateralPrice), ErrorsLib.INSUFFICIENT_COLLATERAL); emit EventsLib.WithdrawCollateral(id, msg.sender, msg.sender, receiver, assets); IERC20(marketParams.collateralToken).safeTransfer(receiver, assets); } /* LIQUIDATION */ /// @inheritdoc IIMFMoneyMarketsBase function liquidate( MarketParams memory marketParams, address borrower, uint256 seizedAssets, uint256 repaidShares, bytes calldata data ) external returns (uint256, uint256) { Id id = marketParams.id(); require(market[id].lastUpdate != 0, ErrorsLib.MARKET_NOT_CREATED); require(!market[id].isPaused, ErrorsLib.MARKET_PAUSED); require(UtilsLib.exactlyOneZero(seizedAssets, repaidShares), ErrorsLib.INCONSISTENT_INPUT); _accrueInterest(marketParams, id); { uint256 collateralPrice = IOracle(marketParams.collateralTokenOracle).price(); require(!_isHealthy(marketParams, id, borrower, collateralPrice), ErrorsLib.HEALTHY_POSITION); // The liquidation incentive factor is min(maxLiquidationIncentiveFactor, 1/(1 - cursor*(1 - lltv))). uint256 liquidationIncentiveFactor = UtilsLib.min( MAX_LIQUIDATION_INCENTIVE_FACTOR, WAD.wDivDown(WAD - LIQUIDATION_CURSOR.wMulDown(WAD - marketParams.lltv)) ); if (seizedAssets > 0) { uint256 seizedAssetsQuoted = seizedAssets.mulDivUp(collateralPrice, ORACLE_PRICE_SCALE); repaidShares = seizedAssetsQuoted.wDivUp(liquidationIncentiveFactor).toSharesUp( market[id].totalBorrowAssets, market[id].totalBorrowShares ); } else { seizedAssets = repaidShares.toAssetsDown(market[id].totalBorrowAssets, market[id].totalBorrowShares) .wMulDown(liquidationIncentiveFactor).mulDivDown(ORACLE_PRICE_SCALE, collateralPrice); } } uint256 repaidAssets = repaidShares.toAssetsUp(market[id].totalBorrowAssets, market[id].totalBorrowShares); position[id][borrower].borrowShares -= repaidShares.toUint128(); market[id].totalBorrowShares -= repaidShares.toUint128(); market[id].totalBorrowAssets = UtilsLib.zeroFloorSub(market[id].totalBorrowAssets, repaidAssets).toUint128(); position[id][borrower].collateral -= seizedAssets.toUint128(); uint256 badDebtShares; uint256 badDebtAssets; if (position[id][borrower].collateral == 0) { badDebtShares = position[id][borrower].borrowShares; badDebtAssets = UtilsLib.min( market[id].totalBorrowAssets, badDebtShares.toAssetsUp(market[id].totalBorrowAssets, market[id].totalBorrowShares) ); market[id].totalBorrowAssets -= badDebtAssets.toUint128(); market[id].totalBorrowShares -= badDebtShares.toUint128(); position[id][borrower].borrowShares = 0; } // `repaidAssets` may be greater than `totalBorrowAssets` by 1. emit EventsLib.Liquidate( id, msg.sender, borrower, repaidAssets, repaidShares, seizedAssets, badDebtAssets, badDebtShares ); IERC20(marketParams.collateralToken).safeTransfer(msg.sender, seizedAssets); if (data.length > 0) { IIMFMoneyMarketsLiquidateCallback(msg.sender).onIMFMoneyMarketsLiquidate(repaidAssets, data); } IERC20(marketParams.loanToken).safeTransferFrom(msg.sender, address(this), repaidAssets); IMoney(marketParams.loanToken).shred(address(this), repaidAssets); return (seizedAssets, repaidAssets); } /* FLASH LOANS */ /// @inheritdoc IIMFMoneyMarketsBase function flashLoan(address token, uint256 assets, bytes calldata data) external { require(assets != 0, ErrorsLib.ZERO_ASSETS); emit EventsLib.FlashLoan(msg.sender, token, assets); IERC20(token).safeTransfer(msg.sender, assets); IIMFMoneyMarketsFlashLoanCallback(msg.sender).onIMFMoneyMarketsFlashLoan(assets, data); IERC20(token).safeTransferFrom(msg.sender, address(this), assets); } /* INTEREST MANAGEMENT */ /// @inheritdoc IIMFMoneyMarketsBase function accrueInterest(MarketParams memory marketParams) external { Id id = marketParams.id(); require(market[id].lastUpdate != 0, ErrorsLib.MARKET_NOT_CREATED); require(!market[id].isPaused, ErrorsLib.MARKET_PAUSED); _accrueInterest(marketParams, id); } /// @dev Accrues interest for the given market `marketParams`. /// @dev Assumes that the inputs `marketParams` and `id` match. function _accrueInterest(MarketParams memory marketParams, Id id) internal { uint256 elapsed = block.timestamp - market[id].lastUpdate; if (elapsed == 0) return; if (marketParams.irm != address(0)) { uint256 borrowRate = IIrm(marketParams.irm).borrowRate(marketParams, market[id]); uint256 interest = market[id].totalBorrowAssets.wMulDown(borrowRate.wTaylorCompounded(elapsed)); market[id].totalBorrowAssets += interest.toUint128(); IMoney(marketParams.loanToken).mint(interestRecipient, interest); emit EventsLib.AccrueInterest(id, borrowRate, interest); } // Safe "unchecked" cast. market[id].lastUpdate = uint128(block.timestamp); } /* HEALTH CHECK */ /// @dev Returns whether the position of `borrower` in the given market `marketParams` with the given /// `collateralPrice` is healthy. /// @dev Assumes that the inputs `marketParams` and `id` match. /// @dev Rounds in favor of the protocol, so one might not be able to borrow exactly `maxBorrow` but one unit less. function _isHealthy(MarketParams memory marketParams, Id id, address borrower, uint256 collateralPrice) internal view returns (bool) { uint256 borrowed = uint256(position[id][borrower].borrowShares).toAssetsUp( market[id].totalBorrowAssets, market[id].totalBorrowShares ); uint256 maxBorrow = uint256(position[id][borrower].collateral).mulDivDown(collateralPrice, ORACLE_PRICE_SCALE) .wMulDown(marketParams.lltv); return maxBorrow >= borrowed; } /* STORAGE VIEW */ /// @inheritdoc IIMFMoneyMarketsBase function extSloads(bytes32[] calldata slots) external view returns (bytes32[] memory res) { uint256 nSlots = slots.length; res = new bytes32[](nSlots); for (uint256 i; i < nSlots;) { bytes32 slot = slots[i++]; assembly ("memory-safe") { mstore(add(res, mul(i, 32)), sload(slot)) } } } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; type Id is bytes32; struct MarketParams { address loanToken; address collateralToken; address collateralTokenOracle; address irm; uint256 lltv; } struct Position { uint128 borrowShares; uint128 collateral; } /// @dev Warning: `totalBorrowAssets` does not contain the accrued interest since the last interest accrual. struct Market { uint128 totalBorrowAssets; uint128 totalBorrowShares; uint128 lastUpdate; bool isPaused; } 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 IIMFMoneyMarketsStaticTyping and IIMFMoneyMarkets. /// @dev Consider using the IIMFMoneyMarkets interface instead of this one. interface IIMFMoneyMarketsBase { /// @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 Outstanding bad debts. Interest is split between reducing bad debt /// and distributed to IMF token holders // function totalBadDebtAssets() 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 The address that receives the interest. function interestRecipient() external view returns (address); /// @notice Set the address that receives the interest. /// @dev It can't be the zero address. function setInterestRecipient(address _newInterestRecipient) external; /// @notice Set if a market is paused function setMarketPause(MarketParams memory marketParams, bool pause) external; /// @notice Creates the market `marketParams`. /// @dev Here is the list of assumptions on the market's dependencies (tokens, IRM and oracle) that guarantees /// IMFMoneyMarkets 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 IMFMoneyMarkets should only decrease on `transfer` and `transferFrom`. In particular, /// tokens with /// burn functions are not supported. /// - The token should not re-enter IMFMoneyMarkets 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 IMFMoneyMarkets. /// - 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 IMFMoneyMarkets'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 Borrows `assets` or `shares` 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 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 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 receiver) external returns (uint256 assetsBorrowed, uint256 sharesBorrowed); /// @notice Repays `assets` or `shares`, optionally calling back the caller's /// `onIMFMoneyMarketsReplay` function with the given `data`. /// @dev Either `assets` or `shares` should be zero. To repay max, pass the `shares`'s balance of the caller /// @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 data Arbitrary data to pass to the `onIMFMoneyMarketsRepay` 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, bytes memory data) external returns (uint256 assetsRepaid, uint256 sharesRepaid); /// @notice Supplies `assets` of collateral on behalf of `onBehalf`, optionally calling back the caller's /// `onIMFMoneyMarketsSupplyCollateral` 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 data Arbitrary data to pass to the `onIMFMoneyMarketsSupplyCollateral` callback. Pass empty data if not /// needed. function supplyCollateral(MarketParams memory marketParams, uint256 assets, 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 receiver The address that will receive the collateral assets. function withdrawCollateral(MarketParams memory marketParams, uint256 assets, 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 /// `onIMFMoneyMarketsLiquidate` 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 `onIMFMoneyMarketsLiquidate` 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 `onIMFMoneyMarketsFlashLoan` 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 IMFMoneyMarkets so that function signatures are checked by the compiler. /// @dev Consider using the IIMFMoneyMarkets interface instead of this one. interface IIMFMoneyMarketsStaticTyping is IIMFMoneyMarketsBase { /// @notice The state of the position of `user` on the market corresponding to `id`. function position(Id id, address user) external view returns (uint128 borrowShares, uint128 collateral); /// @notice The state of the market corresponding to `id`. /// @dev Warning: `totalBorrowAssets` does not contain the accrued interest since the last interest accrual. function market(Id id) external view returns (uint128 totalBorrowAssets, uint128 totalBorrowShares, uint128 lastUpdate, bool isPaused); /// @notice The market params corresponding to `id`. /// @dev This mapping is not used in IMFMoneyMarkets. 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 collateralTokenOracle, address irm, uint256 lltv); } /// @title IIMFMoneyMarkets /// @author Morpho Labs /// @author An IMFer /// @dev Use this interface for IMFMoneyMarkets to have access to all the functions with the appropriate function /// signatures. interface IIMFMoneyMarkets is IIMFMoneyMarketsBase { /// @notice The state of the position of `user` on the market corresponding to `id`. function position(Id id, address user) external view returns (Position memory p); /// @notice The state of the market corresponding to `id`. /// @dev Warning: `m.totalBorrowAssets` does not contain the accrued interest 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 IMFMoneyMarkets. 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 IIMFMoneyMarketsLiquidateCallback /// @notice Interface that liquidators willing to use `liquidate`'s callback must implement. interface IIMFMoneyMarketsLiquidateCallback { /// @notice Callback called when a liquidation occurs. /// @dev The callback is called only if data is not empty. /// @param repaidAssets The amount of repaid assets. /// @param data Arbitrary data passed to the `liquidate` function. function onIMFMoneyMarketsLiquidate(uint256 repaidAssets, bytes calldata data) external; } /// @title IIMFMoneyMarketsRepayCallback /// @notice Interface that users willing to use `repay`'s callback must implement. interface IIMFMoneyMarketsRepayCallback { /// @notice Callback called when a repayment occurs. /// @dev The callback is called only if data is not empty. /// @param assets The amount of repaid assets. /// @param data Arbitrary data passed to the `repay` function. function onIMFMoneyMarketsRepay(uint256 assets, bytes calldata data) external; } /// @title IIMFMoneyMarketsSupplyCallback /// @notice Interface that users willing to use `supply`'s callback must implement. interface IIMFMoneyMarketsSupplyCallback { /// @notice Callback called when a supply occurs. /// @dev The callback is called only if data is not empty. /// @param assets The amount of supplied assets. /// @param data Arbitrary data passed to the `supply` function. function onIMFMoneyMarketsSupply(uint256 assets, bytes calldata data) external; } /// @title IIMFMoneyMarketsSupplyCollateralCallback /// @notice Interface that users willing to use `supplyCollateral`'s callback must implement. interface IIMFMoneyMarketsSupplyCollateralCallback { /// @notice Callback called when a supply of collateral occurs. /// @dev The callback is called only if data is not empty. /// @param assets The amount of supplied collateral. /// @param data Arbitrary data passed to the `supplyCollateral` function. function onIMFMoneyMarketsSupplyCollateral(uint256 assets, bytes calldata data) external; } /// @title IIMFMoneyMarketsFlashLoanCallback /// @notice Interface that users willing to use `flashLoan`'s callback must implement. interface IIMFMoneyMarketsFlashLoanCallback { /// @notice Callback called when a flash loan occurs. /// @dev The callback is called only if data is not empty. /// @param assets The amount of assets that was flash loaned. /// @param data Arbitrary data passed to the `flashLoan` function. function onIMFMoneyMarketsFlashLoan(uint256 assets, bytes calldata data) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; import {MarketParams, Market} from "./IIMFMoneyMarkets.sol"; /// @title IIrm /// @author Morpho Labs /// @custom:contact [email protected] /// @notice Interface that Interest Rate Models (IRMs) used by IMFMoneyMarkets must implement. interface IIrm { /// @notice Returns the borrow rate per second (scaled by WAD) of the market `marketParams`. /// @dev Assumes that `market` corresponds to `marketParams`. function borrowRate(MarketParams memory marketParams, Market memory market) external returns (uint256); /// @notice Returns the borrow rate per second (scaled by WAD) of the market `marketParams` without modifying any /// storage. /// @dev Assumes that `market` corresponds to `marketParams`. function borrowRateView(MarketParams memory marketParams, Market memory market) external view returns (uint256); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /** * @dev Interface of the ERC-20 standard as defined in the ERC. */ 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); function decimals() external view returns (uint8); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; interface IMoney { /// @dev Create new supply via collateral backed loans function mint(address to, uint256 amount) external; /// @dev Destroy supply as loans are repaid function shred(address from, uint256 amount) external; }
// 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 IMFMoneyMarkets 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; /// @dev The maximum fee a market can have (25%). uint256 constant MAX_FEE = 0.25e18; /// @dev Oracle price scale. uint256 constant ORACLE_PRICE_SCALE = 1e36; /// @dev Liquidation cursor. uint256 constant LIQUIDATION_CURSOR = 0.3e18; /// @dev Max liquidation incentive factor. uint256 constant MAX_LIQUIDATION_INCENTIVE_FACTOR = 1.15e18; /// @dev The EIP-712 typeHash for EIP712Domain. bytes32 constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(uint256 chainId,address verifyingContract)"); /// @dev The EIP-712 typeHash for Authorization. bytes32 constant AUTHORIZATION_TYPEHASH = keccak256("Authorization(address authorizer,address authorized,bool isAuthorized,uint256 nonce,uint256 deadline)");
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; import {ErrorsLib} from "../libraries/ErrorsLib.sol"; /// @title UtilsLib /// @author Morpho Labs /// @custom:contact [email protected] /// @notice Library exposing helpers. /// @dev Inspired by https://github.com/morpho-org/morpho-utils. library UtilsLib { /// @dev Returns true if there is exactly one zero among `x` and `y`. function exactlyOneZero(uint256 x, uint256 y) internal pure returns (bool z) { assembly { z := xor(iszero(x), iszero(y)) } } /// @dev Returns the min of `x` and `y`. function min(uint256 x, uint256 y) internal pure returns (uint256 z) { assembly { z := xor(x, mul(xor(x, y), lt(y, x))) } } /// @dev Returns `x` safely cast to uint128. function toUint128(uint256 x) internal pure returns (uint128) { require(x <= type(uint128).max, ErrorsLib.MAX_UINT128_EXCEEDED); return uint128(x); } /// @dev Returns max(0, x - y). function zeroFloorSub(uint256 x, uint256 y) internal pure returns (uint256 z) { assembly { z := mul(gt(x, y), sub(x, y)) } } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; import {Id, MarketParams} from "../interfaces/IIMFMoneyMarkets.sol"; /// @title EventsLib /// @author Morpho Labs /// @custom:contact [email protected] /// @notice Library exposing events. library EventsLib { /// @notice Emitted when setting a new owner. /// @param newOwner The new owner of the contract. event SetOwner(address indexed newOwner); /// @notice Emitted when setting a users authorization /// @param minter The minter to be authorized or unauthorized. /// @param authorized The new authorization status. event SetAuthorization(address indexed minter, bool authorized); /// @notice Emitted when creating a market. /// @param id The market id. /// @param marketParams The market that was created. event CreateMarket(Id indexed id, MarketParams marketParams); /// @notice Emitted on borrow of assets. /// @param id The market id. /// @param caller The caller. /// @param onBehalf The owner of the modified position. /// @param receiver The address that received the borrowed assets. /// @param assets The amount of assets borrowed. /// @param shares The amount of shares minted. event Borrow( Id indexed id, address caller, address indexed onBehalf, address indexed receiver, uint256 assets, uint256 shares ); /// @notice Emitted on repayment of assets. /// @param id The market id. /// @param caller The caller. /// @param onBehalf The owner of the modified position. /// @param assets The amount of assets repaid. May be 1 over the corresponding market's `totalBorrowAssets`. /// @param shares The amount of shares burned. event Repay(Id indexed id, address indexed caller, address indexed onBehalf, uint256 assets, uint256 shares); /// @notice Emitted on supply of collateral. /// @param id The market id. /// @param caller The caller. /// @param onBehalf The owner of the modified position. /// @param assets The amount of collateral supplied. event SupplyCollateral(Id indexed id, address indexed caller, address indexed onBehalf, uint256 assets); /// @notice Emitted on withdrawal of collateral. /// @param id The market id. /// @param caller The caller. /// @param onBehalf The owner of the modified position. /// @param receiver The address that received the withdrawn collateral. /// @param assets The amount of collateral withdrawn. event WithdrawCollateral( Id indexed id, address caller, address indexed onBehalf, address indexed receiver, uint256 assets ); /// @notice Emitted on liquidation of a position. /// @param id The market id. /// @param caller The caller. /// @param borrower The borrower of the position. /// @param repaidAssets The amount of assets repaid. May be 1 over the corresponding market's `totalBorrowAssets`. /// @param repaidShares The amount of shares burned. /// @param seizedAssets The amount of collateral seized. /// @param badDebtAssets The amount of assets of bad debt realized. /// @param badDebtShares The amount of borrow shares of bad debt realized. event Liquidate( Id indexed id, address indexed caller, address indexed borrower, uint256 repaidAssets, uint256 repaidShares, uint256 seizedAssets, uint256 badDebtAssets, uint256 badDebtShares ); /// @notice Emitted on flash loan. /// @param caller The caller. /// @param token The token that was flash loaned. /// @param assets The amount that was flash loaned. event FlashLoan(address indexed caller, address indexed token, uint256 assets); /// @notice Emitted when setting an authorization. /// @param caller The caller. /// @param authorizer The authorizer address. /// @param authorized The authorized address. /// @param newIsAuthorized The new authorization status. event SetAuthorization( address indexed caller, address indexed authorizer, address indexed authorized, bool newIsAuthorized ); /// @notice Emitted when setting an authorization with a signature. /// @param caller The caller. /// @param authorizer The authorizer address. /// @param usedNonce The nonce that was used. event IncrementNonce(address indexed caller, address indexed authorizer, uint256 usedNonce); /// @notice Emitted when accruing interest. /// @param id The market id. /// @param prevBorrowRate The previous borrow rate. /// @param interest The amount of interest accrued. event AccrueInterest(Id indexed id, uint256 prevBorrowRate, uint256 interest); /// @notice Emitted when setting the interest rate recipient /// @param newInterestRecipient The address of the interest rate recipient event SetInterestRecipient(address newInterestRecipient); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; /// @title ErrorsLib /// @author Morpho Labs /// @custom:contact [email protected] /// @notice Library exposing error messages. library ErrorsLib { /// @notice Thrown when the caller is not the owner. string internal constant NOT_OWNER = "not owner"; /// @notice Thrown when the LLTV to enable exceeds the maximum LLTV. string internal constant MAX_LLTV_EXCEEDED = "max LLTV exceeded"; /// @notice Thrown when the fee to set exceeds the maximum fee. string internal constant MAX_FEE_EXCEEDED = "max fee exceeded"; /// @notice Thrown when the value is already set. string internal constant ALREADY_SET = "already set"; /// @notice Thrown when the IRM is not enabled at market creation. string internal constant IRM_NOT_ENABLED = "IRM not enabled"; /// @notice Thrown when the LLTV is not enabled at market creation. string internal constant LLTV_NOT_ENABLED = "LLTV not enabled"; /// @notice Thrown when the market is already created. string internal constant MARKET_ALREADY_CREATED = "market already created"; /// @notice Thrown when a token to transfer doesn't have code. string internal constant NO_CODE = "no code"; /// @notice Thrown when the market is not created. string internal constant MARKET_NOT_CREATED = "market not created"; /// @notice Thrown when the market is paused string internal constant MARKET_PAUSED = "market paused"; /// @notice Thrown when not exactly one of the input amount is zero. string internal constant INCONSISTENT_INPUT = "inconsistent input"; /// @notice Thrown when zero assets is passed as input. string internal constant ZERO_ASSETS = "zero assets"; /// @notice Thrown when a zero address is passed as input. string internal constant ZERO_ADDRESS = "zero address"; /// @notice Thrown when the caller is not authorized to conduct an action. string internal constant UNAUTHORIZED = "unauthorized"; /// @notice Thrown when the collateral is insufficient to `borrow` or `withdrawCollateral`. string internal constant INSUFFICIENT_COLLATERAL = "insufficient collateral"; /// @notice Thrown when the position to liquidate is healthy. string internal constant HEALTHY_POSITION = "position is healthy"; /// @notice Thrown when the authorization signature is invalid. string internal constant INVALID_SIGNATURE = "invalid signature"; /// @notice Thrown when the authorization signature is expired. string internal constant SIGNATURE_EXPIRED = "signature expired"; /// @notice Thrown when the nonce is invalid. string internal constant INVALID_NONCE = "invalid nonce"; /// @notice Thrown when a token transfer reverted. string internal constant TRANSFER_REVERTED = "transfer reverted"; /// @notice Thrown when a token transfer returned false. string internal constant TRANSFER_RETURNED_FALSE = "transfer returned false"; /// @notice Thrown when a token transferFrom reverted. string internal constant TRANSFER_FROM_REVERTED = "transferFrom reverted"; /// @notice Thrown when a token transferFrom returned false string internal constant TRANSFER_FROM_RETURNED_FALSE = "transferFrom returned false"; /// @notice Thrown when the maximum uint128 is exceeded. string internal constant MAX_UINT128_EXCEEDED = "max uint128 exceeded"; /// @notice Thrown when the user authorization is not changed string internal constant AUTHORIZATION_NOT_CHANGED = "Authorization not changed"; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; uint256 constant WAD = 1e18; /// @title MathLib /// @author Morpho Labs /// @custom:contact [email protected] /// @notice Library to manage fixed-point arithmetic. library MathLib { /// @dev Returns (`x` * `y`) / `WAD` rounded down. function wMulDown(uint256 x, uint256 y) internal pure returns (uint256) { return mulDivDown(x, y, WAD); } /// @dev Returns (`x` * `WAD`) / `y` rounded down. function wDivDown(uint256 x, uint256 y) internal pure returns (uint256) { return mulDivDown(x, WAD, y); } /// @dev Returns (`x` * `WAD`) / `y` rounded up. function wDivUp(uint256 x, uint256 y) internal pure returns (uint256) { return mulDivUp(x, WAD, y); } /// @dev Returns (`x` * `y`) / `d` rounded down. function mulDivDown(uint256 x, uint256 y, uint256 d) internal pure returns (uint256) { return (x * y) / d; } /// @dev Returns (`x` * `y`) / `d` rounded up. function mulDivUp(uint256 x, uint256 y, uint256 d) internal pure returns (uint256) { return (x * y + (d - 1)) / d; } /// @dev Returns the sum of the first three non-zero terms of a Taylor expansion of e^(nx) - 1, to approximate a /// continuous compound interest rate. function wTaylorCompounded(uint256 x, uint256 n) internal pure returns (uint256) { uint256 firstTerm = x * n; uint256 secondTerm = mulDivDown(firstTerm, firstTerm, 2 * WAD); uint256 thirdTerm = mulDivDown(secondTerm, firstTerm, 3 * WAD); return firstTerm + secondTerm + thirdTerm; } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; import {MathLib} from "./MathLib.sol"; /// @title SharesMathLib /// @author Morpho Labs /// @custom:contact [email protected] /// @notice Shares management library. /// @dev This implementation mitigates share price manipulations, using OpenZeppelin's method of virtual shares: /// https://docs.openzeppelin.com/contracts/4.x/erc4626#inflation-attack. library SharesMathLib { using MathLib for uint256; /// @dev The number of virtual shares has been chosen low enough to prevent overflows, and high enough to ensure /// high precision computations. /// @dev Virtual shares can never be redeemed for the assets they are entitled to, but it is assumed the share price /// stays low enough not to inflate these assets to a significant value. /// @dev Warning: The assets to which virtual borrow shares are entitled behave like unrealizable bad debt. uint256 internal constant VIRTUAL_SHARES = 1e6; /// @dev A number of virtual assets of 1 enforces a conversion rate between shares and assets when a market is /// empty. uint256 internal constant VIRTUAL_ASSETS = 1; /// @dev Calculates the value of `assets` quoted in shares, rounding down. function toSharesDown(uint256 assets, uint256 totalAssets, uint256 totalShares) internal pure returns (uint256) { return assets.mulDivDown(totalShares + VIRTUAL_SHARES, totalAssets + VIRTUAL_ASSETS); } /// @dev Calculates the value of `shares` quoted in assets, rounding down. function toAssetsDown(uint256 shares, uint256 totalAssets, uint256 totalShares) internal pure returns (uint256) { return shares.mulDivDown(totalAssets + VIRTUAL_ASSETS, totalShares + VIRTUAL_SHARES); } /// @dev Calculates the value of `assets` quoted in shares, rounding up. function toSharesUp(uint256 assets, uint256 totalAssets, uint256 totalShares) internal pure returns (uint256) { return assets.mulDivUp(totalShares + VIRTUAL_SHARES, totalAssets + VIRTUAL_ASSETS); } /// @dev Calculates the value of `shares` quoted in assets, rounding up. function toAssetsUp(uint256 shares, uint256 totalAssets, uint256 totalShares) internal pure returns (uint256) { return shares.mulDivUp(totalAssets + VIRTUAL_ASSETS, totalShares + VIRTUAL_SHARES); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; import {Id, MarketParams} from "../interfaces/IIMFMoneyMarkets.sol"; /// @title MarketParamsLib /// @author Morpho Labs /// @author An IMFer /// @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: GPL-2.0-or-later pragma solidity ^0.8.0; import {IERC20} from "../interfaces/IERC20.sol"; import {ErrorsLib} from "../libraries/ErrorsLib.sol"; interface IERC20Internal { function transfer(address to, uint256 value) external returns (bool); function transferFrom(address from, address to, uint256 value) external returns (bool); } /// @title SafeTransferLib /// @author Morpho Labs /// @custom:contact [email protected] /// @notice Library to manage transfers of tokens, even if calls to the transfer or transferFrom functions are not /// returning a boolean. library SafeTransferLib { function safeTransfer(IERC20 token, address to, uint256 value) internal { require(address(token).code.length > 0, ErrorsLib.NO_CODE); (bool success, bytes memory returndata) = address(token).call(abi.encodeCall(IERC20Internal.transfer, (to, value))); require(success, ErrorsLib.TRANSFER_REVERTED); require(returndata.length == 0 || abi.decode(returndata, (bool)), ErrorsLib.TRANSFER_RETURNED_FALSE); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { require(address(token).code.length > 0, ErrorsLib.NO_CODE); (bool success, bytes memory returndata) = address(token).call(abi.encodeCall(IERC20Internal.transferFrom, (from, to, value))); require(success, ErrorsLib.TRANSFER_FROM_REVERTED); require(returndata.length == 0 || abi.decode(returndata, (bool)), ErrorsLib.TRANSFER_FROM_RETURNED_FALSE); } }
{ "remappings": [ "forge-std/=lib/forge-std/src/", "halmos-cheatcodes/=lib/halmos-cheatcodes/src/", "@uniswap/v3-core/=lib/v3-core/", "@uniswap/v3-periphery/=lib/v3-periphery/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "openzeppelin/=lib/openzeppelin-contracts/contracts/", "v3-core/=lib/v3-core/", "v3-periphery/=lib/v3-periphery/contracts/" ], "optimizer": { "enabled": true, "runs": 999999 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": true, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"newOwner","type":"address"},{"internalType":"address","name":"_interestRecipient","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"Id","name":"id","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"prevBorrowRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"interest","type":"uint256"}],"name":"AccrueInterest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"Id","name":"id","type":"bytes32"},{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"onBehalf","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Borrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"Id","name":"id","type":"bytes32"},{"components":[{"internalType":"address","name":"loanToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"collateralTokenOracle","type":"address"},{"internalType":"address","name":"irm","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"}],"indexed":false,"internalType":"struct MarketParams","name":"marketParams","type":"tuple"}],"name":"CreateMarket","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"}],"name":"FlashLoan","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"Id","name":"id","type":"bytes32"},{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"repaidAssets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"repaidShares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"seizedAssets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"badDebtAssets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"badDebtShares","type":"uint256"}],"name":"Liquidate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"Id","name":"id","type":"bytes32"},{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"onBehalf","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Repay","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newInterestRecipient","type":"address"}],"name":"SetInterestRecipient","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"SetOwner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"Id","name":"id","type":"bytes32"},{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"onBehalf","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"}],"name":"SupplyCollateral","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"Id","name":"id","type":"bytes32"},{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"onBehalf","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"}],"name":"WithdrawCollateral","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"loanToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"collateralTokenOracle","type":"address"},{"internalType":"address","name":"irm","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"}],"internalType":"struct MarketParams","name":"marketParams","type":"tuple"}],"name":"accrueInterest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"loanToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"collateralTokenOracle","type":"address"},{"internalType":"address","name":"irm","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"}],"internalType":"struct MarketParams","name":"marketParams","type":"tuple"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"borrow","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"loanToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"collateralTokenOracle","type":"address"},{"internalType":"address","name":"irm","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"}],"internalType":"struct MarketParams","name":"marketParams","type":"tuple"}],"name":"createMarket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"slots","type":"bytes32[]"}],"name":"extSloads","outputs":[{"internalType":"bytes32[]","name":"res","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"flashLoan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"Id","name":"","type":"bytes32"}],"name":"idToMarketParams","outputs":[{"internalType":"address","name":"loanToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"collateralTokenOracle","type":"address"},{"internalType":"address","name":"irm","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"interestRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"loanToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"collateralTokenOracle","type":"address"},{"internalType":"address","name":"irm","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"}],"internalType":"struct MarketParams","name":"marketParams","type":"tuple"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"seizedAssets","type":"uint256"},{"internalType":"uint256","name":"repaidShares","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"liquidate","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"Id","name":"","type":"bytes32"}],"name":"market","outputs":[{"internalType":"uint128","name":"totalBorrowAssets","type":"uint128"},{"internalType":"uint128","name":"totalBorrowShares","type":"uint128"},{"internalType":"uint128","name":"lastUpdate","type":"uint128"},{"internalType":"bool","name":"isPaused","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"Id","name":"","type":"bytes32"},{"internalType":"address","name":"","type":"address"}],"name":"position","outputs":[{"internalType":"uint128","name":"borrowShares","type":"uint128"},{"internalType":"uint128","name":"collateral","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"loanToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"collateralTokenOracle","type":"address"},{"internalType":"address","name":"irm","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"}],"internalType":"struct MarketParams","name":"marketParams","type":"tuple"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"repay","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newInterestRecipient","type":"address"}],"name":"setInterestRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"loanToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"collateralTokenOracle","type":"address"},{"internalType":"address","name":"irm","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"}],"internalType":"struct MarketParams","name":"marketParams","type":"tuple"},{"internalType":"bool","name":"pause","type":"bool"}],"name":"setMarketPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"loanToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"collateralTokenOracle","type":"address"},{"internalType":"address","name":"irm","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"}],"internalType":"struct MarketParams","name":"marketParams","type":"tuple"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"supplyCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"loanToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"collateralTokenOracle","type":"address"},{"internalType":"address","name":"irm","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"}],"internalType":"struct MarketParams","name":"marketParams","type":"tuple"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"withdrawCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a0346101b2576001600160401b0390601f1990612f6338819003601f810184168301908382108683111761014357808491604094859485528339810103126101b25761004b826101b7565b9061005960208094016101b7565b81516001600160a01b03938416959194919080840188811182821017610143578452600c81526b7a65726f206164647265737360a01b8382015286156101595750508151908101917f47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a7946921883524681830152306060830152606082526080820196828810908811176101435786905251902060805260018060a01b03199183836000541617600055169060045416176004557f167d3e9c1016ab80e58802ca9da10ce5c6a0f4debc46a2e7a2cd9e56899a4fb5600080a2612d9790816101cc823960805181611dbe0152f35b634e487b7160e01b600052604160045260246000fd5b82845192839162461bcd60e51b835280600484015283519081602485015260005b82811061019b5750506044935080600085601f938601015201168101030190fd5b80860182015187820160440152869450810161017a565b600080fd5b51906001600160a01b03821682036101b25756fe6080604052600436101561001257600080fd5b6000803560e01c806313af403514611f0a578063151c1ade14611e735780632c3c915714611de15780633644e51514611d885780634f0c918e14611bb55780635c60e39a14611b365780637784c6851461197e5780638c1358a2146116f55780638da5cb5b146116a457806393c52062146116175780639d1118fd146115c5578063b4360f5214611296578063baa87173146110cf578063c9b7c56814610d57578063d8eabcb8146103c3578063dd95fcdc14610302578063e0232b42146101b55763ee4d5c4b146100e357600080fd5b346101b25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b2577f9c4c2eb2dde9b42f28eed886c7f59145d4226d5f8d88d495ee7f724546a732dd602061013d612002565b73ffffffffffffffffffffffffffffffffffffffff9061016a8286541633146101646121a7565b906121e0565b1661017e610176612327565b8215156121e0565b807fffffffffffffffffffffffff00000000000000000000000000000000000000006004541617600455604051908152a180f35b80fd5b50346101b25760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b2576101ed612002565b6024358260443567ffffffffffffffff81116102fe5761022673ffffffffffffffffffffffffffffffffffffffff913690600401612179565b91909461023c6102346122ee565b8615156121e0565b1693846040518581527fc76f1b4fe4396ac07a9fa55a415d4ca430e72651d37d3401f3bed7cb13fc4f1260203392a36102768433876129e8565b333b156102ef576102b891839160405193849283927f08df878400000000000000000000000000000000000000000000000000000000845288600485016124c8565b038183335af180156102f3576102db575b50506102d89130903390612baf565b80f35b6102e490612025565b6102ef5782386102c9565b8280fd5b6040513d84823e3d90fd5b5080fd5b50346101b25760c07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b25761033b366120e1565b60a435908115158092036102ef5760a09061037173ffffffffffffffffffffffffffffffffffffffff85541633146101646121a7565b208252600260205260016040832001907fffffffffffffffffffffffffffffff00ffffffffffffffffffffffffffffffff70ff0000000000000000000000000000000083549260801b16911617905580f35b50346101b2576101207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b2576103fd366120e1565b73ffffffffffffffffffffffffffffffffffffffff60a4351660a43503610d3f576101043567ffffffffffffffff81116102ef5761043f903690600401612179565b909160e4359160c43593600460a0842094858852600260205261047f6fffffffffffffffffffffffffffffffff600160408b20015416151561016461227c565b85885260026020526104a7600160408a20015460ff61049c6122b5565b9160801c16156121e0565b6104c06104b261246b565b60e4351560c43515186121e0565b6104ca8686612514565b602073ffffffffffffffffffffffffffffffffffffffff604087015116604051938480927fa035b1fe0000000000000000000000000000000000000000000000000000000082525afa918215610d4c578892610d13575b506105706105338360a435898961288b565b156040519061054182612084565b601382527f706f736974696f6e206973206865616c7468790000000000000000000000000060208301526121e0565b6080850151670de0b6b3a764000003670de0b6b3a76400008111610bb957670429d069189e00009080820291820403610be657670de0b6b3a76400009004670de0b6b3a764000081810311610bb95780670de0b6b3a764000014610ce457670de0b6b3a7640000036ec097ce7bc90715b34b9f10000000000491670ff59ee833b300009160c43515610c1557506106079088612d01565b6ec097ce7bc90715b34b9f0fffffffff8101809111610be6576ec097ce7bc90715b34b9f100000000090049081670de0b6b3a7640000810204670de0b6b3a76400001482151715610be6578281188184100281187fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810111610bb95788949392610704926106d99280831892811192909202909118906106d4907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff830190670de0b6b3a764000002612b57565b612d14565b86855260026020526040852054906fffffffffffffffffffffffffffffffff8260801c921690612b8d565b945b808452600260205261073360408520546fffffffffffffffffffffffffffffffff8160801c911688612cde565b9561073d81612833565b82865260016020526040862073ffffffffffffffffffffffffffffffffffffffff60a4351660005260205260406000206fffffffffffffffffffffffffffffffff61078c825493828516612360565b167fffffffffffffffffffffffffffffffff0000000000000000000000000000000080931617905561081a6107c083612833565b84885260026020526107da6040892091825460801c612360565b6fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffff0000000000000000000000000000000083549260801b169116179055565b82865260026020526108486fffffffffffffffffffffffffffffffff60408820541689808203911102612833565b83875260026020526fffffffffffffffffffffffffffffffff604088209116828254161790556108b861087a8a612833565b84885260016020526040882073ffffffffffffffffffffffffffffffffffffffff60a435166000526020526107da604060002091825460801c612360565b8590869084885260016020526040882073ffffffffffffffffffffffffffffffffffffffff60a4351660005260205260406000205460801c15610a9d575b506040519289845260208401528960408401526060830152608082015273ffffffffffffffffffffffffffffffffffffffff60a43516917fa4946ede45d0c6f06a0f5ce92c9ad3b4751452d2fe0e25010783bcab57a67e4160a03393a4610978863373ffffffffffffffffffffffffffffffffffffffff6020880151166129e8565b81610a30575b505050806109a88373ffffffffffffffffffffffffffffffffffffffff8094511630903390612baf565b5116803b15610a2c576040517fd16ff4a0000000000000000000000000000000000000000000000000000000008152306004820152602481018390529084908290604490829084905af18015610a2157610a0d575b6040838382519182526020820152f35b610a178491612025565b6102ef57826109fd565b6040513d86823e3d90fd5b8380fd5b333b156102ef57610a7291839160405193849283927f2bf61e3000000000000000000000000000000000000000000000000000000000845289600485016124c8565b038183335af180156102f357610a89575b8061097e565b610a9290612025565b610a2c578338610a83565b91505082865260016020526040862073ffffffffffffffffffffffffffffffffffffffff60a435166000526020526fffffffffffffffffffffffffffffffff604060002054169083875260026020526040872054610b126fffffffffffffffffffffffffffffffff82169160801c8285612cde565b818110908218021890610b2482612833565b85895260026020526040892090826fffffffffffffffffffffffffffffffff610b51845493828516612360565b169116179055610b7d610b6384612833565b868a5260026020526107da60408b2091825460801c612360565b84885260016020526040882073ffffffffffffffffffffffffffffffffffffffff60a435166000526020526040600020908154169055386108f6565b6024897f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b96975091610c6590610c60670de0b6b3a7640000938a8c52600260205260408c2054928181109082180218916fffffffffffffffffffffffffffffffff8160801c911660e435612b64565b612d01565b04806ec097ce7bc90715b34b9f10000000008102046ec097ce7bc90715b34b9f10000000001481151715610cb757879392916ec097ce7bc90715b34b9f1000000000610cb19202612d14565b95610706565b6024887f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b9091506020813d602011610d44575b81610d2f602093836120a0565b81010312610d3f57519038610521565b600080fd5b3d9150610d22565b6040513d8a823e3d90fd5b50346101b2576101007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b257610d91366120e1565b60a43560c43560e43567ffffffffffffffff811161100657610db7903690600401612179565b829491849560a0842090818952600290896020978389526fffffffffffffffffffffffffffffffff99610df78b600160408620015416151561016461227c565b858352848a52610e12600160408520015460ff61049c6122b5565b15610e27610e1e61246b565b831583186121e0565b610e31868a612514565b6110a457508391505280865260408920548781169060801c620f424081018091116110775760018201809211611077578a95949392916106d4610e74928c612d01565b975b610e7f89612833565b908387526001895260408720336000528952604060002081610ea5825494828616612360565b167fffffffffffffffffffffffffffffffff00000000000000000000000000000000809416179055610ef1610ed98b612833565b858952848b526107da60408a2091825460801c612360565b838752828952610f0d816040892054168c808203911102612833565b92848852895260408720921690825416179055604051888152878782015233917f52acb05cebbd3cd39715469f22afbf5a17496295ef3bc9bb5944056c63ccaa0960403393a48161100a575b50505073ffffffffffffffffffffffffffffffffffffffff90610f83858383511630903390612baf565b5116803b15611006576040517fd16ff4a0000000000000000000000000000000000000000000000000000000008152306004820152602481018590529085908290604490829084905af18015610ffb57610fe7575b50604080945051928352820152f35b610ff18591612025565b610a2c5783610fd8565b6040513d87823e3d90fd5b8480fd5b333b156102ef5761104c91839160405193849283927f5106ac890000000000000000000000000000000000000000000000000000000084528b600485016124c8565b038183335af180156102f357611063575b80610f59565b61106c90612025565b61100657843861105d565b60248b7f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b84826110c99398979695949b9c50528289526040872054908b8260801c921690612cde565b98610e76565b50346101b25760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b257611108366120e1565b9060a43560c43567ffffffffffffffff81116102ef5761112c903690600401612179565b60a0852091828552602092600284526111626fffffffffffffffffffffffffffffffff600160408920015416151561016461227c565b8086526002845261117e600160408820015460ff61049c6122b5565b6111896102346122ee565b6111b761119586612833565b828852600186526040882033895286526107da6040892091825460801c6124a4565b60405185815233917fa3b9472a1399e17e123f3c2e6586c23e504184d504de59cdaa2b375e880c6184863393a481611212575b846102d88573ffffffffffffffffffffffffffffffffffffffff868a01511630903390612baf565b333b156110065761125491859160405193849283927f3996a89700000000000000000000000000000000000000000000000000000000845288600485016124c8565b038183335af18015610a215761126b575b806111ea565b906102d89361128e73ffffffffffffffffffffffffffffffffffffffff93612025565b935090611265565b50346101b2576101007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b2576112d0366120e1565b60a4359060c4359173ffffffffffffffffffffffffffffffffffffffff8060e43516928360e435036115c15760409385849660a0842091828a52602096600288526113398b60016fffffffffffffffffffffffffffffffff9b8c9220015416151561016461227c565b838b5260028852611355600160408d20015460ff61049c6122b5565b15611361610e1e61246b565b61136c610234612327565b6113768487612514565b61159a575050808852600285526113986040892054878160801c911689612b8d565b955b6113a387612833565b828a526001875260408a20338b52875260408a20826113c68254938285166124a4565b167fffffffffffffffffffffffffffffffff000000000000000000000000000000008093161790556114136113fa89612833565b848c52600289526107da60408d2091825460801c6124a4565b61141c89612833565b90838b526002885260408b20926114378454938285166124a4565b16911617905560048585604086015116604051928380927fa035b1fe0000000000000000000000000000000000000000000000000000000082525afa90811561158f57899161155c575b506114916114999133848761288b565b610164612382565b6040519033825287868301528660408301527f570954540bed6b1304a87dfe815a5eda4a648f7097a16240dcd85c9b5fd42a4360603393a45116803b15611006576040517f40c10f1900000000000000000000000000000000000000000000000000000000815260e43573ffffffffffffffffffffffffffffffffffffffff166004820152602481018590529085908290604490829084905af18015610ffb576040955061154d575b508351928352820152f35b61155690612025565b38611542565b90508581813d8311611588575b61157381836120a0565b810103126115845751611491611481565b8880fd5b503d611569565b6040513d8b823e3d90fd5b6115bb91979850828a526002875260408a205490898260801c921690612b64565b9661139a565b8580fd5b50346101b257807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b257602073ffffffffffffffffffffffffffffffffffffffff60045416604051908152f35b50346101b25760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b25760243573ffffffffffffffffffffffffffffffffffffffff81168091036102fe5760409182916004358252600160205282822090825260205220548151906fffffffffffffffffffffffffffffffff8116825260801c6020820152f35b50346101b257807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b25773ffffffffffffffffffffffffffffffffffffffff6020915416604051908152f35b50346101b25760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b25761172e366120e1565b73ffffffffffffffffffffffffffffffffffffffff906117558284541633146101646121a7565b60a08120808452602092600284526fffffffffffffffffffffffffffffffff6117bd81600160408920015416156040519061178f82612084565b601682527f6d61726b657420616c7265616479206372656174656400000000000000000000888301526121e0565b82865260028552600160408720019042167fffffffffffffffffffffffffffffffff00000000000000000000000000000000825416179055600384526040852081845116907fffffffffffffffffffffffff000000000000000000000000000000000000000091828254161781556001810183878701511683825416179055600281018360408701511683825416179055600381016060860192848451169082541617905560046080860151910155827fac4b2400f169220b0c0afdde7a0b32e775ba727ea1cb30b35f935cdaab8683ac60a06040516118e181896080809173ffffffffffffffffffffffffffffffffffffffff80825116855280602083015116602086015280604083015116604086015260608201511660608501520151910152565ba2511691826118ee578480f35b6119359284928652600283526040862091866040518096819582947f099d191b000000000000000000000000000000000000000000000000000000008452600484016123d3565b03925af180156119735761194a575b80808480f35b813d831161196c575b61195d81836120a0565b810103126101b2573880611944565b503d611953565b6040513d85823e3d90fd5b50346101b2576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102fe576004359067ffffffffffffffff90818311610a2c5736602384011215610a2c578260040135918211610a2c576024916005903660248260051b870101116115c1578491816119fd88936123bb565b95611a0b60405197886120a0565b818752611a17826123bb565b947fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08789019601368737845b838110611a8d57505050505060405193838594850191818652518092526040850193925b828110611a7657505050500390f35b835185528695509381019392810192600101611a67565b9497959694807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114611b0a576001019084811015611ade57851b82018301355481861b8801529597949695611a43565b838a7f4e487b710000000000000000000000000000000000000000000000000000000081526032600452fd5b838a7f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b50346101b25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b2576040608091600435815260026020522060ff81549160016fffffffffffffffffffffffffffffffff91015490604051938181168552851c602085015281166040840152831c1615156060820152f35b50346101b25760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b257611bee366120e1565b60a43560c43573ffffffffffffffffffffffffffffffffffffffff8082168083036115c1578460a0600496209182885260209260028452611c4c6fffffffffffffffffffffffffffffffff600160408c20015416151561016461227c565b80895260028452611c68600160408b20015460ff61049c6122b5565b611c7b611c736122ee565b8815156121e0565b611c8e611c86612327565b8315156121e0565b611c988184612514565b611cc6611ca488612833565b828b526001865260408b20338c5286526107da60408c2091825460801c612360565b8385604085015116604051998a80927fa035b1fe0000000000000000000000000000000000000000000000000000000082525afa97881561158f578998611d57575b50611d1b6114916102d89933848761288b565b6040805133808252602082018a905292917fe80ebd7cc9223d7382aab2e0d1d6155c65651f83d53c8b9b06901d167e32114291a40151166129e8565b97508388813d8311611d81575b611d6e81836120a0565b8101031261158457965196611d1b611d08565b503d611d64565b50346101b257807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b25760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b50346101b25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b257604060a091600435815260036020522073ffffffffffffffffffffffffffffffffffffffff8082541691816001820154169160048160028401541691600384015416920154926040519485526020850152604084015260608301526080820152f35b50346101b25760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b2576102d8611eaf366120e1565b60a08120908184526002602052611ee36fffffffffffffffffffffffffffffffff600160408720015416151561016461227c565b8184526002602052611f0560ff600160408720015460801c16156101646122b5565b612514565b50346101b25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b257611fd7611f45612002565b7fffffffffffffffffffffffff0000000000000000000000000000000000000000835473ffffffffffffffffffffffffffffffffffffffff80821693611f94611f8c6121a7565b8633146121e0565b1693849360405190611fa582612084565b600b82527f616c72656164792073657400000000000000000000000000000000000000000060208301528514156121e0565b161782557f167d3e9c1016ab80e58802ca9da10ce5c6a0f4debc46a2e7a2cd9e56899a4fb58280a280f35b6004359073ffffffffffffffffffffffffffffffffffffffff82168203610d3f57565b67ffffffffffffffff811161203957604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60a0810190811067ffffffffffffffff82111761203957604052565b6040810190811067ffffffffffffffff82111761203957604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761203957604052565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc60a0910112610d3f576040519061211882612068565b8173ffffffffffffffffffffffffffffffffffffffff6004358181168103610d3f5782526024358181168103610d3f5760208301526044358181168103610d3f5760408301526064359081168103610d3f5760608201526080608435910152565b9181601f84011215610d3f5782359167ffffffffffffffff8311610d3f5760208381860195010111610d3f57565b604051906121b482612084565b600982527f6e6f74206f776e657200000000000000000000000000000000000000000000006020830152565b156121e85750565b604051907f08c379a000000000000000000000000000000000000000000000000000000000825281602080600483015282519283602484015260005b848110612265575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f836000604480968601015201168101030190fd5b818101830151868201604401528593508201612224565b6040519061228982612084565b601282527f6d61726b6574206e6f74206372656174656400000000000000000000000000006020830152565b604051906122c282612084565b600d82527f6d61726b657420706175736564000000000000000000000000000000000000006020830152565b604051906122fb82612084565b600b82527f7a65726f206173736574730000000000000000000000000000000000000000006020830152565b6040519061233482612084565b600c82527f7a65726f206164647265737300000000000000000000000000000000000000006020830152565b6fffffffffffffffffffffffffffffffff9182169082160391908211610be657565b6040519061238f82612084565b601782527f696e73756666696369656e7420636f6c6c61746572616c0000000000000000006020830152565b67ffffffffffffffff81116120395760051b60200190565b90929160ff6101009161242f846101208101976080809173ffffffffffffffffffffffffffffffffffffffff80825116855280602083015116602086015280604083015116604086015260608201511660608501520151910152565b60018154916fffffffffffffffffffffffffffffffff9283811660a088015260801c60c0870152015490811660e085015260801c161515910152565b6040519061247882612084565b601282527f696e636f6e73697374656e7420696e70757400000000000000000000000000006020830152565b9190916fffffffffffffffffffffffffffffffff80809416911601918211610be657565b9183606094601f927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0948652604060208701528160408701528686013760008582860101520116010190565b9190600092818452602093600285526fffffffffffffffffffffffffffffffff92604092846001858520015416804203904282116128065742146127fc5773ffffffffffffffffffffffffffffffffffffffff9081606084015116806125b2575b50505050600193949560029183525220019042167fffffffffffffffffffffffffffffffff00000000000000000000000000000000825416179055565b90896125fd869493889c9698978852600283528988208a519d8e809481937f099d191b0000000000000000000000000000000000000000000000000000000083528d600484016123d3565b03925af1998a156127f257859a6127bb575b50670de0b6b3a76400006126748b61266e6126388695888b5260028a528d8d8c20541693612d01565b612669671bc16d674ec8000061264e8380612d01565b046729a2241af62c00006126628483612d01565b0492612b57565b612b57565b90612d01565b049561267f87612833565b84875260028652888720907fffffffffffffffffffffffffffffffff000000000000000000000000000000008b6126ba8454938285166124a4565b16911617905551169060045416813b156110065786517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff919091166004820152602481018690529084908290604490829084905af180156127b157988691600198999a612777575b50817f20717e41623f78b14af65ec86121f5afc2356553bc38aa87a67e065cb4fd0727916002969785945191825286820152a2918197969538612575565b917f20717e41623f78b14af65ec86121f5afc2356553bc38aa87a67e065cb4fd0727916002966127a78695612025565b9650915091612739565b86513d86823e3d90fd5b9099508381813d83116127eb575b6127d381836120a0565b81010312611006575198670de0b6b3a764000061260f565b503d6127c9565b87513d87823e3d90fd5b5050505050509050565b6024857f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6fffffffffffffffffffffffffffffffff9061288760405161285481612084565b601481527f6d61782075696e743132382065786365656465640000000000000000000000006020820152838311156121e0565b1690565b60806ec097ce7bc90715b34b9f100000000061292961293394966040670de0b6b3a7640000976000908a8252600160205273ffffffffffffffffffffffffffffffffffffffff83832091169081835260205261290f6fffffffffffffffffffffffffffffffff8085852054168d855260026020528585205491828b1c921690612cde565b9a825260016020528282209082526020522054841c612d01565b0491015190612d01565b04101590565b6040519061294682612084565b600782527f6e6f20636f6465000000000000000000000000000000000000000000000000006020830152565b3d156129cb573d9067ffffffffffffffff821161203957604051916129bf60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601846120a0565b82523d6000602084013e565b606090565b90816020910312610d3f57518015158103610d3f5790565b612b3b9260009283612a78612aa473ffffffffffffffffffffffffffffffffffffffff83961694612a1e863b1515610164612939565b60405192839160208301967fa9059cbb000000000000000000000000000000000000000000000000000000008852602484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081018352826120a0565b51925af1612af0612ab3612972565b9160405190612ac182612084565b601182527f7472616e7366657220726576657274656400000000000000000000000000000060208301526121e0565b8051908115918215612b3d575b505060405190612b0c82612084565b601782527f7472616e736665722072657475726e65642066616c736500000000000000000060208301526121e0565b565b612b5092506020809183010191016129d0565b3880612afd565b91908201809211610be657565b6001820192918310610be657620f42408201809211610be657612b8a926106d491612d01565b90565b91620f42408101809111610be65760018201809211610be657612b8a92612d1e565b60009291838093612b3b9673ffffffffffffffffffffffffffffffffffffffff80951694612be2863b1515610164612939565b604051928160208501967f23b872dd000000000000000000000000000000000000000000000000000000008852166024850152166044830152606482015260648152612c2d81612068565b51925af1612c79612c3c612972565b9160405190612c4a82612084565b601582527f7472616e7366657246726f6d207265766572746564000000000000000000000060208301526121e0565b8051908115918215612cc4575b505060405190612c9582612084565b601b82527f7472616e7366657246726f6d2072657475726e65642066616c7365000000000060208301526121e0565b612cd792506020809183010191016129d0565b3880612c86565b919060018101809111610be657620f42408201809211610be657612b8a92612d1e565b81810292918115918404141715610be657565b8115610ce4570490565b90612d2891612d01565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810191818311610be657612b8a926106d491612b5756fea26469706673582212205f4cb13089d32e01edb89eb8f73d86984f3e4db820fb0747b0a8e681c92fb49764736f6c634300081900330000000000000000000000002625bfb6ad9840c2c0abb48f150eb9158393c4660000000000000000000000003215c358b7a70c09e0a98827f744d107095e14e4
Deployed Bytecode
0x6080604052600436101561001257600080fd5b6000803560e01c806313af403514611f0a578063151c1ade14611e735780632c3c915714611de15780633644e51514611d885780634f0c918e14611bb55780635c60e39a14611b365780637784c6851461197e5780638c1358a2146116f55780638da5cb5b146116a457806393c52062146116175780639d1118fd146115c5578063b4360f5214611296578063baa87173146110cf578063c9b7c56814610d57578063d8eabcb8146103c3578063dd95fcdc14610302578063e0232b42146101b55763ee4d5c4b146100e357600080fd5b346101b25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b2577f9c4c2eb2dde9b42f28eed886c7f59145d4226d5f8d88d495ee7f724546a732dd602061013d612002565b73ffffffffffffffffffffffffffffffffffffffff9061016a8286541633146101646121a7565b906121e0565b1661017e610176612327565b8215156121e0565b807fffffffffffffffffffffffff00000000000000000000000000000000000000006004541617600455604051908152a180f35b80fd5b50346101b25760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b2576101ed612002565b6024358260443567ffffffffffffffff81116102fe5761022673ffffffffffffffffffffffffffffffffffffffff913690600401612179565b91909461023c6102346122ee565b8615156121e0565b1693846040518581527fc76f1b4fe4396ac07a9fa55a415d4ca430e72651d37d3401f3bed7cb13fc4f1260203392a36102768433876129e8565b333b156102ef576102b891839160405193849283927f08df878400000000000000000000000000000000000000000000000000000000845288600485016124c8565b038183335af180156102f3576102db575b50506102d89130903390612baf565b80f35b6102e490612025565b6102ef5782386102c9565b8280fd5b6040513d84823e3d90fd5b5080fd5b50346101b25760c07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b25761033b366120e1565b60a435908115158092036102ef5760a09061037173ffffffffffffffffffffffffffffffffffffffff85541633146101646121a7565b208252600260205260016040832001907fffffffffffffffffffffffffffffff00ffffffffffffffffffffffffffffffff70ff0000000000000000000000000000000083549260801b16911617905580f35b50346101b2576101207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b2576103fd366120e1565b73ffffffffffffffffffffffffffffffffffffffff60a4351660a43503610d3f576101043567ffffffffffffffff81116102ef5761043f903690600401612179565b909160e4359160c43593600460a0842094858852600260205261047f6fffffffffffffffffffffffffffffffff600160408b20015416151561016461227c565b85885260026020526104a7600160408a20015460ff61049c6122b5565b9160801c16156121e0565b6104c06104b261246b565b60e4351560c43515186121e0565b6104ca8686612514565b602073ffffffffffffffffffffffffffffffffffffffff604087015116604051938480927fa035b1fe0000000000000000000000000000000000000000000000000000000082525afa918215610d4c578892610d13575b506105706105338360a435898961288b565b156040519061054182612084565b601382527f706f736974696f6e206973206865616c7468790000000000000000000000000060208301526121e0565b6080850151670de0b6b3a764000003670de0b6b3a76400008111610bb957670429d069189e00009080820291820403610be657670de0b6b3a76400009004670de0b6b3a764000081810311610bb95780670de0b6b3a764000014610ce457670de0b6b3a7640000036ec097ce7bc90715b34b9f10000000000491670ff59ee833b300009160c43515610c1557506106079088612d01565b6ec097ce7bc90715b34b9f0fffffffff8101809111610be6576ec097ce7bc90715b34b9f100000000090049081670de0b6b3a7640000810204670de0b6b3a76400001482151715610be6578281188184100281187fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810111610bb95788949392610704926106d99280831892811192909202909118906106d4907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff830190670de0b6b3a764000002612b57565b612d14565b86855260026020526040852054906fffffffffffffffffffffffffffffffff8260801c921690612b8d565b945b808452600260205261073360408520546fffffffffffffffffffffffffffffffff8160801c911688612cde565b9561073d81612833565b82865260016020526040862073ffffffffffffffffffffffffffffffffffffffff60a4351660005260205260406000206fffffffffffffffffffffffffffffffff61078c825493828516612360565b167fffffffffffffffffffffffffffffffff0000000000000000000000000000000080931617905561081a6107c083612833565b84885260026020526107da6040892091825460801c612360565b6fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffff0000000000000000000000000000000083549260801b169116179055565b82865260026020526108486fffffffffffffffffffffffffffffffff60408820541689808203911102612833565b83875260026020526fffffffffffffffffffffffffffffffff604088209116828254161790556108b861087a8a612833565b84885260016020526040882073ffffffffffffffffffffffffffffffffffffffff60a435166000526020526107da604060002091825460801c612360565b8590869084885260016020526040882073ffffffffffffffffffffffffffffffffffffffff60a4351660005260205260406000205460801c15610a9d575b506040519289845260208401528960408401526060830152608082015273ffffffffffffffffffffffffffffffffffffffff60a43516917fa4946ede45d0c6f06a0f5ce92c9ad3b4751452d2fe0e25010783bcab57a67e4160a03393a4610978863373ffffffffffffffffffffffffffffffffffffffff6020880151166129e8565b81610a30575b505050806109a88373ffffffffffffffffffffffffffffffffffffffff8094511630903390612baf565b5116803b15610a2c576040517fd16ff4a0000000000000000000000000000000000000000000000000000000008152306004820152602481018390529084908290604490829084905af18015610a2157610a0d575b6040838382519182526020820152f35b610a178491612025565b6102ef57826109fd565b6040513d86823e3d90fd5b8380fd5b333b156102ef57610a7291839160405193849283927f2bf61e3000000000000000000000000000000000000000000000000000000000845289600485016124c8565b038183335af180156102f357610a89575b8061097e565b610a9290612025565b610a2c578338610a83565b91505082865260016020526040862073ffffffffffffffffffffffffffffffffffffffff60a435166000526020526fffffffffffffffffffffffffffffffff604060002054169083875260026020526040872054610b126fffffffffffffffffffffffffffffffff82169160801c8285612cde565b818110908218021890610b2482612833565b85895260026020526040892090826fffffffffffffffffffffffffffffffff610b51845493828516612360565b169116179055610b7d610b6384612833565b868a5260026020526107da60408b2091825460801c612360565b84885260016020526040882073ffffffffffffffffffffffffffffffffffffffff60a435166000526020526040600020908154169055386108f6565b6024897f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b96975091610c6590610c60670de0b6b3a7640000938a8c52600260205260408c2054928181109082180218916fffffffffffffffffffffffffffffffff8160801c911660e435612b64565b612d01565b04806ec097ce7bc90715b34b9f10000000008102046ec097ce7bc90715b34b9f10000000001481151715610cb757879392916ec097ce7bc90715b34b9f1000000000610cb19202612d14565b95610706565b6024887f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b9091506020813d602011610d44575b81610d2f602093836120a0565b81010312610d3f57519038610521565b600080fd5b3d9150610d22565b6040513d8a823e3d90fd5b50346101b2576101007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b257610d91366120e1565b60a43560c43560e43567ffffffffffffffff811161100657610db7903690600401612179565b829491849560a0842090818952600290896020978389526fffffffffffffffffffffffffffffffff99610df78b600160408620015416151561016461227c565b858352848a52610e12600160408520015460ff61049c6122b5565b15610e27610e1e61246b565b831583186121e0565b610e31868a612514565b6110a457508391505280865260408920548781169060801c620f424081018091116110775760018201809211611077578a95949392916106d4610e74928c612d01565b975b610e7f89612833565b908387526001895260408720336000528952604060002081610ea5825494828616612360565b167fffffffffffffffffffffffffffffffff00000000000000000000000000000000809416179055610ef1610ed98b612833565b858952848b526107da60408a2091825460801c612360565b838752828952610f0d816040892054168c808203911102612833565b92848852895260408720921690825416179055604051888152878782015233917f52acb05cebbd3cd39715469f22afbf5a17496295ef3bc9bb5944056c63ccaa0960403393a48161100a575b50505073ffffffffffffffffffffffffffffffffffffffff90610f83858383511630903390612baf565b5116803b15611006576040517fd16ff4a0000000000000000000000000000000000000000000000000000000008152306004820152602481018590529085908290604490829084905af18015610ffb57610fe7575b50604080945051928352820152f35b610ff18591612025565b610a2c5783610fd8565b6040513d87823e3d90fd5b8480fd5b333b156102ef5761104c91839160405193849283927f5106ac890000000000000000000000000000000000000000000000000000000084528b600485016124c8565b038183335af180156102f357611063575b80610f59565b61106c90612025565b61100657843861105d565b60248b7f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b84826110c99398979695949b9c50528289526040872054908b8260801c921690612cde565b98610e76565b50346101b25760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b257611108366120e1565b9060a43560c43567ffffffffffffffff81116102ef5761112c903690600401612179565b60a0852091828552602092600284526111626fffffffffffffffffffffffffffffffff600160408920015416151561016461227c565b8086526002845261117e600160408820015460ff61049c6122b5565b6111896102346122ee565b6111b761119586612833565b828852600186526040882033895286526107da6040892091825460801c6124a4565b60405185815233917fa3b9472a1399e17e123f3c2e6586c23e504184d504de59cdaa2b375e880c6184863393a481611212575b846102d88573ffffffffffffffffffffffffffffffffffffffff868a01511630903390612baf565b333b156110065761125491859160405193849283927f3996a89700000000000000000000000000000000000000000000000000000000845288600485016124c8565b038183335af18015610a215761126b575b806111ea565b906102d89361128e73ffffffffffffffffffffffffffffffffffffffff93612025565b935090611265565b50346101b2576101007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b2576112d0366120e1565b60a4359060c4359173ffffffffffffffffffffffffffffffffffffffff8060e43516928360e435036115c15760409385849660a0842091828a52602096600288526113398b60016fffffffffffffffffffffffffffffffff9b8c9220015416151561016461227c565b838b5260028852611355600160408d20015460ff61049c6122b5565b15611361610e1e61246b565b61136c610234612327565b6113768487612514565b61159a575050808852600285526113986040892054878160801c911689612b8d565b955b6113a387612833565b828a526001875260408a20338b52875260408a20826113c68254938285166124a4565b167fffffffffffffffffffffffffffffffff000000000000000000000000000000008093161790556114136113fa89612833565b848c52600289526107da60408d2091825460801c6124a4565b61141c89612833565b90838b526002885260408b20926114378454938285166124a4565b16911617905560048585604086015116604051928380927fa035b1fe0000000000000000000000000000000000000000000000000000000082525afa90811561158f57899161155c575b506114916114999133848761288b565b610164612382565b6040519033825287868301528660408301527f570954540bed6b1304a87dfe815a5eda4a648f7097a16240dcd85c9b5fd42a4360603393a45116803b15611006576040517f40c10f1900000000000000000000000000000000000000000000000000000000815260e43573ffffffffffffffffffffffffffffffffffffffff166004820152602481018590529085908290604490829084905af18015610ffb576040955061154d575b508351928352820152f35b61155690612025565b38611542565b90508581813d8311611588575b61157381836120a0565b810103126115845751611491611481565b8880fd5b503d611569565b6040513d8b823e3d90fd5b6115bb91979850828a526002875260408a205490898260801c921690612b64565b9661139a565b8580fd5b50346101b257807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b257602073ffffffffffffffffffffffffffffffffffffffff60045416604051908152f35b50346101b25760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b25760243573ffffffffffffffffffffffffffffffffffffffff81168091036102fe5760409182916004358252600160205282822090825260205220548151906fffffffffffffffffffffffffffffffff8116825260801c6020820152f35b50346101b257807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b25773ffffffffffffffffffffffffffffffffffffffff6020915416604051908152f35b50346101b25760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b25761172e366120e1565b73ffffffffffffffffffffffffffffffffffffffff906117558284541633146101646121a7565b60a08120808452602092600284526fffffffffffffffffffffffffffffffff6117bd81600160408920015416156040519061178f82612084565b601682527f6d61726b657420616c7265616479206372656174656400000000000000000000888301526121e0565b82865260028552600160408720019042167fffffffffffffffffffffffffffffffff00000000000000000000000000000000825416179055600384526040852081845116907fffffffffffffffffffffffff000000000000000000000000000000000000000091828254161781556001810183878701511683825416179055600281018360408701511683825416179055600381016060860192848451169082541617905560046080860151910155827fac4b2400f169220b0c0afdde7a0b32e775ba727ea1cb30b35f935cdaab8683ac60a06040516118e181896080809173ffffffffffffffffffffffffffffffffffffffff80825116855280602083015116602086015280604083015116604086015260608201511660608501520151910152565ba2511691826118ee578480f35b6119359284928652600283526040862091866040518096819582947f099d191b000000000000000000000000000000000000000000000000000000008452600484016123d3565b03925af180156119735761194a575b80808480f35b813d831161196c575b61195d81836120a0565b810103126101b2573880611944565b503d611953565b6040513d85823e3d90fd5b50346101b2576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102fe576004359067ffffffffffffffff90818311610a2c5736602384011215610a2c578260040135918211610a2c576024916005903660248260051b870101116115c1578491816119fd88936123bb565b95611a0b60405197886120a0565b818752611a17826123bb565b947fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08789019601368737845b838110611a8d57505050505060405193838594850191818652518092526040850193925b828110611a7657505050500390f35b835185528695509381019392810192600101611a67565b9497959694807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114611b0a576001019084811015611ade57851b82018301355481861b8801529597949695611a43565b838a7f4e487b710000000000000000000000000000000000000000000000000000000081526032600452fd5b838a7f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b50346101b25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b2576040608091600435815260026020522060ff81549160016fffffffffffffffffffffffffffffffff91015490604051938181168552851c602085015281166040840152831c1615156060820152f35b50346101b25760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b257611bee366120e1565b60a43560c43573ffffffffffffffffffffffffffffffffffffffff8082168083036115c1578460a0600496209182885260209260028452611c4c6fffffffffffffffffffffffffffffffff600160408c20015416151561016461227c565b80895260028452611c68600160408b20015460ff61049c6122b5565b611c7b611c736122ee565b8815156121e0565b611c8e611c86612327565b8315156121e0565b611c988184612514565b611cc6611ca488612833565b828b526001865260408b20338c5286526107da60408c2091825460801c612360565b8385604085015116604051998a80927fa035b1fe0000000000000000000000000000000000000000000000000000000082525afa97881561158f578998611d57575b50611d1b6114916102d89933848761288b565b6040805133808252602082018a905292917fe80ebd7cc9223d7382aab2e0d1d6155c65651f83d53c8b9b06901d167e32114291a40151166129e8565b97508388813d8311611d81575b611d6e81836120a0565b8101031261158457965196611d1b611d08565b503d611d64565b50346101b257807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b25760206040517fa238af4e16df17ad3ce618ab9905627c10d4897c97e84e537e746836f3ba32a78152f35b50346101b25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b257604060a091600435815260036020522073ffffffffffffffffffffffffffffffffffffffff8082541691816001820154169160048160028401541691600384015416920154926040519485526020850152604084015260608301526080820152f35b50346101b25760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b2576102d8611eaf366120e1565b60a08120908184526002602052611ee36fffffffffffffffffffffffffffffffff600160408720015416151561016461227c565b8184526002602052611f0560ff600160408720015460801c16156101646122b5565b612514565b50346101b25760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b257611fd7611f45612002565b7fffffffffffffffffffffffff0000000000000000000000000000000000000000835473ffffffffffffffffffffffffffffffffffffffff80821693611f94611f8c6121a7565b8633146121e0565b1693849360405190611fa582612084565b600b82527f616c72656164792073657400000000000000000000000000000000000000000060208301528514156121e0565b161782557f167d3e9c1016ab80e58802ca9da10ce5c6a0f4debc46a2e7a2cd9e56899a4fb58280a280f35b6004359073ffffffffffffffffffffffffffffffffffffffff82168203610d3f57565b67ffffffffffffffff811161203957604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60a0810190811067ffffffffffffffff82111761203957604052565b6040810190811067ffffffffffffffff82111761203957604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761203957604052565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc60a0910112610d3f576040519061211882612068565b8173ffffffffffffffffffffffffffffffffffffffff6004358181168103610d3f5782526024358181168103610d3f5760208301526044358181168103610d3f5760408301526064359081168103610d3f5760608201526080608435910152565b9181601f84011215610d3f5782359167ffffffffffffffff8311610d3f5760208381860195010111610d3f57565b604051906121b482612084565b600982527f6e6f74206f776e657200000000000000000000000000000000000000000000006020830152565b156121e85750565b604051907f08c379a000000000000000000000000000000000000000000000000000000000825281602080600483015282519283602484015260005b848110612265575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f836000604480968601015201168101030190fd5b818101830151868201604401528593508201612224565b6040519061228982612084565b601282527f6d61726b6574206e6f74206372656174656400000000000000000000000000006020830152565b604051906122c282612084565b600d82527f6d61726b657420706175736564000000000000000000000000000000000000006020830152565b604051906122fb82612084565b600b82527f7a65726f206173736574730000000000000000000000000000000000000000006020830152565b6040519061233482612084565b600c82527f7a65726f206164647265737300000000000000000000000000000000000000006020830152565b6fffffffffffffffffffffffffffffffff9182169082160391908211610be657565b6040519061238f82612084565b601782527f696e73756666696369656e7420636f6c6c61746572616c0000000000000000006020830152565b67ffffffffffffffff81116120395760051b60200190565b90929160ff6101009161242f846101208101976080809173ffffffffffffffffffffffffffffffffffffffff80825116855280602083015116602086015280604083015116604086015260608201511660608501520151910152565b60018154916fffffffffffffffffffffffffffffffff9283811660a088015260801c60c0870152015490811660e085015260801c161515910152565b6040519061247882612084565b601282527f696e636f6e73697374656e7420696e70757400000000000000000000000000006020830152565b9190916fffffffffffffffffffffffffffffffff80809416911601918211610be657565b9183606094601f927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0948652604060208701528160408701528686013760008582860101520116010190565b9190600092818452602093600285526fffffffffffffffffffffffffffffffff92604092846001858520015416804203904282116128065742146127fc5773ffffffffffffffffffffffffffffffffffffffff9081606084015116806125b2575b50505050600193949560029183525220019042167fffffffffffffffffffffffffffffffff00000000000000000000000000000000825416179055565b90896125fd869493889c9698978852600283528988208a519d8e809481937f099d191b0000000000000000000000000000000000000000000000000000000083528d600484016123d3565b03925af1998a156127f257859a6127bb575b50670de0b6b3a76400006126748b61266e6126388695888b5260028a528d8d8c20541693612d01565b612669671bc16d674ec8000061264e8380612d01565b046729a2241af62c00006126628483612d01565b0492612b57565b612b57565b90612d01565b049561267f87612833565b84875260028652888720907fffffffffffffffffffffffffffffffff000000000000000000000000000000008b6126ba8454938285166124a4565b16911617905551169060045416813b156110065786517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff919091166004820152602481018690529084908290604490829084905af180156127b157988691600198999a612777575b50817f20717e41623f78b14af65ec86121f5afc2356553bc38aa87a67e065cb4fd0727916002969785945191825286820152a2918197969538612575565b917f20717e41623f78b14af65ec86121f5afc2356553bc38aa87a67e065cb4fd0727916002966127a78695612025565b9650915091612739565b86513d86823e3d90fd5b9099508381813d83116127eb575b6127d381836120a0565b81010312611006575198670de0b6b3a764000061260f565b503d6127c9565b87513d87823e3d90fd5b5050505050509050565b6024857f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6fffffffffffffffffffffffffffffffff9061288760405161285481612084565b601481527f6d61782075696e743132382065786365656465640000000000000000000000006020820152838311156121e0565b1690565b60806ec097ce7bc90715b34b9f100000000061292961293394966040670de0b6b3a7640000976000908a8252600160205273ffffffffffffffffffffffffffffffffffffffff83832091169081835260205261290f6fffffffffffffffffffffffffffffffff8085852054168d855260026020528585205491828b1c921690612cde565b9a825260016020528282209082526020522054841c612d01565b0491015190612d01565b04101590565b6040519061294682612084565b600782527f6e6f20636f6465000000000000000000000000000000000000000000000000006020830152565b3d156129cb573d9067ffffffffffffffff821161203957604051916129bf60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601846120a0565b82523d6000602084013e565b606090565b90816020910312610d3f57518015158103610d3f5790565b612b3b9260009283612a78612aa473ffffffffffffffffffffffffffffffffffffffff83961694612a1e863b1515610164612939565b60405192839160208301967fa9059cbb000000000000000000000000000000000000000000000000000000008852602484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081018352826120a0565b51925af1612af0612ab3612972565b9160405190612ac182612084565b601182527f7472616e7366657220726576657274656400000000000000000000000000000060208301526121e0565b8051908115918215612b3d575b505060405190612b0c82612084565b601782527f7472616e736665722072657475726e65642066616c736500000000000000000060208301526121e0565b565b612b5092506020809183010191016129d0565b3880612afd565b91908201809211610be657565b6001820192918310610be657620f42408201809211610be657612b8a926106d491612d01565b90565b91620f42408101809111610be65760018201809211610be657612b8a92612d1e565b60009291838093612b3b9673ffffffffffffffffffffffffffffffffffffffff80951694612be2863b1515610164612939565b604051928160208501967f23b872dd000000000000000000000000000000000000000000000000000000008852166024850152166044830152606482015260648152612c2d81612068565b51925af1612c79612c3c612972565b9160405190612c4a82612084565b601582527f7472616e7366657246726f6d207265766572746564000000000000000000000060208301526121e0565b8051908115918215612cc4575b505060405190612c9582612084565b601b82527f7472616e7366657246726f6d2072657475726e65642066616c7365000000000060208301526121e0565b612cd792506020809183010191016129d0565b3880612c86565b919060018101809111610be657620f42408201809211610be657612b8a92612d1e565b81810292918115918404141715610be657565b8115610ce4570490565b90612d2891612d01565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810191818311610be657612b8a926106d491612b5756fea26469706673582212205f4cb13089d32e01edb89eb8f73d86984f3e4db820fb0747b0a8e681c92fb49764736f6c63430008190033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000002625bfb6ad9840c2c0abb48f150eb9158393c4660000000000000000000000003215c358b7a70c09e0a98827f744d107095e14e4
-----Decoded View---------------
Arg [0] : newOwner (address): 0x2625Bfb6aD9840C2c0ABb48f150Eb9158393c466
Arg [1] : _interestRecipient (address): 0x3215c358b7a70c09E0a98827F744d107095e14E4
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000002625bfb6ad9840c2c0abb48f150eb9158393c466
Arg [1] : 0000000000000000000000003215c358b7a70c09e0a98827f744d107095e14e4
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
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.