Overview
S Balance
S Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
FeeFlowController
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 20000 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity 0.8.24; import {ERC20} from "solmate/tokens/ERC20.sol"; import {SafeTransferLib} from "solmate/utils/SafeTransferLib.sol"; import {EVCUtil} from "evc/utils/EVCUtil.sol"; /// @title FeeFlowController /// @author Euler Labs (https://eulerlabs.com) /// @notice Continous back to back dutch auctions selling any asset received by this contract contract FeeFlowController is EVCUtil { using SafeTransferLib for ERC20; uint256 public constant MIN_EPOCH_PERIOD = 1 hours; uint256 public constant MAX_EPOCH_PERIOD = 365 days; uint256 public constant MIN_PRICE_MULTIPLIER = 1.1e18; // Should at least be 110% of settlement price uint256 public constant MAX_PRICE_MULTIPLIER = 3e18; // Should not exceed 300% of settlement price uint256 public constant ABS_MIN_INIT_PRICE = 1e6; // Minimum sane value for init price uint256 public constant ABS_MAX_INIT_PRICE = type(uint192).max; // chosen so that initPrice * priceMultiplier does not exceed uint256 uint256 public constant PRICE_MULTIPLIER_SCALE = 1e18; ERC20 public immutable paymentToken; address public immutable paymentReceiver; uint256 public immutable epochPeriod; uint256 public immutable priceMultiplier; uint256 public immutable minInitPrice; struct Slot0 { uint8 locked; // 1 if locked, 2 if unlocked uint16 epochId; // intentionally overflowable uint192 initPrice; uint40 startTime; } Slot0 internal slot0; event Buy(address indexed buyer, address indexed assetsReceiver, uint256 paymentAmount); error Reentrancy(); error InitPriceBelowMin(); error InitPriceExceedsMax(); error EpochPeriodBelowMin(); error EpochPeriodExceedsMax(); error PriceMultiplierBelowMin(); error PriceMultiplierExceedsMax(); error MinInitPriceBelowMin(); error MinInitPriceExceedsAbsMaxInitPrice(); error DeadlinePassed(); error EmptyAssets(); error EpochIdMismatch(); error MaxPaymentTokenAmountExceeded(); error PaymentReceiverIsThis(); modifier nonReentrant() { if (slot0.locked == 2) revert Reentrancy(); slot0.locked = 2; _; slot0.locked = 1; } modifier nonReentrantView() { if (slot0.locked == 2) revert Reentrancy(); _; } /// @dev Initializes the FeeFlowController contract with the specified parameters. /// @param evc The address of the Ethereum Vault Connector (EVC) contract. /// @param initPrice The initial price for the first epoch. /// @param paymentToken_ The address of the payment token. /// @param paymentReceiver_ The address of the payment receiver. /// @param epochPeriod_ The duration of each epoch period. /// @param priceMultiplier_ The multiplier for adjusting the price from one epoch to the next. /// @param minInitPrice_ The minimum allowed initial price for an epoch. /// @notice This constructor performs parameter validation and sets the initial values for the contract. constructor( address evc, uint256 initPrice, address paymentToken_, address paymentReceiver_, uint256 epochPeriod_, uint256 priceMultiplier_, uint256 minInitPrice_ ) EVCUtil(evc) { if (initPrice < minInitPrice_) revert InitPriceBelowMin(); if (initPrice > ABS_MAX_INIT_PRICE) revert InitPriceExceedsMax(); if (epochPeriod_ < MIN_EPOCH_PERIOD) revert EpochPeriodBelowMin(); if (epochPeriod_ > MAX_EPOCH_PERIOD) revert EpochPeriodExceedsMax(); if (priceMultiplier_ < MIN_PRICE_MULTIPLIER) revert PriceMultiplierBelowMin(); if (priceMultiplier_ > MAX_PRICE_MULTIPLIER) revert PriceMultiplierExceedsMax(); if (minInitPrice_ < ABS_MIN_INIT_PRICE) revert MinInitPriceBelowMin(); if (minInitPrice_ > ABS_MAX_INIT_PRICE) revert MinInitPriceExceedsAbsMaxInitPrice(); if (paymentReceiver_ == address(this)) revert PaymentReceiverIsThis(); slot0.initPrice = uint192(initPrice); slot0.startTime = uint40(block.timestamp); paymentToken = ERC20(paymentToken_); paymentReceiver = paymentReceiver_; epochPeriod = epochPeriod_; priceMultiplier = priceMultiplier_; minInitPrice = minInitPrice_; } /// @dev Allows a user to buy assets by transferring payment tokens and receiving the assets. /// @param assets The addresses of the assets to be bought. /// @param assetsReceiver The address that will receive the bought assets. /// @param epochId Id of the epoch to buy from, will revert if not the current epoch /// @param deadline The deadline timestamp for the purchase. /// @param maxPaymentTokenAmount The maximum amount of payment tokens the user is willing to spend. /// @return paymentAmount The amount of payment tokens transferred for the purchase. /// @notice This function performs various checks and transfers the payment tokens to the payment receiver. /// It also transfers the assets to the assets receiver and sets up a new auction with an updated initial price. function buy( address[] calldata assets, address assetsReceiver, uint256 epochId, uint256 deadline, uint256 maxPaymentTokenAmount ) external nonReentrant returns (uint256 paymentAmount) { if (block.timestamp > deadline) revert DeadlinePassed(); if (assets.length == 0) revert EmptyAssets(); Slot0 memory slot0Cache = slot0; if (uint16(epochId) != slot0Cache.epochId) revert EpochIdMismatch(); address sender = _msgSender(); paymentAmount = getPriceFromCache(slot0Cache); if (paymentAmount > maxPaymentTokenAmount) revert MaxPaymentTokenAmountExceeded(); if (paymentAmount > 0) { paymentToken.safeTransferFrom(sender, paymentReceiver, paymentAmount); } for (uint256 i = 0; i < assets.length; ++i) { // Transfer full balance to buyer uint256 balance = ERC20(assets[i]).balanceOf(address(this)); ERC20(assets[i]).safeTransfer(assetsReceiver, balance); } // Setup new auction uint256 newInitPrice = paymentAmount * priceMultiplier / PRICE_MULTIPLIER_SCALE; if (newInitPrice > ABS_MAX_INIT_PRICE) { newInitPrice = ABS_MAX_INIT_PRICE; } else if (newInitPrice < minInitPrice) { newInitPrice = minInitPrice; } // epochID is allowed to overflow, effectively reusing them unchecked { slot0Cache.epochId++; } slot0Cache.initPrice = uint192(newInitPrice); slot0Cache.startTime = uint40(block.timestamp); // Write cache in single write slot0 = slot0Cache; emit Buy(sender, assetsReceiver, paymentAmount); return paymentAmount; } /// @dev Retrieves the current price from the cache based on the elapsed time since the start of the epoch. /// @param slot0Cache The Slot0 struct containing the initial price and start time of the epoch. /// @return price The current price calculated based on the elapsed time and the initial price. /// @notice This function calculates the current price by subtracting a fraction of the initial price based on the elapsed time. // If the elapsed time exceeds the epoch period, the price will be 0. function getPriceFromCache(Slot0 memory slot0Cache) internal view returns (uint256) { uint256 timePassed = block.timestamp - slot0Cache.startTime; if (timePassed > epochPeriod) { return 0; } return slot0Cache.initPrice - slot0Cache.initPrice * timePassed / epochPeriod; } /// @dev Calculates the current price /// @return price The current price calculated based on the elapsed time and the initial price. /// @notice Uses the internal function `getPriceFromCache` to calculate the current price. function getPrice() external view nonReentrantView returns (uint256) { return getPriceFromCache(slot0); } /// @dev Retrieves Slot0 as a memory struct /// @return Slot0 The Slot0 value as a Slot0 struct function getSlot0() external view nonReentrantView returns (Slot0 memory) { return slot0; } }
// 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: 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: MIT pragma solidity ^0.8.0; import {IEVC} from "../interfaces/IEthereumVaultConnector.sol"; import {ExecutionContext, EC} from "../ExecutionContext.sol"; /// @title EVCUtil /// @custom:security-contact [email protected] /// @author Euler Labs (https://www.eulerlabs.com/) /// @notice This contract is an abstract base contract for interacting with the Ethereum Vault Connector (EVC). /// It provides utility functions for authenticating the callers in the context of the EVC, a pattern for enforcing the /// contracts to be called through the EVC. abstract contract EVCUtil { using ExecutionContext for EC; uint160 internal constant ACCOUNT_ID_OFFSET = 8; IEVC internal immutable evc; error EVC_InvalidAddress(); error NotAuthorized(); error ControllerDisabled(); constructor(address _evc) { if (_evc == address(0)) revert EVC_InvalidAddress(); evc = IEVC(_evc); } /// @notice Returns the address of the Ethereum Vault Connector (EVC) used by this contract. /// @return The address of the EVC contract. function EVC() external view virtual returns (address) { return address(evc); } /// @notice Ensures that the msg.sender is the EVC by using the EVC callback functionality if necessary. /// @dev Optional to use for functions requiring account and vault status checks to enforce predictable behavior. /// @dev If this modifier used in conjuction with any other modifier, it must appear as the first (outermost) /// modifier of the function. modifier callThroughEVC() virtual { _callThroughEVC(); _; } /// @notice Ensures that the caller is the EVC in the appropriate context. /// @dev Should be used for checkAccountStatus and checkVaultStatus functions. modifier onlyEVCWithChecksInProgress() virtual { _onlyEVCWithChecksInProgress(); _; } /// @notice Ensures a standard authentication path on the EVC allowing the account owner or any of its EVC accounts. /// @dev This modifier checks if the caller is the EVC and if so, verifies the execution context. /// It reverts if the operator is authenticated, control collateral is in progress, or checks are in progress. /// @dev This modifier must not be used on functions utilized by liquidation flows, i.e. transfer or withdraw. /// @dev This modifier must not be used on checkAccountStatus and checkVaultStatus functions. /// @dev This modifier can be used on access controlled functions to prevent non-standard authentication paths on /// the EVC. modifier onlyEVCAccount() virtual { _authenticateCallerWithStandardContextState(false); _; } /// @notice Ensures a standard authentication path on the EVC. /// @dev This modifier checks if the caller is the EVC and if so, verifies the execution context. /// It reverts if the operator is authenticated, control collateral is in progress, or checks are in progress. /// It reverts if the authenticated account owner is known and it is not the account owner. /// @dev It assumes that if the caller is not the EVC, the caller is the account owner. /// @dev This modifier must not be used on functions utilized by liquidation flows, i.e. transfer or withdraw. /// @dev This modifier must not be used on checkAccountStatus and checkVaultStatus functions. /// @dev This modifier can be used on access controlled functions to prevent non-standard authentication paths on /// the EVC. modifier onlyEVCAccountOwner() virtual { _authenticateCallerWithStandardContextState(true); _; } /// @notice Checks whether the specified account and the other account have the same owner. /// @dev The function is used to check whether one account is authorized to perform operations on behalf of the /// other. Accounts are considered to have a common owner if they share the first 19 bytes of their address. /// @param account The address of the account that is being checked. /// @param otherAccount The address of the other account that is being checked. /// @return A boolean flag that indicates whether the accounts have the same owner. function _haveCommonOwner(address account, address otherAccount) internal pure returns (bool) { bool result; assembly { result := lt(xor(account, otherAccount), 0x100) } return result; } /// @notice Returns the address prefix of the specified account. /// @dev The address prefix is the first 19 bytes of the account address. /// @param account The address of the account whose address prefix is being retrieved. /// @return A bytes19 value that represents the address prefix of the account. function _getAddressPrefix(address account) internal pure returns (bytes19) { return bytes19(uint152(uint160(account) >> ACCOUNT_ID_OFFSET)); } /// @notice Retrieves the message sender in the context of the EVC. /// @dev This function returns the account on behalf of which the current operation is being performed, which is /// either msg.sender or the account authenticated by the EVC. /// @return The address of the message sender. function _msgSender() internal view virtual returns (address) { address sender = msg.sender; if (sender == address(evc)) { (sender,) = evc.getCurrentOnBehalfOfAccount(address(0)); } return sender; } /// @notice Retrieves the message sender in the context of the EVC for a borrow operation. /// @dev This function returns the account on behalf of which the current operation is being performed, which is /// either msg.sender or the account authenticated by the EVC. This function reverts if this contract is not enabled /// as a controller for the account on behalf of which the operation is being executed. /// @return The address of the message sender. function _msgSenderForBorrow() internal view virtual returns (address) { address sender = msg.sender; bool controllerEnabled; if (sender == address(evc)) { (sender, controllerEnabled) = evc.getCurrentOnBehalfOfAccount(address(this)); } else { controllerEnabled = evc.isControllerEnabled(sender, address(this)); } if (!controllerEnabled) { revert ControllerDisabled(); } return sender; } /// @notice Retrieves the message sender, ensuring it's any EVC account meaning that the execution context is in a /// standard state (not operator authenticated, not control collateral in progress, not checks in progress). /// @dev This function must not be used on functions utilized by liquidation flows, i.e. transfer or withdraw. /// @dev This function must not be used on checkAccountStatus and checkVaultStatus functions. /// @dev This function can be used on access controlled functions to prevent non-standard authentication paths on /// the EVC. /// @return The address of the message sender. function _msgSenderOnlyEVCAccount() internal view returns (address) { return _authenticateCallerWithStandardContextState(false); } /// @notice Retrieves the message sender, ensuring it's the EVC account owner and that the execution context is in a /// standard state (not operator authenticated, not control collateral in progress, not checks in progress). /// @dev It assumes that if the caller is not the EVC, the caller is the account owner. /// @dev This function must not be used on functions utilized by liquidation flows, i.e. transfer or withdraw. /// @dev This function must not be used on checkAccountStatus and checkVaultStatus functions. /// @dev This function can be used on access controlled functions to prevent non-standard authentication paths on /// the EVC. /// @return The address of the message sender. function _msgSenderOnlyEVCAccountOwner() internal view returns (address) { return _authenticateCallerWithStandardContextState(true); } /// @notice Calls the current external function through the EVC. /// @dev This function is used to route the current call through the EVC if it's not already coming from the EVC. It /// makes the EVC set the execution context and call back this contract with unchanged calldata. msg.sender is used /// as the onBehalfOfAccount. /// @dev This function shall only be used by the callThroughEVC modifier. function _callThroughEVC() internal { address _evc = address(evc); if (msg.sender == _evc) return; assembly { mstore(0, 0x1f8b521500000000000000000000000000000000000000000000000000000000) // EVC.call selector mstore(4, address()) // EVC.call 1st argument - address(this) mstore(36, caller()) // EVC.call 2nd argument - msg.sender mstore(68, callvalue()) // EVC.call 3rd argument - msg.value mstore(100, 128) // EVC.call 4th argument - msg.data, offset to the start of encoding - 128 bytes mstore(132, calldatasize()) // msg.data length calldatacopy(164, 0, calldatasize()) // original calldata // abi encoded bytes array should be zero padded so its length is a multiple of 32 // store zero word after msg.data bytes and round up calldatasize to nearest multiple of 32 mstore(add(164, calldatasize()), 0) let result := call(gas(), _evc, callvalue(), 0, add(164, and(add(calldatasize(), 31), not(31))), 0, 0) returndatacopy(0, 0, returndatasize()) switch result case 0 { revert(0, returndatasize()) } default { return(64, sub(returndatasize(), 64)) } // strip bytes encoding from call return } } /// @notice Ensures that the function is called only by the EVC during the checks phase /// @dev Reverts if the caller is not the EVC or if checks are not in progress. function _onlyEVCWithChecksInProgress() internal view { if (msg.sender != address(evc) || !evc.areChecksInProgress()) { revert NotAuthorized(); } } /// @notice Ensures that the function is called only by the EVC account owner or any of its EVC accounts /// @dev This function checks if the caller is the EVC and if so, verifies that the execution context is not in a /// special state (operator authenticated, collateral control in progress, or checks in progress). If /// onlyAccountOwner is true and the owner was already registered on the EVC, it verifies that the onBehalfOfAccount /// is the owner. If onlyAccountOwner is false, it allows any EVC account of the owner to call the function. /// @param onlyAccountOwner If true, only allows the account owner; if false, allows any EVC account of the owner /// @return The address of the message sender. function _authenticateCallerWithStandardContextState(bool onlyAccountOwner) internal view returns (address) { if (msg.sender == address(evc)) { EC ec = EC.wrap(evc.getRawExecutionContext()); if (ec.isOperatorAuthenticated() || ec.isControlCollateralInProgress() || ec.areChecksInProgress()) { revert NotAuthorized(); } address onBehalfOfAccount = ec.getOnBehalfOfAccount(); if (onlyAccountOwner) { address owner = evc.getAccountOwner(onBehalfOfAccount); if (owner != address(0) && owner != onBehalfOfAccount) { revert NotAuthorized(); } } return onBehalfOfAccount; } return msg.sender; } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.0; /// @title IEVC /// @custom:security-contact [email protected] /// @author Euler Labs (https://www.eulerlabs.com/) /// @notice This interface defines the methods for the Ethereum Vault Connector. interface IEVC { /// @notice A struct representing a batch item. /// @dev Each batch item represents a single operation to be performed within a checks deferred context. struct BatchItem { /// @notice The target contract to be called. address targetContract; /// @notice The account on behalf of which the operation is to be performed. msg.sender must be authorized to /// act on behalf of this account. Must be address(0) if the target contract is the EVC itself. address onBehalfOfAccount; /// @notice The amount of value to be forwarded with the call. If the value is type(uint256).max, the whole /// balance of the EVC contract will be forwarded. Must be 0 if the target contract is the EVC itself. uint256 value; /// @notice The encoded data which is called on the target contract. bytes data; } /// @notice A struct representing the result of a batch item operation. /// @dev Used only for simulation purposes. struct BatchItemResult { /// @notice A boolean indicating whether the operation was successful. bool success; /// @notice The result of the operation. bytes result; } /// @notice A struct representing the result of the account or vault status check. /// @dev Used only for simulation purposes. struct StatusCheckResult { /// @notice The address of the account or vault for which the check was performed. address checkedAddress; /// @notice A boolean indicating whether the status of the account or vault is valid. bool isValid; /// @notice The result of the check. bytes result; } /// @notice Returns current raw execution context. /// @dev When checks in progress, on behalf of account is always address(0). /// @return context Current raw execution context. function getRawExecutionContext() external view returns (uint256 context); /// @notice Returns an account on behalf of which the operation is being executed at the moment and whether the /// controllerToCheck is an enabled controller for that account. /// @dev This function should only be used by external smart contracts if msg.sender is the EVC. Otherwise, the /// account address returned must not be trusted. /// @dev When checks in progress, on behalf of account is always address(0). When address is zero, the function /// reverts to protect the consumer from ever relying on the on behalf of account address which is in its default /// state. /// @param controllerToCheck The address of the controller for which it is checked whether it is an enabled /// controller for the account on behalf of which the operation is being executed at the moment. /// @return onBehalfOfAccount An account that has been authenticated and on behalf of which the operation is being /// executed at the moment. /// @return controllerEnabled A boolean value that indicates whether controllerToCheck is an enabled controller for /// the account on behalf of which the operation is being executed at the moment. Always false if controllerToCheck /// is address(0). function getCurrentOnBehalfOfAccount(address controllerToCheck) external view returns (address onBehalfOfAccount, bool controllerEnabled); /// @notice Checks if checks are deferred. /// @return A boolean indicating whether checks are deferred. function areChecksDeferred() external view returns (bool); /// @notice Checks if checks are in progress. /// @return A boolean indicating whether checks are in progress. function areChecksInProgress() external view returns (bool); /// @notice Checks if control collateral is in progress. /// @return A boolean indicating whether control collateral is in progress. function isControlCollateralInProgress() external view returns (bool); /// @notice Checks if an operator is authenticated. /// @return A boolean indicating whether an operator is authenticated. function isOperatorAuthenticated() external view returns (bool); /// @notice Checks if a simulation is in progress. /// @return A boolean indicating whether a simulation is in progress. function isSimulationInProgress() external view returns (bool); /// @notice Checks whether the specified account and the other account have the same owner. /// @dev The function is used to check whether one account is authorized to perform operations on behalf of the /// other. Accounts are considered to have a common owner if they share the first 19 bytes of their address. /// @param account The address of the account that is being checked. /// @param otherAccount The address of the other account that is being checked. /// @return A boolean flag that indicates whether the accounts have the same owner. function haveCommonOwner(address account, address otherAccount) external pure returns (bool); /// @notice Returns the address prefix of the specified account. /// @dev The address prefix is the first 19 bytes of the account address. /// @param account The address of the account whose address prefix is being retrieved. /// @return A bytes19 value that represents the address prefix of the account. function getAddressPrefix(address account) external pure returns (bytes19); /// @notice Returns the owner for the specified account. /// @dev The function returns address(0) if the owner is not registered. Registration of the owner happens on the /// initial /// interaction with the EVC that requires authentication of an owner. /// @param account The address of the account whose owner is being retrieved. /// @return owner The address of the account owner. An account owner is an EOA/smart contract which address matches /// the first 19 bytes of the account address. function getAccountOwner(address account) external view returns (address); /// @notice Checks if lockdown mode is enabled for a given address prefix. /// @param addressPrefix The address prefix to check for lockdown mode status. /// @return A boolean indicating whether lockdown mode is enabled. function isLockdownMode(bytes19 addressPrefix) external view returns (bool); /// @notice Checks if permit functionality is disabled for a given address prefix. /// @param addressPrefix The address prefix to check for permit functionality status. /// @return A boolean indicating whether permit functionality is disabled. function isPermitDisabledMode(bytes19 addressPrefix) external view returns (bool); /// @notice Returns the current nonce for a given address prefix and nonce namespace. /// @dev Each nonce namespace provides 256 bit nonce that has to be used sequentially. There's no requirement to use /// all the nonces for a given nonce namespace before moving to the next one which allows to use permit messages in /// a non-sequential manner. /// @param addressPrefix The address prefix for which the nonce is being retrieved. /// @param nonceNamespace The nonce namespace for which the nonce is being retrieved. /// @return nonce The current nonce for the given address prefix and nonce namespace. function getNonce(bytes19 addressPrefix, uint256 nonceNamespace) external view returns (uint256 nonce); /// @notice Returns the bit field for a given address prefix and operator. /// @dev The bit field is used to store information about authorized operators for a given address prefix. Each bit /// in the bit field corresponds to one account belonging to the same owner. If the bit is set, the operator is /// authorized for the account. /// @param addressPrefix The address prefix for which the bit field is being retrieved. /// @param operator The address of the operator for which the bit field is being retrieved. /// @return operatorBitField The bit field for the given address prefix and operator. The bit field defines which /// accounts the operator is authorized for. It is a 256-position binary array like 0...010...0, marking the account /// positionally in a uint256. The position in the bit field corresponds to the account ID (0-255), where 0 is the /// owner account's ID. function getOperator(bytes19 addressPrefix, address operator) external view returns (uint256 operatorBitField); /// @notice Returns whether a given operator has been authorized for a given account. /// @param account The address of the account whose operator is being checked. /// @param operator The address of the operator that is being checked. /// @return authorized A boolean value that indicates whether the operator is authorized for the account. function isAccountOperatorAuthorized(address account, address operator) external view returns (bool authorized); /// @notice Enables or disables lockdown mode for a given address prefix. /// @dev This function can only be called by the owner of the address prefix. To disable this mode, the EVC /// must be called directly. It is not possible to disable this mode by using checks-deferrable call or /// permit message. /// @param addressPrefix The address prefix for which the lockdown mode is being set. /// @param enabled A boolean indicating whether to enable or disable lockdown mode. function setLockdownMode(bytes19 addressPrefix, bool enabled) external payable; /// @notice Enables or disables permit functionality for a given address prefix. /// @dev This function can only be called by the owner of the address prefix. To disable this mode, the EVC /// must be called directly. It is not possible to disable this mode by using checks-deferrable call or (by /// definition) permit message. To support permit functionality by default, note that the logic was inverted here. To /// disable the permit functionality, one must pass true as the second argument. To enable the permit /// functionality, one must pass false as the second argument. /// @param addressPrefix The address prefix for which the permit functionality is being set. /// @param enabled A boolean indicating whether to enable or disable the disable-permit mode. function setPermitDisabledMode(bytes19 addressPrefix, bool enabled) external payable; /// @notice Sets the nonce for a given address prefix and nonce namespace. /// @dev This function can only be called by the owner of the address prefix. Each nonce namespace provides a 256 /// bit nonce that has to be used sequentially. There's no requirement to use all the nonces for a given nonce /// namespace before moving to the next one which allows the use of permit messages in a non-sequential manner. To /// invalidate signed permit messages, set the nonce for a given nonce namespace accordingly. To invalidate all the /// permit messages for a given nonce namespace, set the nonce to type(uint).max. /// @param addressPrefix The address prefix for which the nonce is being set. /// @param nonceNamespace The nonce namespace for which the nonce is being set. /// @param nonce The new nonce for the given address prefix and nonce namespace. function setNonce(bytes19 addressPrefix, uint256 nonceNamespace, uint256 nonce) external payable; /// @notice Sets the bit field for a given address prefix and operator. /// @dev This function can only be called by the owner of the address prefix. Each bit in the bit field corresponds /// to one account belonging to the same owner. If the bit is set, the operator is authorized for the account. /// @param addressPrefix The address prefix for which the bit field is being set. /// @param operator The address of the operator for which the bit field is being set. Can neither be the EVC address /// nor an address belonging to the same address prefix. /// @param operatorBitField The new bit field for the given address prefix and operator. Reverts if the provided /// value is equal to the currently stored value. function setOperator(bytes19 addressPrefix, address operator, uint256 operatorBitField) external payable; /// @notice Authorizes or deauthorizes an operator for the account. /// @dev Only the owner or authorized operator of the account can call this function. An operator is an address that /// can perform actions for an account on behalf of the owner. If it's an operator calling this function, it can /// only deauthorize itself. /// @param account The address of the account whose operator is being set or unset. /// @param operator The address of the operator that is being installed or uninstalled. Can neither be the EVC /// address nor an address belonging to the same owner as the account. /// @param authorized A boolean value that indicates whether the operator is being authorized or deauthorized. /// Reverts if the provided value is equal to the currently stored value. function setAccountOperator(address account, address operator, bool authorized) external payable; /// @notice Returns an array of collaterals enabled for an account. /// @dev A collateral is a vault for which an account's balances are under the control of the currently enabled /// controller vault. /// @param account The address of the account whose collaterals are being queried. /// @return An array of addresses that are enabled collaterals for the account. function getCollaterals(address account) external view returns (address[] memory); /// @notice Returns whether a collateral is enabled for an account. /// @dev A collateral is a vault for which account's balances are under the control of the currently enabled /// controller vault. /// @param account The address of the account that is being checked. /// @param vault The address of the collateral that is being checked. /// @return A boolean value that indicates whether the vault is an enabled collateral for the account or not. function isCollateralEnabled(address account, address vault) external view returns (bool); /// @notice Enables a collateral for an account. /// @dev A collaterals is a vault for which account's balances are under the control of the currently enabled /// controller vault. Only the owner or an operator of the account can call this function. Unless it's a duplicate, /// the collateral is added to the end of the array. There can be at most 10 unique collaterals enabled at a time. /// Account status checks are performed. /// @param account The account address for which the collateral is being enabled. /// @param vault The address being enabled as a collateral. function enableCollateral(address account, address vault) external payable; /// @notice Disables a collateral for an account. /// @dev This function does not preserve the order of collaterals in the array obtained using the getCollaterals /// function; the order may change. A collateral is a vault for which account’s balances are under the control of /// the currently enabled controller vault. Only the owner or an operator of the account can call this function. /// Disabling a collateral might change the order of collaterals in the array obtained using getCollaterals /// function. Account status checks are performed. /// @param account The account address for which the collateral is being disabled. /// @param vault The address of a collateral being disabled. function disableCollateral(address account, address vault) external payable; /// @notice Swaps the position of two collaterals so that they appear switched in the array of collaterals for a /// given account obtained by calling getCollaterals function. /// @dev A collateral is a vault for which account’s balances are under the control of the currently enabled /// controller vault. Only the owner or an operator of the account can call this function. The order of collaterals /// can be changed by specifying the indices of the two collaterals to be swapped. Indices are zero-based and must /// be in the range of 0 to the number of collaterals minus 1. index1 must be lower than index2. Account status /// checks are performed. /// @param account The address of the account for which the collaterals are being reordered. /// @param index1 The index of the first collateral to be swapped. /// @param index2 The index of the second collateral to be swapped. function reorderCollaterals(address account, uint8 index1, uint8 index2) external payable; /// @notice Returns an array of enabled controllers for an account. /// @dev A controller is a vault that has been chosen for an account to have special control over the account's /// balances in enabled collaterals vaults. A user can have multiple controllers during a call execution, but at /// most one can be selected when the account status check is performed. /// @param account The address of the account whose controllers are being queried. /// @return An array of addresses that are the enabled controllers for the account. function getControllers(address account) external view returns (address[] memory); /// @notice Returns whether a controller is enabled for an account. /// @dev A controller is a vault that has been chosen for an account to have special control over account’s /// balances in the enabled collaterals vaults. /// @param account The address of the account that is being checked. /// @param vault The address of the controller that is being checked. /// @return A boolean value that indicates whether the vault is enabled controller for the account or not. function isControllerEnabled(address account, address vault) external view returns (bool); /// @notice Enables a controller for an account. /// @dev A controller is a vault that has been chosen for an account to have special control over account’s /// balances in the enabled collaterals vaults. Only the owner or an operator of the account can call this function. /// Unless it's a duplicate, the controller is added to the end of the array. Transiently, there can be at most 10 /// unique controllers enabled at a time, but at most one can be enabled after the outermost checks-deferrable /// call concludes. Account status checks are performed. /// @param account The address for which the controller is being enabled. /// @param vault The address of the controller being enabled. function enableController(address account, address vault) external payable; /// @notice Disables a controller for an account. /// @dev A controller is a vault that has been chosen for an account to have special control over account’s /// balances in the enabled collaterals vaults. Only the vault itself can call this function. Disabling a controller /// might change the order of controllers in the array obtained using getControllers function. Account status checks /// are performed. /// @param account The address for which the calling controller is being disabled. function disableController(address account) external payable; /// @notice Executes signed arbitrary data by self-calling into the EVC. /// @dev Low-level call function is used to execute the arbitrary data signed by the owner or the operator on the /// EVC contract. During that call, EVC becomes msg.sender. /// @param signer The address signing the permit message (ECDSA) or verifying the permit message signature /// (ERC-1271). It's also the owner or the operator of all the accounts for which authentication will be needed /// during the execution of the arbitrary data call. /// @param sender The address of the msg.sender which is expected to execute the data signed by the signer. If /// address(0) is passed, the msg.sender is ignored. /// @param nonceNamespace The nonce namespace for which the nonce is being used. /// @param nonce The nonce for the given account and nonce namespace. A valid nonce value is considered to be the /// value currently stored and can take any value between 0 and type(uint256).max - 1. /// @param deadline The timestamp after which the permit is considered expired. /// @param value The amount of value to be forwarded with the call. If the value is type(uint256).max, the whole /// balance of the EVC contract will be forwarded. /// @param data The encoded data which is self-called on the EVC contract. /// @param signature The signature of the data signed by the signer. function permit( address signer, address sender, uint256 nonceNamespace, uint256 nonce, uint256 deadline, uint256 value, bytes calldata data, bytes calldata signature ) external payable; /// @notice Calls into a target contract as per data encoded. /// @dev This function defers the account and vault status checks (it's a checks-deferrable call). If the outermost /// call ends, the account and vault status checks are performed. /// @dev This function can be used to interact with any contract while checks are deferred. If the target contract /// is msg.sender, msg.sender is called back with the calldata provided and the context set up according to the /// account provided. If the target contract is not msg.sender, only the owner or the operator of the account /// provided can call this function. /// @dev This function can be used to recover the remaining value from the EVC contract. /// @param targetContract The address of the contract to be called. /// @param onBehalfOfAccount If the target contract is msg.sender, the address of the account which will be set /// in the context. It assumes msg.sender has authenticated the account themselves. If the target contract is /// not msg.sender, the address of the account for which it is checked whether msg.sender is authorized to act /// on behalf of. /// @param value The amount of value to be forwarded with the call. If the value is type(uint256).max, the whole /// balance of the EVC contract will be forwarded. /// @param data The encoded data which is called on the target contract. /// @return result The result of the call. function call( address targetContract, address onBehalfOfAccount, uint256 value, bytes calldata data ) external payable returns (bytes memory result); /// @notice For a given account, calls into one of the enabled collateral vaults from the currently enabled /// controller vault as per data encoded. /// @dev This function defers the account and vault status checks (it's a checks-deferrable call). If the outermost /// call ends, the account and vault status checks are performed. /// @dev This function can be used to interact with any contract while checks are deferred as long as the contract /// is enabled as a collateral of the account and the msg.sender is the only enabled controller of the account. /// @param targetCollateral The collateral address to be called. /// @param onBehalfOfAccount The address of the account for which it is checked whether msg.sender is authorized to /// act on behalf. /// @param value The amount of value to be forwarded with the call. If the value is type(uint256).max, the whole /// balance of the EVC contract will be forwarded. /// @param data The encoded data which is called on the target collateral. /// @return result The result of the call. function controlCollateral( address targetCollateral, address onBehalfOfAccount, uint256 value, bytes calldata data ) external payable returns (bytes memory result); /// @notice Executes multiple calls into the target contracts while checks deferred as per batch items provided. /// @dev This function defers the account and vault status checks (it's a checks-deferrable call). If the outermost /// call ends, the account and vault status checks are performed. /// @dev The authentication rules for each batch item are the same as for the call function. /// @param items An array of batch items to be executed. function batch(BatchItem[] calldata items) external payable; /// @notice Executes multiple calls into the target contracts while checks deferred as per batch items provided. /// @dev This function always reverts as it's only used for simulation purposes. This function cannot be called /// within a checks-deferrable call. /// @param items An array of batch items to be executed. function batchRevert(BatchItem[] calldata items) external payable; /// @notice Executes multiple calls into the target contracts while checks deferred as per batch items provided. /// @dev This function does not modify state and should only be used for simulation purposes. This function cannot /// be called within a checks-deferrable call. /// @param items An array of batch items to be executed. /// @return batchItemsResult An array of batch item results for each item. /// @return accountsStatusCheckResult An array of account status check results for each account. /// @return vaultsStatusCheckResult An array of vault status check results for each vault. function batchSimulation(BatchItem[] calldata items) external payable returns ( BatchItemResult[] memory batchItemsResult, StatusCheckResult[] memory accountsStatusCheckResult, StatusCheckResult[] memory vaultsStatusCheckResult ); /// @notice Retrieves the timestamp of the last successful account status check performed for a specific account. /// @dev This function reverts if the checks are in progress. /// @dev The account status check is considered to be successful if it calls into the selected controller vault and /// obtains expected magic value. This timestamp does not change if the account status is considered valid when no /// controller enabled. When consuming, one might need to ensure that the account status check is not deferred at /// the moment. /// @param account The address of the account for which the last status check timestamp is being queried. /// @return The timestamp of the last status check as a uint256. function getLastAccountStatusCheckTimestamp(address account) external view returns (uint256); /// @notice Checks whether the status check is deferred for a given account. /// @dev This function reverts if the checks are in progress. /// @param account The address of the account for which it is checked whether the status check is deferred. /// @return A boolean flag that indicates whether the status check is deferred or not. function isAccountStatusCheckDeferred(address account) external view returns (bool); /// @notice Checks the status of an account and reverts if it is not valid. /// @dev If checks deferred, the account is added to the set of accounts to be checked at the end of the outermost /// checks-deferrable call. There can be at most 10 unique accounts added to the set at a time. Account status /// check is performed by calling into the selected controller vault and passing the array of currently enabled /// collaterals. If controller is not selected, the account is always considered valid. /// @param account The address of the account to be checked. function requireAccountStatusCheck(address account) external payable; /// @notice Forgives previously deferred account status check. /// @dev Account address is removed from the set of addresses for which status checks are deferred. This function /// can only be called by the currently enabled controller of a given account. Depending on the vault /// implementation, may be needed in the liquidation flow. /// @param account The address of the account for which the status check is forgiven. function forgiveAccountStatusCheck(address account) external payable; /// @notice Checks whether the status check is deferred for a given vault. /// @dev This function reverts if the checks are in progress. /// @param vault The address of the vault for which it is checked whether the status check is deferred. /// @return A boolean flag that indicates whether the status check is deferred or not. function isVaultStatusCheckDeferred(address vault) external view returns (bool); /// @notice Checks the status of a vault and reverts if it is not valid. /// @dev If checks deferred, the vault is added to the set of vaults to be checked at the end of the outermost /// checks-deferrable call. There can be at most 10 unique vaults added to the set at a time. This function can /// only be called by the vault itself. function requireVaultStatusCheck() external payable; /// @notice Forgives previously deferred vault status check. /// @dev Vault address is removed from the set of addresses for which status checks are deferred. This function can /// only be called by the vault itself. function forgiveVaultStatusCheck() external payable; /// @notice Checks the status of an account and a vault and reverts if it is not valid. /// @dev If checks deferred, the account and the vault are added to the respective sets of accounts and vaults to be /// checked at the end of the outermost checks-deferrable call. Account status check is performed by calling into /// selected controller vault and passing the array of currently enabled collaterals. If controller is not selected, /// the account is always considered valid. This function can only be called by the vault itself. /// @param account The address of the account to be checked. function requireAccountAndVaultStatusCheck(address account) external payable; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; type EC is uint256; /// @title ExecutionContext /// @custom:security-contact [email protected] /// @author Euler Labs (https://www.eulerlabs.com/) /// @notice This library provides functions for managing the execution context in the Ethereum Vault Connector. /// @dev The execution context is a bit field that stores the following information: /// @dev - on behalf of account - an account on behalf of which the currently executed operation is being performed /// @dev - checks deferred flag - used to indicate whether checks are deferred /// @dev - checks in progress flag - used to indicate that the account/vault status checks are in progress. This flag is /// used to prevent re-entrancy. /// @dev - control collateral in progress flag - used to indicate that the control collateral is in progress. This flag /// is used to prevent re-entrancy. /// @dev - operator authenticated flag - used to indicate that the currently executed operation is being performed by /// the account operator /// @dev - simulation flag - used to indicate that the currently executed batch call is a simulation /// @dev - stamp - dummy value for optimization purposes library ExecutionContext { uint256 internal constant ON_BEHALF_OF_ACCOUNT_MASK = 0x000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; uint256 internal constant CHECKS_DEFERRED_MASK = 0x0000000000000000000000FF0000000000000000000000000000000000000000; uint256 internal constant CHECKS_IN_PROGRESS_MASK = 0x00000000000000000000FF000000000000000000000000000000000000000000; uint256 internal constant CONTROL_COLLATERAL_IN_PROGRESS_LOCK_MASK = 0x000000000000000000FF00000000000000000000000000000000000000000000; uint256 internal constant OPERATOR_AUTHENTICATED_MASK = 0x0000000000000000FF0000000000000000000000000000000000000000000000; uint256 internal constant SIMULATION_MASK = 0x00000000000000FF000000000000000000000000000000000000000000000000; uint256 internal constant STAMP_OFFSET = 200; // None of the functions below modifies the state. All the functions operate on the copy // of the execution context and return its modified value as a result. In order to update // one should use the result of the function call as a new execution context value. function getOnBehalfOfAccount(EC self) internal pure returns (address result) { result = address(uint160(EC.unwrap(self) & ON_BEHALF_OF_ACCOUNT_MASK)); } function setOnBehalfOfAccount(EC self, address account) internal pure returns (EC result) { result = EC.wrap((EC.unwrap(self) & ~ON_BEHALF_OF_ACCOUNT_MASK) | uint160(account)); } function areChecksDeferred(EC self) internal pure returns (bool result) { result = EC.unwrap(self) & CHECKS_DEFERRED_MASK != 0; } function setChecksDeferred(EC self) internal pure returns (EC result) { result = EC.wrap(EC.unwrap(self) | CHECKS_DEFERRED_MASK); } function areChecksInProgress(EC self) internal pure returns (bool result) { result = EC.unwrap(self) & CHECKS_IN_PROGRESS_MASK != 0; } function setChecksInProgress(EC self) internal pure returns (EC result) { result = EC.wrap(EC.unwrap(self) | CHECKS_IN_PROGRESS_MASK); } function isControlCollateralInProgress(EC self) internal pure returns (bool result) { result = EC.unwrap(self) & CONTROL_COLLATERAL_IN_PROGRESS_LOCK_MASK != 0; } function setControlCollateralInProgress(EC self) internal pure returns (EC result) { result = EC.wrap(EC.unwrap(self) | CONTROL_COLLATERAL_IN_PROGRESS_LOCK_MASK); } function isOperatorAuthenticated(EC self) internal pure returns (bool result) { result = EC.unwrap(self) & OPERATOR_AUTHENTICATED_MASK != 0; } function setOperatorAuthenticated(EC self) internal pure returns (EC result) { result = EC.wrap(EC.unwrap(self) | OPERATOR_AUTHENTICATED_MASK); } function clearOperatorAuthenticated(EC self) internal pure returns (EC result) { result = EC.wrap(EC.unwrap(self) & ~OPERATOR_AUTHENTICATED_MASK); } function isSimulationInProgress(EC self) internal pure returns (bool result) { result = EC.unwrap(self) & SIMULATION_MASK != 0; } function setSimulationInProgress(EC self) internal pure returns (EC result) { result = EC.wrap(EC.unwrap(self) | SIMULATION_MASK); } }
{ "remappings": [ "lib/euler-price-oracle:@openzeppelin/contracts/=lib/euler-price-oracle/lib/openzeppelin-contracts/contracts/", "lib/native-token-transfers/evm:openzeppelin-contracts/contracts/=lib/native-token-transfers/evm/lib/openzeppelin-contracts/contracts/", "lib/euler-earn:@openzeppelin/=lib/euler-earn/lib/openzeppelin-contracts/", "lib/euler-earn:@openzeppelin-upgradeable/=lib/euler-earn/lib/openzeppelin-contracts-upgradeable/contracts/", "lib/euler-earn:ethereum-vault-connector/=lib/euler-earn/lib/ethereum-vault-connector/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "ethereum-vault-connector/=lib/ethereum-vault-connector/src/", "evc/=lib/ethereum-vault-connector/src/", "evk/=lib/euler-vault-kit/src/", "evk-test/=lib/euler-vault-kit/test/", "euler-price-oracle/=lib/euler-price-oracle/src/", "euler-price-oracle-test/=lib/euler-price-oracle/test/", "fee-flow/=lib/fee-flow/src/", "reward-streams/=lib/reward-streams/src/", "@openzeppelin/=lib/openzeppelin-contracts/contracts/", "euler-earn/=lib/euler-earn/src/", "native-token-transfers/=lib/native-token-transfers/evm/src/", "@openzeppelin-upgradeable/=lib/euler-earn/lib/openzeppelin-contracts-upgradeable/contracts/", "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@pendle/core-v2/=lib/euler-price-oracle/lib/pendle-core-v2-public/contracts/", "@pyth/=lib/euler-price-oracle/lib/pyth-sdk-solidity/", "@redstone/evm-connector/=lib/euler-price-oracle/lib/redstone-oracles-monorepo/packages/evm-connector/contracts/", "@solady/=lib/euler-price-oracle/lib/solady/src/", "@uniswap/v3-core/=lib/euler-price-oracle/lib/v3-core/", "@uniswap/v3-periphery/=lib/euler-price-oracle/lib/v3-periphery/", "ERC4626/=lib/euler-earn/lib/properties/lib/ERC4626/contracts/", "crytic-properties/=lib/euler-earn/lib/properties/contracts/", "ds-test/=lib/ethereum-vault-connector/lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/", "euler-vault-kit/=lib/euler-vault-kit/", "forge-gas-snapshot/=lib/euler-vault-kit/lib/permit2/lib/forge-gas-snapshot/src/", "forge-std/=lib/forge-std/src/", "halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/", "layerzero-devtools/=lib/layerzero-devtools/packages/toolbox-foundry/src/", "layerzero-v2/=lib/layerzero-v2/", "openzeppelin/=lib/ethereum-vault-connector/lib/openzeppelin-contracts/contracts/", "pendle-core-v2-public/=lib/euler-price-oracle/lib/pendle-core-v2-public/contracts/", "permit2/=lib/euler-vault-kit/lib/permit2/", "properties/=lib/euler-earn/lib/properties/contracts/", "pyth-sdk-solidity/=lib/euler-price-oracle/lib/pyth-sdk-solidity/", "redstone-oracles-monorepo/=lib/euler-price-oracle/lib/", "solady/=lib/euler-price-oracle/lib/solady/src/", "solidity-bytes-utils/=lib/native-token-transfers/evm/lib/solidity-bytes-utils/contracts/", "solmate/=lib/fee-flow/lib/solmate/src/", "v3-core/=lib/euler-price-oracle/lib/v3-core/contracts/", "v3-periphery/=lib/euler-price-oracle/lib/v3-periphery/contracts/", "wormhole-solidity-sdk/=lib/native-token-transfers/evm/lib/wormhole-solidity-sdk/src/" ], "optimizer": { "enabled": true, "runs": 20000 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "cancun", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"evc","type":"address"},{"internalType":"uint256","name":"initPrice","type":"uint256"},{"internalType":"address","name":"paymentToken_","type":"address"},{"internalType":"address","name":"paymentReceiver_","type":"address"},{"internalType":"uint256","name":"epochPeriod_","type":"uint256"},{"internalType":"uint256","name":"priceMultiplier_","type":"uint256"},{"internalType":"uint256","name":"minInitPrice_","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ControllerDisabled","type":"error"},{"inputs":[],"name":"DeadlinePassed","type":"error"},{"inputs":[],"name":"EVC_InvalidAddress","type":"error"},{"inputs":[],"name":"EmptyAssets","type":"error"},{"inputs":[],"name":"EpochIdMismatch","type":"error"},{"inputs":[],"name":"EpochPeriodBelowMin","type":"error"},{"inputs":[],"name":"EpochPeriodExceedsMax","type":"error"},{"inputs":[],"name":"InitPriceBelowMin","type":"error"},{"inputs":[],"name":"InitPriceExceedsMax","type":"error"},{"inputs":[],"name":"MaxPaymentTokenAmountExceeded","type":"error"},{"inputs":[],"name":"MinInitPriceBelowMin","type":"error"},{"inputs":[],"name":"MinInitPriceExceedsAbsMaxInitPrice","type":"error"},{"inputs":[],"name":"NotAuthorized","type":"error"},{"inputs":[],"name":"PaymentReceiverIsThis","type":"error"},{"inputs":[],"name":"PriceMultiplierBelowMin","type":"error"},{"inputs":[],"name":"PriceMultiplierExceedsMax","type":"error"},{"inputs":[],"name":"Reentrancy","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":true,"internalType":"address","name":"assetsReceiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"paymentAmount","type":"uint256"}],"name":"Buy","type":"event"},{"inputs":[],"name":"ABS_MAX_INIT_PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ABS_MIN_INIT_PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EVC","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_EPOCH_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PRICE_MULTIPLIER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_EPOCH_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_PRICE_MULTIPLIER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRICE_MULTIPLIER_SCALE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"assets","type":"address[]"},{"internalType":"address","name":"assetsReceiver","type":"address"},{"internalType":"uint256","name":"epochId","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"maxPaymentTokenAmount","type":"uint256"}],"name":"buy","outputs":[{"internalType":"uint256","name":"paymentAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"epochPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSlot0","outputs":[{"components":[{"internalType":"uint8","name":"locked","type":"uint8"},{"internalType":"uint16","name":"epochId","type":"uint16"},{"internalType":"uint192","name":"initPrice","type":"uint192"},{"internalType":"uint40","name":"startTime","type":"uint40"}],"internalType":"struct FeeFlowController.Slot0","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minInitPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paymentReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paymentToken","outputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
61014060405234801562000011575f80fd5b50604051620013143803806200131483398101604081905262000034916200024c565b866001600160a01b0381166200005d57604051638133abd160e01b815260040160405180910390fd5b6001600160a01b0316608052808610156200008b57604051630d27ec9160e41b815260040160405180910390fd5b6001600160c01b03861115620000b45760405163fd5e9afd60e01b815260040160405180910390fd5b610e10831015620000d857604051630a73237b60e31b815260040160405180910390fd5b6301e13380831115620000fe5760405163cc83413760e01b815260040160405180910390fd5b670f43fc2c04ee00008210156200012857604051634f65421360e11b815260040160405180910390fd5b6729a2241af62c000082111562000152576040516308fac15360e01b815260040160405180910390fd5b620f42408110156200017757604051630279899760e51b815260040160405180910390fd5b6001600160c01b03811115620001a05760405163c7631a2b60e01b815260040160405180910390fd5b306001600160a01b03851603620001ca5760405163fdae86b560e01b815260040160405180910390fd5b5f805462ffffff1663010000006001600160c01b0398909816979097026001600160d81b031696909617600160d81b4264ffffffffff1602179095556001600160a01b0393841660a0529190921660c05260e091909152610100526101205250620002b8565b80516001600160a01b038116811462000247575f80fd5b919050565b5f805f805f805f60e0888a03121562000263575f80fd5b6200026e8862000230565b965060208801519550620002856040890162000230565b9450620002956060890162000230565b93506080880151925060a0880151915060c0880151905092959891949750929550565b60805160a05160c05160e0516101005161012051610fd56200033f5f395f8181610155015281816107a801526107d101525f81816102d3015261073601525f818161022201528181610a3e0152610a6e01525f81816102ac01526105ed01525f818161010401526105ca01525f81816101f901528181610b0a0152610b5e0152610fd55ff3fe608060405234801561000f575f80fd5b50600436106100fb575f3560e01c806399d5ce4911610093578063cb37f3b211610063578063cb37f3b2146102a7578063d50cb88b146102ce578063efd33156146102f5578063f6cb1a49146102ff575f80fd5b806399d5ce49146101e4578063a70354a1146101f7578063b5b7a1841461021d578063c9ae5e0c14610244575f80fd5b8063750d48b8116100ce578063750d48b8146101a357806388f4b49e146101b25780638fc59c52146101d157806398d5fdca146101dc575f80fd5b80633013ce29146100ff5780633c92276e146101505780635889486e146101855780636e5b5b7d14610194575b5f80fd5b6101267f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6101777f000000000000000000000000000000000000000000000000000000000000000081565b604051908152602001610147565b6101776729a2241af62c000081565b610177670de0b6b3a764000081565b610177670f43fc2c04ee000081565b61017777ffffffffffffffffffffffffffffffffffffffffffffffff81565b6101776301e1338081565b610177610308565b6101776101f2366004610dd7565b6103c9565b7f0000000000000000000000000000000000000000000000000000000000000000610126565b6101777f000000000000000000000000000000000000000000000000000000000000000081565b61024c610949565b6040516101479190815160ff16815260208083015161ffff169082015260408083015177ffffffffffffffffffffffffffffffffffffffffffffffff169082015260609182015164ffffffffff169181019190915260800190565b6101267f000000000000000000000000000000000000000000000000000000000000000081565b6101777f000000000000000000000000000000000000000000000000000000000000000081565b610177620f424081565b610177610e1081565b5f805460ff16600203610347576040517fab143c0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516080810182525f5460ff81168252610100810461ffff1660208301526301000000810477ffffffffffffffffffffffffffffffffffffffffffffffff16928201929092527b0100000000000000000000000000000000000000000000000000000090910464ffffffffff1660608201526103c490610a21565b905090565b5f805460ff16600203610408576040517fab143c0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660021790554283101561046c576040517f70f65caa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8690036104a6576040517f23ec2f6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516080810182525f5460ff81168252610100810461ffff908116602084018190526301000000830477ffffffffffffffffffffffffffffffffffffffffffffffff16948401949094527b0100000000000000000000000000000000000000000000000000000090910464ffffffffff16606083015290919086161461055a576040517f608fb7bf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f610563610af1565b905061056e82610a21565b9250838311156105aa576040517f941315a100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82156106125761061273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016827f000000000000000000000000000000000000000000000000000000000000000086610be4565b5f5b88811015610726575f8a8a8381811061062f5761062f610e6f565b90506020020160208101906106449190610e9c565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa1580156106ae573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106d29190610eb7565b905061071d89828d8d868181106106eb576106eb610e6f565b90506020020160208101906107009190610e9c565b73ffffffffffffffffffffffffffffffffffffffff169190610cd7565b50600101610614565b505f670de0b6b3a764000061075b7f000000000000000000000000000000000000000000000000000000000000000086610efb565b6107659190610f18565b905077ffffffffffffffffffffffffffffffffffffffffffffffff8111156107a6575077ffffffffffffffffffffffffffffffffffffffffffffffff6107f1565b7f00000000000000000000000000000000000000000000000000000000000000008110156107f157507f00000000000000000000000000000000000000000000000000000000000000005b6020838101805160010161ffff169081905277ffffffffffffffffffffffffffffffffffffffffffffffff831660408087018290524264ffffffffff166060880181905287515f805460ff9092167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000909216919091176101009095029490941762ffffff1663010000009093027affffffffffffffffffffffffffffffffffffffffffffffffffffff16929092177b01000000000000000000000000000000000000000000000000000000909202919091179091555185815273ffffffffffffffffffffffffffffffffffffffff8a811692908516917fd0c183be209f70036b50de16805d88249019e1288d7b77ef877710999c0d08e6910160405180910390a35050505f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790559695505050505050565b604080516080810182525f8082526020820181905291810182905260608101829052905460ff166002036109a9576040517fab143c0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50604080516080810182525f5460ff81168252610100810461ffff1660208301526301000000810477ffffffffffffffffffffffffffffffffffffffffffffffff16928201929092527b0100000000000000000000000000000000000000000000000000000090910464ffffffffff16606082015290565b5f80826060015164ffffffffff1642610a3a9190610f50565b90507f0000000000000000000000000000000000000000000000000000000000000000811115610a6c57505f92915050565b7f000000000000000000000000000000000000000000000000000000000000000081846040015177ffffffffffffffffffffffffffffffffffffffffffffffff16610ab79190610efb565b610ac19190610f18565b836040015177ffffffffffffffffffffffffffffffffffffffffffffffff16610aea9190610f50565b9392505050565b5f3373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168103610bdf576040517f18503a1e0000000000000000000000000000000000000000000000000000000081525f60048201527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906318503a1e906024016040805180830381865afa158015610bb7573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bdb9190610f63565b5090505b919050565b5f6040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015273ffffffffffffffffffffffffffffffffffffffff8416602482015282604482015260205f6064835f8a5af13d15601f3d1160015f511416171691505080610cd0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c454400000000000000000000000060448201526064015b60405180910390fd5b5050505050565b5f6040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015282602482015260205f6044835f895af13d15601f3d1160015f511416171691505080610da2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152606401610cc7565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81168114610dc9575f80fd5b50565b8035610bdf81610da8565b5f805f805f8060a08789031215610dec575f80fd5b863567ffffffffffffffff80821115610e03575f80fd5b818901915089601f830112610e16575f80fd5b813581811115610e24575f80fd5b8a60208260051b8501011115610e38575f80fd5b602092830198509650610e4e9189019050610dcc565b93506040870135925060608701359150608087013590509295509295509295565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f60208284031215610eac575f80fd5b8135610aea81610da8565b5f60208284031215610ec7575f80fd5b5051919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b8082028115828204841417610f1257610f12610ece565b92915050565b5f82610f4b577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b81810381811115610f1257610f12610ece565b5f8060408385031215610f74575f80fd5b8251610f7f81610da8565b60208401519092508015158114610f94575f80fd5b80915050925092905056fea2646970667358221220916e5290f8e86a3a4beeac5926c17f7f9bc7f132c28477822b4a6defde347fa664736f6c634300081800330000000000000000000000004860c903f6ad709c3eda46d3d502943f184d43150000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000050c42deacd8fc9773493ed674b675be577f2634b000000000000000000000000399764b234078e64506f84b89f81336399dc7fda00000000000000000000000000000000000000000000000000000000001275000000000000000000000000000000000000000000000000001bc16d674ec800000000000000000000000000000000000000000000000000000de0b6b3a7640000
Deployed Bytecode
0x608060405234801561000f575f80fd5b50600436106100fb575f3560e01c806399d5ce4911610093578063cb37f3b211610063578063cb37f3b2146102a7578063d50cb88b146102ce578063efd33156146102f5578063f6cb1a49146102ff575f80fd5b806399d5ce49146101e4578063a70354a1146101f7578063b5b7a1841461021d578063c9ae5e0c14610244575f80fd5b8063750d48b8116100ce578063750d48b8146101a357806388f4b49e146101b25780638fc59c52146101d157806398d5fdca146101dc575f80fd5b80633013ce29146100ff5780633c92276e146101505780635889486e146101855780636e5b5b7d14610194575b5f80fd5b6101267f00000000000000000000000050c42deacd8fc9773493ed674b675be577f2634b81565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6101777f0000000000000000000000000000000000000000000000000de0b6b3a764000081565b604051908152602001610147565b6101776729a2241af62c000081565b610177670de0b6b3a764000081565b610177670f43fc2c04ee000081565b61017777ffffffffffffffffffffffffffffffffffffffffffffffff81565b6101776301e1338081565b610177610308565b6101776101f2366004610dd7565b6103c9565b7f0000000000000000000000004860c903f6ad709c3eda46d3d502943f184d4315610126565b6101777f000000000000000000000000000000000000000000000000000000000012750081565b61024c610949565b6040516101479190815160ff16815260208083015161ffff169082015260408083015177ffffffffffffffffffffffffffffffffffffffffffffffff169082015260609182015164ffffffffff169181019190915260800190565b6101267f000000000000000000000000399764b234078e64506f84b89f81336399dc7fda81565b6101777f0000000000000000000000000000000000000000000000001bc16d674ec8000081565b610177620f424081565b610177610e1081565b5f805460ff16600203610347576040517fab143c0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516080810182525f5460ff81168252610100810461ffff1660208301526301000000810477ffffffffffffffffffffffffffffffffffffffffffffffff16928201929092527b0100000000000000000000000000000000000000000000000000000090910464ffffffffff1660608201526103c490610a21565b905090565b5f805460ff16600203610408576040517fab143c0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660021790554283101561046c576040517f70f65caa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8690036104a6576040517f23ec2f6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516080810182525f5460ff81168252610100810461ffff908116602084018190526301000000830477ffffffffffffffffffffffffffffffffffffffffffffffff16948401949094527b0100000000000000000000000000000000000000000000000000000090910464ffffffffff16606083015290919086161461055a576040517f608fb7bf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f610563610af1565b905061056e82610a21565b9250838311156105aa576040517f941315a100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82156106125761061273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000050c42deacd8fc9773493ed674b675be577f2634b16827f000000000000000000000000399764b234078e64506f84b89f81336399dc7fda86610be4565b5f5b88811015610726575f8a8a8381811061062f5761062f610e6f565b90506020020160208101906106449190610e9c565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa1580156106ae573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106d29190610eb7565b905061071d89828d8d868181106106eb576106eb610e6f565b90506020020160208101906107009190610e9c565b73ffffffffffffffffffffffffffffffffffffffff169190610cd7565b50600101610614565b505f670de0b6b3a764000061075b7f0000000000000000000000000000000000000000000000001bc16d674ec8000086610efb565b6107659190610f18565b905077ffffffffffffffffffffffffffffffffffffffffffffffff8111156107a6575077ffffffffffffffffffffffffffffffffffffffffffffffff6107f1565b7f0000000000000000000000000000000000000000000000000de0b6b3a76400008110156107f157507f0000000000000000000000000000000000000000000000000de0b6b3a76400005b6020838101805160010161ffff169081905277ffffffffffffffffffffffffffffffffffffffffffffffff831660408087018290524264ffffffffff166060880181905287515f805460ff9092167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000909216919091176101009095029490941762ffffff1663010000009093027affffffffffffffffffffffffffffffffffffffffffffffffffffff16929092177b01000000000000000000000000000000000000000000000000000000909202919091179091555185815273ffffffffffffffffffffffffffffffffffffffff8a811692908516917fd0c183be209f70036b50de16805d88249019e1288d7b77ef877710999c0d08e6910160405180910390a35050505f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790559695505050505050565b604080516080810182525f8082526020820181905291810182905260608101829052905460ff166002036109a9576040517fab143c0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50604080516080810182525f5460ff81168252610100810461ffff1660208301526301000000810477ffffffffffffffffffffffffffffffffffffffffffffffff16928201929092527b0100000000000000000000000000000000000000000000000000000090910464ffffffffff16606082015290565b5f80826060015164ffffffffff1642610a3a9190610f50565b90507f0000000000000000000000000000000000000000000000000000000000127500811115610a6c57505f92915050565b7f000000000000000000000000000000000000000000000000000000000012750081846040015177ffffffffffffffffffffffffffffffffffffffffffffffff16610ab79190610efb565b610ac19190610f18565b836040015177ffffffffffffffffffffffffffffffffffffffffffffffff16610aea9190610f50565b9392505050565b5f3373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000004860c903f6ad709c3eda46d3d502943f184d4315168103610bdf576040517f18503a1e0000000000000000000000000000000000000000000000000000000081525f60048201527f0000000000000000000000004860c903f6ad709c3eda46d3d502943f184d431573ffffffffffffffffffffffffffffffffffffffff16906318503a1e906024016040805180830381865afa158015610bb7573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bdb9190610f63565b5090505b919050565b5f6040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015273ffffffffffffffffffffffffffffffffffffffff8416602482015282604482015260205f6064835f8a5af13d15601f3d1160015f511416171691505080610cd0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c454400000000000000000000000060448201526064015b60405180910390fd5b5050505050565b5f6040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015282602482015260205f6044835f895af13d15601f3d1160015f511416171691505080610da2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152606401610cc7565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81168114610dc9575f80fd5b50565b8035610bdf81610da8565b5f805f805f8060a08789031215610dec575f80fd5b863567ffffffffffffffff80821115610e03575f80fd5b818901915089601f830112610e16575f80fd5b813581811115610e24575f80fd5b8a60208260051b8501011115610e38575f80fd5b602092830198509650610e4e9189019050610dcc565b93506040870135925060608701359150608087013590509295509295509295565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f60208284031215610eac575f80fd5b8135610aea81610da8565b5f60208284031215610ec7575f80fd5b5051919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b8082028115828204841417610f1257610f12610ece565b92915050565b5f82610f4b577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b81810381811115610f1257610f12610ece565b5f8060408385031215610f74575f80fd5b8251610f7f81610da8565b60208401519092508015158114610f94575f80fd5b80915050925092905056fea2646970667358221220916e5290f8e86a3a4beeac5926c17f7f9bc7f132c28477822b4a6defde347fa664736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000004860c903f6ad709c3eda46d3d502943f184d43150000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000050c42deacd8fc9773493ed674b675be577f2634b000000000000000000000000399764b234078e64506f84b89f81336399dc7fda00000000000000000000000000000000000000000000000000000000001275000000000000000000000000000000000000000000000000001bc16d674ec800000000000000000000000000000000000000000000000000000de0b6b3a7640000
-----Decoded View---------------
Arg [0] : evc (address): 0x4860C903f6Ad709c3eDA46D3D502943f184D4315
Arg [1] : initPrice (uint256): 1000000000000000000
Arg [2] : paymentToken_ (address): 0x50c42dEAcD8Fc9773493ED674b675bE577f2634b
Arg [3] : paymentReceiver_ (address): 0x399764B234078E64506f84b89F81336399dC7fDa
Arg [4] : epochPeriod_ (uint256): 1209600
Arg [5] : priceMultiplier_ (uint256): 2000000000000000000
Arg [6] : minInitPrice_ (uint256): 1000000000000000000
-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 0000000000000000000000004860c903f6ad709c3eda46d3d502943f184d4315
Arg [1] : 0000000000000000000000000000000000000000000000000de0b6b3a7640000
Arg [2] : 00000000000000000000000050c42deacd8fc9773493ed674b675be577f2634b
Arg [3] : 000000000000000000000000399764b234078e64506f84b89f81336399dc7fda
Arg [4] : 0000000000000000000000000000000000000000000000000000000000127500
Arg [5] : 0000000000000000000000000000000000000000000000001bc16d674ec80000
Arg [6] : 0000000000000000000000000000000000000000000000000de0b6b3a7640000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.