Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 6 from a total of 6 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Multicall | 21250854 | 12 days ago | IN | 0 ETH | 0.01151967 | ||||
Multicall | 21234222 | 14 days ago | IN | 0 ETH | 0.00687128 | ||||
Multicall | 20844930 | 68 days ago | IN | 0 ETH | 0.00743152 | ||||
Multicall | 20747821 | 82 days ago | IN | 0 ETH | 0.00126518 | ||||
Multicall | 20711636 | 87 days ago | IN | 0 ETH | 0.00131503 | ||||
Multicall | 20613372 | 101 days ago | IN | 0 ETH | 0.00181591 |
Latest 7 internal transactions
Advanced mode:
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
CompoundV2MigrationBundler
Compiler Version
v0.8.21+commit.d9974bed
Optimization Enabled:
Yes with 80000 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.21; import {ICEth} from "./interfaces/ICEth.sol"; import {ICToken} from "./interfaces/ICToken.sol"; import {Math} from "../../lib/morpho-utils/src/math/Math.sol"; import {ErrorsLib} from "../libraries/ErrorsLib.sol"; import {BaseBundler} from "../BaseBundler.sol"; import {WNativeBundler} from "../WNativeBundler.sol"; import {MigrationBundler, ERC20} from "./MigrationBundler.sol"; /// @title CompoundV2MigrationBundler /// @author Morpho Labs /// @custom:contact [email protected] /// @notice Contract allowing to migrate a position from Compound V2 to Morpho Blue easily. contract CompoundV2MigrationBundler is WNativeBundler, MigrationBundler { /* IMMUTABLES */ /// @dev The address of the cETH contract. address public immutable C_ETH; /* CONSTRUCTOR */ /// @param morpho The Morpho contract Address. /// @param wNative The address of the wNative token contract. /// @param cEth The address of the cETH contract. constructor(address morpho, address wNative, address cEth) WNativeBundler(wNative) MigrationBundler(morpho) { require(cEth != address(0), ErrorsLib.ZERO_ADDRESS); C_ETH = cEth; } /* ACTIONS */ /// @notice Repays `amount` of `cToken`'s underlying asset, on behalf of the initiator. /// @dev Initiator must have previously transferred their assets to the bundler. /// @param cToken The address of the cToken contract. /// @param amount The amount of `cToken` to repay. Capped at the maximum repayable debt /// (mininimum of the bundler's balance and the initiator's debt). function compoundV2Repay(address cToken, uint256 amount) external payable protected { address _initiator = initiator(); if (cToken == C_ETH) { amount = Math.min(amount, address(this).balance); amount = Math.min(amount, ICEth(C_ETH).borrowBalanceCurrent(_initiator)); require(amount != 0, ErrorsLib.ZERO_AMOUNT); ICEth(C_ETH).repayBorrowBehalf{value: amount}(_initiator); } else { address underlying = ICToken(cToken).underlying(); amount = Math.min(amount, ERC20(underlying).balanceOf(address(this))); amount = Math.min(amount, ICToken(cToken).borrowBalanceCurrent(_initiator)); require(amount != 0, ErrorsLib.ZERO_AMOUNT); _approveMaxTo(underlying, cToken); require(ICToken(cToken).repayBorrowBehalf(_initiator, amount) == 0, ErrorsLib.REPAY_ERROR); } } /// @notice Redeems `amount` of `cToken` from CompoundV2. /// @notice Withdrawn assets are received by the bundler and should be used afterwards. /// @dev Initiator must have previously transferred their cTokens to the bundler. /// @param cToken The address of the cToken contract /// @param amount The amount of `cToken` to redeem. Pass `type(uint256).max` to redeem the bundler's `cToken` /// balance. function compoundV2Redeem(address cToken, uint256 amount) external payable protected { amount = Math.min(amount, ERC20(cToken).balanceOf(address(this))); require(amount != 0, ErrorsLib.ZERO_AMOUNT); require(ICToken(cToken).redeem(amount) == 0, ErrorsLib.REDEEM_ERROR); } /* INTERNAL */ /// @inheritdoc MigrationBundler function _isSenderAuthorized() internal view override(BaseBundler, MigrationBundler) returns (bool) { return MigrationBundler._isSenderAuthorized(); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; interface ICEth { function borrowBalanceCurrent(address borrower) external returns (uint256); function repayBorrowBehalf(address borrower) external payable; function balanceOf(address) external view returns (uint256); function exchangeRateStored() external view returns (uint256); function redeem(uint256 redeemTokens) external returns (uint256); function redeemUnderlying(uint256 redeemAmount) external returns (uint256); function borrow(uint256 borrowAmount) external returns (uint256); function mint() external payable; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; interface ICToken { function underlying() external returns (address); function balanceOf(address) external view returns (uint256); function exchangeRateStored() external view returns (uint256); function borrowBalanceCurrent(address borrower) external returns (uint256); function repayBorrowBehalf(address borrower, uint256 repayAmount) external returns (uint256); function redeem(uint256 redeemTokens) external returns (uint256); function redeemUnderlying(uint256 redeemAmount) external returns (uint256); function borrow(uint256 borrowAmount) external returns (uint256); function mint(uint256 mintAmount) external returns (uint256); }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; /// @title Math Library. /// @author Morpho Labs. /// @custom:contact [email protected] /// @dev Library to perform simple math manipulations. library Math { function min(uint256 x, uint256 y) internal pure returns (uint256 z) { assembly { z := xor(x, mul(xor(x, y), lt(y, x))) } } function max(uint256 x, uint256 y) internal pure returns (uint256 z) { assembly { z := xor(x, mul(xor(x, y), gt(y, x))) } } /// @dev Returns max(x - y, 0). function zeroFloorSub(uint256 x, uint256 y) internal pure returns (uint256 z) { assembly { z := mul(gt(x, y), sub(x, y)) } } /// @dev Returns x / y rounded up (x / y + boolAsInt(x % y > 0)). function divUp(uint256 x, uint256 y) internal pure returns (uint256 z) { // Division by 0 if // y = 0 assembly { if iszero(y) { revert(0, 0) } z := add(gt(mod(x, y), 0), div(x, y)) } } /// @dev Returns the floor of log2(x) and returns 0 when x = 0. /// @dev Uses a method by dichotomy to find the highest bit set of x. function log2(uint256 x) internal pure returns (uint256 y) { assembly { // Finds if x has a 1 on the first 128 bits. If not then do nothing. // If that is the case then the result is more than 128. let z := shl(7, gt(x, 0xffffffffffffffffffffffffffffffff)) y := z x := shr(z, x) // Using y as an accumulator, we can now focus on the last 128 bits of x. // Repeat this process to divide the number of bits to handle by 2 every time. z := shl(6, gt(x, 0xffffffffffffffff)) y := add(y, z) x := shr(z, x) z := shl(5, gt(x, 0xffffffff)) y := add(y, z) x := shr(z, x) z := shl(4, gt(x, 0xffff)) y := add(y, z) x := shr(z, x) z := shl(3, gt(x, 0xff)) y := add(y, z) x := shr(z, x) z := shl(2, gt(x, 0xf)) y := add(y, z) x := shr(z, x) z := shl(1, gt(x, 3)) y := add(add(y, z), gt(shr(z, x), 1)) } } }
// 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 { /* STANDARD BUNDLERS */ /// @dev Thrown when a call is attempted while the bundler is not in an initiated execution context. string internal constant UNINITIATED = "uninitiated"; /// @dev Thrown when a multicall is attempted while the bundler in an initiated execution context. string internal constant ALREADY_INITIATED = "already initiated"; /// @dev Thrown when a call is attempted from an unauthorized sender. string internal constant UNAUTHORIZED_SENDER = "unauthorized sender"; /// @dev Thrown when a call is attempted with a zero address as input. string internal constant ZERO_ADDRESS = "zero address"; /// @dev Thrown when a call is attempted with the bundler address as input. string internal constant BUNDLER_ADDRESS = "bundler address"; /// @dev Thrown when a call is attempted with a zero amount as input. string internal constant ZERO_AMOUNT = "zero amount"; /// @dev Thrown when a call is attempted with a zero shares as input. string internal constant ZERO_SHARES = "zero shares"; /// @dev Thrown when a call reverted and wasn't allowed to revert. string internal constant CALL_FAILED = "call failed"; /// @dev Thrown when the given owner is unexpected. string internal constant UNEXPECTED_OWNER = "unexpected owner"; /// @dev Thrown when an action ends up minting/burning more shares than a given slippage. string internal constant SLIPPAGE_EXCEEDED = "slippage exceeded"; /// @dev Thrown when a call to depositFor fails. string internal constant DEPOSIT_FAILED = "deposit failed"; /// @dev Thrown when a call to withdrawTo fails. string internal constant WITHDRAW_FAILED = "withdraw failed"; /* MIGRATION BUNDLERS */ /// @dev Thrown when repaying a CompoundV2 debt returns an error code. string internal constant REPAY_ERROR = "repay error"; /// @dev Thrown when redeeming CompoundV2 cTokens returns an error code. string internal constant REDEEM_ERROR = "redeem error"; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity 0.8.21; import {IMulticall} from "./interfaces/IMulticall.sol"; import {ErrorsLib} from "./libraries/ErrorsLib.sol"; import {UNSET_INITIATOR} from "./libraries/ConstantsLib.sol"; import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; /// @title BaseBundler /// @author Morpho Labs /// @custom:contact [email protected] /// @notice Enables calling multiple functions in a single call to the same contract (self). /// @dev Every bundler must inherit from this contract. /// @dev Every bundler inheriting from this contract must have their external functions payable as they will be /// delegate called by the `multicall` function (which is payable, and thus might pass a non-null ETH value). It is /// recommended not to rely on `msg.value` as the same value can be reused for multiple calls. abstract contract BaseBundler is IMulticall { using SafeTransferLib for ERC20; /* STORAGE */ /// @notice Keeps track of the bundler's latest bundle initiator. /// @dev Also prevents interacting with the bundler outside of an initiated execution context. address private _initiator = UNSET_INITIATOR; /* MODIFIERS */ /// @dev Prevents a function to be called outside an initiated `multicall` context and protects a function from /// being called by an unauthorized sender inside an initiated multicall context. modifier protected() { require(_initiator != UNSET_INITIATOR, ErrorsLib.UNINITIATED); require(_isSenderAuthorized(), ErrorsLib.UNAUTHORIZED_SENDER); _; } /* PUBLIC */ /// @notice Returns the address of the initiator of the multicall transaction. /// @dev Specialized getter to prevent using `_initiator` directly. function initiator() public view returns (address) { return _initiator; } /* EXTERNAL */ /// @notice Executes a series of delegate calls to the contract itself. /// @dev Locks the initiator so that the sender can uniquely be identified in callbacks. /// @dev All functions delegatecalled must be `payable` if `msg.value` is non-zero. function multicall(bytes[] memory data) external payable { require(_initiator == UNSET_INITIATOR, ErrorsLib.ALREADY_INITIATED); _initiator = msg.sender; _multicall(data); _initiator = UNSET_INITIATOR; } /* INTERNAL */ /// @dev Executes a series of delegate calls to the contract itself. /// @dev All functions delegatecalled must be `payable` if `msg.value` is non-zero. function _multicall(bytes[] memory data) internal { for (uint256 i; i < data.length; ++i) { (bool success, bytes memory returnData) = address(this).delegatecall(data[i]); // No need to check that `address(this)` has code in case of success. if (!success) _revert(returnData); } } /// @dev Bubbles up the revert reason / custom error encoded in `returnData`. /// @dev Assumes `returnData` is the return data of any kind of failing CALL to a contract. function _revert(bytes memory returnData) internal pure { uint256 length = returnData.length; require(length > 0, ErrorsLib.CALL_FAILED); assembly ("memory-safe") { revert(add(32, returnData), length) } } /// @dev Returns whether the sender of the call is authorized. /// @dev Assumes to be inside a properly initiated `multicall` context. function _isSenderAuthorized() internal view virtual returns (bool) { return msg.sender == _initiator; } /// @dev Gives the max approval to `spender` to spend the given `asset` if not already approved. /// @dev Assumes that `type(uint256).max` is large enough to never have to increase the allowance again. function _approveMaxTo(address asset, address spender) internal { if (ERC20(asset).allowance(address(this), spender) == 0) { ERC20(asset).safeApprove(spender, type(uint256).max); } } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity 0.8.21; import {IWNative} from "./interfaces/IWNative.sol"; import {Math} from "../lib/morpho-utils/src/math/Math.sol"; import {ErrorsLib} from "./libraries/ErrorsLib.sol"; import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; import {BaseBundler} from "./BaseBundler.sol"; /// @title WNativeBundler /// @author Morpho Labs /// @custom:contact [email protected] /// @notice Bundler contract managing interactions with network's wrapped native token. /// @notice "wrapped native" refers to forks of WETH. abstract contract WNativeBundler is BaseBundler { using SafeTransferLib for ERC20; /* IMMUTABLES */ /// @dev The address of the wrapped native token contract. address public immutable WRAPPED_NATIVE; /* CONSTRUCTOR */ /// @dev Warning: assumes the given addresses are non-zero (they are not expected to be deployment arguments). /// @param wNative The address of the wNative token contract. constructor(address wNative) { require(wNative != address(0), ErrorsLib.ZERO_ADDRESS); WRAPPED_NATIVE = wNative; } /* FALLBACKS */ /// @notice Native tokens are received by the bundler and should be used afterwards. /// @dev Allows the wrapped native contract to send native tokens to the bundler. receive() external payable {} /* ACTIONS */ /// @notice Wraps the given `amount` of the native token to wNative. /// @notice Wrapped native tokens are received by the bundler and should be used afterwards. /// @dev Initiator must have previously transferred their native tokens to the bundler. /// @param amount The amount of native token to wrap. Capped at the bundler's native token balance. function wrapNative(uint256 amount) external payable protected { amount = Math.min(amount, address(this).balance); require(amount != 0, ErrorsLib.ZERO_AMOUNT); IWNative(WRAPPED_NATIVE).deposit{value: amount}(); } /// @notice Unwraps the given `amount` of wNative to the native token. /// @notice Unwrapped native tokens are received by the bundler and should be used afterwards. /// @dev Initiator must have previously transferred their wrapped native tokens to the bundler. /// @param amount The amount of wrapped native token to unwrap. Capped at the bundler's wNative balance. function unwrapNative(uint256 amount) external payable protected { amount = Math.min(amount, ERC20(WRAPPED_NATIVE).balanceOf(address(this))); require(amount != 0, ErrorsLib.ZERO_AMOUNT); IWNative(WRAPPED_NATIVE).withdraw(amount); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity 0.8.21; import {SafeTransferLib, ERC20} from "../../lib/solmate/src/utils/SafeTransferLib.sol"; import {BaseBundler} from "../BaseBundler.sol"; import {TransferBundler} from "../TransferBundler.sol"; import {PermitBundler} from "../PermitBundler.sol"; import {Permit2Bundler} from "../Permit2Bundler.sol"; import {ERC4626Bundler} from "../ERC4626Bundler.sol"; import {MorphoBundler} from "../MorphoBundler.sol"; /// @title MigrationBundler /// @author Morpho Labs /// @custom:contact [email protected] /// @notice Abstract contract allowing to migrate a position from one lending protocol to Morpho Blue easily. abstract contract MigrationBundler is TransferBundler, PermitBundler, Permit2Bundler, ERC4626Bundler, MorphoBundler { using SafeTransferLib for ERC20; /* CONSTRUCTOR */ constructor(address morpho) MorphoBundler(morpho) {} /* INTERNAL */ /// @inheritdoc MorphoBundler function _isSenderAuthorized() internal view virtual override(BaseBundler, MorphoBundler) returns (bool) { return MorphoBundler._isSenderAuthorized(); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title IMulticall /// @author Morpho Labs /// @custom:contact [email protected] /// @notice Interface of Multicall. interface IMulticall { /// @notice Executes an ordered batch of delegatecalls to this contract. /// @param data The ordered array of calldata to execute. function multicall(bytes[] calldata data) external payable; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; /// @dev The default value of the initiator of the multicall transaction is not the address zero to save gas. address constant UNSET_INITIATOR = address(1);
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; import {ERC20} from "../tokens/ERC20.sol"; /// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol) /// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer. /// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller. library SafeTransferLib { /*////////////////////////////////////////////////////////////// ETH OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferETH(address to, uint256 amount) internal { bool success; /// @solidity memory-safe-assembly assembly { // Transfer the ETH and store if it succeeded or not. success := call(gas(), to, amount, 0, 0, 0, 0) } require(success, "ETH_TRANSFER_FAILED"); } /*////////////////////////////////////////////////////////////// ERC20 OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferFrom( ERC20 token, address from, address to, uint256 amount ) internal { bool success; /// @solidity memory-safe-assembly assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), and(from, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "from" argument. mstore(add(freeMemoryPointer, 36), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument. mstore(add(freeMemoryPointer, 68), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())), // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 100, 0, 32) ) } require(success, "TRANSFER_FROM_FAILED"); } function safeTransfer( ERC20 token, address to, uint256 amount ) internal { bool success; /// @solidity memory-safe-assembly assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument. mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())), // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 68, 0, 32) ) } require(success, "TRANSFER_FAILED"); } function safeApprove( ERC20 token, address to, uint256 amount ) internal { bool success; /// @solidity memory-safe-assembly assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument. mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())), // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 68, 0, 32) ) } require(success, "APPROVE_FAILED"); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; interface IWNative { function deposit() external payable; function withdraw(uint256 wad) external; function approve(address guy, uint256 wad) external returns (bool); function transferFrom(address src, address dst, uint256 wad) external returns (bool); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity 0.8.21; import {Math} from "../lib/morpho-utils/src/math/Math.sol"; import {ErrorsLib} from "./libraries/ErrorsLib.sol"; import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; import {BaseBundler} from "./BaseBundler.sol"; /// @title TransferBundler /// @author Morpho Labs /// @custom:contact [email protected] /// @notice Enables transfer of ERC20 and native tokens. /// @dev Assumes that any tokens left on the contract can be seized by anyone. abstract contract TransferBundler is BaseBundler { using SafeTransferLib for ERC20; /* TRANSFER ACTIONS */ /// @notice Transfers the minimum between the given `amount` and the bundler's balance of native asset from the /// bundler to `recipient`. /// @dev If the minimum happens to be zero, the transfer is silently skipped. /// @param recipient The address that will receive the native tokens. /// @param amount The amount of native tokens to transfer. Capped at the bundler's balance. function nativeTransfer(address recipient, uint256 amount) external payable protected { require(recipient != address(0), ErrorsLib.ZERO_ADDRESS); require(recipient != address(this), ErrorsLib.BUNDLER_ADDRESS); amount = Math.min(amount, address(this).balance); if (amount == 0) return; SafeTransferLib.safeTransferETH(recipient, amount); } /// @notice Transfers the minimum between the given `amount` and the bundler's balance of `asset` from the bundler /// to `recipient`. /// @dev If the minimum happens to be zero, the transfer is silently skipped. /// @param asset The address of the ERC20 token to transfer. /// @param recipient The address that will receive the tokens. /// @param amount The amount of `asset` to transfer. Capped at the bundler's balance. function erc20Transfer(address asset, address recipient, uint256 amount) external payable protected { require(recipient != address(0), ErrorsLib.ZERO_ADDRESS); require(recipient != address(this), ErrorsLib.BUNDLER_ADDRESS); amount = Math.min(amount, ERC20(asset).balanceOf(address(this))); if (amount == 0) return; ERC20(asset).safeTransfer(recipient, amount); } /// @notice Transfers the given `amount` of `asset` from sender to this contract via ERC20 transferFrom. /// @notice User must have given sufficient allowance to the Bundler to spend their tokens. /// @param asset The address of the ERC20 token to transfer. /// @param amount The amount of `asset` to transfer from the initiator. Capped at the initiator's balance. function erc20TransferFrom(address asset, uint256 amount) external payable protected { address _initiator = initiator(); amount = Math.min(amount, ERC20(asset).balanceOf(_initiator)); require(amount != 0, ErrorsLib.ZERO_AMOUNT); ERC20(asset).safeTransferFrom(_initiator, address(this), amount); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity 0.8.21; import {IERC20Permit} from "../lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol"; import {BaseBundler} from "./BaseBundler.sol"; /// @title PermitBundler /// @author Morpho Labs /// @custom:contact [email protected] /// @notice Bundler contract managing interactions with tokens implementing EIP-2612. abstract contract PermitBundler is BaseBundler { /// @notice Permits the given `amount` of `asset` from sender to be spent by the bundler via EIP-2612 Permit with /// the given `deadline` & EIP-712 signature's `v`, `r` & `s`. /// @param asset The address of the token to be permitted. /// @param amount The amount of `asset` to be permitted. /// @param deadline The deadline of the approval. /// @param v The `v` component of a signature. /// @param r The `r` component of a signature. /// @param s The `s` component of a signature. /// @param skipRevert Whether to avoid reverting the call in case the signature is frontrunned. function permit(address asset, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s, bool skipRevert) external payable protected { try IERC20Permit(asset).permit(initiator(), address(this), amount, deadline, v, r, s) {} catch (bytes memory returnData) { if (!skipRevert) _revert(returnData); } } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity 0.8.21; import {IAllowanceTransfer} from "../lib/permit2/src/interfaces/IAllowanceTransfer.sol"; import {ErrorsLib} from "./libraries/ErrorsLib.sol"; import {Math} from "../lib/morpho-utils/src/math/Math.sol"; import {Permit2Lib} from "../lib/permit2/src/libraries/Permit2Lib.sol"; import {SafeCast160} from "../lib/permit2/src/libraries/SafeCast160.sol"; import {ERC20} from "../lib/solmate/src/tokens/ERC20.sol"; import {BaseBundler} from "./BaseBundler.sol"; /// @title Permit2Bundler /// @author Morpho Labs /// @custom:contact [email protected] /// @notice Bundler contract managing interactions with Uniswap's Permit2. abstract contract Permit2Bundler is BaseBundler { using SafeCast160 for uint256; /* ACTIONS */ /// @notice Approves the given `amount` of `asset` from the initiator to be spent by `permitSingle.spender` via /// Permit2 with the given `deadline` & EIP-712 `signature`. /// @param permitSingle The `PermitSingle` struct. /// @param signature The signature, serialized. /// @param skipRevert Whether to avoid reverting the call in case the signature is frontrunned. function approve2(IAllowanceTransfer.PermitSingle calldata permitSingle, bytes calldata signature, bool skipRevert) external payable protected { try Permit2Lib.PERMIT2.permit(initiator(), permitSingle, signature) {} catch (bytes memory returnData) { if (!skipRevert) _revert(returnData); } } /// @notice Transfers the given `amount` of `asset` from the initiator to the bundler via Permit2. /// @param asset The address of the ERC20 token to transfer. /// @param amount The amount of `asset` to transfer from the initiator. Capped at the initiator's balance. function transferFrom2(address asset, uint256 amount) external payable protected { address _initiator = initiator(); amount = Math.min(amount, ERC20(asset).balanceOf(_initiator)); require(amount != 0, ErrorsLib.ZERO_AMOUNT); Permit2Lib.PERMIT2.transferFrom(_initiator, address(this), amount.toUint160(), asset); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity 0.8.21; import {IERC4626} from "../lib/openzeppelin-contracts/contracts/interfaces/IERC4626.sol"; import {Math} from "../lib/morpho-utils/src/math/Math.sol"; import {ErrorsLib} from "./libraries/ErrorsLib.sol"; import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; import {BaseBundler} from "./BaseBundler.sol"; /// @title ERC4626Bundler /// @author Morpho Labs /// @custom:contact [email protected] /// @notice Bundler contract managing interactions with ERC4626 compliant tokens. abstract contract ERC4626Bundler is BaseBundler { using SafeTransferLib for ERC20; /* ACTIONS */ /// @notice Mints the given amount of `shares` on the given ERC4626 `vault`, on behalf of `receiver`. /// @dev Initiator must have previously transferred their assets to the bundler. /// @dev Assumes the given `vault` implements EIP-4626. /// @param vault The address of the vault. /// @param shares The amount of shares to mint. /// @param maxAssets The maximum amount of assets to deposit in exchange for `shares`. /// @param receiver The address to which shares will be minted. function erc4626Mint(address vault, uint256 shares, uint256 maxAssets, address receiver) external payable protected { /// Do not check `receiver != address(this)` to allow the bundler to receive the vault's shares. require(receiver != address(0), ErrorsLib.ZERO_ADDRESS); require(shares != 0, ErrorsLib.ZERO_SHARES); _approveMaxTo(IERC4626(vault).asset(), vault); uint256 assets = IERC4626(vault).mint(shares, receiver); require(assets <= maxAssets, ErrorsLib.SLIPPAGE_EXCEEDED); } /// @notice Deposits the given amount of `assets` on the given ERC4626 `vault`, on behalf of `receiver`. /// @dev Initiator must have previously transferred their assets to the bundler. /// @dev Assumes the given `vault` implements EIP-4626. /// @param vault The address of the vault. /// @param assets The amount of assets to deposit. Capped at the bundler's assets. /// @param minShares The minimum amount of shares to mint in exchange for `assets`. This parameter is proportionally /// scaled down in case there are fewer assets than `assets` on the bundler. /// @param receiver The address to which shares will be minted. function erc4626Deposit(address vault, uint256 assets, uint256 minShares, address receiver) external payable protected { /// Do not check `receiver != address(this)` to allow the bundler to receive the vault's shares. require(receiver != address(0), ErrorsLib.ZERO_ADDRESS); uint256 initialAssets = assets; address asset = IERC4626(vault).asset(); assets = Math.min(assets, ERC20(asset).balanceOf(address(this))); require(assets != 0, ErrorsLib.ZERO_AMOUNT); _approveMaxTo(asset, vault); uint256 shares = IERC4626(vault).deposit(assets, receiver); require(shares * initialAssets >= minShares * assets, ErrorsLib.SLIPPAGE_EXCEEDED); } /// @notice Withdraws the given amount of `assets` from the given ERC4626 `vault`, transferring assets to /// `receiver`. /// @dev Assumes the given `vault` implements EIP-4626. /// @param vault The address of the vault. /// @param assets The amount of assets to withdraw. /// @param maxShares The maximum amount of shares to redeem in exchange for `assets`. /// @param receiver The address that will receive the withdrawn assets. /// @param owner The address on behalf of which the assets are withdrawn. Can only be the bundler or the initiator. /// If `owner` is the initiator, they must have previously approved the bundler to spend their vault shares. /// Otherwise, they must have previously transferred their vault shares to the bundler. function erc4626Withdraw(address vault, uint256 assets, uint256 maxShares, address receiver, address owner) external payable protected { /// Do not check `receiver != address(this)` to allow the bundler to receive the underlying asset. require(receiver != address(0), ErrorsLib.ZERO_ADDRESS); require(owner == address(this) || owner == initiator(), ErrorsLib.UNEXPECTED_OWNER); require(assets != 0, ErrorsLib.ZERO_AMOUNT); uint256 shares = IERC4626(vault).withdraw(assets, receiver, owner); require(shares <= maxShares, ErrorsLib.SLIPPAGE_EXCEEDED); } /// @notice Redeems the given amount of `shares` from the given ERC4626 `vault`, transferring assets to `receiver`. /// @dev Assumes the given `vault` implements EIP-4626. /// @param vault The address of the vault. /// @param shares The amount of shares to redeem. Capped at the owner's shares. /// @param minAssets The minimum amount of assets to withdraw in exchange for `shares`. This parameter is /// proportionally scaled down in case the owner holds fewer shares than `shares`. /// @param receiver The address that will receive the withdrawn assets. /// @param owner The address on behalf of which the shares are redeemed. Can only be the bundler or the initiator. /// If `owner` is the initiator, they must have previously approved the bundler to spend their vault shares. /// Otherwise, they must have previously transferred their vault shares to the bundler. function erc4626Redeem(address vault, uint256 shares, uint256 minAssets, address receiver, address owner) external payable protected { /// Do not check `receiver != address(this)` to allow the bundler to receive the underlying asset. require(receiver != address(0), ErrorsLib.ZERO_ADDRESS); require(owner == address(this) || owner == initiator(), ErrorsLib.UNEXPECTED_OWNER); uint256 initialShares = shares; shares = Math.min(shares, IERC4626(vault).balanceOf(owner)); require(shares != 0, ErrorsLib.ZERO_SHARES); uint256 assets = IERC4626(vault).redeem(shares, receiver, owner); require(assets * initialShares >= minAssets * shares, ErrorsLib.SLIPPAGE_EXCEEDED); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity 0.8.21; import {IMorphoBundler} from "./interfaces/IMorphoBundler.sol"; import {MarketParams, Signature, Authorization, IMorpho} from "../lib/morpho-blue/src/interfaces/IMorpho.sol"; import {ErrorsLib} from "./libraries/ErrorsLib.sol"; import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; import {BaseBundler} from "./BaseBundler.sol"; /// @title MorphoBundler /// @author Morpho Labs /// @custom:contact [email protected] /// @notice Bundler contract managing interactions with Morpho. abstract contract MorphoBundler is BaseBundler, IMorphoBundler { using SafeTransferLib for ERC20; /* IMMUTABLES */ /// @notice The Morpho contract address. IMorpho public immutable MORPHO; /* CONSTRUCTOR */ constructor(address morpho) { require(morpho != address(0), ErrorsLib.ZERO_ADDRESS); MORPHO = IMorpho(morpho); } /* CALLBACKS */ function onMorphoSupply(uint256, bytes calldata data) external { // Don't need to approve Morpho to pull tokens because it should already be approved max. _callback(data); } function onMorphoSupplyCollateral(uint256, bytes calldata data) external { // Don't need to approve Morpho to pull tokens because it should already be approved max. _callback(data); } function onMorphoRepay(uint256, bytes calldata data) external { // Don't need to approve Morpho to pull tokens because it should already be approved max. _callback(data); } function onMorphoFlashLoan(uint256, bytes calldata data) external { // Don't need to approve Morpho to pull tokens because it should already be approved max. _callback(data); } /* ACTIONS */ /// @notice Approves `authorization.authorized` to manage `authorization.authorizer`'s position via EIP712 /// `signature`. /// @param authorization The `Authorization` struct. /// @param signature The signature. /// @param skipRevert Whether to avoid reverting the call in case the signature is frontrunned. function morphoSetAuthorizationWithSig( Authorization calldata authorization, Signature calldata signature, bool skipRevert ) external payable protected { try MORPHO.setAuthorizationWithSig(authorization, signature) {} catch (bytes memory returnData) { if (!skipRevert) _revert(returnData); } } /// @notice Supplies `assets` of the loan asset on behalf of `onBehalf`. /// @notice The supplied assets cannot be used as collateral but is eligible to earn interest. /// @dev Either `assets` or `shares` should be zero. Most usecases should rely on `assets` as an input so the /// bundler is guaranteed to have `assets` tokens pulled from its balance, but the possibility to mint a specific /// amount of shares is given for full compatibility and precision. /// @dev Initiator must have previously transferred their assets to the bundler. /// @param marketParams The Morpho market to supply assets to. /// @param assets The amount of assets to supply. Pass `type(uint256).max` to supply the bundler's loan asset /// balance. /// @param shares The amount of shares to mint. /// @param slippageAmount The minimum amount of supply shares to mint in exchange for `assets` when it is used. /// The maximum amount of assets to deposit in exchange for `shares` otherwise. /// @param onBehalf The address that will own the increased supply position. /// @param data Arbitrary data to pass to the `onMorphoSupply` callback. Pass empty data if not needed. function morphoSupply( MarketParams calldata marketParams, uint256 assets, uint256 shares, uint256 slippageAmount, address onBehalf, bytes calldata data ) external payable protected { // Do not check `onBehalf` against the zero address as it's done at Morpho's level. require(onBehalf != address(this), ErrorsLib.BUNDLER_ADDRESS); // Don't always cap the assets to the bundler's balance because the liquidity can be transferred later // (via the `onMorphoSupply` callback). if (assets == type(uint256).max) assets = ERC20(marketParams.loanToken).balanceOf(address(this)); _approveMaxTo(marketParams.loanToken, address(MORPHO)); (uint256 suppliedAssets, uint256 suppliedShares) = MORPHO.supply(marketParams, assets, shares, onBehalf, data); if (assets > 0) require(suppliedShares >= slippageAmount, ErrorsLib.SLIPPAGE_EXCEEDED); else require(suppliedAssets <= slippageAmount, ErrorsLib.SLIPPAGE_EXCEEDED); } /// @notice Supplies `assets` of collateral on behalf of `onBehalf`. /// @dev Initiator must have previously transferred their assets to the bundler. /// @param marketParams The Morpho market to supply collateral to. /// @param assets The amount of collateral to supply. Pass `type(uint256).max` to supply the bundler's loan asset /// balance. /// @param onBehalf The address that will own the increased collateral position. /// @param data Arbitrary data to pass to the `onMorphoSupplyCollateral` callback. Pass empty data if not needed. function morphoSupplyCollateral( MarketParams calldata marketParams, uint256 assets, address onBehalf, bytes calldata data ) external payable protected { // Do not check `onBehalf` against the zero address as it's done at Morpho's level. require(onBehalf != address(this), ErrorsLib.BUNDLER_ADDRESS); // Don't always cap the assets to the bundler's balance because the liquidity can be transferred later // (via the `onMorphoSupplyCollateral` callback). if (assets == type(uint256).max) assets = ERC20(marketParams.collateralToken).balanceOf(address(this)); _approveMaxTo(marketParams.collateralToken, address(MORPHO)); MORPHO.supplyCollateral(marketParams, assets, onBehalf, data); } /// @notice Borrows `assets` of the loan asset on behalf of the initiator. /// @dev Either `assets` or `shares` should be zero. Most usecases should rely on `assets` as an input so the /// initiator is guaranteed to borrow `assets` tokens, but the possibility to mint a specific amount of shares is /// given for full compatibility and precision. /// @dev Initiator must have previously authorized the bundler to act on their behalf on Morpho. /// @param marketParams The Morpho market to borrow assets from. /// @param assets The amount of assets to borrow. /// @param shares The amount of shares to mint. /// @param slippageAmount The maximum amount of borrow shares to mint in exchange for `assets` when it is used. /// The minimum amount of assets to borrow in exchange for `shares` otherwise. /// @param receiver The address that will receive the borrowed assets. function morphoBorrow( MarketParams calldata marketParams, uint256 assets, uint256 shares, uint256 slippageAmount, address receiver ) external payable protected { (uint256 borrowedAssets, uint256 borrowedShares) = MORPHO.borrow(marketParams, assets, shares, initiator(), receiver); if (assets > 0) require(borrowedShares <= slippageAmount, ErrorsLib.SLIPPAGE_EXCEEDED); else require(borrowedAssets >= slippageAmount, ErrorsLib.SLIPPAGE_EXCEEDED); } /// @notice Repays `assets` of the loan asset on behalf of `onBehalf`. /// @dev Either `assets` or `shares` should be zero. Most usecases should rely on `assets` as an input so the /// bundler is guaranteed to have `assets` tokens pulled from its balance, but the possibility to burn a specific /// amount of shares is given for full compatibility and precision. /// @param marketParams The Morpho market to repay assets to. /// @param assets The amount of assets to repay. Pass `type(uint256).max` to repay the bundler's loan asset balance. /// @param shares The amount of shares to burn. /// @param slippageAmount The minimum amount of borrow shares to burn in exchange for `assets` when it is used. /// The maximum amount of assets to deposit in exchange for `shares` otherwise. /// @param onBehalf The address of the owner of the debt position. /// @param data Arbitrary data to pass to the `onMorphoRepay` callback. Pass empty data if not needed. function morphoRepay( MarketParams calldata marketParams, uint256 assets, uint256 shares, uint256 slippageAmount, address onBehalf, bytes calldata data ) external payable protected { // Do not check `onBehalf` against the zero address as it's done at Morpho's level. require(onBehalf != address(this), ErrorsLib.BUNDLER_ADDRESS); // Don't always cap the assets to the bundler's balance because the liquidity can be transferred later // (via the `onMorphoRepay` callback). if (assets == type(uint256).max) assets = ERC20(marketParams.loanToken).balanceOf(address(this)); _approveMaxTo(marketParams.loanToken, address(MORPHO)); (uint256 repaidAssets, uint256 repaidShares) = MORPHO.repay(marketParams, assets, shares, onBehalf, data); if (assets > 0) require(repaidShares >= slippageAmount, ErrorsLib.SLIPPAGE_EXCEEDED); else require(repaidAssets <= slippageAmount, ErrorsLib.SLIPPAGE_EXCEEDED); } /// @notice Withdraws `assets` of the loan asset on behalf of the initiator. /// @dev Either `assets` or `shares` should be zero. Most usecases should rely on `assets` as an input so the /// initiator is guaranteed to withdraw `assets` tokens, but the possibility to burn a specific amount of shares is /// given for full compatibility and precision. /// @dev Initiator must have previously authorized the bundler to act on their behalf on Morpho. /// @param marketParams The Morpho market to withdraw assets from. /// @param assets The amount of assets to withdraw. /// @param shares The amount of shares to burn. /// @param slippageAmount The maximum amount of supply shares to burn in exchange for `assets` when it is used. /// The minimum amount of assets to withdraw in exchange for `shares` otherwise. /// @param receiver The address that will receive the withdrawn assets. function morphoWithdraw( MarketParams calldata marketParams, uint256 assets, uint256 shares, uint256 slippageAmount, address receiver ) external payable protected { (uint256 withdrawnAssets, uint256 withdrawnShares) = MORPHO.withdraw(marketParams, assets, shares, initiator(), receiver); if (assets > 0) require(withdrawnShares <= slippageAmount, ErrorsLib.SLIPPAGE_EXCEEDED); else require(withdrawnAssets >= slippageAmount, ErrorsLib.SLIPPAGE_EXCEEDED); } /// @notice Withdraws `assets` of the collateral asset on behalf of the initiator. /// @dev Initiator must have previously authorized the bundler to act on their behalf on Morpho. /// @param marketParams The Morpho market to withdraw collateral from. /// @param assets The amount of collateral to withdraw. /// @param receiver The address that will receive the collateral assets. function morphoWithdrawCollateral(MarketParams calldata marketParams, uint256 assets, address receiver) external payable protected { MORPHO.withdrawCollateral(marketParams, assets, initiator(), receiver); } /// @notice Triggers a flash loan on Morpho. /// @param token The address of the token to flash loan. /// @param assets The amount of assets to flash loan. /// @param data Arbitrary data to pass to the `onMorphoFlashLoan` callback. function morphoFlashLoan(address token, uint256 assets, bytes calldata data) external payable protected { _approveMaxTo(token, address(MORPHO)); MORPHO.flashLoan(token, assets, data); } /* INTERNAL */ /// @dev Triggers `_multicall` logic during a callback. function _callback(bytes calldata data) internal { require(msg.sender == address(MORPHO), ErrorsLib.UNAUTHORIZED_SENDER); _multicall(abi.decode(data, (bytes[]))); } /// @inheritdoc BaseBundler function _isSenderAuthorized() internal view virtual override returns (bool) { return super._isSenderAuthorized() || msg.sender == address(MORPHO); } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; /// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol) /// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) /// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. abstract contract ERC20 { /*////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 amount); event Approval(address indexed owner, address indexed spender, uint256 amount); /*////////////////////////////////////////////////////////////// METADATA STORAGE //////////////////////////////////////////////////////////////*/ string public name; string public symbol; uint8 public immutable decimals; /*////////////////////////////////////////////////////////////// ERC20 STORAGE //////////////////////////////////////////////////////////////*/ uint256 public totalSupply; mapping(address => uint256) public balanceOf; mapping(address => mapping(address => uint256)) public allowance; /*////////////////////////////////////////////////////////////// EIP-2612 STORAGE //////////////////////////////////////////////////////////////*/ uint256 internal immutable INITIAL_CHAIN_ID; bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR; mapping(address => uint256) public nonces; /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor( string memory _name, string memory _symbol, uint8 _decimals ) { name = _name; symbol = _symbol; decimals = _decimals; INITIAL_CHAIN_ID = block.chainid; INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); } /*////////////////////////////////////////////////////////////// ERC20 LOGIC //////////////////////////////////////////////////////////////*/ function approve(address spender, uint256 amount) public virtual returns (bool) { allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } function transfer(address to, uint256 amount) public virtual returns (bool) { balanceOf[msg.sender] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(msg.sender, to, amount); return true; } function transferFrom( address from, address to, uint256 amount ) public virtual returns (bool) { uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount; balanceOf[from] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(from, to, amount); return true; } /*////////////////////////////////////////////////////////////// EIP-2612 LOGIC //////////////////////////////////////////////////////////////*/ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); // Unchecked because the only math done is incrementing // the owner's nonce which cannot realistically overflow. unchecked { address recoveredAddress = ecrecover( keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR(), keccak256( abi.encode( keccak256( "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" ), owner, spender, value, nonces[owner]++, deadline ) ) ) ), v, r, s ); require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); allowance[recoveredAddress][spender] = value; } emit Approval(owner, spender, value); } function DOMAIN_SEPARATOR() public view virtual returns (bytes32) { return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator(); } function computeDomainSeparator() internal view virtual returns (bytes32) { return keccak256( abi.encode( keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(bytes(name)), keccak256("1"), block.chainid, address(this) ) ); } /*////////////////////////////////////////////////////////////// INTERNAL MINT/BURN LOGIC //////////////////////////////////////////////////////////////*/ function _mint(address to, uint256 amount) internal virtual { totalSupply += amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(address(0), to, amount); } function _burn(address from, uint256 amount) internal virtual { balanceOf[from] -= amount; // Cannot underflow because a user's balance // will never be larger than the total supply. unchecked { totalSupply -= amount; } emit Transfer(from, address(0), amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import {IEIP712} from "./IEIP712.sol"; /// @title AllowanceTransfer /// @notice Handles ERC20 token permissions through signature based allowance setting and ERC20 token transfers by checking allowed amounts /// @dev Requires user's token approval on the Permit2 contract interface IAllowanceTransfer is IEIP712 { /// @notice Thrown when an allowance on a token has expired. /// @param deadline The timestamp at which the allowed amount is no longer valid error AllowanceExpired(uint256 deadline); /// @notice Thrown when an allowance on a token has been depleted. /// @param amount The maximum amount allowed error InsufficientAllowance(uint256 amount); /// @notice Thrown when too many nonces are invalidated. error ExcessiveInvalidation(); /// @notice Emits an event when the owner successfully invalidates an ordered nonce. event NonceInvalidation( address indexed owner, address indexed token, address indexed spender, uint48 newNonce, uint48 oldNonce ); /// @notice Emits an event when the owner successfully sets permissions on a token for the spender. event Approval( address indexed owner, address indexed token, address indexed spender, uint160 amount, uint48 expiration ); /// @notice Emits an event when the owner successfully sets permissions using a permit signature on a token for the spender. event Permit( address indexed owner, address indexed token, address indexed spender, uint160 amount, uint48 expiration, uint48 nonce ); /// @notice Emits an event when the owner sets the allowance back to 0 with the lockdown function. event Lockdown(address indexed owner, address token, address spender); /// @notice The permit data for a token struct PermitDetails { // ERC20 token address address token; // the maximum amount allowed to spend uint160 amount; // timestamp at which a spender's token allowances become invalid uint48 expiration; // an incrementing value indexed per owner,token,and spender for each signature uint48 nonce; } /// @notice The permit message signed for a single token allownce struct PermitSingle { // the permit data for a single token alownce PermitDetails details; // address permissioned on the allowed tokens address spender; // deadline on the permit signature uint256 sigDeadline; } /// @notice The permit message signed for multiple token allowances struct PermitBatch { // the permit data for multiple token allowances PermitDetails[] details; // address permissioned on the allowed tokens address spender; // deadline on the permit signature uint256 sigDeadline; } /// @notice The saved permissions /// @dev This info is saved per owner, per token, per spender and all signed over in the permit message /// @dev Setting amount to type(uint160).max sets an unlimited approval struct PackedAllowance { // amount allowed uint160 amount; // permission expiry uint48 expiration; // an incrementing value indexed per owner,token,and spender for each signature uint48 nonce; } /// @notice A token spender pair. struct TokenSpenderPair { // the token the spender is approved address token; // the spender address address spender; } /// @notice Details for a token transfer. struct AllowanceTransferDetails { // the owner of the token address from; // the recipient of the token address to; // the amount of the token uint160 amount; // the token to be transferred address token; } /// @notice A mapping from owner address to token address to spender address to PackedAllowance struct, which contains details and conditions of the approval. /// @notice The mapping is indexed in the above order see: allowance[ownerAddress][tokenAddress][spenderAddress] /// @dev The packed slot holds the allowed amount, expiration at which the allowed amount is no longer valid, and current nonce thats updated on any signature based approvals. function allowance(address user, address token, address spender) external view returns (uint160 amount, uint48 expiration, uint48 nonce); /// @notice Approves the spender to use up to amount of the specified token up until the expiration /// @param token The token to approve /// @param spender The spender address to approve /// @param amount The approved amount of the token /// @param expiration The timestamp at which the approval is no longer valid /// @dev The packed allowance also holds a nonce, which will stay unchanged in approve /// @dev Setting amount to type(uint160).max sets an unlimited approval function approve(address token, address spender, uint160 amount, uint48 expiration) external; /// @notice Permit a spender to a given amount of the owners token via the owner's EIP-712 signature /// @dev May fail if the owner's nonce was invalidated in-flight by invalidateNonce /// @param owner The owner of the tokens being approved /// @param permitSingle Data signed over by the owner specifying the terms of approval /// @param signature The owner's signature over the permit data function permit(address owner, PermitSingle memory permitSingle, bytes calldata signature) external; /// @notice Permit a spender to the signed amounts of the owners tokens via the owner's EIP-712 signature /// @dev May fail if the owner's nonce was invalidated in-flight by invalidateNonce /// @param owner The owner of the tokens being approved /// @param permitBatch Data signed over by the owner specifying the terms of approval /// @param signature The owner's signature over the permit data function permit(address owner, PermitBatch memory permitBatch, bytes calldata signature) external; /// @notice Transfer approved tokens from one address to another /// @param from The address to transfer from /// @param to The address of the recipient /// @param amount The amount of the token to transfer /// @param token The token address to transfer /// @dev Requires the from address to have approved at least the desired amount /// of tokens to msg.sender. function transferFrom(address from, address to, uint160 amount, address token) external; /// @notice Transfer approved tokens in a batch /// @param transferDetails Array of owners, recipients, amounts, and tokens for the transfers /// @dev Requires the from addresses to have approved at least the desired amount /// of tokens to msg.sender. function transferFrom(AllowanceTransferDetails[] calldata transferDetails) external; /// @notice Enables performing a "lockdown" of the sender's Permit2 identity /// by batch revoking approvals /// @param approvals Array of approvals to revoke. function lockdown(TokenSpenderPair[] calldata approvals) external; /// @notice Invalidate nonces for a given (token, spender) pair /// @param token The token to invalidate nonces for /// @param spender The spender to invalidate nonces for /// @param newNonce The new nonce to set. Invalidates all nonces less than it. /// @dev Can't invalidate more than 2**16 nonces per transaction. function invalidateNonces(address token, address spender, uint48 newNonce) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import {ERC20} from "solmate/src/tokens/ERC20.sol"; import {IDAIPermit} from "../interfaces/IDAIPermit.sol"; import {IAllowanceTransfer} from "../interfaces/IAllowanceTransfer.sol"; import {SafeCast160} from "./SafeCast160.sol"; /// @title Permit2Lib /// @notice Enables efficient transfers and EIP-2612/DAI /// permits for any token by falling back to Permit2. library Permit2Lib { using SafeCast160 for uint256; /*////////////////////////////////////////////////////////////// CONSTANTS //////////////////////////////////////////////////////////////*/ /// @dev The unique EIP-712 domain domain separator for the DAI token contract. bytes32 internal constant DAI_DOMAIN_SEPARATOR = 0xdbb8cf42e1ecb028be3f3dbc922e1d878b963f411dc388ced501601c60f7c6f7; /// @dev The address for the WETH9 contract on Ethereum mainnet, encoded as a bytes32. bytes32 internal constant WETH9_ADDRESS = 0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2; /// @dev The address of the Permit2 contract the library will use. IAllowanceTransfer internal constant PERMIT2 = IAllowanceTransfer(address(0x000000000022D473030F116dDEE9F6B43aC78BA3)); /// @notice Transfer a given amount of tokens from one user to another. /// @param token The token to transfer. /// @param from The user to transfer from. /// @param to The user to transfer to. /// @param amount The amount to transfer. function transferFrom2(ERC20 token, address from, address to, uint256 amount) internal { // Generate calldata for a standard transferFrom call. bytes memory inputData = abi.encodeCall(ERC20.transferFrom, (from, to, amount)); bool success; // Call the token contract as normal, capturing whether it succeeded. assembly { success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(eq(mload(0), 1), iszero(returndatasize())), // Counterintuitively, this call() must be positioned after the or() in the // surrounding and() because and() evaluates its arguments from right to left. // We use 0 and 32 to copy up to 32 bytes of return data into the first slot of scratch space. call(gas(), token, 0, add(inputData, 32), mload(inputData), 0, 32) ) } // We'll fall back to using Permit2 if calling transferFrom on the token directly reverted. if (!success) PERMIT2.transferFrom(from, to, amount.toUint160(), address(token)); } /*////////////////////////////////////////////////////////////// PERMIT LOGIC //////////////////////////////////////////////////////////////*/ /// @notice Permit a user to spend a given amount of /// another user's tokens via native EIP-2612 permit if possible, falling /// back to Permit2 if native permit fails or is not implemented on the token. /// @param token The token to permit spending. /// @param owner The user to permit spending from. /// @param spender The user to permit spending to. /// @param amount The amount to permit spending. /// @param deadline The timestamp after which the signature is no longer valid. /// @param v Must produce valid secp256k1 signature from the owner along with r and s. /// @param r Must produce valid secp256k1 signature from the owner along with v and s. /// @param s Must produce valid secp256k1 signature from the owner along with r and v. function permit2( ERC20 token, address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { // Generate calldata for a call to DOMAIN_SEPARATOR on the token. bytes memory inputData = abi.encodeWithSelector(ERC20.DOMAIN_SEPARATOR.selector); bool success; // Call the token contract as normal, capturing whether it succeeded. bytes32 domainSeparator; // If the call succeeded, we'll capture the return value here. assembly { // If the token is WETH9, we know it doesn't have a DOMAIN_SEPARATOR, and we'll skip this step. // We make sure to mask the token address as its higher order bits aren't guaranteed to be clean. if iszero(eq(and(token, 0xffffffffffffffffffffffffffffffffffffffff), WETH9_ADDRESS)) { success := and( // Should resolve false if its not 32 bytes or its first word is 0. and(iszero(iszero(mload(0))), eq(returndatasize(), 32)), // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the and() call in the // surrounding and() call or else returndatasize() will be zero during the computation. // We send a maximum of 5000 gas to prevent tokens with fallbacks from using a ton of gas. // which should be plenty to allow tokens to fetch their DOMAIN_SEPARATOR from storage, etc. staticcall(5000, token, add(inputData, 32), mload(inputData), 0, 32) ) domainSeparator := mload(0) // Copy the return value into the domainSeparator variable. } } // If the call to DOMAIN_SEPARATOR succeeded, try using permit on the token. if (success) { // We'll use DAI's special permit if it's DOMAIN_SEPARATOR matches, // otherwise we'll just encode a call to the standard permit function. inputData = domainSeparator == DAI_DOMAIN_SEPARATOR ? abi.encodeCall(IDAIPermit.permit, (owner, spender, token.nonces(owner), deadline, true, v, r, s)) : abi.encodeCall(ERC20.permit, (owner, spender, amount, deadline, v, r, s)); assembly { success := call(gas(), token, 0, add(inputData, 32), mload(inputData), 0, 0) } } if (!success) { // If the initial DOMAIN_SEPARATOR call on the token failed or a // subsequent call to permit failed, fall back to using Permit2. simplePermit2(token, owner, spender, amount, deadline, v, r, s); } } /// @notice Simple unlimited permit on the Permit2 contract. /// @param token The token to permit spending. /// @param owner The user to permit spending from. /// @param spender The user to permit spending to. /// @param amount The amount to permit spending. /// @param deadline The timestamp after which the signature is no longer valid. /// @param v Must produce valid secp256k1 signature from the owner along with r and s. /// @param r Must produce valid secp256k1 signature from the owner along with v and s. /// @param s Must produce valid secp256k1 signature from the owner along with r and v. function simplePermit2( ERC20 token, address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { (,, uint48 nonce) = PERMIT2.allowance(owner, address(token), spender); PERMIT2.permit( owner, IAllowanceTransfer.PermitSingle({ details: IAllowanceTransfer.PermitDetails({ token: address(token), amount: amount.toUint160(), // Use an unlimited expiration because it most // closely mimics how a standard approval works. expiration: type(uint48).max, nonce: nonce }), spender: spender, sigDeadline: deadline }), bytes.concat(r, s, bytes1(v)) ); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; library SafeCast160 { /// @notice Thrown when a valude greater than type(uint160).max is cast to uint160 error UnsafeCast(); /// @notice Safely casts uint256 to uint160 /// @param value The uint256 to be cast function toUint160(uint256 value) internal pure returns (uint160) { if (value > type(uint160).max) revert UnsafeCast(); return uint160(value); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC4626.sol) pragma solidity ^0.8.0; import "../token/ERC20/IERC20.sol"; import "../token/ERC20/extensions/IERC20Metadata.sol"; /** * @dev Interface of the ERC4626 "Tokenized Vault Standard", as defined in * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626]. * * _Available since v4.7._ */ interface IERC4626 is IERC20, IERC20Metadata { event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares); event Withdraw( address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares ); /** * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing. * * - MUST be an ERC-20 token contract. * - MUST NOT revert. */ function asset() external view returns (address assetTokenAddress); /** * @dev Returns the total amount of the underlying asset that is “managed” by Vault. * * - SHOULD include any compounding that occurs from yield. * - MUST be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT revert. */ function totalAssets() external view returns (uint256 totalManagedAssets); /** * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal * scenario where all the conditions are met. * * - MUST NOT be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT show any variations depending on the caller. * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange. * - MUST NOT revert. * * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and * from. */ function convertToShares(uint256 assets) external view returns (uint256 shares); /** * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal * scenario where all the conditions are met. * * - MUST NOT be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT show any variations depending on the caller. * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange. * - MUST NOT revert. * * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and * from. */ function convertToAssets(uint256 shares) external view returns (uint256 assets); /** * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver, * through a deposit call. * * - MUST return a limited value if receiver is subject to some deposit limit. * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited. * - MUST NOT revert. */ function maxDeposit(address receiver) external view returns (uint256 maxAssets); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given * current on-chain conditions. * * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called * in the same transaction. * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the * deposit would be accepted, regardless if the user has enough tokens approved, etc. * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by depositing. */ function previewDeposit(uint256 assets) external view returns (uint256 shares); /** * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens. * * - MUST emit the Deposit event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * deposit execution, and are accounted for during deposit. * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not * approving enough underlying tokens to the Vault contract, etc). * * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token. */ function deposit(uint256 assets, address receiver) external returns (uint256 shares); /** * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call. * - MUST return a limited value if receiver is subject to some mint limit. * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted. * - MUST NOT revert. */ function maxMint(address receiver) external view returns (uint256 maxShares); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given * current on-chain conditions. * * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the * same transaction. * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint * would be accepted, regardless if the user has enough tokens approved, etc. * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by minting. */ function previewMint(uint256 shares) external view returns (uint256 assets); /** * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens. * * - MUST emit the Deposit event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint * execution, and are accounted for during mint. * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not * approving enough underlying tokens to the Vault contract, etc). * * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token. */ function mint(uint256 shares, address receiver) external returns (uint256 assets); /** * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the * Vault, through a withdraw call. * * - MUST return a limited value if owner is subject to some withdrawal limit or timelock. * - MUST NOT revert. */ function maxWithdraw(address owner) external view returns (uint256 maxAssets); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block, * given current on-chain conditions. * * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if * called * in the same transaction. * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though * the withdrawal would be accepted, regardless if the user has enough shares, etc. * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by depositing. */ function previewWithdraw(uint256 assets) external view returns (uint256 shares); /** * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver. * * - MUST emit the Withdraw event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * withdraw execution, and are accounted for during withdraw. * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner * not having enough shares, etc). * * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. * Those methods should be performed separately. */ function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares); /** * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault, * through a redeem call. * * - MUST return a limited value if owner is subject to some withdrawal limit or timelock. * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock. * - MUST NOT revert. */ function maxRedeem(address owner) external view returns (uint256 maxShares); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block, * given current on-chain conditions. * * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the * same transaction. * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the * redemption would be accepted, regardless if the user has enough shares, etc. * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by redeeming. */ function previewRedeem(uint256 shares) external view returns (uint256 assets); /** * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver. * * - MUST emit the Withdraw event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * redeem execution, and are accounted for during redeem. * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner * not having enough shares, etc). * * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed. * Those methods should be performed separately. */ function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; import { IMorphoRepayCallback, IMorphoSupplyCallback, IMorphoSupplyCollateralCallback, IMorphoFlashLoanCallback } from "../../lib/morpho-blue/src/interfaces/IMorphoCallbacks.sol"; /// @title IMorphoBundler /// @author Morpho Labs /// @custom:contact [email protected] /// @notice Interface of MorphoBundler. interface IMorphoBundler is IMorphoSupplyCallback, IMorphoRepayCallback, IMorphoSupplyCollateralCallback, IMorphoFlashLoanCallback {}
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; type Id is bytes32; struct MarketParams { address loanToken; address collateralToken; address oracle; address irm; uint256 lltv; } /// @dev Warning: For `feeRecipient`, `supplyShares` does not contain the accrued shares since the last interest /// accrual. struct Position { uint256 supplyShares; uint128 borrowShares; uint128 collateral; } /// @dev Warning: `totalSupplyAssets` does not contain the accrued interest since the last interest accrual. /// @dev Warning: `totalBorrowAssets` does not contain the accrued interest since the last interest accrual. /// @dev Warning: `totalSupplyShares` does not contain the additional shares accrued by `feeRecipient` since the last /// interest accrual. struct Market { uint128 totalSupplyAssets; uint128 totalSupplyShares; uint128 totalBorrowAssets; uint128 totalBorrowShares; uint128 lastUpdate; uint128 fee; } struct Authorization { address authorizer; address authorized; bool isAuthorized; uint256 nonce; uint256 deadline; } struct Signature { uint8 v; bytes32 r; bytes32 s; } /// @dev This interface is used for factorizing IMorphoStaticTyping and IMorpho. /// @dev Consider using the IMorpho interface instead of this one. interface IMorphoBase { /// @notice The EIP-712 domain separator. /// @dev Warning: Every EIP-712 signed message based on this domain separator can be reused on another chain sharing /// the same chain id because the domain separator would be the same. function DOMAIN_SEPARATOR() external view returns (bytes32); /// @notice The owner of the contract. /// @dev It has the power to change the owner. /// @dev It has the power to set fees on markets and set the fee recipient. /// @dev It has the power to enable but not disable IRMs and LLTVs. function owner() external view returns (address); /// @notice The fee recipient of all markets. /// @dev The recipient receives the fees of a given market through a supply position on that market. function feeRecipient() external view returns (address); /// @notice Whether the `irm` is enabled. function isIrmEnabled(address irm) external view returns (bool); /// @notice Whether the `lltv` is enabled. function isLltvEnabled(uint256 lltv) external view returns (bool); /// @notice Whether `authorized` is authorized to modify `authorizer`'s position on all markets. /// @dev Anyone is authorized to modify their own positions, regardless of this variable. function isAuthorized(address authorizer, address authorized) external view returns (bool); /// @notice The `authorizer`'s current nonce. Used to prevent replay attacks with EIP-712 signatures. function nonce(address authorizer) external view returns (uint256); /// @notice Sets `newOwner` as `owner` of the contract. /// @dev Warning: No two-step transfer ownership. /// @dev Warning: The owner can be set to the zero address. function setOwner(address newOwner) external; /// @notice Enables `irm` as a possible IRM for market creation. /// @dev Warning: It is not possible to disable an IRM. function enableIrm(address irm) external; /// @notice Enables `lltv` as a possible LLTV for market creation. /// @dev Warning: It is not possible to disable a LLTV. function enableLltv(uint256 lltv) external; /// @notice Sets the `newFee` for the given market `marketParams`. /// @param newFee The new fee, scaled by WAD. /// @dev Warning: The recipient can be the zero address. function setFee(MarketParams memory marketParams, uint256 newFee) external; /// @notice Sets `newFeeRecipient` as `feeRecipient` of the fee. /// @dev Warning: If the fee recipient is set to the zero address, fees will accrue there and will be lost. /// @dev Modifying the fee recipient will allow the new recipient to claim any pending fees not yet accrued. To /// ensure that the current recipient receives all due fees, accrue interest manually prior to making any changes. function setFeeRecipient(address newFeeRecipient) external; /// @notice Creates the market `marketParams`. /// @dev Here is the list of assumptions on the market's dependencies (tokens, IRM and oracle) that guarantees /// Morpho behaves as expected: /// - The token should be ERC-20 compliant, except that it can omit return values on `transfer` and `transferFrom`. /// - The token balance of Morpho should only decrease on `transfer` and `transferFrom`. In particular, tokens with /// burn functions are not supported. /// - The token should not re-enter Morpho on `transfer` nor `transferFrom`. /// - The token balance of the sender (resp. receiver) should decrease (resp. increase) by exactly the given amount /// on `transfer` and `transferFrom`. In particular, tokens with fees on transfer are not supported. /// - The IRM should not re-enter Morpho. /// - The oracle should return a price with the correct scaling. /// @dev Here is a list of properties on the market's dependencies that could break Morpho's liveness properties /// (funds could get stuck): /// - The token can revert on `transfer` and `transferFrom` for a reason other than an approval or balance issue. /// - A very high amount of assets (~1e35) supplied or borrowed can make the computation of `toSharesUp` and /// `toSharesDown` overflow. /// - The IRM can revert on `borrowRate`. /// - A very high borrow rate returned by the IRM can make the computation of `interest` in `_accrueInterest` /// overflow. /// - The oracle can revert on `price`. Note that this can be used to prevent `borrow`, `withdrawCollateral` and /// `liquidate` from being used under certain market conditions. /// - A very high price returned by the oracle can make the computation of `maxBorrow` in `_isHealthy` overflow, or /// the computation of `assetsRepaid` in `liquidate` overflow. /// @dev The borrow share price of a market with less than 1e4 assets borrowed can be decreased by manipulations, to /// the point where `totalBorrowShares` is very large and borrowing overflows. function createMarket(MarketParams memory marketParams) external; /// @notice Supplies `assets` or `shares` on behalf of `onBehalf`, optionally calling back the caller's /// `onMorphoSupply` function with the given `data`. /// @dev Either `assets` or `shares` should be zero. Most use cases should rely on `assets` as an input so the /// caller is guaranteed to have `assets` tokens pulled from their balance, but the possibility to mint a specific /// amount of shares is given for full compatibility and precision. /// @dev Supplying a large amount can revert for overflow. /// @dev Supplying an amount of shares may lead to supply more or fewer assets than expected due to slippage. /// Consider using the `assets` parameter to avoid this. /// @param marketParams The market to supply assets to. /// @param assets The amount of assets to supply. /// @param shares The amount of shares to mint. /// @param onBehalf The address that will own the increased supply position. /// @param data Arbitrary data to pass to the `onMorphoSupply` callback. Pass empty data if not needed. /// @return assetsSupplied The amount of assets supplied. /// @return sharesSupplied The amount of shares minted. function supply( MarketParams memory marketParams, uint256 assets, uint256 shares, address onBehalf, bytes memory data ) external returns (uint256 assetsSupplied, uint256 sharesSupplied); /// @notice Withdraws `assets` or `shares` on behalf of `onBehalf` and sends the assets to `receiver`. /// @dev Either `assets` or `shares` should be zero. To withdraw max, pass the `shares`'s balance of `onBehalf`. /// @dev `msg.sender` must be authorized to manage `onBehalf`'s positions. /// @dev Withdrawing an amount corresponding to more shares than supplied will revert for underflow. /// @dev It is advised to use the `shares` input when withdrawing the full position to avoid reverts due to /// conversion roundings between shares and assets. /// @param marketParams The market to withdraw assets from. /// @param assets The amount of assets to withdraw. /// @param shares The amount of shares to burn. /// @param onBehalf The address of the owner of the supply position. /// @param receiver The address that will receive the withdrawn assets. /// @return assetsWithdrawn The amount of assets withdrawn. /// @return sharesWithdrawn The amount of shares burned. function withdraw( MarketParams memory marketParams, uint256 assets, uint256 shares, address onBehalf, address receiver ) external returns (uint256 assetsWithdrawn, uint256 sharesWithdrawn); /// @notice Borrows `assets` or `shares` on behalf of `onBehalf` and sends the assets to `receiver`. /// @dev Either `assets` or `shares` should be zero. Most use cases should rely on `assets` as an input so the /// caller is guaranteed to borrow `assets` of tokens, but the possibility to mint a specific amount of shares is /// given for full compatibility and precision. /// @dev `msg.sender` must be authorized to manage `onBehalf`'s positions. /// @dev Borrowing a large amount can revert for overflow. /// @dev Borrowing an amount of shares may lead to borrow fewer assets than expected due to slippage. /// Consider using the `assets` parameter to avoid this. /// @param marketParams The market to borrow assets from. /// @param assets The amount of assets to borrow. /// @param shares The amount of shares to mint. /// @param onBehalf The address that will own the increased borrow position. /// @param receiver The address that will receive the borrowed assets. /// @return assetsBorrowed The amount of assets borrowed. /// @return sharesBorrowed The amount of shares minted. function borrow( MarketParams memory marketParams, uint256 assets, uint256 shares, address onBehalf, address receiver ) external returns (uint256 assetsBorrowed, uint256 sharesBorrowed); /// @notice Repays `assets` or `shares` on behalf of `onBehalf`, optionally calling back the caller's /// `onMorphoReplay` function with the given `data`. /// @dev Either `assets` or `shares` should be zero. To repay max, pass the `shares`'s balance of `onBehalf`. /// @dev Repaying an amount corresponding to more shares than borrowed will revert for underflow. /// @dev It is advised to use the `shares` input when repaying the full position to avoid reverts due to conversion /// roundings between shares and assets. /// @dev An attacker can front-run a repay with a small repay making the transaction revert for underflow. /// @param marketParams The market to repay assets to. /// @param assets The amount of assets to repay. /// @param shares The amount of shares to burn. /// @param onBehalf The address of the owner of the debt position. /// @param data Arbitrary data to pass to the `onMorphoRepay` callback. Pass empty data if not needed. /// @return assetsRepaid The amount of assets repaid. /// @return sharesRepaid The amount of shares burned. function repay( MarketParams memory marketParams, uint256 assets, uint256 shares, address onBehalf, bytes memory data ) external returns (uint256 assetsRepaid, uint256 sharesRepaid); /// @notice Supplies `assets` of collateral on behalf of `onBehalf`, optionally calling back the caller's /// `onMorphoSupplyCollateral` function with the given `data`. /// @dev Interest are not accrued since it's not required and it saves gas. /// @dev Supplying a large amount can revert for overflow. /// @param marketParams The market to supply collateral to. /// @param assets The amount of collateral to supply. /// @param onBehalf The address that will own the increased collateral position. /// @param data Arbitrary data to pass to the `onMorphoSupplyCollateral` callback. Pass empty data if not needed. function supplyCollateral(MarketParams memory marketParams, uint256 assets, address onBehalf, bytes memory data) external; /// @notice Withdraws `assets` of collateral on behalf of `onBehalf` and sends the assets to `receiver`. /// @dev `msg.sender` must be authorized to manage `onBehalf`'s positions. /// @dev Withdrawing an amount corresponding to more collateral than supplied will revert for underflow. /// @param marketParams The market to withdraw collateral from. /// @param assets The amount of collateral to withdraw. /// @param onBehalf The address of the owner of the collateral position. /// @param receiver The address that will receive the collateral assets. function withdrawCollateral(MarketParams memory marketParams, uint256 assets, address onBehalf, address receiver) external; /// @notice Liquidates the given `repaidShares` of debt asset or seize the given `seizedAssets` of collateral on the /// given market `marketParams` of the given `borrower`'s position, optionally calling back the caller's /// `onMorphoLiquidate` function with the given `data`. /// @dev Either `seizedAssets` or `repaidShares` should be zero. /// @dev Seizing more than the collateral balance will underflow and revert without any error message. /// @dev Repaying more than the borrow balance will underflow and revert without any error message. /// @dev An attacker can front-run a liquidation with a small repay making the transaction revert for underflow. /// @param marketParams The market of the position. /// @param borrower The owner of the position. /// @param seizedAssets The amount of collateral to seize. /// @param repaidShares The amount of shares to repay. /// @param data Arbitrary data to pass to the `onMorphoLiquidate` callback. Pass empty data if not needed. /// @return The amount of assets seized. /// @return The amount of assets repaid. function liquidate( MarketParams memory marketParams, address borrower, uint256 seizedAssets, uint256 repaidShares, bytes memory data ) external returns (uint256, uint256); /// @notice Executes a flash loan. /// @dev Flash loans have access to the whole balance of the contract (the liquidity and deposited collateral of all /// markets combined, plus donations). /// @dev Warning: Not ERC-3156 compliant but compatibility is easily reached: /// - `flashFee` is zero. /// - `maxFlashLoan` is the token's balance of this contract. /// - The receiver of `assets` is the caller. /// @param token The token to flash loan. /// @param assets The amount of assets to flash loan. /// @param data Arbitrary data to pass to the `onMorphoFlashLoan` callback. function flashLoan(address token, uint256 assets, bytes calldata data) external; /// @notice Sets the authorization for `authorized` to manage `msg.sender`'s positions. /// @param authorized The authorized address. /// @param newIsAuthorized The new authorization status. function setAuthorization(address authorized, bool newIsAuthorized) external; /// @notice Sets the authorization for `authorization.authorized` to manage `authorization.authorizer`'s positions. /// @dev Warning: Reverts if the signature has already been submitted. /// @dev The signature is malleable, but it has no impact on the security here. /// @dev The nonce is passed as argument to be able to revert with a different error message. /// @param authorization The `Authorization` struct. /// @param signature The signature. function setAuthorizationWithSig(Authorization calldata authorization, Signature calldata signature) external; /// @notice Accrues interest for the given market `marketParams`. function accrueInterest(MarketParams memory marketParams) external; /// @notice Returns the data stored on the different `slots`. function extSloads(bytes32[] memory slots) external view returns (bytes32[] memory); } /// @dev This interface is inherited by Morpho so that function signatures are checked by the compiler. /// @dev Consider using the IMorpho interface instead of this one. interface IMorphoStaticTyping is IMorphoBase { /// @notice The state of the position of `user` on the market corresponding to `id`. /// @dev Warning: For `feeRecipient`, `supplyShares` does not contain the accrued shares since the last interest /// accrual. function position(Id id, address user) external view returns (uint256 supplyShares, uint128 borrowShares, uint128 collateral); /// @notice The state of the market corresponding to `id`. /// @dev Warning: `totalSupplyAssets` does not contain the accrued interest since the last interest accrual. /// @dev Warning: `totalBorrowAssets` does not contain the accrued interest since the last interest accrual. /// @dev Warning: `totalSupplyShares` does not contain the accrued shares by `feeRecipient` since the last interest /// accrual. function market(Id id) external view returns ( uint128 totalSupplyAssets, uint128 totalSupplyShares, uint128 totalBorrowAssets, uint128 totalBorrowShares, uint128 lastUpdate, uint128 fee ); /// @notice The market params corresponding to `id`. /// @dev This mapping is not used in Morpho. It is there to enable reducing the cost associated to calldata on layer /// 2s by creating a wrapper contract with functions that take `id` as input instead of `marketParams`. function idToMarketParams(Id id) external view returns (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv); } /// @title IMorpho /// @author Morpho Labs /// @custom:contact [email protected] /// @dev Use this interface for Morpho to have access to all the functions with the appropriate function signatures. interface IMorpho is IMorphoBase { /// @notice The state of the position of `user` on the market corresponding to `id`. /// @dev Warning: For `feeRecipient`, `p.supplyShares` does not contain the accrued shares since the last interest /// accrual. function position(Id id, address user) external view returns (Position memory p); /// @notice The state of the market corresponding to `id`. /// @dev Warning: `m.totalSupplyAssets` does not contain the accrued interest since the last interest accrual. /// @dev Warning: `m.totalBorrowAssets` does not contain the accrued interest since the last interest accrual. /// @dev Warning: `m.totalSupplyShares` does not contain the accrued shares by `feeRecipient` since the last /// interest accrual. function market(Id id) external view returns (Market memory m); /// @notice The market params corresponding to `id`. /// @dev This mapping is not used in Morpho. It is there to enable reducing the cost associated to calldata on layer /// 2s by creating a wrapper contract with functions that take `id` as input instead of `marketParams`. function idToMarketParams(Id id) external view returns (MarketParams memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; interface IEIP712 { function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; /// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol) /// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) /// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. abstract contract ERC20 { /*////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 amount); event Approval(address indexed owner, address indexed spender, uint256 amount); /*////////////////////////////////////////////////////////////// METADATA STORAGE //////////////////////////////////////////////////////////////*/ string public name; string public symbol; uint8 public immutable decimals; /*////////////////////////////////////////////////////////////// ERC20 STORAGE //////////////////////////////////////////////////////////////*/ uint256 public totalSupply; mapping(address => uint256) public balanceOf; mapping(address => mapping(address => uint256)) public allowance; /*////////////////////////////////////////////////////////////// EIP-2612 STORAGE //////////////////////////////////////////////////////////////*/ uint256 internal immutable INITIAL_CHAIN_ID; bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR; mapping(address => uint256) public nonces; /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor( string memory _name, string memory _symbol, uint8 _decimals ) { name = _name; symbol = _symbol; decimals = _decimals; INITIAL_CHAIN_ID = block.chainid; INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); } /*////////////////////////////////////////////////////////////// ERC20 LOGIC //////////////////////////////////////////////////////////////*/ function approve(address spender, uint256 amount) public virtual returns (bool) { allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } function transfer(address to, uint256 amount) public virtual returns (bool) { balanceOf[msg.sender] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(msg.sender, to, amount); return true; } function transferFrom( address from, address to, uint256 amount ) public virtual returns (bool) { uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount; balanceOf[from] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(from, to, amount); return true; } /*////////////////////////////////////////////////////////////// EIP-2612 LOGIC //////////////////////////////////////////////////////////////*/ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); // Unchecked because the only math done is incrementing // the owner's nonce which cannot realistically overflow. unchecked { address recoveredAddress = ecrecover( keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR(), keccak256( abi.encode( keccak256( "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" ), owner, spender, value, nonces[owner]++, deadline ) ) ) ), v, r, s ); require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); allowance[recoveredAddress][spender] = value; } emit Approval(owner, spender, value); } function DOMAIN_SEPARATOR() public view virtual returns (bytes32) { return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator(); } function computeDomainSeparator() internal view virtual returns (bytes32) { return keccak256( abi.encode( keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(bytes(name)), keccak256("1"), block.chainid, address(this) ) ); } /*////////////////////////////////////////////////////////////// INTERNAL MINT/BURN LOGIC //////////////////////////////////////////////////////////////*/ function _mint(address to, uint256 amount) internal virtual { totalSupply += amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(address(0), to, amount); } function _burn(address from, uint256 amount) internal virtual { balanceOf[from] -= amount; // Cannot underflow because a user's balance // will never be larger than the total supply. unchecked { totalSupply -= amount; } emit Transfer(from, address(0), amount); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; interface IDAIPermit { /// @param holder The address of the token owner. /// @param spender The address of the token spender. /// @param nonce The owner's nonce, increases at each call to permit. /// @param expiry The timestamp at which the permit is no longer valid. /// @param allowed Boolean that sets approval amount, true for type(uint256).max and false for 0. /// @param v Must produce valid secp256k1 signature from the owner along with r and s. /// @param r Must produce valid secp256k1 signature from the owner along with v and s. /// @param s Must produce valid secp256k1 signature from the owner along with r and v. function permit( address holder, address spender, uint256 nonce, uint256 expiry, bool allowed, uint8 v, bytes32 r, bytes32 s ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title IMorphoLiquidateCallback /// @notice Interface that liquidators willing to use `liquidate`'s callback must implement. interface IMorphoLiquidateCallback { /// @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 onMorphoLiquidate(uint256 repaidAssets, bytes calldata data) external; } /// @title IMorphoRepayCallback /// @notice Interface that users willing to use `repay`'s callback must implement. interface IMorphoRepayCallback { /// @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 onMorphoRepay(uint256 assets, bytes calldata data) external; } /// @title IMorphoSupplyCallback /// @notice Interface that users willing to use `supply`'s callback must implement. interface IMorphoSupplyCallback { /// @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 onMorphoSupply(uint256 assets, bytes calldata data) external; } /// @title IMorphoSupplyCollateralCallback /// @notice Interface that users willing to use `supplyCollateral`'s callback must implement. interface IMorphoSupplyCollateralCallback { /// @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 onMorphoSupplyCollateral(uint256 assets, bytes calldata data) external; } /// @title IMorphoFlashLoanCallback /// @notice Interface that users willing to use `flashLoan`'s callback must implement. interface IMorphoFlashLoanCallback { /// @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 onMorphoFlashLoan(uint256 assets, bytes calldata data) external; }
{ "remappings": [ "solmate/=lib/permit2/lib/solmate/", "@aave/core-v3/=lib/morpho-utils/lib/aave-v3-core/", "aave-v3-core/=lib/morpho-utils/lib/aave-v3-core/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-gas-snapshot/=lib/permit2/lib/forge-gas-snapshot/src/", "forge-std/=lib/forge-std/src/", "morpho-blue-irm/=lib/morpho-blue-irm/src/", "morpho-blue/=lib/morpho-blue/", "morpho-utils/=lib/morpho-utils/src/", "murky/=lib/murky/", "openzeppelin-contracts-upgradeable/=lib/morpho-utils/lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "openzeppelin-upgradeable/=lib/morpho-utils/lib/openzeppelin-contracts-upgradeable/contracts/", "openzeppelin/=lib/openzeppelin-contracts/contracts/", "permit2/=lib/permit2/", "universal-rewards-distributor/=lib/universal-rewards-distributor/src/", "weird-erc20/=lib/universal-rewards-distributor/lib/solmate/lib/weird-erc20/src/" ], "optimizer": { "enabled": true, "runs": 80000 }, "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
[{"inputs":[{"internalType":"address","name":"morpho","type":"address"},{"internalType":"address","name":"wNative","type":"address"},{"internalType":"address","name":"cEth","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"UnsafeCast","type":"error"},{"inputs":[],"name":"C_ETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MORPHO","outputs":[{"internalType":"contract IMorpho","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WRAPPED_NATIVE","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint160","name":"amount","type":"uint160"},{"internalType":"uint48","name":"expiration","type":"uint48"},{"internalType":"uint48","name":"nonce","type":"uint48"}],"internalType":"struct IAllowanceTransfer.PermitDetails","name":"details","type":"tuple"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"sigDeadline","type":"uint256"}],"internalType":"struct IAllowanceTransfer.PermitSingle","name":"permitSingle","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bool","name":"skipRevert","type":"bool"}],"name":"approve2","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"cToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"compoundV2Redeem","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"cToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"compoundV2Repay","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"erc20Transfer","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"erc20TransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"minShares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"erc4626Deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"maxAssets","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"erc4626Mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"minAssets","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"erc4626Redeem","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"maxShares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"erc4626Withdraw","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"initiator","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":"oracle","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":"uint256","name":"slippageAmount","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"morphoBorrow","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"morphoFlashLoan","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"loanToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"oracle","type":"address"},{"internalType":"address","name":"irm","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"}],"internalType":"struct MarketParams","name":"marketParams","type":"tuple"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"slippageAmount","type":"uint256"},{"internalType":"address","name":"onBehalf","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"morphoRepay","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"authorizer","type":"address"},{"internalType":"address","name":"authorized","type":"address"},{"internalType":"bool","name":"isAuthorized","type":"bool"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct Authorization","name":"authorization","type":"tuple"},{"components":[{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct Signature","name":"signature","type":"tuple"},{"internalType":"bool","name":"skipRevert","type":"bool"}],"name":"morphoSetAuthorizationWithSig","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"loanToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"oracle","type":"address"},{"internalType":"address","name":"irm","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"}],"internalType":"struct MarketParams","name":"marketParams","type":"tuple"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"slippageAmount","type":"uint256"},{"internalType":"address","name":"onBehalf","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"morphoSupply","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"loanToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"oracle","type":"address"},{"internalType":"address","name":"irm","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"}],"internalType":"struct MarketParams","name":"marketParams","type":"tuple"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"onBehalf","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"morphoSupplyCollateral","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"loanToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"oracle","type":"address"},{"internalType":"address","name":"irm","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"}],"internalType":"struct MarketParams","name":"marketParams","type":"tuple"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"slippageAmount","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"morphoWithdraw","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"loanToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"oracle","type":"address"},{"internalType":"address","name":"irm","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"}],"internalType":"struct MarketParams","name":"marketParams","type":"tuple"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"morphoWithdrawCollateral","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"nativeTransfer","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onMorphoFlashLoan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onMorphoRepay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onMorphoSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onMorphoSupplyCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"bool","name":"skipRevert","type":"bool"}],"name":"permit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom2","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unwrapNative","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"wrapNative","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60e034620001e657601f62003b8938819003918201601f19168301916001600160401b03831184841017620001eb57808492606094604052833981010312620001e657620000d8620000518262000201565b6200006d6040620000656020860162000201565b940162000201565b600080546001600160a01b0319166001179055926001600160a01b03918291620000a56200009a62000216565b84831615156200024f565b60805216620000c0620000b762000216565b8215156200024f565b60a052620000cd62000216565b90831615156200024f565b60c0526040516138cf9081620002ba823960805181818161086a015281816118200152612818015260a0518181816102180152818161069d0152818161075a015281816107f401528181610a8201528181610b9901528181610cbb01528181610e5401528181610f260152818161101d015281816111e6015281816115cc015281816117720152818161188f0152818161193f015281816119dc01528181611be301528181611ddf01528181611e8f01528181611fb00152818161211c015281816122fc015281816124a001528181612512015281816126db015281816127860152818161291c015281816129c901528181612a5e0152612b2a015260c0518181816102c5015261163e0152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203620001e657565b60408051919082016001600160401b03811183821017620001eb57604052600c82526b7a65726f206164647265737360a01b6020830152565b15620002585750565b6040519062461bcd60e51b82528160208060048301528251908160248401526000935b8285106200029f575050604492506000838284010152601f80199101168101030190fd5b84810182015186860160440152938101938593506200027b56fe60406080815260049081361015610020575b5050361561001e57600080fd5b005b600091823560e01c90816305b4591c146110485781631af3bbc6146129435781632075be031461104857816331f57072146110485783826334b10a6d146127ae575081633790767d1461270257816339029ab6146125365781633acb5624146124c7578382634d5fcf68146123235750816354c53ef014612143578382635b866db614611f07575081635c39fcc114611eb65783826362577ad014611e06575081636ef5eeae14611c0a57816370dc41fe14611a035783826384d287ef146118b65782639169d8331461179957508163a184a5a314611662578163a74f7854146115f3578163a7f6e606146113bf578163ac9650d81461120d578163af5042021461104d578163b1022fdf146110485783908263bea88fda14610e7b578263c956570614610ceb578263ca46367314610aad578263cecf4a2514610892578263d999984d1461081f578263e2975912146106c8578263e89142ec1461024357505063f2522bcd03610011577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610240576102116101be612c69565b61020873ffffffffffffffffffffffffffffffffffffffff808554166101ef6101e56130e4565b6001831415612f3c565b3314908115610214575b5061020261311d565b90612f3c565b6024359061365d565b80f35b90507f0000000000000000000000000000000000000000000000000000000000000000163314386101f9565b80fd5b915091807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106c457610277612c69565b60249081359173ffffffffffffffffffffffffffffffffffffffff9283875416926102ad6102a36130e4565b6001861415612f3c565b8333148015610699575b6102c39061020261311d565b7f0000000000000000000000000000000000000000000000000000000000000000851694818116808703610407575050504781811090821802189484517f17bfdfbc000000000000000000000000000000000000000000000000000000008152838282015260208184818b895af19081156103fd5788916103c4575b50868110908718029361035c6103536133a9565b86891415612f3c565b803b156103c0578794865197889586947fe597461900000000000000000000000000000000000000000000000000000000865285015218905af19081156103b757506103a757505080f35b6103b090612e91565b6102405780f35b513d84823e3d90fd5b8780fd5b9750506020873d82116103f5575b816103df60209383612ec1565b810103126103f0578796513861033f565b600080fd5b3d91506103d2565b86513d8a823e3d90fd5b919892955096928651957f6f307dc30000000000000000000000000000000000000000000000000000000087526020988988878188885af197881561062b57908a918699610666575b509083918a51928380927f70a08231000000000000000000000000000000000000000000000000000000008252308b8301528c165afa90811561062b578591610635575b5081811090821802189887517f17bfdfbc00000000000000000000000000000000000000000000000000000000815286868201528981848188885af190811561062b57918b91869594938c999897916105ee575b5090604497989961050f838561051495109086180294856105076133a9565b911415612f3c565b61322d565b88519a8b9788967f2608f81800000000000000000000000000000000000000000000000000000000885287015218908401525af19283156105e4578493610595575b50917f7265706179206572726f7200000000000000000000000000000000000000000061021193519261058884612ea5565b600b845283015215612f3c565b92508183813d83116105dd575b6105ac8183612ec1565b810103126103f0579151917f7265706179206572726f72000000000000000000000000000000000000000000610556565b503d6105a2565b81513d86823e3d90fd5b9798925050935085813d8311610624575b6106098183612ec1565b810103126103f05793518895948b9390918b919060446104e8565b503d6105ff565b89513d87823e3d90fd5b8095508a8092503d831161065f575b61064e8183612ec1565b810103126103f0578a935138610494565b503d610644565b8291995061068a9085933d8411610692575b6106828183612ec1565b8101906131c8565b989091610450565b503d610678565b50337f00000000000000000000000000000000000000000000000000000000000000008616146102b7565b5050fd5b91509160607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106c4576106fd612c69565b60443567ffffffffffffffff811161081b5761071c9036908501612a85565b939073ffffffffffffffffffffffffffffffffffffffff808754166107426101e56130e4565b331480156107f0575b6107579061020261311d565b807f00000000000000000000000000000000000000000000000000000000000000001691610785838661322d565b823b156103c05787946107dd86928851998a97889687957fe0232b420000000000000000000000000000000000000000000000000000000087521690850152602435602485015260606044850152606484019161358b565b03925af19081156103b757506103a75750f35b50337f000000000000000000000000000000000000000000000000000000000000000082161461074b565b8480fd5b50823461088e57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261088e576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b5080fd5b83807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610aa9576108c4612c69565b906024359173ffffffffffffffffffffffffffffffffffffffff90818654166108ee6101e56130e4565b33148015610a7e575b6109039061020261311d565b168151927f70a082310000000000000000000000000000000000000000000000000000000084523085850152856020948581602481875afa908115610a74579082918795949391610a3e575b50908183602494931090831802936109716109686133a9565b86851415612f3c565b865198899586947fdb006a7500000000000000000000000000000000000000000000000000000000865218908401525af19283156105e45784936109ef575b50917f72656465656d206572726f7200000000000000000000000000000000000000006102119351926109e284612ea5565b600c845283015215612f3c565b92508183813d8311610a37575b610a068183612ec1565b810103126103f0579151917f72656465656d206572726f7200000000000000000000000000000000000000006109b0565b503d6109fc565b92948092508391503d8311610a6d575b610a588183612ec1565b810103126103f057518492908790602461094f565b503d610a4e565b85513d84823e3d90fd5b50337f00000000000000000000000000000000000000000000000000000000000000008316146108f7565b8280fd5b9150917ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36016101009081811261081b5760a013610ce65760a43592610af1612c46565b9060e43567ffffffffffffffff8111610ce257610b119036908301612a85565b73ffffffffffffffffffffffffffffffffffffffff9283895416610b366101e56130e4565b33148015610cb7575b610b4b9061020261311d565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8489961698610b85610b7c61342e565b308c1415612f3c565b14610c24575b610bc0610b96613467565b947f000000000000000000000000000000000000000000000000000000000000000016809561322d565b833b15610c20576107dd610c06938a979388948a519b8c998a9889977f238d657900000000000000000000000000000000000000000000000000000000895288016134c1565b60a487015260c486015260e485015261010484019161358b565b8880fd5b93506024602084610c33613467565b168851928380927f70a08231000000000000000000000000000000000000000000000000000000008252308a8301525afa908115610cad578991610c79575b5093610b8b565b9850506020883d8211610ca5575b81610c9460209383612ec1565b810103126103f05788975138610c72565b3d9150610c87565b87513d8b823e3d90fd5b50337f0000000000000000000000000000000000000000000000000000000000000000851614610b3f565b8680fd5b505050fd5b8382916020610cf936612e21565b97909392919573ffffffffffffffffffffffffffffffffffffffff90610d6b82845416610d276101e56130e4565b8033148015610e50575b610d3d9061020261311d565b610d52610d48613156565b858a161515612f3c565b838c1690308214918215610e46575b50506102026133f5565b610d7e610d766133a9565b851515612f3c565b610ddf89519a8b97889687947fb460af9400000000000000000000000000000000000000000000000000000000865285019160409194936060840195845273ffffffffffffffffffffffffffffffffffffffff809216602085015216910152565b0393165af1918215610e3d57508391610e08575b6102119250610e006131f4565b911115612f3c565b90506020823d8211610e35575b81610e2260209383612ec1565b810103126103f057610211915190610df3565b3d9150610e15565b513d85823e3d90fd5b1490508d80610d61565b50337f0000000000000000000000000000000000000000000000000000000000000000851614610d31565b83907ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360161012081126110445760a013610aa95760607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5c360112610aa9576101048035928315938415036103f05773ffffffffffffffffffffffffffffffffffffffff80865416610f0e6101e56130e4565b33148015611019575b610f239061020261311d565b807f00000000000000000000000000000000000000000000000000000000000000001691823b15610ce25751937f8069218f00000000000000000000000000000000000000000000000000000000855281610f7c612c69565b1690850152610f89612c8c565b1660248401526044358015158091036103f05760448401526064356064840152608435608484015260a43560ff81168091036103f057859284848094829460a484015260c43560c484015260e43560e48401525af19182611005575b505061100157610ff3612fd8565b90610ffc575080f35b61309b565b5080f35b61100e90612e91565b610aa9578284610fe5565b50337f0000000000000000000000000000000000000000000000000000000000000000821614610f17565b8380fd5b612ab3565b9050610100367ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0181811261081b5760c0136110445760c43567ffffffffffffffff811161081b576110a29036908401612a85565b919060e435948515958615036103f05773ffffffffffffffffffffffffffffffffffffffff91828854166110d76101e56130e4565b80331480156111e2575b6110ed9061020261311d565b6e22d473030f116ddee9f6b43ac78ba392833b156111de5751967f2b67b57000000000000000000000000000000000000000000000000000000000885287015282611136612c69565b166024870152602435838116809103610c2057604487015260443565ffffffffffff908181168091036103f05760648801526064359081168091036103f05760848701526084359283168093036103f05787866111b281959383988498849660a486015260a43560c486015260e485015261010484019161358b565b03925af191826111ca57505061100157610ff3612fd8565b6111d390612e91565b610aa9578238610fe5565b8980fd5b50337f00000000000000000000000000000000000000000000000000000000000000008516146110e1565b8383602092837ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103f057803567ffffffffffffffff918282116103f057366023830112156103f057818101359260249181851161139257508360051b9085519461127d89840187612ec1565b85528288860192850101933685116103f057838101925b85841061133157886001896113288a6112fb8f7f616c726561647920696e6974696174656400000000000000000000000000000087549551916112d683612ea5565b601183528201528573ffffffffffffffffffffffffffffffffffffffff861614612f3c565b7fffffffffffffffffffffffff000000000000000000000000000000000000000092831633178555613008565b82541617815580f35b83358381116103f057820190366043830112156103f057858201359060449261135983612f02565b906113668c519283612ec1565b838252368585830101116103f0578d848196958296600094018386013783010152815201930192611294565b604191507f4e487b7100000000000000000000000000000000000000000000000000000000600052526000fd5b9190506113cb36612e21565b919492939073ffffffffffffffffffffffffffffffffffffffff80895416926113f56102a36130e4565b83331480156115c8575b61140b9061020261311d565b611420611416613156565b8385161515612f3c565b61143b828616943086149081156115be575b506102026133f5565b168451927f70a0823100000000000000000000000000000000000000000000000000000000845288840152886020938481602481865afa9081156115b457829161157d575b5098849392918a896114a99c10908a180291828a189b8c936114a061318f565b908c1415612f3c565b61150a8951988996879586947fba08765200000000000000000000000000000000000000000000000000000000865285019160409194936060840195845273ffffffffffffffffffffffffffffffffffffffff809216602085015216910152565b03925af192831561157457508692611540575b50509261153061153692610211956133e2565b926133e2565b11156102026131f4565b9080959250813d831161156d575b6115588183612ec1565b810103126103f057925161153061153661151d565b503d61154e565b513d88823e3d90fd5b8094939250858092503d83116115ad575b6115988183612ec1565b810103126103f0579151909190899084611480565b503d61158e565b87513d84823e3d90fd5b9050851438611432565b50337f00000000000000000000000000000000000000000000000000000000000000008316146113ff565b50503461088e57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261088e576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b91905060e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610aa957611697612c69565b916064359160ff83168093036103f05760c435938415948515036103f057859273ffffffffffffffffffffffffffffffffffffffff80855416926116dc6102a36130e4565b833314801561176e575b6116f29061020261311d565b1690813b1561081b578460e49281955197889586947fd505accf00000000000000000000000000000000000000000000000000000000865285015230602485015260243560448501526044356064850152608484015260843560a484015260a43560c48401525af191826111ca57505061100157610ff3612fd8565b50337f00000000000000000000000000000000000000000000000000000000000000008316146116e6565b80918460207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106c457813573ffffffffffffffffffffffffffffffffffffffff808554166117ec6101e56130e4565b3314801561188b575b6118019061020261311d565b47828110908318029061181e6118156133a9565b83851415612f3c565b7f00000000000000000000000000000000000000000000000000000000000000001693843b15611887578592845195869384927fd0e30db000000000000000000000000000000000000000000000000000000000845218905af19081156103b757506103a75750f35b8580fd5b50337f00000000000000000000000000000000000000000000000000000000000000008216146117f5565b915091806118c336612dbc565b9196839594919861193b73ffffffffffffffffffffffffffffffffffffffff94858454166118f26101e56130e4565b80331480156119d8575b6119089061020261311d565b88519b8c98899788967f5c2bea490000000000000000000000000000000000000000000000000000000088528701613616565b03927f0000000000000000000000000000000000000000000000000000000000000000165af19283156119ce578592869461199b575b505015611985575061021191610e006131f4565b9050610211916119936131f4565b911015612f3c565b80919294506119bf9350903d106119c7575b6119b78183612ec1565b8101906134ab565b913880611971565b503d6119ad565b82513d87823e3d90fd5b50337f00000000000000000000000000000000000000000000000000000000000000008816146118fc565b9050817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610aa957611a36612c69565b91602435908473ffffffffffffffffffffffffffffffffffffffff8082541695611a6b611a616130e4565b6001891415612f3c565b8633148015611bdf575b611a819061020261311d565b16948251957f70a0823100000000000000000000000000000000000000000000000000000000875281868801526020948588602481855afa8015611bd5578697988597969791611b9a575b50918183869360649695109082180290611af0611ae76133a9565b83831415612f3c565b8851947f23b872dd0000000000000000000000000000000000000000000000000000000086528b8601523060248601521860448401525af13d15601f3d11600187511416171615611b3f578380f35b6064935051917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152fd5b958092949395508691503d8311611bce575b611bb68183612ec1565b810103126103f0579251859388939092909184611acc565b503d611bac565b85513d86823e3d90fd5b50337f0000000000000000000000000000000000000000000000000000000000000000831614611a75565b9050611c1536612cd0565b73ffffffffffffffffffffffffffffffffffffffff959293959491949081885416611c416101e56130e4565b33148015611ddb575b611c569061020261311d565b611c6b611c61613156565b8383161515612f3c565b8187168451937f38d52e0f00000000000000000000000000000000000000000000000000000000855260209384868381865afa958615611dad578b96611db7575b50846024918851928380927f70a0823100000000000000000000000000000000000000000000000000000000825230878301528a165afa908115611dad579085949392918c91611d7e575b5088811090891802958689189a8b97611d0e6133a9565b611d1a918c1415612f3c565b611d239161322d565b8a87518097819582947f6e553f6500000000000000000000000000000000000000000000000000000000845283019161150a9290929173ffffffffffffffffffffffffffffffffffffffff6020916040840195845216910152565b85819692503d8311611da6575b611d958183612ec1565b810103126103f05784935138611cf7565b503d611d8b565b87513d8d823e3d90fd5b6024919650611dd38691823d8411610692576106828183612ec1565b969150611cac565b50337f0000000000000000000000000000000000000000000000000000000000000000831614611c4a565b91509180611e1336612dbc565b9196839594919861193b73ffffffffffffffffffffffffffffffffffffffff9485845416611e426101e56130e4565b8033148015611e8b575b611e589061020261311d565b88519b8c98899788967f50d8cd4b0000000000000000000000000000000000000000000000000000000088528701613616565b50337f0000000000000000000000000000000000000000000000000000000000000000881614611e4c565b50503461088e57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261088e5773ffffffffffffffffffffffffffffffffffffffff60209254169051908152f35b809184611f1336612d34565b9073ffffffffffffffffffffffffffffffffffffffff9993999892959694989586855416611f426101e56130e4565b33148015612118575b611f579061020261311d565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff88611f8f611f8461342e565b308b86161415612f3c565b14612063575b8896949286949261200a92611fd7611fad8c9a61348a565b987f000000000000000000000000000000000000000000000000000000000000000016809961322d565b89519c8d998a9889977fa99aad8900000000000000000000000000000000000000000000000000000000895288016135ca565b03925af19283156119ce5785928694612040575b5050156120325750610211916119936131f4565b905061021191610e006131f4565b809192945061205b9350903d106119c7576119b78183612ec1565b91858061201e565b94929095939160249a9998975060208561207c8661348a565b1689519c8d80927f70a0823100000000000000000000000000000000000000000000000000000000825230878301525afa801561210e5788999a9b84999899916120d2575b509794965092949193909291611f95565b97505091506020863d8211612106575b816120ef60209383612ec1565b810103126103f05761200a8b9289975190916120c1565b3d91506120e2565b88513d85823e3d90fd5b50337f0000000000000000000000000000000000000000000000000000000000000000881614611f4b565b8383807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261088e57612176612c69565b906024359173ffffffffffffffffffffffffffffffffffffffff908180865416916121ac6121a26130e4565b6001851415612f3c565b82331480156122f8575b6121c29061020261311d565b1683517f70a082310000000000000000000000000000000000000000000000000000000081528288820152602081602481855afa80156122ee5787906122bb575b61221c91508681109087180295868118966105076133a9565b8285116122935785966e22d473030f116ddee9f6b43ac78ba393843b156103c057879460849386928851998a9788967f36c7851600000000000000000000000000000000000000000000000000000000885287015230602487015216604485015260648401525af19081156103b757506103a75750f35b8684517fc4bd89a9000000000000000000000000000000000000000000000000000000008152fd5b506020813d82116122e6575b816122d460209383612ec1565b810103126103f05761221c9051612203565b3d91506122c7565b85513d89823e3d90fd5b50337f00000000000000000000000000000000000000000000000000000000000000008316146121b6565b80918461232f36612d34565b9073ffffffffffffffffffffffffffffffffffffffff999399989295969498958685541661235e6101e56130e4565b3314801561249c575b6123739061020261311d565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff886123a0611f8461342e565b146123f1575b8896949286949261200a926123be611fad8c9a61348a565b89519c8d998a9889977f20b76e8100000000000000000000000000000000000000000000000000000000895288016135ca565b94929095939160249a9998975060208561240a8661348a565b1689519c8d80927f70a0823100000000000000000000000000000000000000000000000000000000825230878301525afa801561210e5788999a9b8499989991612460575b5097949650929491939092916123a6565b97505091506020863d8211612494575b8161247d60209383612ec1565b810103126103f05761200a8b92899751909161244f565b3d9150612470565b50337f0000000000000000000000000000000000000000000000000000000000000000881614612367565b50503461088e57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261088e576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b91905061254236612cd0565b949092918673ffffffffffffffffffffffffffffffffffffffff8082541661256b6101e56130e4565b331480156126d7575b6125809061020261311d565b61259561258b613156565b828a161515612f3c565b6125a86125a061318f565b841515612f3c565b8416928651947f38d52e0f00000000000000000000000000000000000000000000000000000000865260209586818481895afa9081156126cd5784926126549b9694926125fe928a9997916126b0575b5061322d565b8851998a95869485937f94bf804d000000000000000000000000000000000000000000000000000000008552840190929173ffffffffffffffffffffffffffffffffffffffff6020916040840195845216910152565b03925af19283156126a757508492612675575b506102119250610e006131f4565b90915082813d83116126a0575b61268c8183612ec1565b810103126103f05761021191519038612667565b503d612682565b513d86823e3d90fd5b6126c79150893d8b11610692576106828183612ec1565b386125f8565b89513d86823e3d90fd5b50337f0000000000000000000000000000000000000000000000000000000000000000821614612574565b8360607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261024057610211612738612c69565b612740612c8c565b61277973ffffffffffffffffffffffffffffffffffffffff808654166127676101e56130e4565b3314908115612782575061020261311d565b60443591613721565b90507f0000000000000000000000000000000000000000000000000000000000000000163314866101f9565b80918460207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106c457813573ffffffffffffffffffffffffffffffffffffffff808554166128016101e56130e4565b33148015612918575b6128169061020261311d565b7f00000000000000000000000000000000000000000000000000000000000000001682517f70a082310000000000000000000000000000000000000000000000000000000081523085820152602081602481855afa90811561290e5786916128da575b50828110908318029061288d6118156133a9565b803b1561188757859283602492865197889586947f2e1a7d4d00000000000000000000000000000000000000000000000000000000865218908401525af19081156103b757506103a75750f35b9550506020853d8211612906575b816128f560209383612ec1565b810103126103f05785945187612879565b3d91506128e8565b84513d88823e3d90fd5b50337f000000000000000000000000000000000000000000000000000000000000000082161461280a565b9190507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360160e081126110445760a013610aa95782612981612c46565b73ffffffffffffffffffffffffffffffffffffffff80835416946129b06129a66130e4565b6001881415612f3c565b8533148015612a5a575b6129c69061020261311d565b817f00000000000000000000000000000000000000000000000000000000000000001692833b1561081b57612a2c936101049386928851998a9788967f8720316d00000000000000000000000000000000000000000000000000000000885287016134c1565b60a43560a487015260c48601521660e48401525af19081156103b75750612a51575080f35b61021190612e91565b50337f00000000000000000000000000000000000000000000000000000000000000008316146129ba565b9181601f840112156103f05782359167ffffffffffffffff83116103f057602083818601950101116103f057565b346103f0576040807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103f05767ffffffffffffffff906024358281116103f057612b05903690600401612a85565b612b51612b1394929461311d565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163314612f3c565b83019160209384818503126103f0578035908382116103f057019183601f840112156103f057823593818511612c17578460051b91835195612b9588850188612ec1565b86528680870193860101948286116103f057878101935b868510612bbc5761001e88613008565b84358381116103f057820184603f820112156103f0578981013591612be083612f02565b612bec89519182612ec1565b838152868985850101116103f05760008c8581968c8397018386013783010152815201940193612bac565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60c4359073ffffffffffffffffffffffffffffffffffffffff821682036103f057565b6004359073ffffffffffffffffffffffffffffffffffffffff821682036103f057565b6024359073ffffffffffffffffffffffffffffffffffffffff821682036103f057565b359073ffffffffffffffffffffffffffffffffffffffff821682036103f057565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc60809101126103f05773ffffffffffffffffffffffffffffffffffffffff9060043582811681036103f05791602435916044359160643590811681036103f05790565b907ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc820161014081126103f05760a0136103f05760049160a4359160c4359160e435916101043573ffffffffffffffffffffffffffffffffffffffff811681036103f05791610124359067ffffffffffffffff82116103f057612db8918801612a85565b9091565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0161012081126103f05760a0136103f05760049060a4359060c4359060e435906101043573ffffffffffffffffffffffffffffffffffffffff811681036103f05790565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc60a09101126103f05773ffffffffffffffffffffffffffffffffffffffff60043581811681036103f05791602435916044359160643582811681036103f0579160843590811681036103f05790565b67ffffffffffffffff8111612c1757604052565b6040810190811067ffffffffffffffff821117612c1757604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117612c1757604052565b67ffffffffffffffff8111612c1757601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b15612f445750565b604051907f08c379a000000000000000000000000000000000000000000000000000000000825281602080600483015282519283602484015260005b848110612fc1575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f836000604480968601015201168101030190fd5b818101830151868201604401528593508201612f80565b3d15613003573d90612fe982612f02565b91612ff76040519384612ec1565b82523d6000602084013e565b606090565b60005b8151811015613097576000806020808460051b860101519081519101305af4613032612fd8565b9015610ffc57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146130685760010161300b565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b5050565b8051906130df6040516130ad81612ea5565b600b81527f63616c6c206661696c65640000000000000000000000000000000000000000006020820152831515612f3c565b602001fd5b604051906130f182612ea5565b600b82527f756e696e697469617465640000000000000000000000000000000000000000006020830152565b6040519061312a82612ea5565b601382527f756e617574686f72697a65642073656e646572000000000000000000000000006020830152565b6040519061316382612ea5565b600c82527f7a65726f206164647265737300000000000000000000000000000000000000006020830152565b6040519061319c82612ea5565b600b82527f7a65726f207368617265730000000000000000000000000000000000000000006020830152565b908160209103126103f0575173ffffffffffffffffffffffffffffffffffffffff811681036103f05790565b6040519061320182612ea5565b601182527f736c6970706167652065786365656465640000000000000000000000000000006020830152565b73ffffffffffffffffffffffffffffffffffffffff80911690604051927fdd62ed3e000000000000000000000000000000000000000000000000000000008452306004850152168060248401526020928381604481865afa90811561339d57600091613370575b501561329f57505050565b6044600091828594604051927f095ea7b300000000000000000000000000000000000000000000000000000000845260048401527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60248401525af13d15601f3d11600160005114161716156133125750565b606490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152600e60248201527f415050524f56455f4641494c45440000000000000000000000000000000000006044820152fd5b908482813d8311613396575b6133868183612ec1565b8101031261024057505138613294565b503d61337c565b6040513d6000823e3d90fd5b604051906133b682612ea5565b600b82527f7a65726f20616d6f756e740000000000000000000000000000000000000000006020830152565b8181029291811591840414171561306857565b6040519061340282612ea5565b601082527f756e6578706563746564206f776e6572000000000000000000000000000000006020830152565b6040519061343b82612ea5565b600f82527f62756e646c6572206164647265737300000000000000000000000000000000006020830152565b60243573ffffffffffffffffffffffffffffffffffffffff811681036103f05790565b3573ffffffffffffffffffffffffffffffffffffffff811681036103f05790565b91908260409103126103f0576020825192015190565b60043573ffffffffffffffffffffffffffffffffffffffff908181168091036103f05782526024358181168091036103f05760208301526044358181168091036103f05760408301526064359081168091036103f05760608201526080608435910152565b6080809173ffffffffffffffffffffffffffffffffffffffff8061354983612caf565b1685528061355960208401612caf565b1660208601528061356c60408401612caf565b16604086015261357e60608301612caf565b1660608501520135910152565b601f82602094937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0938186528686013760008582860101520116010190565b919373ffffffffffffffffffffffffffffffffffffffff919361361397956135f58561012097613526565b60a085015260c08401521660e082015281610100820152019161358b565b90565b939192610100939695919661363086610120810199613526565b60a086015260c085015273ffffffffffffffffffffffffffffffffffffffff80921660e085015216910152565b61369b73ffffffffffffffffffffffffffffffffffffffff821661368a613682613156565b821515612f3c565b61369261342e565b90301415612f3c565b478281109083180280831461371c5760009283928392839218905af1156136be57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4554485f5452414e534645525f4641494c4544000000000000000000000000006044820152fd5b505050565b919073ffffffffffffffffffffffffffffffffffffffff80911692613747610d76613156565b61375b61375261342e565b30861415612f3c565b16604051927f70a082310000000000000000000000000000000000000000000000000000000084523060048501526020938481602481865afa90811561339d5760009161386c575b50838110908418029081841461386557600080936044938796604051947fa9059cbb00000000000000000000000000000000000000000000000000000000865260048601521860248401525af13d15601f3d11600160005114161716156138075750565b606490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152fd5b5050505050565b908582813d8311613892575b6138828183612ec1565b81010312610240575051386137a3565b503d61387856fea26469706673582212204ddd178b72fb1f216e3d0628a1c4bf0e7d604676f77ca9c96f25d7eb38ee294864736f6c63430008150033000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000004ddc2d193948926d02f9b1fe9e1daa0718270ed5
Deployed Bytecode
0x60406080815260049081361015610020575b5050361561001e57600080fd5b005b600091823560e01c90816305b4591c146110485781631af3bbc6146129435781632075be031461104857816331f57072146110485783826334b10a6d146127ae575081633790767d1461270257816339029ab6146125365781633acb5624146124c7578382634d5fcf68146123235750816354c53ef014612143578382635b866db614611f07575081635c39fcc114611eb65783826362577ad014611e06575081636ef5eeae14611c0a57816370dc41fe14611a035783826384d287ef146118b65782639169d8331461179957508163a184a5a314611662578163a74f7854146115f3578163a7f6e606146113bf578163ac9650d81461120d578163af5042021461104d578163b1022fdf146110485783908263bea88fda14610e7b578263c956570614610ceb578263ca46367314610aad578263cecf4a2514610892578263d999984d1461081f578263e2975912146106c8578263e89142ec1461024357505063f2522bcd03610011577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610240576102116101be612c69565b61020873ffffffffffffffffffffffffffffffffffffffff808554166101ef6101e56130e4565b6001831415612f3c565b3314908115610214575b5061020261311d565b90612f3c565b6024359061365d565b80f35b90507f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb163314386101f9565b80fd5b915091807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106c457610277612c69565b60249081359173ffffffffffffffffffffffffffffffffffffffff9283875416926102ad6102a36130e4565b6001861415612f3c565b8333148015610699575b6102c39061020261311d565b7f0000000000000000000000004ddc2d193948926d02f9b1fe9e1daa0718270ed5851694818116808703610407575050504781811090821802189484517f17bfdfbc000000000000000000000000000000000000000000000000000000008152838282015260208184818b895af19081156103fd5788916103c4575b50868110908718029361035c6103536133a9565b86891415612f3c565b803b156103c0578794865197889586947fe597461900000000000000000000000000000000000000000000000000000000865285015218905af19081156103b757506103a757505080f35b6103b090612e91565b6102405780f35b513d84823e3d90fd5b8780fd5b9750506020873d82116103f5575b816103df60209383612ec1565b810103126103f0578796513861033f565b600080fd5b3d91506103d2565b86513d8a823e3d90fd5b919892955096928651957f6f307dc30000000000000000000000000000000000000000000000000000000087526020988988878188885af197881561062b57908a918699610666575b509083918a51928380927f70a08231000000000000000000000000000000000000000000000000000000008252308b8301528c165afa90811561062b578591610635575b5081811090821802189887517f17bfdfbc00000000000000000000000000000000000000000000000000000000815286868201528981848188885af190811561062b57918b91869594938c999897916105ee575b5090604497989961050f838561051495109086180294856105076133a9565b911415612f3c565b61322d565b88519a8b9788967f2608f81800000000000000000000000000000000000000000000000000000000885287015218908401525af19283156105e4578493610595575b50917f7265706179206572726f7200000000000000000000000000000000000000000061021193519261058884612ea5565b600b845283015215612f3c565b92508183813d83116105dd575b6105ac8183612ec1565b810103126103f0579151917f7265706179206572726f72000000000000000000000000000000000000000000610556565b503d6105a2565b81513d86823e3d90fd5b9798925050935085813d8311610624575b6106098183612ec1565b810103126103f05793518895948b9390918b919060446104e8565b503d6105ff565b89513d87823e3d90fd5b8095508a8092503d831161065f575b61064e8183612ec1565b810103126103f0578a935138610494565b503d610644565b8291995061068a9085933d8411610692575b6106828183612ec1565b8101906131c8565b989091610450565b503d610678565b50337f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb8616146102b7565b5050fd5b91509160607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106c4576106fd612c69565b60443567ffffffffffffffff811161081b5761071c9036908501612a85565b939073ffffffffffffffffffffffffffffffffffffffff808754166107426101e56130e4565b331480156107f0575b6107579061020261311d565b807f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb1691610785838661322d565b823b156103c05787946107dd86928851998a97889687957fe0232b420000000000000000000000000000000000000000000000000000000087521690850152602435602485015260606044850152606484019161358b565b03925af19081156103b757506103a75750f35b50337f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb82161461074b565b8480fd5b50823461088e57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261088e576020905173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2168152f35b5080fd5b83807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610aa9576108c4612c69565b906024359173ffffffffffffffffffffffffffffffffffffffff90818654166108ee6101e56130e4565b33148015610a7e575b6109039061020261311d565b168151927f70a082310000000000000000000000000000000000000000000000000000000084523085850152856020948581602481875afa908115610a74579082918795949391610a3e575b50908183602494931090831802936109716109686133a9565b86851415612f3c565b865198899586947fdb006a7500000000000000000000000000000000000000000000000000000000865218908401525af19283156105e45784936109ef575b50917f72656465656d206572726f7200000000000000000000000000000000000000006102119351926109e284612ea5565b600c845283015215612f3c565b92508183813d8311610a37575b610a068183612ec1565b810103126103f0579151917f72656465656d206572726f7200000000000000000000000000000000000000006109b0565b503d6109fc565b92948092508391503d8311610a6d575b610a588183612ec1565b810103126103f057518492908790602461094f565b503d610a4e565b85513d84823e3d90fd5b50337f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb8316146108f7565b8280fd5b9150917ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36016101009081811261081b5760a013610ce65760a43592610af1612c46565b9060e43567ffffffffffffffff8111610ce257610b119036908301612a85565b73ffffffffffffffffffffffffffffffffffffffff9283895416610b366101e56130e4565b33148015610cb7575b610b4b9061020261311d565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8489961698610b85610b7c61342e565b308c1415612f3c565b14610c24575b610bc0610b96613467565b947f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb16809561322d565b833b15610c20576107dd610c06938a979388948a519b8c998a9889977f238d657900000000000000000000000000000000000000000000000000000000895288016134c1565b60a487015260c486015260e485015261010484019161358b565b8880fd5b93506024602084610c33613467565b168851928380927f70a08231000000000000000000000000000000000000000000000000000000008252308a8301525afa908115610cad578991610c79575b5093610b8b565b9850506020883d8211610ca5575b81610c9460209383612ec1565b810103126103f05788975138610c72565b3d9150610c87565b87513d8b823e3d90fd5b50337f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb851614610b3f565b8680fd5b505050fd5b8382916020610cf936612e21565b97909392919573ffffffffffffffffffffffffffffffffffffffff90610d6b82845416610d276101e56130e4565b8033148015610e50575b610d3d9061020261311d565b610d52610d48613156565b858a161515612f3c565b838c1690308214918215610e46575b50506102026133f5565b610d7e610d766133a9565b851515612f3c565b610ddf89519a8b97889687947fb460af9400000000000000000000000000000000000000000000000000000000865285019160409194936060840195845273ffffffffffffffffffffffffffffffffffffffff809216602085015216910152565b0393165af1918215610e3d57508391610e08575b6102119250610e006131f4565b911115612f3c565b90506020823d8211610e35575b81610e2260209383612ec1565b810103126103f057610211915190610df3565b3d9150610e15565b513d85823e3d90fd5b1490508d80610d61565b50337f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb851614610d31565b83907ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360161012081126110445760a013610aa95760607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5c360112610aa9576101048035928315938415036103f05773ffffffffffffffffffffffffffffffffffffffff80865416610f0e6101e56130e4565b33148015611019575b610f239061020261311d565b807f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb1691823b15610ce25751937f8069218f00000000000000000000000000000000000000000000000000000000855281610f7c612c69565b1690850152610f89612c8c565b1660248401526044358015158091036103f05760448401526064356064840152608435608484015260a43560ff81168091036103f057859284848094829460a484015260c43560c484015260e43560e48401525af19182611005575b505061100157610ff3612fd8565b90610ffc575080f35b61309b565b5080f35b61100e90612e91565b610aa9578284610fe5565b50337f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb821614610f17565b8380fd5b612ab3565b9050610100367ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0181811261081b5760c0136110445760c43567ffffffffffffffff811161081b576110a29036908401612a85565b919060e435948515958615036103f05773ffffffffffffffffffffffffffffffffffffffff91828854166110d76101e56130e4565b80331480156111e2575b6110ed9061020261311d565b6e22d473030f116ddee9f6b43ac78ba392833b156111de5751967f2b67b57000000000000000000000000000000000000000000000000000000000885287015282611136612c69565b166024870152602435838116809103610c2057604487015260443565ffffffffffff908181168091036103f05760648801526064359081168091036103f05760848701526084359283168093036103f05787866111b281959383988498849660a486015260a43560c486015260e485015261010484019161358b565b03925af191826111ca57505061100157610ff3612fd8565b6111d390612e91565b610aa9578238610fe5565b8980fd5b50337f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb8516146110e1565b8383602092837ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103f057803567ffffffffffffffff918282116103f057366023830112156103f057818101359260249181851161139257508360051b9085519461127d89840187612ec1565b85528288860192850101933685116103f057838101925b85841061133157886001896113288a6112fb8f7f616c726561647920696e6974696174656400000000000000000000000000000087549551916112d683612ea5565b601183528201528573ffffffffffffffffffffffffffffffffffffffff861614612f3c565b7fffffffffffffffffffffffff000000000000000000000000000000000000000092831633178555613008565b82541617815580f35b83358381116103f057820190366043830112156103f057858201359060449261135983612f02565b906113668c519283612ec1565b838252368585830101116103f0578d848196958296600094018386013783010152815201930192611294565b604191507f4e487b7100000000000000000000000000000000000000000000000000000000600052526000fd5b9190506113cb36612e21565b919492939073ffffffffffffffffffffffffffffffffffffffff80895416926113f56102a36130e4565b83331480156115c8575b61140b9061020261311d565b611420611416613156565b8385161515612f3c565b61143b828616943086149081156115be575b506102026133f5565b168451927f70a0823100000000000000000000000000000000000000000000000000000000845288840152886020938481602481865afa9081156115b457829161157d575b5098849392918a896114a99c10908a180291828a189b8c936114a061318f565b908c1415612f3c565b61150a8951988996879586947fba08765200000000000000000000000000000000000000000000000000000000865285019160409194936060840195845273ffffffffffffffffffffffffffffffffffffffff809216602085015216910152565b03925af192831561157457508692611540575b50509261153061153692610211956133e2565b926133e2565b11156102026131f4565b9080959250813d831161156d575b6115588183612ec1565b810103126103f057925161153061153661151d565b503d61154e565b513d88823e3d90fd5b8094939250858092503d83116115ad575b6115988183612ec1565b810103126103f0579151909190899084611480565b503d61158e565b87513d84823e3d90fd5b9050851438611432565b50337f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb8316146113ff565b50503461088e57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261088e576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000004ddc2d193948926d02f9b1fe9e1daa0718270ed5168152f35b91905060e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610aa957611697612c69565b916064359160ff83168093036103f05760c435938415948515036103f057859273ffffffffffffffffffffffffffffffffffffffff80855416926116dc6102a36130e4565b833314801561176e575b6116f29061020261311d565b1690813b1561081b578460e49281955197889586947fd505accf00000000000000000000000000000000000000000000000000000000865285015230602485015260243560448501526044356064850152608484015260843560a484015260a43560c48401525af191826111ca57505061100157610ff3612fd8565b50337f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb8316146116e6565b80918460207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106c457813573ffffffffffffffffffffffffffffffffffffffff808554166117ec6101e56130e4565b3314801561188b575b6118019061020261311d565b47828110908318029061181e6118156133a9565b83851415612f3c565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21693843b15611887578592845195869384927fd0e30db000000000000000000000000000000000000000000000000000000000845218905af19081156103b757506103a75750f35b8580fd5b50337f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb8216146117f5565b915091806118c336612dbc565b9196839594919861193b73ffffffffffffffffffffffffffffffffffffffff94858454166118f26101e56130e4565b80331480156119d8575b6119089061020261311d565b88519b8c98899788967f5c2bea490000000000000000000000000000000000000000000000000000000088528701613616565b03927f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb165af19283156119ce578592869461199b575b505015611985575061021191610e006131f4565b9050610211916119936131f4565b911015612f3c565b80919294506119bf9350903d106119c7575b6119b78183612ec1565b8101906134ab565b913880611971565b503d6119ad565b82513d87823e3d90fd5b50337f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb8816146118fc565b9050817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610aa957611a36612c69565b91602435908473ffffffffffffffffffffffffffffffffffffffff8082541695611a6b611a616130e4565b6001891415612f3c565b8633148015611bdf575b611a819061020261311d565b16948251957f70a0823100000000000000000000000000000000000000000000000000000000875281868801526020948588602481855afa8015611bd5578697988597969791611b9a575b50918183869360649695109082180290611af0611ae76133a9565b83831415612f3c565b8851947f23b872dd0000000000000000000000000000000000000000000000000000000086528b8601523060248601521860448401525af13d15601f3d11600187511416171615611b3f578380f35b6064935051917f08c379a0000000000000000000000000000000000000000000000000000000008352820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152fd5b958092949395508691503d8311611bce575b611bb68183612ec1565b810103126103f0579251859388939092909184611acc565b503d611bac565b85513d86823e3d90fd5b50337f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb831614611a75565b9050611c1536612cd0565b73ffffffffffffffffffffffffffffffffffffffff959293959491949081885416611c416101e56130e4565b33148015611ddb575b611c569061020261311d565b611c6b611c61613156565b8383161515612f3c565b8187168451937f38d52e0f00000000000000000000000000000000000000000000000000000000855260209384868381865afa958615611dad578b96611db7575b50846024918851928380927f70a0823100000000000000000000000000000000000000000000000000000000825230878301528a165afa908115611dad579085949392918c91611d7e575b5088811090891802958689189a8b97611d0e6133a9565b611d1a918c1415612f3c565b611d239161322d565b8a87518097819582947f6e553f6500000000000000000000000000000000000000000000000000000000845283019161150a9290929173ffffffffffffffffffffffffffffffffffffffff6020916040840195845216910152565b85819692503d8311611da6575b611d958183612ec1565b810103126103f05784935138611cf7565b503d611d8b565b87513d8d823e3d90fd5b6024919650611dd38691823d8411610692576106828183612ec1565b969150611cac565b50337f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb831614611c4a565b91509180611e1336612dbc565b9196839594919861193b73ffffffffffffffffffffffffffffffffffffffff9485845416611e426101e56130e4565b8033148015611e8b575b611e589061020261311d565b88519b8c98899788967f50d8cd4b0000000000000000000000000000000000000000000000000000000088528701613616565b50337f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb881614611e4c565b50503461088e57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261088e5773ffffffffffffffffffffffffffffffffffffffff60209254169051908152f35b809184611f1336612d34565b9073ffffffffffffffffffffffffffffffffffffffff9993999892959694989586855416611f426101e56130e4565b33148015612118575b611f579061020261311d565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff88611f8f611f8461342e565b308b86161415612f3c565b14612063575b8896949286949261200a92611fd7611fad8c9a61348a565b987f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb16809961322d565b89519c8d998a9889977fa99aad8900000000000000000000000000000000000000000000000000000000895288016135ca565b03925af19283156119ce5785928694612040575b5050156120325750610211916119936131f4565b905061021191610e006131f4565b809192945061205b9350903d106119c7576119b78183612ec1565b91858061201e565b94929095939160249a9998975060208561207c8661348a565b1689519c8d80927f70a0823100000000000000000000000000000000000000000000000000000000825230878301525afa801561210e5788999a9b84999899916120d2575b509794965092949193909291611f95565b97505091506020863d8211612106575b816120ef60209383612ec1565b810103126103f05761200a8b9289975190916120c1565b3d91506120e2565b88513d85823e3d90fd5b50337f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb881614611f4b565b8383807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261088e57612176612c69565b906024359173ffffffffffffffffffffffffffffffffffffffff908180865416916121ac6121a26130e4565b6001851415612f3c565b82331480156122f8575b6121c29061020261311d565b1683517f70a082310000000000000000000000000000000000000000000000000000000081528288820152602081602481855afa80156122ee5787906122bb575b61221c91508681109087180295868118966105076133a9565b8285116122935785966e22d473030f116ddee9f6b43ac78ba393843b156103c057879460849386928851998a9788967f36c7851600000000000000000000000000000000000000000000000000000000885287015230602487015216604485015260648401525af19081156103b757506103a75750f35b8684517fc4bd89a9000000000000000000000000000000000000000000000000000000008152fd5b506020813d82116122e6575b816122d460209383612ec1565b810103126103f05761221c9051612203565b3d91506122c7565b85513d89823e3d90fd5b50337f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb8316146121b6565b80918461232f36612d34565b9073ffffffffffffffffffffffffffffffffffffffff999399989295969498958685541661235e6101e56130e4565b3314801561249c575b6123739061020261311d565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff886123a0611f8461342e565b146123f1575b8896949286949261200a926123be611fad8c9a61348a565b89519c8d998a9889977f20b76e8100000000000000000000000000000000000000000000000000000000895288016135ca565b94929095939160249a9998975060208561240a8661348a565b1689519c8d80927f70a0823100000000000000000000000000000000000000000000000000000000825230878301525afa801561210e5788999a9b8499989991612460575b5097949650929491939092916123a6565b97505091506020863d8211612494575b8161247d60209383612ec1565b810103126103f05761200a8b92899751909161244f565b3d9150612470565b50337f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb881614612367565b50503461088e57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261088e576020905173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb168152f35b91905061254236612cd0565b949092918673ffffffffffffffffffffffffffffffffffffffff8082541661256b6101e56130e4565b331480156126d7575b6125809061020261311d565b61259561258b613156565b828a161515612f3c565b6125a86125a061318f565b841515612f3c565b8416928651947f38d52e0f00000000000000000000000000000000000000000000000000000000865260209586818481895afa9081156126cd5784926126549b9694926125fe928a9997916126b0575b5061322d565b8851998a95869485937f94bf804d000000000000000000000000000000000000000000000000000000008552840190929173ffffffffffffffffffffffffffffffffffffffff6020916040840195845216910152565b03925af19283156126a757508492612675575b506102119250610e006131f4565b90915082813d83116126a0575b61268c8183612ec1565b810103126103f05761021191519038612667565b503d612682565b513d86823e3d90fd5b6126c79150893d8b11610692576106828183612ec1565b386125f8565b89513d86823e3d90fd5b50337f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb821614612574565b8360607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261024057610211612738612c69565b612740612c8c565b61277973ffffffffffffffffffffffffffffffffffffffff808654166127676101e56130e4565b3314908115612782575061020261311d565b60443591613721565b90507f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb163314866101f9565b80918460207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126106c457813573ffffffffffffffffffffffffffffffffffffffff808554166128016101e56130e4565b33148015612918575b6128169061020261311d565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21682517f70a082310000000000000000000000000000000000000000000000000000000081523085820152602081602481855afa90811561290e5786916128da575b50828110908318029061288d6118156133a9565b803b1561188757859283602492865197889586947f2e1a7d4d00000000000000000000000000000000000000000000000000000000865218908401525af19081156103b757506103a75750f35b9550506020853d8211612906575b816128f560209383612ec1565b810103126103f05785945187612879565b3d91506128e8565b84513d88823e3d90fd5b50337f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb82161461280a565b9190507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360160e081126110445760a013610aa95782612981612c46565b73ffffffffffffffffffffffffffffffffffffffff80835416946129b06129a66130e4565b6001881415612f3c565b8533148015612a5a575b6129c69061020261311d565b817f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb1692833b1561081b57612a2c936101049386928851998a9788967f8720316d00000000000000000000000000000000000000000000000000000000885287016134c1565b60a43560a487015260c48601521660e48401525af19081156103b75750612a51575080f35b61021190612e91565b50337f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb8316146129ba565b9181601f840112156103f05782359167ffffffffffffffff83116103f057602083818601950101116103f057565b346103f0576040807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103f05767ffffffffffffffff906024358281116103f057612b05903690600401612a85565b612b51612b1394929461311d565b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb163314612f3c565b83019160209384818503126103f0578035908382116103f057019183601f840112156103f057823593818511612c17578460051b91835195612b9588850188612ec1565b86528680870193860101948286116103f057878101935b868510612bbc5761001e88613008565b84358381116103f057820184603f820112156103f0578981013591612be083612f02565b612bec89519182612ec1565b838152868985850101116103f05760008c8581968c8397018386013783010152815201940193612bac565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60c4359073ffffffffffffffffffffffffffffffffffffffff821682036103f057565b6004359073ffffffffffffffffffffffffffffffffffffffff821682036103f057565b6024359073ffffffffffffffffffffffffffffffffffffffff821682036103f057565b359073ffffffffffffffffffffffffffffffffffffffff821682036103f057565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc60809101126103f05773ffffffffffffffffffffffffffffffffffffffff9060043582811681036103f05791602435916044359160643590811681036103f05790565b907ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc820161014081126103f05760a0136103f05760049160a4359160c4359160e435916101043573ffffffffffffffffffffffffffffffffffffffff811681036103f05791610124359067ffffffffffffffff82116103f057612db8918801612a85565b9091565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0161012081126103f05760a0136103f05760049060a4359060c4359060e435906101043573ffffffffffffffffffffffffffffffffffffffff811681036103f05790565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc60a09101126103f05773ffffffffffffffffffffffffffffffffffffffff60043581811681036103f05791602435916044359160643582811681036103f0579160843590811681036103f05790565b67ffffffffffffffff8111612c1757604052565b6040810190811067ffffffffffffffff821117612c1757604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117612c1757604052565b67ffffffffffffffff8111612c1757601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b15612f445750565b604051907f08c379a000000000000000000000000000000000000000000000000000000000825281602080600483015282519283602484015260005b848110612fc1575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f836000604480968601015201168101030190fd5b818101830151868201604401528593508201612f80565b3d15613003573d90612fe982612f02565b91612ff76040519384612ec1565b82523d6000602084013e565b606090565b60005b8151811015613097576000806020808460051b860101519081519101305af4613032612fd8565b9015610ffc57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146130685760010161300b565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b5050565b8051906130df6040516130ad81612ea5565b600b81527f63616c6c206661696c65640000000000000000000000000000000000000000006020820152831515612f3c565b602001fd5b604051906130f182612ea5565b600b82527f756e696e697469617465640000000000000000000000000000000000000000006020830152565b6040519061312a82612ea5565b601382527f756e617574686f72697a65642073656e646572000000000000000000000000006020830152565b6040519061316382612ea5565b600c82527f7a65726f206164647265737300000000000000000000000000000000000000006020830152565b6040519061319c82612ea5565b600b82527f7a65726f207368617265730000000000000000000000000000000000000000006020830152565b908160209103126103f0575173ffffffffffffffffffffffffffffffffffffffff811681036103f05790565b6040519061320182612ea5565b601182527f736c6970706167652065786365656465640000000000000000000000000000006020830152565b73ffffffffffffffffffffffffffffffffffffffff80911690604051927fdd62ed3e000000000000000000000000000000000000000000000000000000008452306004850152168060248401526020928381604481865afa90811561339d57600091613370575b501561329f57505050565b6044600091828594604051927f095ea7b300000000000000000000000000000000000000000000000000000000845260048401527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60248401525af13d15601f3d11600160005114161716156133125750565b606490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152600e60248201527f415050524f56455f4641494c45440000000000000000000000000000000000006044820152fd5b908482813d8311613396575b6133868183612ec1565b8101031261024057505138613294565b503d61337c565b6040513d6000823e3d90fd5b604051906133b682612ea5565b600b82527f7a65726f20616d6f756e740000000000000000000000000000000000000000006020830152565b8181029291811591840414171561306857565b6040519061340282612ea5565b601082527f756e6578706563746564206f776e6572000000000000000000000000000000006020830152565b6040519061343b82612ea5565b600f82527f62756e646c6572206164647265737300000000000000000000000000000000006020830152565b60243573ffffffffffffffffffffffffffffffffffffffff811681036103f05790565b3573ffffffffffffffffffffffffffffffffffffffff811681036103f05790565b91908260409103126103f0576020825192015190565b60043573ffffffffffffffffffffffffffffffffffffffff908181168091036103f05782526024358181168091036103f05760208301526044358181168091036103f05760408301526064359081168091036103f05760608201526080608435910152565b6080809173ffffffffffffffffffffffffffffffffffffffff8061354983612caf565b1685528061355960208401612caf565b1660208601528061356c60408401612caf565b16604086015261357e60608301612caf565b1660608501520135910152565b601f82602094937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0938186528686013760008582860101520116010190565b919373ffffffffffffffffffffffffffffffffffffffff919361361397956135f58561012097613526565b60a085015260c08401521660e082015281610100820152019161358b565b90565b939192610100939695919661363086610120810199613526565b60a086015260c085015273ffffffffffffffffffffffffffffffffffffffff80921660e085015216910152565b61369b73ffffffffffffffffffffffffffffffffffffffff821661368a613682613156565b821515612f3c565b61369261342e565b90301415612f3c565b478281109083180280831461371c5760009283928392839218905af1156136be57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4554485f5452414e534645525f4641494c4544000000000000000000000000006044820152fd5b505050565b919073ffffffffffffffffffffffffffffffffffffffff80911692613747610d76613156565b61375b61375261342e565b30861415612f3c565b16604051927f70a082310000000000000000000000000000000000000000000000000000000084523060048501526020938481602481865afa90811561339d5760009161386c575b50838110908418029081841461386557600080936044938796604051947fa9059cbb00000000000000000000000000000000000000000000000000000000865260048601521860248401525af13d15601f3d11600160005114161716156138075750565b606490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152fd5b5050505050565b908582813d8311613892575b6138828183612ec1565b81010312610240575051386137a3565b503d61387856fea26469706673582212204ddd178b72fb1f216e3d0628a1c4bf0e7d604676f77ca9c96f25d7eb38ee294864736f6c63430008150033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000004ddc2d193948926d02f9b1fe9e1daa0718270ed5
-----Decoded View---------------
Arg [0] : morpho (address): 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb
Arg [1] : wNative (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [2] : cEth (address): 0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb
Arg [1] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [2] : 0000000000000000000000004ddc2d193948926d02f9b1fe9e1daa0718270ed5
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ 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.