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
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
This contract contains unverified libraries: V2MigrationChainConfig
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 Source Code Verified (Exact Match)
Contract Name:
VaultSupervisor
Compiler Version
v0.8.25+commit.b61c2a91
Optimization Enabled:
Yes with 20000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity ^0.8.21; import {Initializable} from "@openzeppelin-upgradeable/proxy/utils/Initializable.sol"; import {IERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol"; import {PausableUpgradeable} from "@openzeppelin-upgradeable/utils/PausableUpgradeable.sol"; import {IBeacon} from "@openzeppelin/contracts/proxy/beacon/IBeacon.sol"; import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol"; import {BeaconProxy} from "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol"; import {EIP712Upgradeable} from "@openzeppelin-upgradeable/utils/cryptography/EIP712Upgradeable.sol"; import {UUPSUpgradeable} from "solady/src/utils/UUPSUpgradeable.sol"; import {OwnableRoles} from "solady/src/auth/OwnableRoles.sol"; import {ReentrancyGuard} from "solady/src/utils/ReentrancyGuard.sol"; import {IVault} from "./interfaces/IVault.sol"; import {IVault2} from "./interfaces/IVault2.sol"; import {ISwapper} from "./interfaces/ISwapper.sol"; import "./interfaces/IVaultSupervisor.sol"; import "./interfaces/IVault.sol"; import "./interfaces/IDelegationSupervisor.sol"; import "./interfaces/Constants.sol"; import "./interfaces/Errors.sol"; import "./interfaces/Events.sol"; import "./interfaces/ILimiter.sol"; import "./entities/VaultSupervisorLib.sol"; contract VaultSupervisor is Initializable, OwnableRoles, ReentrancyGuard, PausableUpgradeable, UUPSUpgradeable, IVaultSupervisor, IBeacon { using VaultSupervisorLib for VaultSupervisorLib.Storage; // keccak256(abi.encode(uint256(keccak256("vaultsupervisor.storage")) - 1)) & ~bytes32(uint256(0xff)); bytes32 internal constant STORAGE_SLOT = 0xa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649100; /* ========== MUTATIVE FUNCTIONS ========== */ constructor() { _disableInitializers(); } function initialize(address _delegationSupervisor, address _vaultImpl, ILimiter _limiter, address _manager) external initializer { _initializeOwner(msg.sender); __Pausable_init(); _grantRoles(_manager, Constants.MANAGER_ROLE); VaultSupervisorLib.Storage storage self = _self(); self.initOrUpdate(_delegationSupervisor, _vaultImpl, _limiter); } function allowlistRoute(address v1Vault, address v2Vault) external onlyRolesOrOwner(Constants.MANAGER_ROLE) { _self().allowlistedRoutes[v1Vault][v2Vault] = true; } function denylistRoute(address v1Vault, address v2Vault) external onlyRolesOrOwner(Constants.MANAGER_ROLE) { _self().allowlistedRoutes[v1Vault][v2Vault] = false; } function deposit(IVault vault, uint256 amount, uint256 minSharesOut) external nonReentrant whenNotPaused returns (uint256 shares) { return depositInternal(msg.sender, msg.sender, vault, amount, minSharesOut); } function depositAndGimmie(IVault vault, uint256 amount, uint256 minSharesOut) external nonReentrant whenNotPaused returns (uint256 shares) { shares = depositInternal(msg.sender, msg.sender, vault, amount, minSharesOut); gimmieSharesInternal(vault, shares); } function depositWithSignature( IVault vault, address user, uint256 value, uint256 minSharesOut, uint256 deadline, Signature calldata permit, Signature calldata vaultAllowance ) external nonReentrant whenNotPaused returns (uint256 shares) { VaultSupervisorLib.Storage storage self = _self(); VaultSupervisorLib.verifySignatures( vault, user, value, minSharesOut, deadline, permit, vaultAllowance, self.userNonce[user] ); self.userNonce[user]++; return depositInternal(user, user, vault, value, minSharesOut); } function redeemShares(address staker, IVault vault, uint256 shares) external onlyDelegationSupervisor onlyChildVault(vault) nonReentrant { redeemSharesInternal(staker, vault, shares); } function removeShares(address staker, IVault vault, uint256 shares) external onlyDelegationSupervisor onlyChildVault(vault) nonReentrant { removeSharesInternal(staker, vault, shares); } function pause(bool toPause) external onlyRolesOrOwner(Constants.MANAGER_ROLE) { if (toPause) _pause(); else _unpause(); } function deployVault(IERC20 depositToken, string memory name, string memory symbol, IVault.AssetType assetType) external onlyRolesOrOwner(Constants.MANAGER_ROLE) returns (IVault) { VaultSupervisorLib.Storage storage self = _self(); IVault vault = cloneVault(abi.encodeCall(IVault.initialize, (address(this), depositToken, name, symbol, assetType))); self.vaults.push(vault); // Optimization: Set to constant so we can see if a vault exists and was made by us in O(1) time self.vaultToImplMap[address(vault)] = Constants.DEFAULT_VAULT_IMPLEMENTATION_FLAG; emit NewVault(address(vault)); return vault; } function changeImplementation(address newVaultImpl) external onlyOwner { if (newVaultImpl == address(0)) revert ZeroAddress(); VaultSupervisorLib.Storage storage self = _self(); self.vaultImpl = newVaultImpl; emit UpgradedAllVaults(newVaultImpl); } function changeImplementationForVault(address vault, address newVaultImpl) external onlyOwner { // Don't let the implementation ever be changed to 0 after it's created. // It's either DEFAULT_VAULT_IMPLEMENTATION_FLAG or a valid address if (newVaultImpl == address(0)) revert ZeroAddress(); VaultSupervisorLib.Storage storage self = _self(); // Don't let the admin change the implementation from address(0) to something else // bypassing the deployVault flow if (self.vaultToImplMap[vault] == address(0)) revert VaultNotAChildVault(); self.vaultToImplMap[vault] = newVaultImpl; emit UpgradedVault(newVaultImpl, vault); } /// @dev Allow for it to be set to address(0) /// in the future to disable the global limit function setLimiter(ILimiter limiter) external onlyRolesOrOwner(Constants.MANAGER_ROLE) { VaultSupervisorLib.Storage storage self = _self(); self.limiter = limiter; } function runAdminOperation(IVault vault, bytes calldata fn) external onlyRolesOrOwner(Constants.MANAGER_ROLE) nonReentrant returns (bytes memory) { bytes4 incomingFnSelector = bytes4(fn); bool isValidAdminFunction = ( incomingFnSelector == IVault.setLimit.selector || incomingFnSelector == IVault.transferOwnership.selector || incomingFnSelector == IVault.pause.selector ); if (!isValidAdminFunction) { revert InvalidVaultAdminFunction(); } // Only the owner can transferOwnership of the vault if (incomingFnSelector == IVault.transferOwnership.selector) { _checkOwner(); } (bool success, bytes memory result) = address(vault).call(fn); if (!success) { // Load revert reason into memory and revert // with it because we can't revert with bytes // from https://ethereum.stackexchange.com/a/114140 assembly { revert(add(result, 32), result) } } return result; } function registerSwapperForRoutes(IERC20[] calldata inputAsset, IERC20[] calldata outputAsset, ISwapper swapper) external onlyOwner { uint256 routeCount = inputAsset.length; if (routeCount != outputAsset.length) revert InvalidSwapperRouteLength(); for (uint256 i = 0; i < routeCount; i++) { IERC20 inputAsset = inputAsset[i]; IERC20 outputAsset = outputAsset[i]; if (!swapper.canSwap(inputAsset, outputAsset)) { revert InvalidSwapper(); } _self().inputToOutputToSwapper[inputAsset][outputAsset] = swapper; } } function vaultSwap( IVault vault, IVault.SwapAssetParams calldata params, uint256 minNewAssetAmount, bytes calldata swapperParams ) external nonReentrant onlyRolesOrOwner(Constants.MANAGER_ROLE) onlyChildVault(vault) { address oldAsset = vault.asset(); ISwapper swapper = _self().inputToOutputToSwapper[IERC20(oldAsset)][params.newDepositToken]; if (address(swapper) == address(0)) { revert InvalidSwapper(); } uint256 oldAssetBefore = IERC20(oldAsset).balanceOf(address(vault)); uint256 newAssetBefore = params.newDepositToken.balanceOf(address(vault)); vault.swapAsset(swapper, params, minNewAssetAmount, swapperParams); uint256 oldAssetAfter = IERC20(oldAsset).balanceOf(address(vault)); uint256 newAssetAfter = params.newDepositToken.balanceOf(address(vault)); emit VaultSwap( address(vault), oldAsset, address(params.newDepositToken), oldAssetBefore - oldAssetAfter, newAssetAfter - newAssetBefore, params.name, params.symbol, params.assetType, params.assetLimit ); } function migrate( IVault oldVault, IVault newVault, uint256 oldShares, uint256 minNewShares, bytes calldata swapperOtherParams ) external nonReentrant onlyChildVault(oldVault) onlyChildVault(newVault) whenNotPaused { IERC20 oldAsset = IERC20(oldVault.asset()); IERC20 newAsset = IERC20(newVault.asset()); ISwapper swapper = _self().inputToOutputToSwapper[oldAsset][newAsset]; if (address(swapper) == address(0)) { revert InvalidSwapper(); } // NOTE: convertToAssets does not take fees into account. // But we don't need to take fees into account here since this code path won't be used for any vaults that have this behavior. uint256 oldAssetsToSwap = oldVault.convertToAssets(oldShares); uint256 minNewAssets = newVault.convertToAssets(minNewShares); ISwapper.SwapParams memory swapParams = ISwapper.SwapParams({ inputAsset: oldAsset, outputAsset: newAsset, inputAmount: oldAssetsToSwap, minOutputAmount: minNewAssets }); uint256 oldAssetsBeforeRedeem = oldAsset.balanceOf(address(this)); removeSharesInternal(msg.sender, oldVault, oldShares); emit StartedWithdrawal(address(oldVault), msg.sender, address(0), msg.sender, oldShares); redeemSharesInternal(address(this), oldVault, oldShares); emit FinishedWithdrawal(address(oldVault), msg.sender, address(0), msg.sender, oldShares, bytes32(0)); uint256 oldAssetsAfterRedeem = oldAsset.balanceOf(address(this)); if (oldAssetsAfterRedeem - oldAssetsBeforeRedeem != oldAssetsToSwap) { revert MigrationRedeemFailed(); } oldAsset.approve(address(swapper), oldAssetsToSwap); uint256 newAssetsBeforeSwap = newAsset.balanceOf(address(this)); swapper.swapAssets(swapParams, swapperOtherParams); uint256 newAssetsAfterSwap = newAsset.balanceOf(address(this)); uint256 newAssetsToDeposit = newAssetsAfterSwap - newAssetsBeforeSwap; if (newAssetsToDeposit < minNewAssets) { revert MigrationSwapFailed(); } depositInternal(msg.sender, address(this), newVault, newAssetsToDeposit, minNewShares); } // TODO: Add tests for this function migrateToV2(IVault v1Vault, IVault2 v2Vault, uint256 oldShares, uint256 minNewShares) external nonReentrant onlyChildVault(v1Vault) whenNotPaused { if (!_self().allowlistedRoutes[address(v1Vault)][address(v2Vault)]) { revert RouteNotAllowlisted(); } if (v1Vault.asset() != v2Vault.asset()) { revert AssetMismatch(); } uint256 assetBalanceBefore = IERC20(v1Vault.asset()).balanceOf(address(this)); uint256 newShareBalanceBefore = IERC20(address(v2Vault)).balanceOf(msg.sender); removeSharesInternal(msg.sender, v1Vault, oldShares); emit StartedWithdrawal(address(v1Vault), msg.sender, address(this), msg.sender, oldShares); redeemSharesInternal(address(this), v1Vault, oldShares); emit FinishedWithdrawal(address(v1Vault), msg.sender, address(this), msg.sender, oldShares, bytes32(0)); uint256 withdrawnAssets = IERC20(v1Vault.asset()).balanceOf(address(this)) - assetBalanceBefore; IERC20(v1Vault.asset()).approve(address(v2Vault), withdrawnAssets); uint256 newShares = v2Vault.deposit(withdrawnAssets, msg.sender, minNewShares); uint256 newMintedShares = IERC20(address(v2Vault)).balanceOf(msg.sender) - newShareBalanceBefore; if (newShares != newMintedShares) { revert NotEnoughShares(); } emit MigratedToV2(msg.sender, address(v1Vault), address(v2Vault), oldShares, newShares, withdrawnAssets); } /* ========== VIEWS ========== */ function _self() internal pure returns (VaultSupervisorLib.Storage storage $) { assembly { $.slot := STORAGE_SLOT } } function SIGNED_DEPOSIT_TYPEHASH() public pure returns (bytes32) { return Constants.SIGNED_DEPOSIT_TYPEHASH; } function getDeposits(address staker) external view returns (IVault[] memory vaults, IERC20[] memory tokens, uint256[] memory assets, uint256[] memory shares) { VaultSupervisorLib.Storage storage self = _self(); uint256 vaultLength = self.stakersVaults[staker].length; assets = new uint256[](vaultLength); shares = new uint256[](vaultLength); tokens = new IERC20[](vaultLength); for (uint256 i = 0; i < vaultLength; i++) { uint256 _shares = self.stakerShares[staker][self.stakersVaults[staker][i]]; assets[i] = self.stakersVaults[staker][i].convertToAssets(_shares); shares[i] = _shares; tokens[i] = IERC20(self.stakersVaults[staker][i].asset()); } return (self.stakersVaults[staker], tokens, assets, shares); } function implementation() external view override returns (address) { return implementation(msg.sender); } /// @dev Doesn't revert if the vault is not set yet because during `deployVault` /// theres a period before we set it to the default flag where the vault /// needs an impl to be initialized against function implementation(address vault) public view returns (address) { VaultSupervisorLib.Storage storage self = _self(); address vaultImplOverride = self.vaultToImplMap[vault]; if (vaultImplOverride == Constants.DEFAULT_VAULT_IMPLEMENTATION_FLAG || vaultImplOverride == address(0)) { return self.vaultImpl; } return vaultImplOverride; } function delegationSupervisor() public view returns (IDelegationSupervisor) { VaultSupervisorLib.Storage storage self = _self(); return self.delegationSupervisor; } function getUserNonce(address user) external view returns (uint256) { VaultSupervisorLib.Storage storage self = _self(); return self.userNonce[user]; } function getVaults() external view returns (IVault[] memory) { VaultSupervisorLib.Storage storage self = _self(); return self.vaults; } function allowlistedRoutes(address v1Vault, address v2Vault) public view returns (bool) { return _self().allowlistedRoutes[v1Vault][v2Vault]; } /* ========== INTERNAL FUNCTIONS ========== */ function depositInternal(address staker, address depositor, IVault vault, uint256 amount, uint256 minSharesOut) internal onlyChildVault(vault) whenNotPaused returns (uint256 shares) { VaultSupervisorLib.Storage storage self = _self(); shares = vault.deposit(amount, depositor); if (shares < minSharesOut) revert NotEnoughShares(); // If the limiter is set, check if the deposit limit is breached // allow for it to be set to address(0) in the future to disable the global limit if (address(self.limiter) != address(0)) { if (self.limiter.isLimitBreached(self.vaults)) revert CrossedDepositLimit(); } // add the returned shares to the staker's existing shares for this Vault increaseShares(staker, vault, shares); return shares; } function increaseShares(address staker, IVault vault, uint256 shares) internal { // sanity checks on inputs if (staker == address(0)) revert ZeroAddress(); if (shares == 0) revert ZeroShares(); VaultSupervisorLib.Storage storage self = _self(); // if they dont have existing shares of this Vault, add it to their strats if (self.stakerShares[staker][vault] == 0) { if (self.stakersVaults[staker].length >= Constants.MAX_VAULTS_PER_STAKER) revert MaxStakerVault(); self.stakersVaults[staker].push(vault); } // add the returned shares to their existing shares for this Vault self.stakerShares[staker][vault] += shares; } /// This function allows `shares` tokens NOT the underlying asset to be withdrawn /// for use in other protocols by the holder. You have to return the share tokens back to /// this contract to fully withdraw. function gimmieShares(IVault vault, uint256 shares) public onlyChildVault(vault) nonReentrant { gimmieSharesInternal(vault, shares); } function gimmieSharesInternal(IVault vault, uint256 shares) internal { if (shares == 0) revert ZeroShares(); IERC20 shareToken = IERC20(vault); VaultSupervisorLib.Storage storage self = _self(); // Verify the user is the owner of these shares if (self.stakerShares[msg.sender][vault] < shares) revert NotEnoughShares(); self.stakerShares[msg.sender][vault] -= shares; shareToken.transfer(msg.sender, shares); if (self.stakerShares[msg.sender][vault] == 0) { removeVaultFromStaker(msg.sender, vault); } emit GaveShares(msg.sender, address(vault), address(shareToken), shares); } function returnShares(IVault vault, uint256 shares) external onlyChildVault(vault) nonReentrant { increaseShares(msg.sender, vault, shares); IERC20 shareToken = IERC20(vault); shareToken.transferFrom(msg.sender, address(this), shares); emit ReturnedShares(msg.sender, address(vault), address(shareToken), shares); } function removeVaultFromStaker(address staker, IVault vault) internal { VaultSupervisorLib.Storage storage self = _self(); uint256 vaultsLength = self.stakersVaults[staker].length; uint256 i = 0; while (i < vaultsLength) { if (self.stakersVaults[staker][i] == vault) { // Replace this vault with the last vault and then pop the last one off // prevents leaving a gap in the array self.stakersVaults[staker][i] = self.stakersVaults[staker][vaultsLength - 1]; break; } unchecked { i++; } } if (i == vaultsLength) revert VaultNotFound(); self.stakersVaults[staker].pop(); } function cloneVault(bytes memory initData) internal returns (IVault) { return IVault(address(new BeaconProxy(address(this), initData))); } function _authorizeUpgrade(address newImplementation) internal override onlyOwner {} function redeemSharesInternal(address redeemTo, IVault vault, uint256 shares) internal { vault.redeem(shares, redeemTo, address(this)); } function removeSharesInternal(address staker, IVault vault, uint256 shares) internal { if (shares == 0) revert ZeroShares(); VaultSupervisorLib.Storage storage self = _self(); uint256 userShares = self.stakerShares[staker][vault]; if (shares > userShares) revert NotEnoughShares(); // Already checked above that userShares >= shareAmount unchecked { userShares = userShares - shares; } self.stakerShares[staker][vault] = userShares; // if user has no more shares, delete if (userShares == 0) { removeVaultFromStaker(staker, vault); } } /* ========== MODIFIERS ========== */ modifier onlyChildVault(IVault vault) { VaultSupervisorLib.Storage storage self = _self(); if (self.vaultToImplMap[address(vault)] == address(0)) { revert VaultNotAChildVault(); } _; } modifier onlyDelegationSupervisor() { VaultSupervisorLib.Storage storage self = _self(); if (msg.sender != address(self.delegationSupervisor)) { revert NotDelegationSupervisor(); } _; } /* ========== EVENTS ========== */ event UpgradedVault(address indexed implementation, address indexed vault); event UpgradedAllVaults(address indexed implementation); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._initialized = 1; if (isTopLevelCall) { $._initializing = true; } _; if (isTopLevelCall) { $._initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._initialized = version; $._initializing = true; _; $._initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @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. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ 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]. * * CAUTION: See Security Considerations above. */ 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 // OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol) pragma solidity ^0.8.20; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Pausable struct PausableStorage { bool _paused; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Pausable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant PausableStorageLocation = 0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300; function _getPausableStorage() private pure returns (PausableStorage storage $) { assembly { $.slot := PausableStorageLocation } } /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); /** * @dev The operation failed because the contract is paused. */ error EnforcedPause(); /** * @dev The operation failed because the contract is not paused. */ error ExpectedPause(); /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { PausableStorage storage $ = _getPausableStorage(); $._paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { PausableStorage storage $ = _getPausableStorage(); return $._paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { if (paused()) { revert EnforcedPause(); } } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { if (!paused()) { revert ExpectedPause(); } } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { PausableStorage storage $ = _getPausableStorage(); $._paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { PausableStorage storage $ = _getPausableStorage(); $._paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.20; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {UpgradeableBeacon} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/Clones.sol) pragma solidity ^0.8.20; /** * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for * deploying minimal proxy contracts, also known as "clones". * * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies * > a minimal bytecode implementation that delegates all calls to a known, fixed address. * * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2` * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the * deterministic method. */ library Clones { /** * @dev A clone instance deployment failed. */ error ERC1167FailedCreateClone(); /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create opcode, which should never revert. */ function clone(address implementation) internal returns (address instance) { /// @solidity memory-safe-assembly assembly { // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes // of the `implementation` address with the bytecode before the address. mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000)) // Packs the remaining 17 bytes of `implementation` with the bytecode after the address. mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3)) instance := create(0, 0x09, 0x37) } if (instance == address(0)) { revert ERC1167FailedCreateClone(); } } /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create2 opcode and a `salt` to deterministically deploy * the clone. Using the same `implementation` and `salt` multiple time will revert, since * the clones cannot be deployed twice at the same address. */ function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) { /// @solidity memory-safe-assembly assembly { // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes // of the `implementation` address with the bytecode before the address. mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000)) // Packs the remaining 17 bytes of `implementation` with the bytecode after the address. mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3)) instance := create2(0, 0x09, 0x37, salt) } if (instance == address(0)) { revert ERC1167FailedCreateClone(); } } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress( address implementation, bytes32 salt, address deployer ) internal pure returns (address predicted) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(add(ptr, 0x38), deployer) mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff) mstore(add(ptr, 0x14), implementation) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73) mstore(add(ptr, 0x58), salt) mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37)) predicted := keccak256(add(ptr, 0x43), 0x55) } } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress( address implementation, bytes32 salt ) internal view returns (address predicted) { return predictDeterministicAddress(implementation, salt, address(this)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/BeaconProxy.sol) pragma solidity ^0.8.20; import {IBeacon} from "./IBeacon.sol"; import {Proxy} from "../Proxy.sol"; import {ERC1967Utils} from "../ERC1967/ERC1967Utils.sol"; /** * @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}. * * The beacon address can only be set once during construction, and cannot be changed afterwards. It is stored in an * immutable variable to avoid unnecessary storage reads, and also in the beacon storage slot specified by * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] so that it can be accessed externally. * * CAUTION: Since the beacon address can never be changed, you must ensure that you either control the beacon, or trust * the beacon to not upgrade the implementation maliciously. * * IMPORTANT: Do not use the implementation logic to modify the beacon storage slot. Doing so would leave the proxy in * an inconsistent state where the beacon storage slot does not match the beacon address. */ contract BeaconProxy is Proxy { // An immutable address for the beacon to avoid unnecessary SLOADs before each delegate call. address private immutable _beacon; /** * @dev Initializes the proxy with `beacon`. * * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This * will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity * constructor. * * Requirements: * * - `beacon` must be a contract with the interface {IBeacon}. * - If `data` is empty, `msg.value` must be zero. */ constructor(address beacon, bytes memory data) payable { ERC1967Utils.upgradeBeaconToAndCall(beacon, data); _beacon = beacon; } /** * @dev Returns the current implementation address of the associated beacon. */ function _implementation() internal view virtual override returns (address) { return IBeacon(_getBeacon()).implementation(); } /** * @dev Returns the beacon. */ function _getBeacon() internal view virtual returns (address) { return _beacon; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.20; import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol"; import {IERC5267} from "@openzeppelin/contracts/interfaces/IERC5267.sol"; import {Initializable} from "../../proxy/utils/Initializable.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose * encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract * does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to * produce the hash of their typed data using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain * separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the * separator from the immutable values, which is cheaper than accessing a cached version in cold storage. */ abstract contract EIP712Upgradeable is Initializable, IERC5267 { bytes32 private constant TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); /// @custom:storage-location erc7201:openzeppelin.storage.EIP712 struct EIP712Storage { /// @custom:oz-renamed-from _HASHED_NAME bytes32 _hashedName; /// @custom:oz-renamed-from _HASHED_VERSION bytes32 _hashedVersion; string _name; string _version; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.EIP712")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant EIP712StorageLocation = 0xa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d100; function _getEIP712Storage() private pure returns (EIP712Storage storage $) { assembly { $.slot := EIP712StorageLocation } } /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ function __EIP712_init(string memory name, string memory version) internal onlyInitializing { __EIP712_init_unchained(name, version); } function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing { EIP712Storage storage $ = _getEIP712Storage(); $._name = name; $._version = version; // Reset prior values in storage if upgrading $._hashedName = 0; $._hashedVersion = 0; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { return _buildDomainSeparator(); } function _buildDomainSeparator() private view returns (bytes32) { return keccak256(abi.encode(TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash); } /** * @dev See {IERC-5267}. */ function eip712Domain() public view virtual returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ) { EIP712Storage storage $ = _getEIP712Storage(); // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized // and the EIP712 domain is not reliable, as it will be missing name and version. require($._hashedName == 0 && $._hashedVersion == 0, "EIP712: Uninitialized"); return ( hex"0f", // 01111 _EIP712Name(), _EIP712Version(), block.chainid, address(this), bytes32(0), new uint256[](0) ); } /** * @dev The name parameter for the EIP712 domain. * * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs * are a concern. */ function _EIP712Name() internal view virtual returns (string memory) { EIP712Storage storage $ = _getEIP712Storage(); return $._name; } /** * @dev The version parameter for the EIP712 domain. * * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs * are a concern. */ function _EIP712Version() internal view virtual returns (string memory) { EIP712Storage storage $ = _getEIP712Storage(); return $._version; } /** * @dev The hash of the name parameter for the EIP712 domain. * * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead. */ function _EIP712NameHash() internal view returns (bytes32) { EIP712Storage storage $ = _getEIP712Storage(); string memory name = _EIP712Name(); if (bytes(name).length > 0) { return keccak256(bytes(name)); } else { // If the name is empty, the contract may have been upgraded without initializing the new storage. // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design. bytes32 hashedName = $._hashedName; if (hashedName != 0) { return hashedName; } else { return keccak256(""); } } } /** * @dev The hash of the version parameter for the EIP712 domain. * * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead. */ function _EIP712VersionHash() internal view returns (bytes32) { EIP712Storage storage $ = _getEIP712Storage(); string memory version = _EIP712Version(); if (bytes(version).length > 0) { return keccak256(bytes(version)); } else { // If the version is empty, the contract may have been upgraded without initializing the new storage. // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design. bytes32 hashedVersion = $._hashedVersion; if (hashedVersion != 0) { return hashedVersion; } else { return keccak256(""); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice UUPS proxy mixin. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/UUPSUpgradeable.sol) /// @author Modified from OpenZeppelin /// (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/proxy/utils/UUPSUpgradeable.sol) /// /// @dev Note: /// - This implementation is intended to be used with ERC1967 proxies. /// See: `LibClone.deployERC1967` and related functions. /// - This implementation is NOT compatible with legacy OpenZeppelin proxies /// which do not store the implementation at `_ERC1967_IMPLEMENTATION_SLOT`. abstract contract UUPSUpgradeable { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The upgrade failed. error UpgradeFailed(); /// @dev The call is from an unauthorized call context. error UnauthorizedCallContext(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* IMMUTABLES */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev For checking if the context is a delegate call. uint256 private immutable __self = uint256(uint160(address(this))); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Emitted when the proxy's implementation is upgraded. event Upgraded(address indexed implementation); /// @dev `keccak256(bytes("Upgraded(address)"))`. uint256 private constant _UPGRADED_EVENT_SIGNATURE = 0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ERC-1967 storage slot for the implementation in the proxy. /// `uint256(keccak256("eip1967.proxy.implementation")) - 1`. bytes32 internal constant _ERC1967_IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* UUPS OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Please override this function to check if `msg.sender` is authorized /// to upgrade the proxy to `newImplementation`, reverting if not. /// ``` /// function _authorizeUpgrade(address) internal override onlyOwner {} /// ``` function _authorizeUpgrade(address newImplementation) internal virtual; /// @dev Returns the storage slot used by the implementation, /// as specified in [ERC1822](https://eips.ethereum.org/EIPS/eip-1822). /// /// Note: The `notDelegated` modifier prevents accidental upgrades to /// an implementation that is a proxy contract. function proxiableUUID() public view virtual notDelegated returns (bytes32) { // This function must always return `_ERC1967_IMPLEMENTATION_SLOT` to comply with ERC1967. return _ERC1967_IMPLEMENTATION_SLOT; } /// @dev Upgrades the proxy's implementation to `newImplementation`. /// Emits a {Upgraded} event. /// /// Note: Passing in empty `data` skips the delegatecall to `newImplementation`. function upgradeToAndCall(address newImplementation, bytes calldata data) public payable virtual onlyProxy { _authorizeUpgrade(newImplementation); /// @solidity memory-safe-assembly assembly { newImplementation := shr(96, shl(96, newImplementation)) // Clears upper 96 bits. mstore(0x01, 0x52d1902d) // `proxiableUUID()`. let s := _ERC1967_IMPLEMENTATION_SLOT // Check if `newImplementation` implements `proxiableUUID` correctly. if iszero(eq(mload(staticcall(gas(), newImplementation, 0x1d, 0x04, 0x01, 0x20)), s)) { mstore(0x01, 0x55299b49) // `UpgradeFailed()`. revert(0x1d, 0x04) } // Emit the {Upgraded} event. log2(codesize(), 0x00, _UPGRADED_EVENT_SIGNATURE, newImplementation) sstore(s, newImplementation) // Updates the implementation. // Perform a delegatecall to `newImplementation` if `data` is non-empty. if data.length { // Forwards the `data` to `newImplementation` via delegatecall. let m := mload(0x40) calldatacopy(m, data.offset, data.length) if iszero(delegatecall(gas(), newImplementation, m, data.length, codesize(), 0x00)) { // Bubble up the revert if the call reverts. returndatacopy(m, 0x00, returndatasize()) revert(m, returndatasize()) } } } } /// @dev Requires that the execution is performed through a proxy. modifier onlyProxy() { uint256 s = __self; /// @solidity memory-safe-assembly assembly { // To enable use cases with an immutable default implementation in the bytecode, // (see: ERC6551Proxy), we don't require that the proxy address must match the // value stored in the implementation slot, which may not be initialized. if eq(s, address()) { mstore(0x00, 0x9f03a026) // `UnauthorizedCallContext()`. revert(0x1c, 0x04) } } _; } /// @dev Requires that the execution is NOT performed via delegatecall. /// This is the opposite of `onlyProxy`. modifier notDelegated() { uint256 s = __self; /// @solidity memory-safe-assembly assembly { if iszero(eq(s, address())) { mstore(0x00, 0x9f03a026) // `UnauthorizedCallContext()`. revert(0x1c, 0x04) } } _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import {Ownable} from "./Ownable.sol"; /// @notice Simple single owner and multiroles authorization mixin. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol) /// @dev While the ownable portion follows [EIP-173](https://eips.ethereum.org/EIPS/eip-173) /// for compatibility, the nomenclature for the 2-step ownership handover and roles /// may be unique to this codebase. abstract contract OwnableRoles is Ownable { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The `user`'s roles is updated to `roles`. /// Each bit of `roles` represents whether the role is set. event RolesUpdated(address indexed user, uint256 indexed roles); /// @dev `keccak256(bytes("RolesUpdated(address,uint256)"))`. uint256 private constant _ROLES_UPDATED_EVENT_SIGNATURE = 0x715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The role slot of `user` is given by: /// ``` /// mstore(0x00, or(shl(96, user), _ROLE_SLOT_SEED)) /// let roleSlot := keccak256(0x00, 0x20) /// ``` /// This automatically ignores the upper bits of the `user` in case /// they are not clean, as well as keep the `keccak256` under 32-bytes. /// /// Note: This is equivalent to `uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))`. uint256 private constant _ROLE_SLOT_SEED = 0x8b78c6d8; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Overwrite the roles directly without authorization guard. function _setRoles(address user, uint256 roles) internal virtual { /// @solidity memory-safe-assembly assembly { mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, user) // Store the new value. sstore(keccak256(0x0c, 0x20), roles) // Emit the {RolesUpdated} event. log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), roles) } } /// @dev Updates the roles directly without authorization guard. /// If `on` is true, each set bit of `roles` will be turned on, /// otherwise, each set bit of `roles` will be turned off. function _updateRoles(address user, uint256 roles, bool on) internal virtual { /// @solidity memory-safe-assembly assembly { mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, user) let roleSlot := keccak256(0x0c, 0x20) // Load the current value. let current := sload(roleSlot) // Compute the updated roles if `on` is true. let updated := or(current, roles) // Compute the updated roles if `on` is false. // Use `and` to compute the intersection of `current` and `roles`, // `xor` it with `current` to flip the bits in the intersection. if iszero(on) { updated := xor(current, and(current, roles)) } // Then, store the new value. sstore(roleSlot, updated) // Emit the {RolesUpdated} event. log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), updated) } } /// @dev Grants the roles directly without authorization guard. /// Each bit of `roles` represents the role to turn on. function _grantRoles(address user, uint256 roles) internal virtual { _updateRoles(user, roles, true); } /// @dev Removes the roles directly without authorization guard. /// Each bit of `roles` represents the role to turn off. function _removeRoles(address user, uint256 roles) internal virtual { _updateRoles(user, roles, false); } /// @dev Throws if the sender does not have any of the `roles`. function _checkRoles(uint256 roles) internal view virtual { /// @solidity memory-safe-assembly assembly { // Compute the role slot. mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, caller()) // Load the stored value, and if the `and` intersection // of the value and `roles` is zero, revert. if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } /// @dev Throws if the sender is not the owner, /// and does not have any of the `roles`. /// Checks for ownership first, then lazily checks for roles. function _checkOwnerOrRoles(uint256 roles) internal view virtual { /// @solidity memory-safe-assembly assembly { // If the caller is not the stored owner. // Note: `_ROLE_SLOT_SEED` is equal to `_OWNER_SLOT_NOT`. if iszero(eq(caller(), sload(not(_ROLE_SLOT_SEED)))) { // Compute the role slot. mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, caller()) // Load the stored value, and if the `and` intersection // of the value and `roles` is zero, revert. if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } } /// @dev Throws if the sender does not have any of the `roles`, /// and is not the owner. /// Checks for roles first, then lazily checks for ownership. function _checkRolesOrOwner(uint256 roles) internal view virtual { /// @solidity memory-safe-assembly assembly { // Compute the role slot. mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, caller()) // Load the stored value, and if the `and` intersection // of the value and `roles` is zero, revert. if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) { // If the caller is not the stored owner. // Note: `_ROLE_SLOT_SEED` is equal to `_OWNER_SLOT_NOT`. if iszero(eq(caller(), sload(not(_ROLE_SLOT_SEED)))) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } } /// @dev Convenience function to return a `roles` bitmap from an array of `ordinals`. /// This is meant for frontends like Etherscan, and is therefore not fully optimized. /// Not recommended to be called on-chain. /// Made internal to conserve bytecode. Wrap it in a public function if needed. function _rolesFromOrdinals(uint8[] memory ordinals) internal pure returns (uint256 roles) { /// @solidity memory-safe-assembly assembly { for { let i := shl(5, mload(ordinals)) } i { i := sub(i, 0x20) } { // We don't need to mask the values of `ordinals`, as Solidity // cleans dirty upper bits when storing variables into memory. roles := or(shl(mload(add(ordinals, i)), 1), roles) } } } /// @dev Convenience function to return an array of `ordinals` from the `roles` bitmap. /// This is meant for frontends like Etherscan, and is therefore not fully optimized. /// Not recommended to be called on-chain. /// Made internal to conserve bytecode. Wrap it in a public function if needed. function _ordinalsFromRoles(uint256 roles) internal pure returns (uint8[] memory ordinals) { /// @solidity memory-safe-assembly assembly { // Grab the pointer to the free memory. ordinals := mload(0x40) let ptr := add(ordinals, 0x20) let o := 0 // The absence of lookup tables, De Bruijn, etc., here is intentional for // smaller bytecode, as this function is not meant to be called on-chain. for { let t := roles } 1 {} { mstore(ptr, o) // `shr` 5 is equivalent to multiplying by 0x20. // Push back into the ordinals array if the bit is set. ptr := add(ptr, shl(5, and(t, 1))) o := add(o, 1) t := shr(o, roles) if iszero(t) { break } } // Store the length of `ordinals`. mstore(ordinals, shr(5, sub(ptr, add(ordinals, 0x20)))) // Allocate the memory. mstore(0x40, ptr) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC UPDATE FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Allows the owner to grant `user` `roles`. /// If the `user` already has a role, then it will be an no-op for the role. function grantRoles(address user, uint256 roles) public payable virtual onlyOwner { _grantRoles(user, roles); } /// @dev Allows the owner to remove `user` `roles`. /// If the `user` does not have a role, then it will be an no-op for the role. function revokeRoles(address user, uint256 roles) public payable virtual onlyOwner { _removeRoles(user, roles); } /// @dev Allow the caller to remove their own roles. /// If the caller does not have a role, then it will be an no-op for the role. function renounceRoles(uint256 roles) public payable virtual { _removeRoles(msg.sender, roles); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC READ FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the roles of `user`. function rolesOf(address user) public view virtual returns (uint256 roles) { /// @solidity memory-safe-assembly assembly { // Compute the role slot. mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, user) // Load the stored value. roles := sload(keccak256(0x0c, 0x20)) } } /// @dev Returns whether `user` has any of `roles`. function hasAnyRole(address user, uint256 roles) public view virtual returns (bool) { return rolesOf(user) & roles != 0; } /// @dev Returns whether `user` has all of `roles`. function hasAllRoles(address user, uint256 roles) public view virtual returns (bool) { return rolesOf(user) & roles == roles; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* MODIFIERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Marks a function as only callable by an account with `roles`. modifier onlyRoles(uint256 roles) virtual { _checkRoles(roles); _; } /// @dev Marks a function as only callable by the owner or by an account /// with `roles`. Checks for ownership first, then lazily checks for roles. modifier onlyOwnerOrRoles(uint256 roles) virtual { _checkOwnerOrRoles(roles); _; } /// @dev Marks a function as only callable by an account with `roles` /// or the owner. Checks for roles first, then lazily checks for ownership. modifier onlyRolesOrOwner(uint256 roles) virtual { _checkRolesOrOwner(roles); _; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ROLE CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // IYKYK uint256 internal constant _ROLE_0 = 1 << 0; uint256 internal constant _ROLE_1 = 1 << 1; uint256 internal constant _ROLE_2 = 1 << 2; uint256 internal constant _ROLE_3 = 1 << 3; uint256 internal constant _ROLE_4 = 1 << 4; uint256 internal constant _ROLE_5 = 1 << 5; uint256 internal constant _ROLE_6 = 1 << 6; uint256 internal constant _ROLE_7 = 1 << 7; uint256 internal constant _ROLE_8 = 1 << 8; uint256 internal constant _ROLE_9 = 1 << 9; uint256 internal constant _ROLE_10 = 1 << 10; uint256 internal constant _ROLE_11 = 1 << 11; uint256 internal constant _ROLE_12 = 1 << 12; uint256 internal constant _ROLE_13 = 1 << 13; uint256 internal constant _ROLE_14 = 1 << 14; uint256 internal constant _ROLE_15 = 1 << 15; uint256 internal constant _ROLE_16 = 1 << 16; uint256 internal constant _ROLE_17 = 1 << 17; uint256 internal constant _ROLE_18 = 1 << 18; uint256 internal constant _ROLE_19 = 1 << 19; uint256 internal constant _ROLE_20 = 1 << 20; uint256 internal constant _ROLE_21 = 1 << 21; uint256 internal constant _ROLE_22 = 1 << 22; uint256 internal constant _ROLE_23 = 1 << 23; uint256 internal constant _ROLE_24 = 1 << 24; uint256 internal constant _ROLE_25 = 1 << 25; uint256 internal constant _ROLE_26 = 1 << 26; uint256 internal constant _ROLE_27 = 1 << 27; uint256 internal constant _ROLE_28 = 1 << 28; uint256 internal constant _ROLE_29 = 1 << 29; uint256 internal constant _ROLE_30 = 1 << 30; uint256 internal constant _ROLE_31 = 1 << 31; uint256 internal constant _ROLE_32 = 1 << 32; uint256 internal constant _ROLE_33 = 1 << 33; uint256 internal constant _ROLE_34 = 1 << 34; uint256 internal constant _ROLE_35 = 1 << 35; uint256 internal constant _ROLE_36 = 1 << 36; uint256 internal constant _ROLE_37 = 1 << 37; uint256 internal constant _ROLE_38 = 1 << 38; uint256 internal constant _ROLE_39 = 1 << 39; uint256 internal constant _ROLE_40 = 1 << 40; uint256 internal constant _ROLE_41 = 1 << 41; uint256 internal constant _ROLE_42 = 1 << 42; uint256 internal constant _ROLE_43 = 1 << 43; uint256 internal constant _ROLE_44 = 1 << 44; uint256 internal constant _ROLE_45 = 1 << 45; uint256 internal constant _ROLE_46 = 1 << 46; uint256 internal constant _ROLE_47 = 1 << 47; uint256 internal constant _ROLE_48 = 1 << 48; uint256 internal constant _ROLE_49 = 1 << 49; uint256 internal constant _ROLE_50 = 1 << 50; uint256 internal constant _ROLE_51 = 1 << 51; uint256 internal constant _ROLE_52 = 1 << 52; uint256 internal constant _ROLE_53 = 1 << 53; uint256 internal constant _ROLE_54 = 1 << 54; uint256 internal constant _ROLE_55 = 1 << 55; uint256 internal constant _ROLE_56 = 1 << 56; uint256 internal constant _ROLE_57 = 1 << 57; uint256 internal constant _ROLE_58 = 1 << 58; uint256 internal constant _ROLE_59 = 1 << 59; uint256 internal constant _ROLE_60 = 1 << 60; uint256 internal constant _ROLE_61 = 1 << 61; uint256 internal constant _ROLE_62 = 1 << 62; uint256 internal constant _ROLE_63 = 1 << 63; uint256 internal constant _ROLE_64 = 1 << 64; uint256 internal constant _ROLE_65 = 1 << 65; uint256 internal constant _ROLE_66 = 1 << 66; uint256 internal constant _ROLE_67 = 1 << 67; uint256 internal constant _ROLE_68 = 1 << 68; uint256 internal constant _ROLE_69 = 1 << 69; uint256 internal constant _ROLE_70 = 1 << 70; uint256 internal constant _ROLE_71 = 1 << 71; uint256 internal constant _ROLE_72 = 1 << 72; uint256 internal constant _ROLE_73 = 1 << 73; uint256 internal constant _ROLE_74 = 1 << 74; uint256 internal constant _ROLE_75 = 1 << 75; uint256 internal constant _ROLE_76 = 1 << 76; uint256 internal constant _ROLE_77 = 1 << 77; uint256 internal constant _ROLE_78 = 1 << 78; uint256 internal constant _ROLE_79 = 1 << 79; uint256 internal constant _ROLE_80 = 1 << 80; uint256 internal constant _ROLE_81 = 1 << 81; uint256 internal constant _ROLE_82 = 1 << 82; uint256 internal constant _ROLE_83 = 1 << 83; uint256 internal constant _ROLE_84 = 1 << 84; uint256 internal constant _ROLE_85 = 1 << 85; uint256 internal constant _ROLE_86 = 1 << 86; uint256 internal constant _ROLE_87 = 1 << 87; uint256 internal constant _ROLE_88 = 1 << 88; uint256 internal constant _ROLE_89 = 1 << 89; uint256 internal constant _ROLE_90 = 1 << 90; uint256 internal constant _ROLE_91 = 1 << 91; uint256 internal constant _ROLE_92 = 1 << 92; uint256 internal constant _ROLE_93 = 1 << 93; uint256 internal constant _ROLE_94 = 1 << 94; uint256 internal constant _ROLE_95 = 1 << 95; uint256 internal constant _ROLE_96 = 1 << 96; uint256 internal constant _ROLE_97 = 1 << 97; uint256 internal constant _ROLE_98 = 1 << 98; uint256 internal constant _ROLE_99 = 1 << 99; uint256 internal constant _ROLE_100 = 1 << 100; uint256 internal constant _ROLE_101 = 1 << 101; uint256 internal constant _ROLE_102 = 1 << 102; uint256 internal constant _ROLE_103 = 1 << 103; uint256 internal constant _ROLE_104 = 1 << 104; uint256 internal constant _ROLE_105 = 1 << 105; uint256 internal constant _ROLE_106 = 1 << 106; uint256 internal constant _ROLE_107 = 1 << 107; uint256 internal constant _ROLE_108 = 1 << 108; uint256 internal constant _ROLE_109 = 1 << 109; uint256 internal constant _ROLE_110 = 1 << 110; uint256 internal constant _ROLE_111 = 1 << 111; uint256 internal constant _ROLE_112 = 1 << 112; uint256 internal constant _ROLE_113 = 1 << 113; uint256 internal constant _ROLE_114 = 1 << 114; uint256 internal constant _ROLE_115 = 1 << 115; uint256 internal constant _ROLE_116 = 1 << 116; uint256 internal constant _ROLE_117 = 1 << 117; uint256 internal constant _ROLE_118 = 1 << 118; uint256 internal constant _ROLE_119 = 1 << 119; uint256 internal constant _ROLE_120 = 1 << 120; uint256 internal constant _ROLE_121 = 1 << 121; uint256 internal constant _ROLE_122 = 1 << 122; uint256 internal constant _ROLE_123 = 1 << 123; uint256 internal constant _ROLE_124 = 1 << 124; uint256 internal constant _ROLE_125 = 1 << 125; uint256 internal constant _ROLE_126 = 1 << 126; uint256 internal constant _ROLE_127 = 1 << 127; uint256 internal constant _ROLE_128 = 1 << 128; uint256 internal constant _ROLE_129 = 1 << 129; uint256 internal constant _ROLE_130 = 1 << 130; uint256 internal constant _ROLE_131 = 1 << 131; uint256 internal constant _ROLE_132 = 1 << 132; uint256 internal constant _ROLE_133 = 1 << 133; uint256 internal constant _ROLE_134 = 1 << 134; uint256 internal constant _ROLE_135 = 1 << 135; uint256 internal constant _ROLE_136 = 1 << 136; uint256 internal constant _ROLE_137 = 1 << 137; uint256 internal constant _ROLE_138 = 1 << 138; uint256 internal constant _ROLE_139 = 1 << 139; uint256 internal constant _ROLE_140 = 1 << 140; uint256 internal constant _ROLE_141 = 1 << 141; uint256 internal constant _ROLE_142 = 1 << 142; uint256 internal constant _ROLE_143 = 1 << 143; uint256 internal constant _ROLE_144 = 1 << 144; uint256 internal constant _ROLE_145 = 1 << 145; uint256 internal constant _ROLE_146 = 1 << 146; uint256 internal constant _ROLE_147 = 1 << 147; uint256 internal constant _ROLE_148 = 1 << 148; uint256 internal constant _ROLE_149 = 1 << 149; uint256 internal constant _ROLE_150 = 1 << 150; uint256 internal constant _ROLE_151 = 1 << 151; uint256 internal constant _ROLE_152 = 1 << 152; uint256 internal constant _ROLE_153 = 1 << 153; uint256 internal constant _ROLE_154 = 1 << 154; uint256 internal constant _ROLE_155 = 1 << 155; uint256 internal constant _ROLE_156 = 1 << 156; uint256 internal constant _ROLE_157 = 1 << 157; uint256 internal constant _ROLE_158 = 1 << 158; uint256 internal constant _ROLE_159 = 1 << 159; uint256 internal constant _ROLE_160 = 1 << 160; uint256 internal constant _ROLE_161 = 1 << 161; uint256 internal constant _ROLE_162 = 1 << 162; uint256 internal constant _ROLE_163 = 1 << 163; uint256 internal constant _ROLE_164 = 1 << 164; uint256 internal constant _ROLE_165 = 1 << 165; uint256 internal constant _ROLE_166 = 1 << 166; uint256 internal constant _ROLE_167 = 1 << 167; uint256 internal constant _ROLE_168 = 1 << 168; uint256 internal constant _ROLE_169 = 1 << 169; uint256 internal constant _ROLE_170 = 1 << 170; uint256 internal constant _ROLE_171 = 1 << 171; uint256 internal constant _ROLE_172 = 1 << 172; uint256 internal constant _ROLE_173 = 1 << 173; uint256 internal constant _ROLE_174 = 1 << 174; uint256 internal constant _ROLE_175 = 1 << 175; uint256 internal constant _ROLE_176 = 1 << 176; uint256 internal constant _ROLE_177 = 1 << 177; uint256 internal constant _ROLE_178 = 1 << 178; uint256 internal constant _ROLE_179 = 1 << 179; uint256 internal constant _ROLE_180 = 1 << 180; uint256 internal constant _ROLE_181 = 1 << 181; uint256 internal constant _ROLE_182 = 1 << 182; uint256 internal constant _ROLE_183 = 1 << 183; uint256 internal constant _ROLE_184 = 1 << 184; uint256 internal constant _ROLE_185 = 1 << 185; uint256 internal constant _ROLE_186 = 1 << 186; uint256 internal constant _ROLE_187 = 1 << 187; uint256 internal constant _ROLE_188 = 1 << 188; uint256 internal constant _ROLE_189 = 1 << 189; uint256 internal constant _ROLE_190 = 1 << 190; uint256 internal constant _ROLE_191 = 1 << 191; uint256 internal constant _ROLE_192 = 1 << 192; uint256 internal constant _ROLE_193 = 1 << 193; uint256 internal constant _ROLE_194 = 1 << 194; uint256 internal constant _ROLE_195 = 1 << 195; uint256 internal constant _ROLE_196 = 1 << 196; uint256 internal constant _ROLE_197 = 1 << 197; uint256 internal constant _ROLE_198 = 1 << 198; uint256 internal constant _ROLE_199 = 1 << 199; uint256 internal constant _ROLE_200 = 1 << 200; uint256 internal constant _ROLE_201 = 1 << 201; uint256 internal constant _ROLE_202 = 1 << 202; uint256 internal constant _ROLE_203 = 1 << 203; uint256 internal constant _ROLE_204 = 1 << 204; uint256 internal constant _ROLE_205 = 1 << 205; uint256 internal constant _ROLE_206 = 1 << 206; uint256 internal constant _ROLE_207 = 1 << 207; uint256 internal constant _ROLE_208 = 1 << 208; uint256 internal constant _ROLE_209 = 1 << 209; uint256 internal constant _ROLE_210 = 1 << 210; uint256 internal constant _ROLE_211 = 1 << 211; uint256 internal constant _ROLE_212 = 1 << 212; uint256 internal constant _ROLE_213 = 1 << 213; uint256 internal constant _ROLE_214 = 1 << 214; uint256 internal constant _ROLE_215 = 1 << 215; uint256 internal constant _ROLE_216 = 1 << 216; uint256 internal constant _ROLE_217 = 1 << 217; uint256 internal constant _ROLE_218 = 1 << 218; uint256 internal constant _ROLE_219 = 1 << 219; uint256 internal constant _ROLE_220 = 1 << 220; uint256 internal constant _ROLE_221 = 1 << 221; uint256 internal constant _ROLE_222 = 1 << 222; uint256 internal constant _ROLE_223 = 1 << 223; uint256 internal constant _ROLE_224 = 1 << 224; uint256 internal constant _ROLE_225 = 1 << 225; uint256 internal constant _ROLE_226 = 1 << 226; uint256 internal constant _ROLE_227 = 1 << 227; uint256 internal constant _ROLE_228 = 1 << 228; uint256 internal constant _ROLE_229 = 1 << 229; uint256 internal constant _ROLE_230 = 1 << 230; uint256 internal constant _ROLE_231 = 1 << 231; uint256 internal constant _ROLE_232 = 1 << 232; uint256 internal constant _ROLE_233 = 1 << 233; uint256 internal constant _ROLE_234 = 1 << 234; uint256 internal constant _ROLE_235 = 1 << 235; uint256 internal constant _ROLE_236 = 1 << 236; uint256 internal constant _ROLE_237 = 1 << 237; uint256 internal constant _ROLE_238 = 1 << 238; uint256 internal constant _ROLE_239 = 1 << 239; uint256 internal constant _ROLE_240 = 1 << 240; uint256 internal constant _ROLE_241 = 1 << 241; uint256 internal constant _ROLE_242 = 1 << 242; uint256 internal constant _ROLE_243 = 1 << 243; uint256 internal constant _ROLE_244 = 1 << 244; uint256 internal constant _ROLE_245 = 1 << 245; uint256 internal constant _ROLE_246 = 1 << 246; uint256 internal constant _ROLE_247 = 1 << 247; uint256 internal constant _ROLE_248 = 1 << 248; uint256 internal constant _ROLE_249 = 1 << 249; uint256 internal constant _ROLE_250 = 1 << 250; uint256 internal constant _ROLE_251 = 1 << 251; uint256 internal constant _ROLE_252 = 1 << 252; uint256 internal constant _ROLE_253 = 1 << 253; uint256 internal constant _ROLE_254 = 1 << 254; uint256 internal constant _ROLE_255 = 1 << 255; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Reentrancy guard mixin. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ReentrancyGuard.sol) abstract contract ReentrancyGuard { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Unauthorized reentrant call. error Reentrancy(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Equivalent to: `uint72(bytes9(keccak256("_REENTRANCY_GUARD_SLOT")))`. /// 9 bytes is large enough to avoid collisions with lower slots, /// but not too large to result in excessive bytecode bloat. uint256 private constant _REENTRANCY_GUARD_SLOT = 0x929eee149b4bd21268; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* REENTRANCY GUARD */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Guards a function from reentrancy. modifier nonReentrant() virtual { /// @solidity memory-safe-assembly assembly { if eq(sload(_REENTRANCY_GUARD_SLOT), address()) { mstore(0x00, 0xab143c06) // `Reentrancy()`. revert(0x1c, 0x04) } sstore(_REENTRANCY_GUARD_SLOT, address()) } _; /// @solidity memory-safe-assembly assembly { sstore(_REENTRANCY_GUARD_SLOT, codesize()) } } /// @dev Guards a view function from read-only reentrancy. modifier nonReadReentrant() virtual { /// @solidity memory-safe-assembly assembly { if eq(sload(_REENTRANCY_GUARD_SLOT), address()) { mstore(0x00, 0xab143c06) // `Reentrancy()`. revert(0x1c, 0x04) } } _; } }
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity ^0.8.21; import {IERC4626} from "@openzeppelin/contracts/interfaces/IERC4626.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IVaultSupervisor} from "./IVaultSupervisor.sol"; import {ISwapper} from "./ISwapper.sol"; interface IVault is IERC4626 { enum AssetType { NONE, ETH, STABLE, BTC, OTHER } struct SwapAssetParams { IERC20 newDepositToken; string name; string symbol; AssetType assetType; uint256 assetLimit; } function initialize( address _owner, IERC20 _depositToken, string memory _name, string memory _symbol, AssetType _assetType ) external; function deposit(uint256 assets, address depositor) external returns (uint256); function redeem(uint256 shares, address to, address owner) external returns (uint256 assets); function setLimit(uint256 newLimit) external; function assetLimit() external view returns (uint256); function pause(bool toPause) external; function owner() external view returns (address); function transferOwnership(address newOwner) external; function renounceOwnership() external; function totalAssets() external view returns (uint256); function decimals() external view returns (uint8); function assetType() external view returns (AssetType); function swapAsset( ISwapper swapper, SwapAssetParams calldata params, uint256 minNewAssetAmount, bytes calldata swapperOtherParams ) external; }
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity ^0.8.21; import {WithdrawLib2} from "../entities/Withdraw2.sol"; import {VaultLib2} from "../entities/VaultLib2.sol"; interface IVault2 { /* ========== MUTATIVE FUNCTIONS ========== */ function initialize( address _owner, address _operator, address _depositToken, string memory _name, string memory _symbol, bytes memory _extraData ) external; function deposit(uint256 assets, address to) external returns (uint256 shares); function deposit(uint256 assets, address to, uint256 minSharesOut) external returns (uint256 shares); function mint(uint256 shares, address to) external returns (uint256 assets); function startRedeem(uint256 shares, address withdrawer) external returns (bytes32 withdrawalKey); function finishRedeem(bytes32 withdrawalKey) external; function pause(uint256 map) external; function unpause(uint256 map) external; function slashAssets(uint256 slashPercentageWad, address slashingHandler) external returns (uint256 transferAmount); function transfer(address to, uint256 shares) external; /* ======================================== */ /* ============ VIEW FUNCTIONS ============ */ function owner() external view returns (address); function totalAssets() external view returns (uint256); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function vaultConfig() external pure returns (VaultLib2.Config memory); function asset() external view returns (address); function getNextWithdrawNonce(address staker) external view returns (uint256); function isWithdrawalPending(address staker, uint256 _withdrawNonce) external view returns (bool); function getQueuedWithdrawal(address staker, uint256 _withdrawNonce) external view returns (WithdrawLib2.QueuedWithdrawal memory); function balanceOf(address account) external view returns (uint256); /* ======================================== */ }
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity ^0.8.21; import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol"; interface ISwapper { struct SwapParams { IERC20 inputAsset; IERC20 outputAsset; uint256 inputAmount; uint256 minOutputAmount; } function swapAssets(SwapParams calldata swapParams, bytes calldata domainSpecificParams) external; function canSwap(IERC20 input, IERC20 output) external view returns (bool); }
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity ^0.8.21; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./IVault.sol"; import "./IVault2.sol"; import "./ILimiter.sol"; import {ISwapper} from "./ISwapper.sol"; interface IVaultSupervisor { struct Signature { uint8 v; bytes32 r; bytes32 s; } function getDeposits(address staker) external view returns (IVault[] memory vaults, IERC20[] memory tokens, uint256[] memory assets, uint256[] memory shares); function initialize(address _delegationSupervisor, address _vaultImpl, ILimiter _limiter, address _manager) external; function allowlistRoute(address v1Vault, address v2Vault) external; function denylistRoute(address v1Vault, address v2Vault) external; function redeemShares(address staker, IVault vault, uint256 shares) external; function returnShares(IVault vault, uint256 shares) external; function removeShares(address staker, IVault vault, uint256 shares) external; function deposit(IVault vault, uint256 amount, uint256 minSharesOut) external returns (uint256); function deployVault(IERC20 depositToken, string memory name, string memory symbol, IVault.AssetType assetType) external returns (IVault); function runAdminOperation(IVault vault, bytes calldata fn) external returns (bytes memory); function depositWithSignature( IVault vault, address user, uint256 value, uint256 minSharesOut, uint256 deadline, Signature calldata permit, Signature calldata vaultAllowance ) external returns (uint256); function SIGNED_DEPOSIT_TYPEHASH() external returns (bytes32); function getUserNonce(address user) external returns (uint256); function registerSwapperForRoutes(IERC20[] calldata inputAssets, IERC20[] calldata outputAssets, ISwapper swapper) external; function vaultSwap( IVault vault, IVault.SwapAssetParams calldata params, uint256 minNewAssetAmount, bytes calldata swapperParams ) external; function migrate( IVault oldVault, IVault newVault, uint256 oldShares, uint256 minNewShares, bytes calldata swapperParams ) external; function migrateToV2(IVault v1Vault, IVault2 v2Vault, uint256 oldShares, uint256 minNewShares) external; }
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity ^0.8.21; import "./IVault.sol"; import "../entities/Withdraw.sol"; interface IDelegationSupervisor { function withdrawalDelay() external view returns (uint256); function initialize(address vaultSupervisor, uint256 minWithdrawDelay, address manager) external; function startWithdraw(Withdraw.WithdrawRequest[] calldata withdrawRequest) external returns (bytes32[] memory withdrawalRoots, Withdraw.QueuedWithdrawal[] memory); function finishWithdraw(Withdraw.QueuedWithdrawal[] calldata withdrawals) external; function pause(bool toPause) external; function fetchQueuedWithdrawals(address staker) external view returns (Withdraw.QueuedWithdrawal[] memory queuedWithdrawals); function isWithdrawPending(Withdraw.QueuedWithdrawal calldata withdrawal) external view returns (bool); }
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity ^0.8.21; import {OwnableRoles} from "solady/src/auth/OwnableRoles.sol"; library Constants { uint256 public constant MAX_WITHDRAWAL_DELAY = 30 days; uint8 public constant MAX_VAULTS_PER_STAKER = 32; bytes32 public constant SIGNED_DEPOSIT_TYPEHASH = keccak256("Deposit(address vault, uint256 deadline, uint256 value, uint256 minSharesOut, uint256 nonce)"); bytes32 constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); address public constant DEFAULT_VAULT_IMPLEMENTATION_FLAG = address(1); // Bit from solady/src/auth/OwnableRoles.sol uint256 public constant MANAGER_ROLE = 1 << 0; }
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity ^0.8.21; error InvalidInput(); error InvalidWithdrawalDelay(); error ZeroAddress(); error NotVaultSupervisor(); error NotStaker(); error WithdrawAlreadyCompleted(); error MinWithdrawDelayNotPassed(); error WithdrawerNotCaller(); error ZeroShares(); error MaxStakerVault(); error VaultNotAChildVault(); error NotDelegationSupervisor(); error NotPreviousNorCurrentDelegationSupervisor(); error VaultNotFound(); error NotEnoughShares(); error InvalidVaultAdminFunction(); error NotInitialized(); error RoleNotGranted(); error MigrationRedeemFailed(); error MigrationSwapFailed(); error RouteNotAllowlisted(); // Vault.sol error NotSupervisor(); error TokenNotEnabled(); error SwapFailed(); // Generic error NoElementsInArray(); error ArrayLengthsNotEqual(); error ZeroAmount(); // VaultSupervisor.sol error PermitFailed(); error ExpiredSign(); error InvalidSignature(); error CrossedDepositLimit(); error InvalidSwapper(); error InvalidSwapperRouteLength(); error AssetMismatch(); // Limiter.sol error UnsupportedAsset(); // Swapper.sol error LengthDoesNotMatch(); error CannotSwap(); error InvalidSwapParams(); error PendleSwapFailed();
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity ^0.8.21; import {IVault} from "./IVault.sol"; event StartedWithdrawal( address indexed vault, address indexed staker, address indexed operator, address withdrawer, uint256 shares ); event FinishedWithdrawal( address indexed vault, address indexed staker, address indexed operator, address withdrawer, uint256 shares, bytes32 withdrawRoot ); event NewVault(address indexed vault); event GaveShares(address indexed staker, address indexed vault, address shareToken, uint256 shares); event ReturnedShares(address indexed staker, address indexed vault, address shareToken, uint256 shares); event VaultSwap( address indexed vault, address indexed oldAsset, address indexed newAsset, uint256 oldAssetIn, uint256 newAssetOut, string newName, string newSymbol, IVault.AssetType newAssetType, uint256 newAssetLimit ); event MigratedToV2( address indexed user, address indexed v1Vault, address indexed v2Vault, uint256 oldShares, uint256 newShares, uint256 assets );
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity ^0.8.21; import "./IVault.sol"; interface ILimiter { function globalUsdLimit() external view returns (uint256); function usdPerEth() external view returns (uint256); function isLimitBreached(IVault[] calldata vaults) external view returns (bool); function remainingGlobalUsdLimit(IVault[] memory vaults) external view returns (uint256); function computeGlobalDepositsInUsd(IVault[] memory vaults) external view returns (uint256); function computeUserMaximumDeposit( IVault[] memory vaults, IVault vaultToDeposit, address user, uint256 walletBalance ) external view returns (uint256); function setGlobalUsdLimit(uint256 _limit) external; function setUsdPerEth(uint256 _usdPerEth) external; }
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity ^0.8.21; import {IVault} from "../interfaces/IVault.sol"; import {IVaultSupervisor} from "../interfaces/IVaultSupervisor.sol"; import {IDelegationSupervisor} from "../interfaces/IDelegationSupervisor.sol"; import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol"; import {IERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol"; import "../interfaces/Constants.sol"; import "../interfaces/Errors.sol"; import "../interfaces/ILimiter.sol"; import {ISwapper} from "../interfaces/ISwapper.sol"; library VaultSupervisorLib { /// @custom:storage-location erc7201:vaultsupervisor.storage struct Storage { mapping(address staker => mapping(IVault vault => uint256 shares)) stakerShares; mapping(address staker => IVault[] vaults) stakersVaults; mapping(address staker => uint256 nonce) userNonce; mapping(address vault => address implementation) vaultToImplMap; IVault[] vaults; address vaultImpl; IDelegationSupervisor delegationSupervisor; ILimiter limiter; mapping(IERC20 inputAsset => mapping(IERC20 outputAsset => ISwapper swapper)) inputToOutputToSwapper; mapping(address v1Vaults => mapping(address v2Vaults => bool isAllowlisted)) allowlistedRoutes; } function initOrUpdate(Storage storage self, address _delegationSupervisor, address _vaultImpl, ILimiter _limiter) internal { if (_vaultImpl == address(0) || _delegationSupervisor == address(0)) { revert ZeroAddress(); } self.delegationSupervisor = IDelegationSupervisor(_delegationSupervisor); self.vaultImpl = _vaultImpl; self.limiter = _limiter; } function verifySignatures( IVault vault, address user, uint256 value, uint256 minSharesOut, uint256 deadline, IVaultSupervisor.Signature calldata permit, IVaultSupervisor.Signature calldata vaultAllowance, uint256 nonce ) internal { try IERC20Permit(address(vault.asset())).permit( user, address(vault), value, deadline, permit.v, permit.r, permit.s ) {} catch { if (IERC20(vault.asset()).allowance(user, address(vault)) < value) revert PermitFailed(); } verifyVaultSign({ vault: address(vault), user: user, value: value, minSharesOut: minSharesOut, deadline: deadline, vaultSign: vaultAllowance, nonce: nonce }); } function verifyVaultSign( address vault, address user, uint256 value, uint256 minSharesOut, uint256 deadline, IVaultSupervisor.Signature calldata vaultSign, uint256 nonce ) internal view { if (deadline < block.timestamp) revert ExpiredSign(); bytes32 EIP712DomainHash = keccak256( abi.encode( Constants.DOMAIN_TYPEHASH, keccak256(bytes("Karak_Vault_Sup")), keccak256(bytes("v1")), block.chainid, address(this) ) ); bytes32 vaultHash = keccak256(abi.encodePacked(Constants.SIGNED_DEPOSIT_TYPEHASH, vault, deadline, value, minSharesOut, nonce)); bytes32 combinedHash = keccak256(abi.encodePacked("\x19\x01", EIP712DomainHash, vaultHash)); address signer = ECDSA.recover(combinedHash, vaultSign.v, vaultSign.r, vaultSign.s); if (signer != user) revert InvalidSignature(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/Proxy.sol) pragma solidity ^0.8.20; /** * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to * be specified by overriding the virtual {_implementation} function. * * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a * different contract through the {_delegate} function. * * The success and return data of the delegated call will be returned back to the caller of the proxy. */ abstract contract Proxy { /** * @dev Delegates the current call to `implementation`. * * This function does not return to its internal call site, it will return directly to the external caller. */ function _delegate(address implementation) internal virtual { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @dev This is a virtual function that should be overridden so it returns the address to which the fallback * function and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates the current call to the address returned by `_implementation()`. * * This function does not return to its internal call site, it will return directly to the external caller. */ function _fallback() internal virtual { _delegate(_implementation()); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other * function in the contract matches the call data. */ fallback() external payable virtual { _fallback(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol) pragma solidity ^0.8.20; import {IBeacon} from "../beacon/IBeacon.sol"; import {Address} from "../../utils/Address.sol"; import {StorageSlot} from "../../utils/StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. */ library ERC1967Utils { // We re-declare ERC-1967 events here because they can't be used directly from IERC1967. // This will be fixed in Solidity 0.8.21. At that point we should remove these events. /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Emitted when the beacon is changed. */ event BeaconUpgraded(address indexed beacon); /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev The `implementation` of the proxy is invalid. */ error ERC1967InvalidImplementation(address implementation); /** * @dev The `admin` of the proxy is invalid. */ error ERC1967InvalidAdmin(address admin); /** * @dev The `beacon` of the proxy is invalid. */ error ERC1967InvalidBeacon(address beacon); /** * @dev An upgrade function sees `msg.value > 0` that may be lost. */ error ERC1967NonPayable(); /** * @dev Returns the current implementation address. */ function getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { if (newImplementation.code.length == 0) { revert ERC1967InvalidImplementation(newImplementation); } StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Performs implementation upgrade with additional setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); if (data.length > 0) { Address.functionDelegateCall(newImplementation, data); } else { _checkNonPayable(); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Returns the current admin. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` */ function getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { if (newAdmin == address(0)) { revert ERC1967InvalidAdmin(address(0)); } StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {IERC1967-AdminChanged} event. */ function changeAdmin(address newAdmin) internal { emit AdminChanged(getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Returns the current beacon. */ function getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { if (newBeacon.code.length == 0) { revert ERC1967InvalidBeacon(newBeacon); } StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon; address beaconImplementation = IBeacon(newBeacon).implementation(); if (beaconImplementation.code.length == 0) { revert ERC1967InvalidImplementation(beaconImplementation); } } /** * @dev Change the beacon and trigger a setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-BeaconUpgraded} event. * * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for * efficiency. */ function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } else { _checkNonPayable(); } } /** * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract * if an upgrade doesn't perform an initialization call. */ function _checkNonPayable() private { if (msg.value > 0) { revert ERC1967NonPayable(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol) pragma solidity ^0.8.20; import {Strings} from "../Strings.sol"; /** * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing. * * The library provides methods for generating a hash of a message that conforms to the * https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712] * specifications. */ library MessageHashUtils { /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing a bytes32 `messageHash` with * `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with * keccak256, although any bytes32 value can be safely used because the final digest will * be re-hashed. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20) } } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing an arbitrary `message` with * `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) { return keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message)); } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x00` (data with intended validator). * * The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended * `validator` address. Then hashing the result. * * See {ECDSA-recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked(hex"19_00", validator, data)); } /** * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`). * * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with * `\x19\x01` and hashing the result. It corresponds to the hash signed by the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712. * * See {ECDSA-recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, hex"19_01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) digest := keccak256(ptr, 0x42) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5267.sol) pragma solidity ^0.8.20; interface IERC5267 { /** * @dev MAY be emitted to signal that the domain could have changed. */ event EIP712DomainChanged(); /** * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712 * signature. */ function eip712Domain() external view returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Simple single owner authorization mixin. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol) /// /// @dev Note: /// This implementation does NOT auto-initialize the owner to `msg.sender`. /// You MUST call the `_initializeOwner` in the constructor / initializer. /// /// While the ownable portion follows /// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility, /// the nomenclature for the 2-step ownership handover may be unique to this codebase. abstract contract Ownable { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The caller is not authorized to call the function. error Unauthorized(); /// @dev The `newOwner` cannot be the zero address. error NewOwnerIsZeroAddress(); /// @dev The `pendingOwner` does not have a valid handover request. error NoHandoverRequest(); /// @dev Cannot double-initialize. error AlreadyInitialized(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ownership is transferred from `oldOwner` to `newOwner`. /// This event is intentionally kept the same as OpenZeppelin's Ownable to be /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173), /// despite it not being as lightweight as a single argument event. event OwnershipTransferred(address indexed oldOwner, address indexed newOwner); /// @dev An ownership handover to `pendingOwner` has been requested. event OwnershipHandoverRequested(address indexed pendingOwner); /// @dev The ownership handover to `pendingOwner` has been canceled. event OwnershipHandoverCanceled(address indexed pendingOwner); /// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`. uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE = 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0; /// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE = 0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d; /// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE = 0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The owner slot is given by: /// `bytes32(~uint256(uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))))`. /// It is intentionally chosen to be a high value /// to avoid collision with lower slots. /// The choice of manual storage layout is to enable compatibility /// with both regular and upgradeable contracts. bytes32 internal constant _OWNER_SLOT = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927; /// The ownership handover slot of `newOwner` is given by: /// ``` /// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED)) /// let handoverSlot := keccak256(0x00, 0x20) /// ``` /// It stores the expiry timestamp of the two-step ownership handover. uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Override to return true to make `_initializeOwner` prevent double-initialization. function _guardInitializeOwner() internal pure virtual returns (bool guard) {} /// @dev Initializes the owner directly without authorization guard. /// This function must be called upon initialization, /// regardless of whether the contract is upgradeable or not. /// This is to enable generalization to both regular and upgradeable contracts, /// and to save gas in case the initial owner is not the caller. /// For performance reasons, this function will not check if there /// is an existing owner. function _initializeOwner(address newOwner) internal virtual { if (_guardInitializeOwner()) { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT if sload(ownerSlot) { mstore(0x00, 0x0dc149f0) // `AlreadyInitialized()`. revert(0x1c, 0x04) } // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Store the new value. sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) } } else { /// @solidity memory-safe-assembly assembly { // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Store the new value. sstore(_OWNER_SLOT, newOwner) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) } } } /// @dev Sets the owner directly without authorization guard. function _setOwner(address newOwner) internal virtual { if (_guardInitializeOwner()) { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) // Store the new value. sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) } } else { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) // Store the new value. sstore(ownerSlot, newOwner) } } } /// @dev Throws if the sender is not the owner. function _checkOwner() internal view virtual { /// @solidity memory-safe-assembly assembly { // If the caller is not the stored owner, revert. if iszero(eq(caller(), sload(_OWNER_SLOT))) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } /// @dev Returns how long a two-step ownership handover is valid for in seconds. /// Override to return a different value if needed. /// Made internal to conserve bytecode. Wrap it in a public function if needed. function _ownershipHandoverValidFor() internal view virtual returns (uint64) { return 48 * 3600; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC UPDATE FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Allows the owner to transfer the ownership to `newOwner`. function transferOwnership(address newOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { if iszero(shl(96, newOwner)) { mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`. revert(0x1c, 0x04) } } _setOwner(newOwner); } /// @dev Allows the owner to renounce their ownership. function renounceOwnership() public payable virtual onlyOwner { _setOwner(address(0)); } /// @dev Request a two-step ownership handover to the caller. /// The request will automatically expire in 48 hours (172800 seconds) by default. function requestOwnershipHandover() public payable virtual { unchecked { uint256 expires = block.timestamp + _ownershipHandoverValidFor(); /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to `expires`. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), expires) // Emit the {OwnershipHandoverRequested} event. log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller()) } } } /// @dev Cancels the two-step ownership handover to the caller, if any. function cancelOwnershipHandover() public payable virtual { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), 0) // Emit the {OwnershipHandoverCanceled} event. log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller()) } } /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`. /// Reverts if there is no existing ownership handover requested by `pendingOwner`. function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) let handoverSlot := keccak256(0x0c, 0x20) // If the handover does not exist, or has expired. if gt(timestamp(), sload(handoverSlot)) { mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`. revert(0x1c, 0x04) } // Set the handover slot to 0. sstore(handoverSlot, 0) } _setOwner(pendingOwner); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC READ FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the owner of the contract. function owner() public view virtual returns (address result) { /// @solidity memory-safe-assembly assembly { result := sload(_OWNER_SLOT) } } /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`. function ownershipHandoverExpiresAt(address pendingOwner) public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { // Compute the handover slot. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) // Load the handover slot. result := sload(keccak256(0x0c, 0x20)) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* MODIFIERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Marks a function as only callable by the owner. modifier onlyOwner() virtual { _checkOwner(); _; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC4626.sol) pragma solidity ^0.8.20; import {IERC20} from "../token/ERC20/IERC20.sol"; import {IERC20Metadata} from "../token/ERC20/extensions/IERC20Metadata.sol"; /** * @dev Interface of the ERC4626 "Tokenized Vault Standard", as defined in * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626]. */ interface IERC4626 is IERC20, IERC20Metadata { event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares); event Withdraw( address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares ); /** * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing. * * - MUST be an ERC-20 token contract. * - MUST NOT revert. */ function asset() external view returns (address assetTokenAddress); /** * @dev Returns the total amount of the underlying asset that is “managed” by Vault. * * - SHOULD include any compounding that occurs from yield. * - MUST be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT revert. */ function totalAssets() external view returns (uint256 totalManagedAssets); /** * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal * scenario where all the conditions are met. * * - MUST NOT be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT show any variations depending on the caller. * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange. * - MUST NOT revert. * * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and * from. */ function convertToShares(uint256 assets) external view returns (uint256 shares); /** * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal * scenario where all the conditions are met. * * - MUST NOT be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT show any variations depending on the caller. * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange. * - MUST NOT revert. * * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and * from. */ function convertToAssets(uint256 shares) external view returns (uint256 assets); /** * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver, * through a deposit call. * * - MUST return a limited value if receiver is subject to some deposit limit. * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited. * - MUST NOT revert. */ function maxDeposit(address receiver) external view returns (uint256 maxAssets); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given * current on-chain conditions. * * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called * in the same transaction. * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the * deposit would be accepted, regardless if the user has enough tokens approved, etc. * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by depositing. */ function previewDeposit(uint256 assets) external view returns (uint256 shares); /** * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens. * * - MUST emit the Deposit event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * deposit execution, and are accounted for during deposit. * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not * approving enough underlying tokens to the Vault contract, etc). * * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token. */ function deposit(uint256 assets, address receiver) external returns (uint256 shares); /** * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call. * - MUST return a limited value if receiver is subject to some mint limit. * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted. * - MUST NOT revert. */ function maxMint(address receiver) external view returns (uint256 maxShares); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given * current on-chain conditions. * * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the * same transaction. * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint * would be accepted, regardless if the user has enough tokens approved, etc. * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by minting. */ function previewMint(uint256 shares) external view returns (uint256 assets); /** * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens. * * - MUST emit the Deposit event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint * execution, and are accounted for during mint. * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not * approving enough underlying tokens to the Vault contract, etc). * * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token. */ function mint(uint256 shares, address receiver) external returns (uint256 assets); /** * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the * Vault, through a withdraw call. * * - MUST return a limited value if owner is subject to some withdrawal limit or timelock. * - MUST NOT revert. */ function maxWithdraw(address owner) external view returns (uint256 maxAssets); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block, * given current on-chain conditions. * * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if * called * in the same transaction. * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though * the withdrawal would be accepted, regardless if the user has enough shares, etc. * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by depositing. */ function previewWithdraw(uint256 assets) external view returns (uint256 shares); /** * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver. * * - MUST emit the Withdraw event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * withdraw execution, and are accounted for during withdraw. * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner * not having enough shares, etc). * * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. * Those methods should be performed separately. */ function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares); /** * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault, * through a redeem call. * * - MUST return a limited value if owner is subject to some withdrawal limit or timelock. * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock. * - MUST NOT revert. */ function maxRedeem(address owner) external view returns (uint256 maxShares); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block, * given current on-chain conditions. * * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the * same transaction. * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the * redemption would be accepted, regardless if the user has enough shares, etc. * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by redeeming. */ function previewRedeem(uint256 shares) external view returns (uint256 assets); /** * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver. * * - MUST emit the Withdraw event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * redeem execution, and are accounted for during redeem. * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner * not having enough shares, etc). * * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed. * Those methods should be performed separately. */ function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity ^0.8.21; library WithdrawLib2 { struct QueuedWithdrawal { address staker; uint96 start; uint256 shares; address beneficiary; } function calculateWithdrawKey(address staker, uint256 stakerNonce) internal pure returns (bytes32) { return keccak256(abi.encode(staker, stakerNonce)); } }
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity ^0.8.21; library VaultLib2 { struct Config { // Required fields address asset; uint8 decimals; address operator; string name; string symbol; bytes extraData; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../token/ERC20/IERC20.sol";
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity ^0.8.21; import "./DelegationSupervisorLib.sol"; import "../interfaces/IVault.sol"; import "../interfaces/IVaultSupervisor.sol"; import "../interfaces/Errors.sol"; import "../interfaces/Events.sol"; library Withdraw { struct QueuedWithdrawal { address staker; address delegatedTo; uint256 nonce; uint256 start; WithdrawRequest request; } struct WithdrawRequest { IVault[] vaults; uint256[] shares; address withdrawer; } function finishStartedWithdrawal( QueuedWithdrawal calldata withdrawal, DelegationSupervisorLib.Storage storage delegationSupervisor ) internal { bytes32 withdrawalRoot = calculateWithdrawalRoot(withdrawal); if (withdrawal.request.withdrawer != msg.sender) revert WithdrawerNotCaller(); if (withdrawal.start + delegationSupervisor.withdrawalDelay > block.timestamp) { revert MinWithdrawDelayNotPassed(); } if (!delegationSupervisor.pendingWithdrawals[withdrawalRoot]) revert WithdrawAlreadyCompleted(); delete delegationSupervisor.pendingWithdrawals[withdrawalRoot]; for (uint256 i = 0; i < withdrawal.request.vaults.length; i++) { delegationSupervisor.vaultSupervisor.redeemShares( msg.sender, withdrawal.request.vaults[i], withdrawal.request.shares[i] ); emit FinishedWithdrawal( address(withdrawal.request.vaults[i]), withdrawal.staker, withdrawal.delegatedTo, withdrawal.request.withdrawer, withdrawal.request.shares[i], withdrawalRoot ); } } function calculateWithdrawalRoot(QueuedWithdrawal memory withdrawal) internal pure returns (bytes32) { return keccak256(abi.encode(withdrawal)); } function validate(Withdraw.WithdrawRequest calldata withdrawalRequest) internal view { // Length Checks if (withdrawalRequest.shares.length == 0 || withdrawalRequest.vaults.length == 0) revert NoElementsInArray(); if (withdrawalRequest.shares.length != withdrawalRequest.vaults.length) revert ArrayLengthsNotEqual(); // ACL checks if (withdrawalRequest.withdrawer != msg.sender) revert NotStaker(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.20; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS } /** * @dev The signature derives the `address(0)`. */ error ECDSAInvalidSignature(); /** * @dev The signature has an invalid length. */ error ECDSAInvalidSignatureLength(uint256 length); /** * @dev The signature has an S value that is in the upper half order. */ error ECDSAInvalidSignatureS(bytes32 s); /** * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not * return address(0) without also returning an error description. Errors are documented using an enum (error type) * and a bytes32 providing additional information about the error. * * If no error is returned, then the address can be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length)); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) { unchecked { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); // We do not check for an overflow here since the shift operation results in 0 or 1. uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError, bytes32) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS, s); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature, bytes32(0)); } return (signer, RecoverError.NoError, bytes32(0)); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s); _throwError(error, errorArg); return recovered; } /** * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided. */ function _throwError(RecoverError error, bytes32 errorArg) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert ECDSAInvalidSignature(); } else if (error == RecoverError.InvalidSignatureLength) { revert ECDSAInvalidSignatureLength(uint256(errorArg)); } else if (error == RecoverError.InvalidSignatureS) { revert ECDSAInvalidSignatureS(errorArg); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.20; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(newImplementation.code.length > 0); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { uint256 localValue = value; bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = HEX_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal * representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity ^0.8.21; import {Staker} from "./Staker.sol"; import {IVault} from "../interfaces/IVault.sol"; import {IVaultSupervisor} from "../interfaces/IVaultSupervisor.sol"; import "../interfaces/Errors.sol"; import "../interfaces/Constants.sol"; library DelegationSupervisorLib { /// @custom:storage-location erc7201:delegationsupervisor.storage struct Storage { mapping(bytes32 => bool) pendingWithdrawals; mapping(address => mapping(bytes32 => bool)) delegationApproverSaltIsSpent; mapping(address staker => Staker.StakerState state) stakers; uint256 withdrawalDelay; IVaultSupervisor vaultSupervisor; } function initOrUpdate(Storage storage self, address vaultSupervisor, uint256 withdrawDelay) internal { if (withdrawDelay > Constants.MAX_WITHDRAWAL_DELAY) revert InvalidWithdrawalDelay(); self.withdrawalDelay = withdrawDelay; self.vaultSupervisor = IVaultSupervisor(vaultSupervisor); } function updateMinWithdrawDelay(Storage storage self, uint256 withdrawDelay) internal { if (withdrawDelay > Constants.MAX_WITHDRAWAL_DELAY) revert InvalidWithdrawalDelay(); self.withdrawalDelay = withdrawDelay; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity ^0.8.21; import "./Withdraw.sol"; library Staker { struct StakerState { address delegatee; // staker this staker is delegating to uint256 nonce; uint256 totalWithdrawsQueued; Withdraw.QueuedWithdrawal[] queuedWithdrawals; } }
{ "remappings": [ "@openzeppelin/=node_modules/@openzeppelin/", "@openzeppelin-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/", "@openzeppelin-contracts/=node_modules/@openzeppelin/contracts/", "solady/=node_modules/solady/", "forge-std/=lib/forge-std/src/" ], "optimizer": { "enabled": true, "runs": 20000 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": true, "libraries": { "script/config/V2MigrationConfig.sol": { "V2MigrationChainConfig": "0x6A4f8dcBD42842c0C9718B832A00305Fe6a19306" } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"AssetMismatch","type":"error"},{"inputs":[],"name":"CrossedDepositLimit","type":"error"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"ExpiredSign","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"InvalidSwapper","type":"error"},{"inputs":[],"name":"InvalidSwapperRouteLength","type":"error"},{"inputs":[],"name":"InvalidVaultAdminFunction","type":"error"},{"inputs":[],"name":"MaxStakerVault","type":"error"},{"inputs":[],"name":"MigrationRedeemFailed","type":"error"},{"inputs":[],"name":"MigrationSwapFailed","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoHandoverRequest","type":"error"},{"inputs":[],"name":"NotDelegationSupervisor","type":"error"},{"inputs":[],"name":"NotEnoughShares","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"PermitFailed","type":"error"},{"inputs":[],"name":"Reentrancy","type":"error"},{"inputs":[],"name":"RouteNotAllowlisted","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"UnauthorizedCallContext","type":"error"},{"inputs":[],"name":"UpgradeFailed","type":"error"},{"inputs":[],"name":"VaultNotAChildVault","type":"error"},{"inputs":[],"name":"VaultNotFound","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroShares","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"address","name":"withdrawer","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"withdrawRoot","type":"bytes32"}],"name":"FinishedWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":false,"internalType":"address","name":"shareToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"GaveShares","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"v1Vault","type":"address"},{"indexed":true,"internalType":"address","name":"v2Vault","type":"address"},{"indexed":false,"internalType":"uint256","name":"oldShares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newShares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"}],"name":"MigratedToV2","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"}],"name":"NewVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":false,"internalType":"address","name":"shareToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"ReturnedShares","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"roles","type":"uint256"}],"name":"RolesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"address","name":"withdrawer","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"StartedWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"UpgradedAllVaults","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"},{"indexed":true,"internalType":"address","name":"vault","type":"address"}],"name":"UpgradedVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":true,"internalType":"address","name":"oldAsset","type":"address"},{"indexed":true,"internalType":"address","name":"newAsset","type":"address"},{"indexed":false,"internalType":"uint256","name":"oldAssetIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newAssetOut","type":"uint256"},{"indexed":false,"internalType":"string","name":"newName","type":"string"},{"indexed":false,"internalType":"string","name":"newSymbol","type":"string"},{"indexed":false,"internalType":"enum IVault.AssetType","name":"newAssetType","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"newAssetLimit","type":"uint256"}],"name":"VaultSwap","type":"event"},{"inputs":[],"name":"SIGNED_DEPOSIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"v1Vault","type":"address"},{"internalType":"address","name":"v2Vault","type":"address"}],"name":"allowlistRoute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"v1Vault","type":"address"},{"internalType":"address","name":"v2Vault","type":"address"}],"name":"allowlistedRoutes","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cancelOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newVaultImpl","type":"address"}],"name":"changeImplementation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"address","name":"newVaultImpl","type":"address"}],"name":"changeImplementationForVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"completeOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"delegationSupervisor","outputs":[{"internalType":"contract IDelegationSupervisor","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"v1Vault","type":"address"},{"internalType":"address","name":"v2Vault","type":"address"}],"name":"denylistRoute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"depositToken","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"enum IVault.AssetType","name":"assetType","type":"uint8"}],"name":"deployVault","outputs":[{"internalType":"contract IVault","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IVault","name":"vault","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minSharesOut","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IVault","name":"vault","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minSharesOut","type":"uint256"}],"name":"depositAndGimmie","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IVault","name":"vault","type":"address"},{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"minSharesOut","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"components":[{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct IVaultSupervisor.Signature","name":"permit","type":"tuple"},{"components":[{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct IVaultSupervisor.Signature","name":"vaultAllowance","type":"tuple"}],"name":"depositWithSignature","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"staker","type":"address"}],"name":"getDeposits","outputs":[{"internalType":"contract IVault[]","name":"vaults","type":"address[]"},{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"assets","type":"uint256[]"},{"internalType":"uint256[]","name":"shares","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVaults","outputs":[{"internalType":"contract IVault[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IVault","name":"vault","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"gimmieShares","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"grantRoles","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"hasAllRoles","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"hasAnyRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"}],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_delegationSupervisor","type":"address"},{"internalType":"address","name":"_vaultImpl","type":"address"},{"internalType":"contract ILimiter","name":"_limiter","type":"address"},{"internalType":"address","name":"_manager","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IVault","name":"oldVault","type":"address"},{"internalType":"contract IVault","name":"newVault","type":"address"},{"internalType":"uint256","name":"oldShares","type":"uint256"},{"internalType":"uint256","name":"minNewShares","type":"uint256"},{"internalType":"bytes","name":"swapperOtherParams","type":"bytes"}],"name":"migrate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IVault","name":"v1Vault","type":"address"},{"internalType":"contract IVault2","name":"v2Vault","type":"address"},{"internalType":"uint256","name":"oldShares","type":"uint256"},{"internalType":"uint256","name":"minNewShares","type":"uint256"}],"name":"migrateToV2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"ownershipHandoverExpiresAt","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"toPause","type":"bool"}],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"staker","type":"address"},{"internalType":"contract IVault","name":"vault","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"redeemShares","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20[]","name":"inputAsset","type":"address[]"},{"internalType":"contract IERC20[]","name":"outputAsset","type":"address[]"},{"internalType":"contract ISwapper","name":"swapper","type":"address"}],"name":"registerSwapperForRoutes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"staker","type":"address"},{"internalType":"contract IVault","name":"vault","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"removeShares","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"renounceRoles","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"requestOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IVault","name":"vault","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"returnShares","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"revokeRoles","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"rolesOf","outputs":[{"internalType":"uint256","name":"roles","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IVault","name":"vault","type":"address"},{"internalType":"bytes","name":"fn","type":"bytes"}],"name":"runAdminOperation","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ILimiter","name":"limiter","type":"address"}],"name":"setLimiter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IVault","name":"vault","type":"address"},{"components":[{"internalType":"contract IERC20","name":"newDepositToken","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"enum IVault.AssetType","name":"assetType","type":"uint8"},{"internalType":"uint256","name":"assetLimit","type":"uint256"}],"internalType":"struct IVault.SwapAssetParams","name":"params","type":"tuple"},{"internalType":"uint256","name":"minNewAssetAmount","type":"uint256"},{"internalType":"bytes","name":"swapperParams","type":"bytes"}],"name":"vaultSwap","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a0806040523460c857306080527ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a009081549060ff8260401c1660b957506001600160401b036002600160401b0319828216016075575b6040516153df90816100ce8239608051818181611024015261128f0152f35b6001600160401b031990911681179091556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a13880806056565b63f92ee8a960e01b8152600490fd5b600080fdfe6080604052600436101561001257600080fd5b60003560e01c806302329a29146102d75780630a2c13a1146102d25780630efe6a8b146102cd57806317070f02146102c857806317a68dd8146102c3578063183a4f6e146102be5780631c10893f146102b95780631cd64df4146102b457806325692962146102af578063258809e3146102aa578063259dff0c146102a55780632b93e0a2146102a05780632de948071461029b57806344d00f82146102965780634a4ee7b1146102915780634f1ef2861461028c578063514e62fc1461028757806351ffb74a1461028257806352d1902d1461027d57806354d1f13d146102785780635c60da1b146102735780635c975abb1461026e5780636834e3a8146102695780636b88071814610264578063715018a61461025f5780637a29084c1461025a5780637fb2a0a1146102555780638b198025146102505780638c80d4e51461024b5780638da5cb5b1461024657806394f649dd14610241578063aa0a050c1461023c578063c1f09e3014610237578063ca5f767814610232578063df6704481461022d578063e4af8b2214610228578063efc1e71214610223578063f04e283e1461021e578063f0edf6aa14610219578063f2fde38b14610214578063f8c8765e1461020f578063fadb7dc91461020a578063fc346664146102055763fee81cf41461020057600080fd5b6136b4565b61303c565b613000565b612de8565b612da8565b612bb8565b612a14565b6123bc565b612381565b61233b565b611e81565b611cc8565b611b82565b61184e565b611755565b6116ae565b61157a565b6114fb565b61147f565b61141d565b6113f6565b611393565b611351565b611324565b6112dd565b61127b565b61117b565b61110a565b610fe8565b610f8e565b610ed8565b610e5d565b610acc565b610854565b6107a2565b610753565b610702565b61069c565b610682565b6105b4565b610561565b61050b565b610472565b6102eb565b801515036102e657565b600080fd5b346102e65760206003193601126102e657600435610308816102dc565b610310613eec565b156103935761031d613f40565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f0330060017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008254161790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1005b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300805460ff81161561040f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b60046040517f8dfc202b000000000000000000000000000000000000000000000000000000008152fd5b6001600160a01b038116036102e657565b60031960409101126102e65760043561046281610439565b9060243561046f81610439565b90565b346102e657602060ff6104dc6104c461048a3661044a565b91906001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649109602052604060002090565b906001600160a01b0316600052602052604060002090565b54166040519015158152f35b60031960609101126102e65760043561050081610439565b906024359060443590565b346102e657610519366104e8565b909168929eee149b4bd2126891308354146105535760209361054792308555610540613f40565b3333613f95565b90389055604051908152f35b63ab143c066000526004601cfd5b346102e65761056f366104e8565b68929eee149b4bd212689291929030825414610553576105a26105a99160209530855561059a613f40565b853333613f95565b8093614222565b389055604051908152f35b346102e65760206003193601126102e6576001600160a01b036004356105d981610439565b6105e1613f08565b168015610658577fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649105817fffffffffffffffffffffffff00000000000000000000000000000000000000008254161790557f2768c62492a0ab17bb4fd74f18e51a421e2a8e30c0d05ec389cd5609e91b4d5e600080a2005b60046040517fd92e233d000000000000000000000000000000000000000000000000000000008152fd5b60206003193601126102e65761069a60043533614982565b005b60406003193601126102e6576004356106b481610439565b6106bc613f08565b638b78c6d8600c526000526020600c20602435815417809155600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26600080a3005b346102e65760406003193601126102e657602061073e60043561072481610439565b602435918291638b78c6d8600c526000526020600c205490565b1614604051908152f35b60009103126102e657565b60008060031936011261079f5763389a75e1600c523381526202a30042016020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d8280a280f35b80fd5b346102e6576107f86104c46107b63661044a565b91906107c0613eec565b6001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649109602052604060002090565b80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055005b9181601f840112156102e65782359167ffffffffffffffff83116102e6576020808501948460051b0101116102e657565b346102e65760606003193601126102e657600467ffffffffffffffff81358181116102e6576108869036908401610823565b90916024359081116102e65761089f9036908501610823565b93604435946108ad86610439565b6108b5613f08565b808403610a445792936001600160a01b038616939060005b8681106108d657005b6108e96108e482898561371a565b61372f565b6108f76108e483868961371a565b9060408181517fbcdbc94700000000000000000000000000000000000000000000000000000000815288818c818061094f8a602098899784019060209093929360408301946001600160a01b03809216845216910152565b03915afa918215610a3f57600092610a12575b5050156109ea5750896109b1600194936104c46109e4946001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649108602052604060002090565b906001600160a01b03167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b016108cd565b8690517fc94f7a9a000000000000000000000000000000000000000000000000000000008152fd5b610a319250803d10610a38575b610a298183612acc565b810190613739565b3880610962565b503d610a1f565b61374e565b506040517f3e31cc61000000000000000000000000000000000000000000000000000000008152fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5c60609101126102e65760a490565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffefc60609101126102e65761010490565b346102e6576101606003193601126102e6576004803590610aec82610439565b60243590610af982610439565b6044356064359360843593610b0d36610a6d565b610b1636610a9c565b68929eee149b4bd212689630885414610e5057308855610b34613f40565b610b70846001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649102602052604060002090565b54926001600160a01b0397888716916040998a51917f38d52e0f0000000000000000000000000000000000000000000000000000000090818452602093848187818a5afa8015610a3f578491600091610e33575b501690610bd0816143f3565b823b156102e65787928f8f818f946000968c8f92610c5d938a968f98519c8d9b8c9a8b997fd505accf000000000000000000000000000000000000000000000000000000008b528801359701359589019360ff929897969360c0969260e087019a6001600160a01b0380921688521660208701526040860152606085015216608083015260a08201520152565b03925af19081610e1a575b50610dfd578b5190815282818581885afa918215610a3f57610cdf928a87928f8795600094610dce575b50518096819582947fdd62ed3e0000000000000000000000000000000000000000000000000000000084528b84019060209093929360408301946001600160a01b03809216845216910152565b0392165afa908115610a3f578a92600092610da1575b505010610d7a5750928492610d16928b89610d649a98610d769e9a98614a80565b610d52816001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649102602052604060002090565b610d5c8154613789565b905580613f95565b38909255519081529081906020820190565b0390f35b88517fb78cb0dd000000000000000000000000000000000000000000000000000000008152fd5b610dc09250803d10610dc7575b610db88183612acc565b810190613923565b3880610cf5565b503d610dae565b610def919450863d8811610df6575b610de78183612acc565b810190613946565b9238610c92565b503d610ddd565b50505050928492610d16928b89610d649a98610d769e9a98614a80565b80610e27610e2d92612a97565b80610748565b38610c68565b610e4a9150863d8811610df657610de78183612acc565b38610bc4565b8663ab143c06600052601cfd5b346102e65760206003193601126102e6576020610e93600435610e7f81610439565b638b78c6d8600c526000526020600c205490565b604051908152f35b90815180825260208080930193019160005b828110610ebb575050505090565b83516001600160a01b031685529381019392810192600101610ead565b346102e65760006003193601126102e657604051807fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad86491049182548082526020809201936000527fcc963e9281187e610857e988900b0c72937ebb5122acc7f351ae2143b44e4682916000905b828210610f6e57610d7685610f5a81890382612acc565b604051918291602083526020830190610e9b565b83546001600160a01b031686529485019460019384019390910190610f43565b60406003193601126102e65761069a600435610fa981610439565b610fb1613f08565b60243590614982565b9181601f840112156102e65782359167ffffffffffffffff83116102e657602083818601950101116102e657565b60406003193601126102e65760043561100081610439565b60243567ffffffffffffffff81116102e657611020903690600401610fba565b91307f0000000000000000000000000000000000000000000000000000000000000000146110fc576001600160a01b0390611059613f08565b16916352d1902d6001527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc9081602060016004601d885afa51036110ee578084916000958694817fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8780a2556110cd578280f35b806040519485378338925af4156110e5578181808280f35b903d90823e3d90fd5b6355299b496001526004601dfd5b639f03a0266000526004601cfd5b346102e65760406003193601126102e657602060043561112981610439565b61114460243591638b78c6d8600c526000526020600c205490565b161515604051908152f35b60031960609101126102e65760043561116781610439565b9060243561117481610439565b9060443590565b346102e6576111893661114f565b6001600160a01b03929192807fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad864910654163303611251576111fc8185166001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604060002090565b5416156112275768929eee149b4bd2126892308454146105535761122292308555614401565b389055005b60046040517fb13b4eea000000000000000000000000000000000000000000000000000000008152fd5b60046040517fd04f8cc5000000000000000000000000000000000000000000000000000000008152fd5b346102e65760006003193601126102e657307f0000000000000000000000000000000000000000000000000000000000000000036110fc5760206040517f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8152f35b60008060031936011261079f5763389a75e1600c52338152806020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c928280a280f35b346102e65760006003193601126102e657602061134033613817565b6001600160a01b0360405191168152f35b346102e65760006003193601126102e657602060ff7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f0330054166040519015158152f35b346102e65760206003193601126102e65760206113ed6004356113b581610439565b6001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649102602052604060002090565b54604051908152f35b346102e65760206003193601126102e657602061134060043561141881610439565b613817565b60008060031936011261079f57611432613f08565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a35580f35b346102e65760206003193601126102e65760043561149c81610439565b6114a4613eec565b6001600160a01b037fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad864910791167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055600080f35b346102e65760406003193601126102e65760043561151881610439565b6001600160a01b0381811660009081527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604090205416156112275768929eee149b4bd212689030825414610553576112229030835560243590614222565b346102e65760406003193601126102e65760043561159781610439565b6001600160a01b0381811660008181527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604090209091602435915416156112275768929eee149b4bd21268923084541461055357816115fd91308655336144dc565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081523360048201523060248201528160448201526020816064816000875af18015610a3f5761168f575b50604080516001600160a01b0384168152602081019290925233917fd92108066c19fd1ca914adf88fe45def4bfb59e8b5df7a7c02c4275cbe3152cb9190a3389055005b6116a79060203d602011610a3857610a298183612acc565b503861164b565b346102e6576116bc3661114f565b6001600160a01b03929192807fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649106541633036112515761172f8185166001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604060002090565b5416156112275768929eee149b4bd2126892308454146105535761122292308555614650565b346102e65760006003193601126102e65760207fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927546001600160a01b0360405191168152f35b90815180825260208080930193019160005b8281106117bb575050505090565b8351855293810193928101926001016117ad565b92906117e79095949295608085526080850190610e9b565b60209084810360208601526020808851928381520197019160005b828110611831575050505084611823918461046f969703604086015261179b565b91606081840391015261179b565b83516001600160a01b031689529781019792810192600101611802565b346102e6576020806003193601126102e6576004803561186d81610439565b6118a9816001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649101602052604060002090565b54906118b4826138bc565b926118be836138bc565b926118c8816138bc565b9560005b82811061192a578787610d768861191d6119188a6001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649101602052604060002090565b6137bb565b92604051948594856117cf565b6119db611969866001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649100602052604060002090565b6119c46119b1846119ac8a6001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649101602052604060002090565b61390b565b90546001600160a01b039160031b1c1690565b6001600160a01b0316600052602052604060002090565b5490611a2f611a236119b1836119ac8a6001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649101602052604060002090565b6001600160a01b031690565b604084815180937f07a2d13a0000000000000000000000000000000000000000000000000000000082528180611a6c898d83019190602083019252565b03915afa938415610a3f5787948693600091611b65575b50611a8e858d613932565b52611a99848b613932565b52611ae0611a236119b1856119ac8c6001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649101602052604060002090565b9051938480927f38d52e0f0000000000000000000000000000000000000000000000000000000082525afa8015610a3f576001600160a01b03611b4291600194600091611b48575b5016611b34838c613932565b906001600160a01b03169052565b016118cc565b611b5f9150863d8811610df657610de78183612acc565b38611b28565b611b7c9150843d8611610dc757610db88183612acc565b38611a83565b346102e657611b903661044a565b90611b99613f08565b6001600160a01b03908183169283156106585782611be9836001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604060002090565b54161561122757611c30906109b1836001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604060002090565b16907f928c1491037173ffa6782c693f229e11dbb934cb28daf9e2d1fca4b5131ffbf7600080a3005b919082519283825260005b848110611ca35750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b602081830181015184830182015201611c64565b90602061046f928181520190611c59565b346102e65760406003193601126102e657600435611ce581610439565b60243567ffffffffffffffff81116102e657611d05903690600401610fba565b611d0d613eec565b68929eee149b4bd212689230845414610553573084557fffffffff00000000000000000000000000000000000000000000000000000000611d4e838561395b565b16917f27ea6f2b0000000000000000000000000000000000000000000000000000000083148015611e58575b8015611e2f575b15611e055760006001600160a01b0381957ff2fde38b00000000000000000000000000000000000000000000000000000000839614611df8575b611dca6040518095819361399f565b0393165af190611dd86139ad565b9115611df157389055604051908190610d769082611cb7565b5060208101fd5b611e00613f08565b611dbb565b60046040517fc55dde3d000000000000000000000000000000000000000000000000000000008152fd5b507f02329a29000000000000000000000000000000000000000000000000000000008314611d81565b507ff2fde38b000000000000000000000000000000000000000000000000000000008314611d7a565b346102e6576003196080813601126102e6576004908135611ea181610439565b6024359167ffffffffffffffff8084116102e65760a08486019285360301126102e6576064359081116102e657611edb9036908601610fba565b94909268929eee149b4bd21268953087541461232e57308755611efc613eec565b6001600160a01b038092169382611f45866001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604060002090565b541615612305576040908151907f38d52e0f000000000000000000000000000000000000000000000000000000008252602091828188818b5afa8015610a3f5786916000916122e8575b501697611fea611fdd611fd48b6001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649108602052604060002090565b6119c48561372f565b546001600160a01b031690565b94868616156122c05791839185938b958b8b9a99985197888080937f70a08231000000000000000000000000000000000000000000000000000000009e8f835282019061204490916001600160a01b036020820193169052565b03915afa958615610a3f5760009661229f575b5061208f9596848c61206b611a238761372f565b8d8d8a519b8c9485938493845283019190916001600160a01b036020820193169052565b03915afa968715610a3f57600097612280575b508b3b156102e6578b8460008d936120ec82968b51988997889687957fa5b1a73e000000000000000000000000000000000000000000000000000000008752604435928701613aad565b03925af18015610a3f5761226d575b5082518781526001600160a01b038a1689820190815283908290819003602001818e5afa978815610a3f578a91600099612242575b5090839161216a9798999a612147611a238661372f565b918751998a9485938493845283019190916001600160a01b036020820193169052565b03915afa938415610a3f577f279cf0e48edd251c8060c231df3357902624d49b62cf6a41f4320588924d3c0298612206968d9460009761220e575b5050916121ce6121ed926121c8606496956121c2611a238661372f565b9b613ba2565b97613ba2565b60846121f66121e06024870185613baf565b9590946044880190613baf565b97909601613c00565b96519a8b9a169e01359689613c0a565b0390a4389055005b60649594929750926121c86122366121ce93866121ed97903d10610dc757610db88183612acc565b989395965050926121a5565b61216a9798995090612262859392843d8611610dc757610db88183612acc565b999897509091612130565b80610e2761227a92612a97565b386120fb565b612298919750853d8711610dc757610db88183612acc565b95386120a2565b61208f96506122ba90853d8711610dc757610db88183612acc565b95612057565b8785517fc94f7a9a000000000000000000000000000000000000000000000000000000008152fd5b6122ff9150843d8611610df657610de78183612acc565b38611f8f565b836040517fb13b4eea000000000000000000000000000000000000000000000000000000008152fd5b8263ab143c06600052601cfd5b346102e65760006003193601126102e65760206001600160a01b037fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad86491065416604051908152f35b346102e65760006003193601126102e65760206040517f94fb01b7061fcfca7a3e92b7604dda2f7f5f098146840ac40016cda24c3a88598152f35b346102e65760a06003193601126102e6576123d8600435610439565b6024356123e481610439565b60843567ffffffffffffffff81116102e657612404903690600401610fba565b9190913068929eee149b4bd212685414610553573068929eee149b4bd21268556001600160a01b03908161246e81600435166001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604060002090565b5416156112275781831693826124b6866001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604060002090565b541615611227576124c5613f40565b6040517f38d52e0f00000000000000000000000000000000000000000000000000000000808252602082600481888235165afa918215610a3f576000926129f3575b506040519081526020816004818a5afa908115610a3f576000916129d4575b50612571611a23611fdd8784166104c48987166001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649108602052604060002090565b93858516156129aa576040517f07a2d13a000000000000000000000000000000000000000000000000000000008082526044356004830152909190602083806024810103818b600435165afa928315610a3f57600093612988575b506040519081526064356004820152986020908a9060249082905afa988915610a3f57600099612967575b50612600612b0d565b6001600160a01b03858916168152916001600160a01b038489161660208401526040838101829052606084018b9052517f70a08231000000000000000000000000000000000000000000000000000000008082523060048301529590602081806024810103818d86165afa908115610a3f57600091612948575b5061268a60443560043533614650565b6040805133808252604435602083015260009290916004358e16917f6ee63f530864567ac8a1fcce5050111457154b213c6297ffc622603e8497f7b291a46126d760443560043530614401565b604080513380825260443560208301526000928201839052906004358d16907f486508c3c40ef7985dcc1f7d43acb1e77e0059505d1f0e6064674ca655a0c82f90606090a4604051878152306004820152602081602481868f165afa918215610a3f57849261274e926000916128ac575b50613ba2565b0361291e576040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b03891660048201526024810192909252602090829060449082906000908d165af18015610a3f576128ff575b5060405184815230600482015295602087602481878c165afa968715610a3f576000976128de575b50803b156102e65761281a9560008094604051988995869485937f6103b22500000000000000000000000000000000000000000000000000000000855260048501613c55565b03925af1928315610a3f576020936128cb575b50604051918252306004830152909384916024918391165afa8015610a3f5761285d926000916128ac5750613ba2565b9182106128825761287391606435913033613f95565b503868929eee149b4bd2126855005b60046040517fd93fc0fd000000000000000000000000000000000000000000000000000000008152fd5b6128c5915060203d602011610dc757610db88183612acc565b38612748565b80610e276128d892612a97565b3861282d565b6128f891975060203d602011610dc757610db88183612acc565b95386127d4565b6129179060203d602011610a3857610a298183612acc565b50386127ac565b60046040517f56783f53000000000000000000000000000000000000000000000000000000008152fd5b612961915060203d602011610dc757610db88183612acc565b3861267a565b61298191995060203d602011610dc757610db88183612acc565b97386125f7565b60209193506129a390823d8411610dc757610db88183612acc565b92906125cc565b60046040517fc94f7a9a000000000000000000000000000000000000000000000000000000008152fd5b6129ed915060203d602011610df657610de78183612acc565b38612526565b612a0d91925060203d602011610df657610de78183612acc565b9038612507565b60206003193601126102e657600435612a2c81610439565b612a34613f08565b63389a75e1600c52806000526020600c209081544211612a5a57600061069a925561447a565b636f5e88186000526004601cfd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b67ffffffffffffffff8111612aab57604052565b612a68565b6040810190811067ffffffffffffffff821117612aab57604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117612aab57604052565b604051906080820182811067ffffffffffffffff821117612aab57604052565b67ffffffffffffffff8111612aab57601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b81601f820112156102e657803590612b7e82612b2d565b92612b8c6040519485612acc565b828452602083830101116102e657816000926020809301838601378301015290565b600511156102e657565b346102e65760806003193601126102e657600435612bd581610439565b67ffffffffffffffff6024358181116102e657612bf6903690600401612b67565b6044359182116102e657612ced612c8691612c18612cf2943690600401612b67565b612cc1612cb660643592612c2b84612bae565b612c33613eec565b6040519687957f8420ce990000000000000000000000000000000000000000000000000000000060208801523060248801526001600160a01b03809b16604488015260a0606488015260c4870190611c59565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdc868303016084870152611c59565b9160a4840190613a9b565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282612acc565b6146f1565b90612cfc82613c96565b8116612d68612d3d826001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604060002090565b60017fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b610d766040519283927f2cd7a531712f8899004c782d9607e0886d1dbc91bfac7be88dadf6750d9e1419600080a26001600160a01b031682526020820190565b60206003193601126102e657600435612dc081610439565b612dc8613f08565b8060601b15612dda5761069a9061447a565b637448fbae6000526004601cfd5b346102e65760806003193601126102e657600435612e0581610439565b60243590612e1282610439565b604435612e1e81610439565b60643590612e2b82610439565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00549367ffffffffffffffff60ff8660401c1615951680159081612ff8575b6001149081612fee575b159081612fe5575b50612fbb57612ede9385612ed57ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0060017fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000825416179055565b612f5f57613d7c565b612ee457005b612f307ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a007fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff8154169055565b604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a1005b612fb67ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00680100000000000000007fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff825416179055565b613d7c565b60046040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b90501538612e7c565b303b159150612e74565b869150612e6a565b346102e6576130146104c46107b63661044a565b80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055005b346102e65760806003193601126102e657600480359061305b82610439565b6024359061306882610439565b60443568929eee149b4bd21268933085541461232e573085556001600160a01b0380821693816130ca866001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604060002090565b54161561368c576130d9613f40565b61314661314261313b8461311f896001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649109602052604060002090565b99168099906001600160a01b0316600052602052604060002090565b5460ff1690565b1590565b6136645760409081517f38d52e0f0000000000000000000000000000000000000000000000000000000094858252602091828185818c5afa908115610a3f57600091613647575b508451878152838186818e5afa908115610a3f578791829160009161362a575b501691160361360257835194868652828685818c5afa958615610a3f576000966135e3575b5084519183837f70a08231000000000000000000000000000000000000000000000000000000009889825281858161321c308c83019190916001600160a01b036020820193169052565b0392165afa928315610a3f576000936135c4575b5085519287845284848d8180613258338c83019190916001600160a01b036020820193169052565b03915afa938415610a3f5786928b9160009661359f575b509081613280826132d39433614650565b8d8a5130917f6ee63f530864567ac8a1fcce5050111457154b213c6297ffc622603e8497f7b23392806132ca883383602090939291936001600160a01b0360408201951681520152565b0390a430614401565b865133808252602082018c90526000604083015230918d907f486508c3c40ef7985dcc1f7d43acb1e77e0059505d1f0e6064674ca655a0c82f90606090a4848b8851938480928d82525afa918215610a3f57600092613580575b5084875180938a8252818681613355308d83019190916001600160a01b036020820193169052565b0392165afa8015610a3f57613371926000916135695750613ba2565b968551908152838186818d5afa918215610a3f576133e3928c8a928794600093613547575b506000908a518097819682957f095ea7b30000000000000000000000000000000000000000000000000000000084528d8401602090939291936001600160a01b0360408201951681520152565b0393165af18015610a3f5761352a575b5083517fbc157ac10000000000000000000000000000000000000000000000000000000081528381018781523360208201526064356040820152909590839087908190036060018160008e5af1958615610a3f5760009661350b575b5084519081523384820190815283908290819060200103818d5afa908115610a3f57613484936000926134ee575b5050613ba2565b83036134c75750519283526020830152604082015233907f423b53102adc96bdca1912c080d05033fc81552dbbbdfabf80291ba824421a29908060608101612206565b90517ff15ed214000000000000000000000000000000000000000000000000000000008152fd5b6135049250803d10610dc757610db88183612acc565b388061347d565b613523919650833d8511610dc757610db88183612acc565b943861344f565b61354090833d8511610a3857610a298183612acc565b50386133f3565b600091935061356290863d8811610df657610de78183612acc565b9290613396565b6128c59150863d8811610dc757610db88183612acc565b613598919250853d8711610df657610de78183612acc565b903861332d565b6132d3929196506135bc90883d8a11610dc757610db88183612acc565b95909161326f565b6135dc919350843d8611610dc757610db88183612acc565b9138613230565b6135fb919650833d8511610df657610de78183612acc565b94386131d2565b8284517f83c1010a000000000000000000000000000000000000000000000000000000008152fd5b6136419150863d8811610df657610de78183612acc565b386131ad565b61365e9150833d8511610df657610de78183612acc565b3861318d565b6040517f4c7fc9d4000000000000000000000000000000000000000000000000000000008152fd5b6040517fb13b4eea000000000000000000000000000000000000000000000000000000008152fd5b346102e65760206003193601126102e6576004356136d181610439565b63389a75e1600c52600052602080600c2054604051908152f35b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b919081101561372a5760051b0190565b6136eb565b3561046f81610439565b908160209103126102e6575161046f816102dc565b6040513d6000823e3d90fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146137b65760010190565b61375a565b90604051918281549182825260209260208301916000526020600020936000905b8282106137f4575050506137f292500383612acc565b565b85546001600160a01b0316845260019586019588955093810193909101906137dc565b61385e906001600160a01b039182916001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604060002090565b54169060018214801561389c575b613874575090565b90507fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649105541690565b50811561386c565b67ffffffffffffffff8111612aab5760051b60200190565b906138c6826138a4565b6138d36040519182612acc565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe061390182946138a4565b0190602036910137565b805482101561372a5760005260206000200190600090565b908160209103126102e6575190565b805182101561372a5760209160051b010190565b908160209103126102e6575161046f81610439565b7fffffffff00000000000000000000000000000000000000000000000000000000903581811693926004811061399057505050565b60040360031b82901b16169150565b908092918237016000815290565b3d156139d8573d906139be82612b2d565b916139cc6040519384612acc565b82523d6000602084013e565b606090565b90357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1823603018112156102e657016020813591019167ffffffffffffffff82116102e65781360383136102e657565b601f82602094937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0938186528686013760008582860101520116010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b906005821015613aa85752565b613a6c565b909261046f95939492946001600160a01b038091168352608060208401528535613ad681610439565b1660808301526080613b3f613b02613af160208901896139dd565b60a080880152610120870191613a2d565b613b0f60408901896139dd565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808784030160c0880152613a2d565b95613b5b6060820135613b5181612bae565b60e0860190613a9b565b013561010083015260408201526060818503910152613a2d565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82019182116137b657565b919082039182116137b657565b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1813603018212156102e6570180359067ffffffffffffffff82116102e6576020019181360383136102e657565b3561046f81612bae565b9491613c4693613c5195613c389260a099949c9b9a9c8952602089015260c0604089015260c0880191613a2d565b918583036060870152613a2d565b956080830190613a9b565b0152565b60a090606061046f95936001600160a01b03808251168452602082015116602084015260408101516040840152015160608201528160808201520191613a2d565b7fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad864910490815468010000000000000000811015612aab576001810180845581101561372a576137f2926000527fcc963e9281187e610857e988900b0c72937ebb5122acc7f351ae2143b44e468201906001600160a01b03167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b9081549168010000000000000000831015612aab5782613d5d9160016137f29501815561390b565b9091906001600160a01b038084549260031b9316831b921b1916179055565b9192613e2890337fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927553360007f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a3613dd4614c98565b613ddc614c98565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0081541690556149c9565b6001600160a01b0380911680158015613ee2575b610658577fffffffffffffffffffffffff000000000000000000000000000000000000000092827fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad86491069116848254161790557fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad864910590838254161790557fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649107921690825416179055565b5081831615613e3c565b638b78c6d8600c523360005260016020600c20541615613f0857565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927543303613f3257565b6382b429006000526004601cfd5b60ff7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033005416613f6b57565b60046040517fd93c0665000000000000000000000000000000000000000000000000000000008152fd5b90939192936001600160a01b03928385169584613fe4886001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604060002090565b54161561122757613ff3613f40565b60405180977f6e553f65000000000000000000000000000000000000000000000000000000008252816000816140466020988997600484019092916001600160a01b036020916040840195845216910152565b03925af1958615610a3f57600096614178575b50851061414e578492614096611a237fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649107546001600160a01b031690565b9081166140aa575b50509161046f926144dc565b908092935060405180927f60cfb20400000000000000000000000000000000000000000000000000000000825281806140e560048201614197565b03915afa918215610a3f57600092614131575b5050614107578290388061409e565b60046040517fbf2af50b000000000000000000000000000000000000000000000000000000008152fd5b6141479250803d10610a3857610a298183612acc565b38806140f8565b60046040517ff15ed214000000000000000000000000000000000000000000000000000000008152fd5b614190919650823d8411610dc757610db88183612acc565b9438614059565b60208082016020835260407fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad864910493845480935201926000527fcc963e9281187e610857e988900b0c72937ebb5122acc7f351ae2143b44e4682916000905b828210614202575050505090565b83546001600160a01b0316855293840193600193840193909101906141f4565b9080156143c9576001600160a01b0382169181614275826104c4336001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649100602052604060002090565b541061414e576142bb816104c4336001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649100602052604060002090565b6142c6838254613ba2565b90556040517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018390526020816044816000885af18015610a3f576143aa575b50614352816104c4336001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649100602052604060002090565b541561439a575b50604080516001600160a01b0384168152602081019290925233917ffbbbd9facbad6d22caedbbc41b96121e94e21eb0fdc25f3279c686af9aa1c9f79190a3565b6143a490336147be565b38614359565b6143c29060203d602011610a3857610a298183612acc565b5038614311565b60046040517f9811e0c7000000000000000000000000000000000000000000000000000000008152fd5b3560ff811681036102e65790565b60646020929360006001600160a01b03809660405197889687957fba0876520000000000000000000000000000000000000000000000000000000087526004870152166024850152306044850152165af18015610a3f5761445f5750565b6144779060203d602011610dc757610db88183612acc565b50565b6001600160a01b03167fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b919082018092116137b657565b6001600160a01b038116156106585782156143c957614531826104c4836001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649100602052604060002090565b5415614587575b614583916104c461457b926001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649100602052604060002090565b9182546144cf565b9055565b60206145c5826001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649101602052604060002090565b54101561462657816104c48261461c6145839561461761457b966001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649101602052604060002090565b613d35565b9250509150614538565b60046040517f63923f0e000000000000000000000000000000000000000000000000000000008152fd5b9180156143c9576001600160a01b038316806000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649100806020526146ab846040600020906001600160a01b0316600052602052604060002090565b549182841161414e576000526020528181036146de846040600020906001600160a01b0316600052602052604060002090565b55146146e8575050565b6137f2916147be565b6040519061053b908183019083821067ffffffffffffffff831117612aab57604061472d928594614e6f86393081528160208201520190611c59565b03906000f08015610a3f576001600160a01b031690565b8054801561478f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190614779828261390b565b6001600160a01b0382549160031b1b1916905555565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b906147fb826001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649101602052604060002090565b54906000905b82821061487d575b50146148535761484e6137f2916001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649101602052604060002090565b614744565b60046040517fdee790fb000000000000000000000000000000000000000000000000000000008152fd5b9291906148c0816119ac856001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649101602052604060002090565b906001600160a01b0390548187169260031b1c16146148e457600101909192614801565b9091925061497c61493c6119b161492d866001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649101602052604060002090565b61493686613b75565b9061390b565b613d5d836119ac876001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649101602052604060002090565b38614809565b638b78c6d8600c526000526020600c2090815490811618809155600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26600080a3565b638b78c6d8600c526000526020600c206001815417809155600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26600080a3565b60405190614a1b82612ab0565b600f82527f4b6172616b5f5661756c745f53757000000000000000000000000000000000006020830152565b60405190614a5482612ab0565b600282527f76310000000000000000000000000000000000000000000000000000000000006020830152565b909594939291428410614c6e57614c3095614c0892614c1492614bc4614aa4614a0e565b97614bb889516020809b012095614ab9614a47565b8051908c0120604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f818f01908152602081019a909a5290890191909152466060890152306080890152968760a082010397614b3d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0998a8101835282612acc565b519020996040519586948d8601988993917fffffffffffffffffffffffffffffffffffffffff00000000000000000000000060b49694927f94fb01b7061fcfca7a3e92b7604dda2f7f5f098146840ac40016cda24c3a8859875260601b16602086015260348501526054840152607483015260948201520190565b03848101835282612acc565b519020604051938491878301968790916042927f19010000000000000000000000000000000000000000000000000000000000008352600283015260228201520190565b03908101835282612acc565b51902090614c21836143f3565b90604084013593013591614cf1565b6001600160a01b03918216911603614c4457565b60046040517f8baa579f000000000000000000000000000000000000000000000000000000008152fd5b60046040517faf04a38e000000000000000000000000000000000000000000000000000000008152fd5b60ff7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005460401c1615614cc757565b60046040517fd7e6bcf8000000000000000000000000000000000000000000000000000000008152fd5b9161046f9391614d0093614d09565b90929192614d97565b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411614d8157926020929160ff608095604051948552168484015260408301526060820152600092839182805260015afa15610a3f5780516001600160a01b03811615614d7857918190565b50809160019190565b50505060009160039190565b60041115613aa857565b614da081614d8d565b80614da9575050565b614db281614d8d565b60018103614de45760046040517ff645eedf000000000000000000000000000000000000000000000000000000008152fd5b614ded81614d8d565b60028103614e27576040517ffce698f700000000000000000000000000000000000000000000000000000000815260048101839052602490fd5b80614e33600392614d8d565b14614e3b5750565b6040517fd78bce0c0000000000000000000000000000000000000000000000000000000081526004810191909152602490fdfe60a060409080825261053b803803809161001982856102ae565b8339810182828203126101e95761002f826102e7565b60208084015191939091906001600160401b0382116101e9570182601f820112156101e957805190610060826102fb565b9361006d875195866102ae565b8285528383830101116101e957829060005b83811061029a57505060009184010152823b1561027a577fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080546001600160a01b0319166001600160a01b038581169182179092558551635c60da1b60e01b8082529194928482600481895afa91821561026f57600092610238575b50813b1561021f5750508551847f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e600080a282511561020057508290600487518096819382525afa9283156101f5576000936101b3575b5091600080848461019096519101845af4903d156101aa573d610174816102fb565b90610181885192836102ae565b8152600081943d92013e610316565b505b608052516101c1908161037a82396080518160450152f35b60609250610316565b92508183813d83116101ee575b6101ca81836102ae565b810103126101e9576000806101e1610190956102e7565b945050610152565b600080fd5b503d6101c0565b85513d6000823e3d90fd5b9350505050346102105750610192565b63b398979f60e01b8152600490fd5b8751634c9c8ce360e01b81529116600482015260249150fd5b9091508481813d8311610268575b61025081836102ae565b810103126101e957610261906102e7565b90386100fb565b503d610246565b88513d6000823e3d90fd5b8351631933b43b60e21b81526001600160a01b0384166004820152602490fd5b81810183015186820184015284920161007f565b601f909101601f19168101906001600160401b038211908210176102d157604052565b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b03821682036101e957565b6001600160401b0381116102d157601f01601f191660200190565b9061033d575080511561032b57805190602001fd5b604051630a12f52160e11b8152600490fd5b81511580610370575b61034e575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b1561034656fe6080806040527f5c60da1b00000000000000000000000000000000000000000000000000000000815260208160048173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa90811561010e5760009161007c575b5061016c565b905060203d602011610107575b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f82011682019180831067ffffffffffffffff8411176100d8576100d2926040520161011a565b38610076565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b503d610089565b6040513d6000823e3d90fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8060209101126101675760805173ffffffffffffffffffffffffffffffffffffffff811681036101675790565b600080fd5b6000808092368280378136915af43d82803e15610187573d90f35b3d90fdfea26469706673582212205c3a93b519f16ade741beb6ae31c658bdfe28066a054905e94cb62950751c83a64736f6c63430008190033a264697066735822122037a7d98782473b8f0557c57945f8a6f2d3925e4eb83602fbb500d7c2980dcdbd64736f6c63430008190033
Deployed Bytecode
0x6080604052600436101561001257600080fd5b60003560e01c806302329a29146102d75780630a2c13a1146102d25780630efe6a8b146102cd57806317070f02146102c857806317a68dd8146102c3578063183a4f6e146102be5780631c10893f146102b95780631cd64df4146102b457806325692962146102af578063258809e3146102aa578063259dff0c146102a55780632b93e0a2146102a05780632de948071461029b57806344d00f82146102965780634a4ee7b1146102915780634f1ef2861461028c578063514e62fc1461028757806351ffb74a1461028257806352d1902d1461027d57806354d1f13d146102785780635c60da1b146102735780635c975abb1461026e5780636834e3a8146102695780636b88071814610264578063715018a61461025f5780637a29084c1461025a5780637fb2a0a1146102555780638b198025146102505780638c80d4e51461024b5780638da5cb5b1461024657806394f649dd14610241578063aa0a050c1461023c578063c1f09e3014610237578063ca5f767814610232578063df6704481461022d578063e4af8b2214610228578063efc1e71214610223578063f04e283e1461021e578063f0edf6aa14610219578063f2fde38b14610214578063f8c8765e1461020f578063fadb7dc91461020a578063fc346664146102055763fee81cf41461020057600080fd5b6136b4565b61303c565b613000565b612de8565b612da8565b612bb8565b612a14565b6123bc565b612381565b61233b565b611e81565b611cc8565b611b82565b61184e565b611755565b6116ae565b61157a565b6114fb565b61147f565b61141d565b6113f6565b611393565b611351565b611324565b6112dd565b61127b565b61117b565b61110a565b610fe8565b610f8e565b610ed8565b610e5d565b610acc565b610854565b6107a2565b610753565b610702565b61069c565b610682565b6105b4565b610561565b61050b565b610472565b6102eb565b801515036102e657565b600080fd5b346102e65760206003193601126102e657600435610308816102dc565b610310613eec565b156103935761031d613f40565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f0330060017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008254161790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1005b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300805460ff81161561040f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b60046040517f8dfc202b000000000000000000000000000000000000000000000000000000008152fd5b6001600160a01b038116036102e657565b60031960409101126102e65760043561046281610439565b9060243561046f81610439565b90565b346102e657602060ff6104dc6104c461048a3661044a565b91906001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649109602052604060002090565b906001600160a01b0316600052602052604060002090565b54166040519015158152f35b60031960609101126102e65760043561050081610439565b906024359060443590565b346102e657610519366104e8565b909168929eee149b4bd2126891308354146105535760209361054792308555610540613f40565b3333613f95565b90389055604051908152f35b63ab143c066000526004601cfd5b346102e65761056f366104e8565b68929eee149b4bd212689291929030825414610553576105a26105a99160209530855561059a613f40565b853333613f95565b8093614222565b389055604051908152f35b346102e65760206003193601126102e6576001600160a01b036004356105d981610439565b6105e1613f08565b168015610658577fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649105817fffffffffffffffffffffffff00000000000000000000000000000000000000008254161790557f2768c62492a0ab17bb4fd74f18e51a421e2a8e30c0d05ec389cd5609e91b4d5e600080a2005b60046040517fd92e233d000000000000000000000000000000000000000000000000000000008152fd5b60206003193601126102e65761069a60043533614982565b005b60406003193601126102e6576004356106b481610439565b6106bc613f08565b638b78c6d8600c526000526020600c20602435815417809155600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26600080a3005b346102e65760406003193601126102e657602061073e60043561072481610439565b602435918291638b78c6d8600c526000526020600c205490565b1614604051908152f35b60009103126102e657565b60008060031936011261079f5763389a75e1600c523381526202a30042016020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d8280a280f35b80fd5b346102e6576107f86104c46107b63661044a565b91906107c0613eec565b6001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649109602052604060002090565b80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055005b9181601f840112156102e65782359167ffffffffffffffff83116102e6576020808501948460051b0101116102e657565b346102e65760606003193601126102e657600467ffffffffffffffff81358181116102e6576108869036908401610823565b90916024359081116102e65761089f9036908501610823565b93604435946108ad86610439565b6108b5613f08565b808403610a445792936001600160a01b038616939060005b8681106108d657005b6108e96108e482898561371a565b61372f565b6108f76108e483868961371a565b9060408181517fbcdbc94700000000000000000000000000000000000000000000000000000000815288818c818061094f8a602098899784019060209093929360408301946001600160a01b03809216845216910152565b03915afa918215610a3f57600092610a12575b5050156109ea5750896109b1600194936104c46109e4946001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649108602052604060002090565b906001600160a01b03167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b016108cd565b8690517fc94f7a9a000000000000000000000000000000000000000000000000000000008152fd5b610a319250803d10610a38575b610a298183612acc565b810190613739565b3880610962565b503d610a1f565b61374e565b506040517f3e31cc61000000000000000000000000000000000000000000000000000000008152fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5c60609101126102e65760a490565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffefc60609101126102e65761010490565b346102e6576101606003193601126102e6576004803590610aec82610439565b60243590610af982610439565b6044356064359360843593610b0d36610a6d565b610b1636610a9c565b68929eee149b4bd212689630885414610e5057308855610b34613f40565b610b70846001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649102602052604060002090565b54926001600160a01b0397888716916040998a51917f38d52e0f0000000000000000000000000000000000000000000000000000000090818452602093848187818a5afa8015610a3f578491600091610e33575b501690610bd0816143f3565b823b156102e65787928f8f818f946000968c8f92610c5d938a968f98519c8d9b8c9a8b997fd505accf000000000000000000000000000000000000000000000000000000008b528801359701359589019360ff929897969360c0969260e087019a6001600160a01b0380921688521660208701526040860152606085015216608083015260a08201520152565b03925af19081610e1a575b50610dfd578b5190815282818581885afa918215610a3f57610cdf928a87928f8795600094610dce575b50518096819582947fdd62ed3e0000000000000000000000000000000000000000000000000000000084528b84019060209093929360408301946001600160a01b03809216845216910152565b0392165afa908115610a3f578a92600092610da1575b505010610d7a5750928492610d16928b89610d649a98610d769e9a98614a80565b610d52816001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649102602052604060002090565b610d5c8154613789565b905580613f95565b38909255519081529081906020820190565b0390f35b88517fb78cb0dd000000000000000000000000000000000000000000000000000000008152fd5b610dc09250803d10610dc7575b610db88183612acc565b810190613923565b3880610cf5565b503d610dae565b610def919450863d8811610df6575b610de78183612acc565b810190613946565b9238610c92565b503d610ddd565b50505050928492610d16928b89610d649a98610d769e9a98614a80565b80610e27610e2d92612a97565b80610748565b38610c68565b610e4a9150863d8811610df657610de78183612acc565b38610bc4565b8663ab143c06600052601cfd5b346102e65760206003193601126102e6576020610e93600435610e7f81610439565b638b78c6d8600c526000526020600c205490565b604051908152f35b90815180825260208080930193019160005b828110610ebb575050505090565b83516001600160a01b031685529381019392810192600101610ead565b346102e65760006003193601126102e657604051807fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad86491049182548082526020809201936000527fcc963e9281187e610857e988900b0c72937ebb5122acc7f351ae2143b44e4682916000905b828210610f6e57610d7685610f5a81890382612acc565b604051918291602083526020830190610e9b565b83546001600160a01b031686529485019460019384019390910190610f43565b60406003193601126102e65761069a600435610fa981610439565b610fb1613f08565b60243590614982565b9181601f840112156102e65782359167ffffffffffffffff83116102e657602083818601950101116102e657565b60406003193601126102e65760043561100081610439565b60243567ffffffffffffffff81116102e657611020903690600401610fba565b91307f00000000000000000000000035024634a49ffd6de5caad0a0493f3e01cec49c2146110fc576001600160a01b0390611059613f08565b16916352d1902d6001527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc9081602060016004601d885afa51036110ee578084916000958694817fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8780a2556110cd578280f35b806040519485378338925af4156110e5578181808280f35b903d90823e3d90fd5b6355299b496001526004601dfd5b639f03a0266000526004601cfd5b346102e65760406003193601126102e657602060043561112981610439565b61114460243591638b78c6d8600c526000526020600c205490565b161515604051908152f35b60031960609101126102e65760043561116781610439565b9060243561117481610439565b9060443590565b346102e6576111893661114f565b6001600160a01b03929192807fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad864910654163303611251576111fc8185166001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604060002090565b5416156112275768929eee149b4bd2126892308454146105535761122292308555614401565b389055005b60046040517fb13b4eea000000000000000000000000000000000000000000000000000000008152fd5b60046040517fd04f8cc5000000000000000000000000000000000000000000000000000000008152fd5b346102e65760006003193601126102e657307f00000000000000000000000035024634a49ffd6de5caad0a0493f3e01cec49c2036110fc5760206040517f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8152f35b60008060031936011261079f5763389a75e1600c52338152806020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c928280a280f35b346102e65760006003193601126102e657602061134033613817565b6001600160a01b0360405191168152f35b346102e65760006003193601126102e657602060ff7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f0330054166040519015158152f35b346102e65760206003193601126102e65760206113ed6004356113b581610439565b6001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649102602052604060002090565b54604051908152f35b346102e65760206003193601126102e657602061134060043561141881610439565b613817565b60008060031936011261079f57611432613f08565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a35580f35b346102e65760206003193601126102e65760043561149c81610439565b6114a4613eec565b6001600160a01b037fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad864910791167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055600080f35b346102e65760406003193601126102e65760043561151881610439565b6001600160a01b0381811660009081527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604090205416156112275768929eee149b4bd212689030825414610553576112229030835560243590614222565b346102e65760406003193601126102e65760043561159781610439565b6001600160a01b0381811660008181527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604090209091602435915416156112275768929eee149b4bd21268923084541461055357816115fd91308655336144dc565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081523360048201523060248201528160448201526020816064816000875af18015610a3f5761168f575b50604080516001600160a01b0384168152602081019290925233917fd92108066c19fd1ca914adf88fe45def4bfb59e8b5df7a7c02c4275cbe3152cb9190a3389055005b6116a79060203d602011610a3857610a298183612acc565b503861164b565b346102e6576116bc3661114f565b6001600160a01b03929192807fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649106541633036112515761172f8185166001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604060002090565b5416156112275768929eee149b4bd2126892308454146105535761122292308555614650565b346102e65760006003193601126102e65760207fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927546001600160a01b0360405191168152f35b90815180825260208080930193019160005b8281106117bb575050505090565b8351855293810193928101926001016117ad565b92906117e79095949295608085526080850190610e9b565b60209084810360208601526020808851928381520197019160005b828110611831575050505084611823918461046f969703604086015261179b565b91606081840391015261179b565b83516001600160a01b031689529781019792810192600101611802565b346102e6576020806003193601126102e6576004803561186d81610439565b6118a9816001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649101602052604060002090565b54906118b4826138bc565b926118be836138bc565b926118c8816138bc565b9560005b82811061192a578787610d768861191d6119188a6001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649101602052604060002090565b6137bb565b92604051948594856117cf565b6119db611969866001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649100602052604060002090565b6119c46119b1846119ac8a6001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649101602052604060002090565b61390b565b90546001600160a01b039160031b1c1690565b6001600160a01b0316600052602052604060002090565b5490611a2f611a236119b1836119ac8a6001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649101602052604060002090565b6001600160a01b031690565b604084815180937f07a2d13a0000000000000000000000000000000000000000000000000000000082528180611a6c898d83019190602083019252565b03915afa938415610a3f5787948693600091611b65575b50611a8e858d613932565b52611a99848b613932565b52611ae0611a236119b1856119ac8c6001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649101602052604060002090565b9051938480927f38d52e0f0000000000000000000000000000000000000000000000000000000082525afa8015610a3f576001600160a01b03611b4291600194600091611b48575b5016611b34838c613932565b906001600160a01b03169052565b016118cc565b611b5f9150863d8811610df657610de78183612acc565b38611b28565b611b7c9150843d8611610dc757610db88183612acc565b38611a83565b346102e657611b903661044a565b90611b99613f08565b6001600160a01b03908183169283156106585782611be9836001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604060002090565b54161561122757611c30906109b1836001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604060002090565b16907f928c1491037173ffa6782c693f229e11dbb934cb28daf9e2d1fca4b5131ffbf7600080a3005b919082519283825260005b848110611ca35750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b602081830181015184830182015201611c64565b90602061046f928181520190611c59565b346102e65760406003193601126102e657600435611ce581610439565b60243567ffffffffffffffff81116102e657611d05903690600401610fba565b611d0d613eec565b68929eee149b4bd212689230845414610553573084557fffffffff00000000000000000000000000000000000000000000000000000000611d4e838561395b565b16917f27ea6f2b0000000000000000000000000000000000000000000000000000000083148015611e58575b8015611e2f575b15611e055760006001600160a01b0381957ff2fde38b00000000000000000000000000000000000000000000000000000000839614611df8575b611dca6040518095819361399f565b0393165af190611dd86139ad565b9115611df157389055604051908190610d769082611cb7565b5060208101fd5b611e00613f08565b611dbb565b60046040517fc55dde3d000000000000000000000000000000000000000000000000000000008152fd5b507f02329a29000000000000000000000000000000000000000000000000000000008314611d81565b507ff2fde38b000000000000000000000000000000000000000000000000000000008314611d7a565b346102e6576003196080813601126102e6576004908135611ea181610439565b6024359167ffffffffffffffff8084116102e65760a08486019285360301126102e6576064359081116102e657611edb9036908601610fba565b94909268929eee149b4bd21268953087541461232e57308755611efc613eec565b6001600160a01b038092169382611f45866001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604060002090565b541615612305576040908151907f38d52e0f000000000000000000000000000000000000000000000000000000008252602091828188818b5afa8015610a3f5786916000916122e8575b501697611fea611fdd611fd48b6001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649108602052604060002090565b6119c48561372f565b546001600160a01b031690565b94868616156122c05791839185938b958b8b9a99985197888080937f70a08231000000000000000000000000000000000000000000000000000000009e8f835282019061204490916001600160a01b036020820193169052565b03915afa958615610a3f5760009661229f575b5061208f9596848c61206b611a238761372f565b8d8d8a519b8c9485938493845283019190916001600160a01b036020820193169052565b03915afa968715610a3f57600097612280575b508b3b156102e6578b8460008d936120ec82968b51988997889687957fa5b1a73e000000000000000000000000000000000000000000000000000000008752604435928701613aad565b03925af18015610a3f5761226d575b5082518781526001600160a01b038a1689820190815283908290819003602001818e5afa978815610a3f578a91600099612242575b5090839161216a9798999a612147611a238661372f565b918751998a9485938493845283019190916001600160a01b036020820193169052565b03915afa938415610a3f577f279cf0e48edd251c8060c231df3357902624d49b62cf6a41f4320588924d3c0298612206968d9460009761220e575b5050916121ce6121ed926121c8606496956121c2611a238661372f565b9b613ba2565b97613ba2565b60846121f66121e06024870185613baf565b9590946044880190613baf565b97909601613c00565b96519a8b9a169e01359689613c0a565b0390a4389055005b60649594929750926121c86122366121ce93866121ed97903d10610dc757610db88183612acc565b989395965050926121a5565b61216a9798995090612262859392843d8611610dc757610db88183612acc565b999897509091612130565b80610e2761227a92612a97565b386120fb565b612298919750853d8711610dc757610db88183612acc565b95386120a2565b61208f96506122ba90853d8711610dc757610db88183612acc565b95612057565b8785517fc94f7a9a000000000000000000000000000000000000000000000000000000008152fd5b6122ff9150843d8611610df657610de78183612acc565b38611f8f565b836040517fb13b4eea000000000000000000000000000000000000000000000000000000008152fd5b8263ab143c06600052601cfd5b346102e65760006003193601126102e65760206001600160a01b037fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad86491065416604051908152f35b346102e65760006003193601126102e65760206040517f94fb01b7061fcfca7a3e92b7604dda2f7f5f098146840ac40016cda24c3a88598152f35b346102e65760a06003193601126102e6576123d8600435610439565b6024356123e481610439565b60843567ffffffffffffffff81116102e657612404903690600401610fba565b9190913068929eee149b4bd212685414610553573068929eee149b4bd21268556001600160a01b03908161246e81600435166001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604060002090565b5416156112275781831693826124b6866001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604060002090565b541615611227576124c5613f40565b6040517f38d52e0f00000000000000000000000000000000000000000000000000000000808252602082600481888235165afa918215610a3f576000926129f3575b506040519081526020816004818a5afa908115610a3f576000916129d4575b50612571611a23611fdd8784166104c48987166001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649108602052604060002090565b93858516156129aa576040517f07a2d13a000000000000000000000000000000000000000000000000000000008082526044356004830152909190602083806024810103818b600435165afa928315610a3f57600093612988575b506040519081526064356004820152986020908a9060249082905afa988915610a3f57600099612967575b50612600612b0d565b6001600160a01b03858916168152916001600160a01b038489161660208401526040838101829052606084018b9052517f70a08231000000000000000000000000000000000000000000000000000000008082523060048301529590602081806024810103818d86165afa908115610a3f57600091612948575b5061268a60443560043533614650565b6040805133808252604435602083015260009290916004358e16917f6ee63f530864567ac8a1fcce5050111457154b213c6297ffc622603e8497f7b291a46126d760443560043530614401565b604080513380825260443560208301526000928201839052906004358d16907f486508c3c40ef7985dcc1f7d43acb1e77e0059505d1f0e6064674ca655a0c82f90606090a4604051878152306004820152602081602481868f165afa918215610a3f57849261274e926000916128ac575b50613ba2565b0361291e576040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b03891660048201526024810192909252602090829060449082906000908d165af18015610a3f576128ff575b5060405184815230600482015295602087602481878c165afa968715610a3f576000976128de575b50803b156102e65761281a9560008094604051988995869485937f6103b22500000000000000000000000000000000000000000000000000000000855260048501613c55565b03925af1928315610a3f576020936128cb575b50604051918252306004830152909384916024918391165afa8015610a3f5761285d926000916128ac5750613ba2565b9182106128825761287391606435913033613f95565b503868929eee149b4bd2126855005b60046040517fd93fc0fd000000000000000000000000000000000000000000000000000000008152fd5b6128c5915060203d602011610dc757610db88183612acc565b38612748565b80610e276128d892612a97565b3861282d565b6128f891975060203d602011610dc757610db88183612acc565b95386127d4565b6129179060203d602011610a3857610a298183612acc565b50386127ac565b60046040517f56783f53000000000000000000000000000000000000000000000000000000008152fd5b612961915060203d602011610dc757610db88183612acc565b3861267a565b61298191995060203d602011610dc757610db88183612acc565b97386125f7565b60209193506129a390823d8411610dc757610db88183612acc565b92906125cc565b60046040517fc94f7a9a000000000000000000000000000000000000000000000000000000008152fd5b6129ed915060203d602011610df657610de78183612acc565b38612526565b612a0d91925060203d602011610df657610de78183612acc565b9038612507565b60206003193601126102e657600435612a2c81610439565b612a34613f08565b63389a75e1600c52806000526020600c209081544211612a5a57600061069a925561447a565b636f5e88186000526004601cfd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b67ffffffffffffffff8111612aab57604052565b612a68565b6040810190811067ffffffffffffffff821117612aab57604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117612aab57604052565b604051906080820182811067ffffffffffffffff821117612aab57604052565b67ffffffffffffffff8111612aab57601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b81601f820112156102e657803590612b7e82612b2d565b92612b8c6040519485612acc565b828452602083830101116102e657816000926020809301838601378301015290565b600511156102e657565b346102e65760806003193601126102e657600435612bd581610439565b67ffffffffffffffff6024358181116102e657612bf6903690600401612b67565b6044359182116102e657612ced612c8691612c18612cf2943690600401612b67565b612cc1612cb660643592612c2b84612bae565b612c33613eec565b6040519687957f8420ce990000000000000000000000000000000000000000000000000000000060208801523060248801526001600160a01b03809b16604488015260a0606488015260c4870190611c59565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdc868303016084870152611c59565b9160a4840190613a9b565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282612acc565b6146f1565b90612cfc82613c96565b8116612d68612d3d826001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604060002090565b60017fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b610d766040519283927f2cd7a531712f8899004c782d9607e0886d1dbc91bfac7be88dadf6750d9e1419600080a26001600160a01b031682526020820190565b60206003193601126102e657600435612dc081610439565b612dc8613f08565b8060601b15612dda5761069a9061447a565b637448fbae6000526004601cfd5b346102e65760806003193601126102e657600435612e0581610439565b60243590612e1282610439565b604435612e1e81610439565b60643590612e2b82610439565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00549367ffffffffffffffff60ff8660401c1615951680159081612ff8575b6001149081612fee575b159081612fe5575b50612fbb57612ede9385612ed57ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0060017fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000825416179055565b612f5f57613d7c565b612ee457005b612f307ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a007fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff8154169055565b604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a1005b612fb67ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00680100000000000000007fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff825416179055565b613d7c565b60046040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b90501538612e7c565b303b159150612e74565b869150612e6a565b346102e6576130146104c46107b63661044a565b80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055005b346102e65760806003193601126102e657600480359061305b82610439565b6024359061306882610439565b60443568929eee149b4bd21268933085541461232e573085556001600160a01b0380821693816130ca866001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604060002090565b54161561368c576130d9613f40565b61314661314261313b8461311f896001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649109602052604060002090565b99168099906001600160a01b0316600052602052604060002090565b5460ff1690565b1590565b6136645760409081517f38d52e0f0000000000000000000000000000000000000000000000000000000094858252602091828185818c5afa908115610a3f57600091613647575b508451878152838186818e5afa908115610a3f578791829160009161362a575b501691160361360257835194868652828685818c5afa958615610a3f576000966135e3575b5084519183837f70a08231000000000000000000000000000000000000000000000000000000009889825281858161321c308c83019190916001600160a01b036020820193169052565b0392165afa928315610a3f576000936135c4575b5085519287845284848d8180613258338c83019190916001600160a01b036020820193169052565b03915afa938415610a3f5786928b9160009661359f575b509081613280826132d39433614650565b8d8a5130917f6ee63f530864567ac8a1fcce5050111457154b213c6297ffc622603e8497f7b23392806132ca883383602090939291936001600160a01b0360408201951681520152565b0390a430614401565b865133808252602082018c90526000604083015230918d907f486508c3c40ef7985dcc1f7d43acb1e77e0059505d1f0e6064674ca655a0c82f90606090a4848b8851938480928d82525afa918215610a3f57600092613580575b5084875180938a8252818681613355308d83019190916001600160a01b036020820193169052565b0392165afa8015610a3f57613371926000916135695750613ba2565b968551908152838186818d5afa918215610a3f576133e3928c8a928794600093613547575b506000908a518097819682957f095ea7b30000000000000000000000000000000000000000000000000000000084528d8401602090939291936001600160a01b0360408201951681520152565b0393165af18015610a3f5761352a575b5083517fbc157ac10000000000000000000000000000000000000000000000000000000081528381018781523360208201526064356040820152909590839087908190036060018160008e5af1958615610a3f5760009661350b575b5084519081523384820190815283908290819060200103818d5afa908115610a3f57613484936000926134ee575b5050613ba2565b83036134c75750519283526020830152604082015233907f423b53102adc96bdca1912c080d05033fc81552dbbbdfabf80291ba824421a29908060608101612206565b90517ff15ed214000000000000000000000000000000000000000000000000000000008152fd5b6135049250803d10610dc757610db88183612acc565b388061347d565b613523919650833d8511610dc757610db88183612acc565b943861344f565b61354090833d8511610a3857610a298183612acc565b50386133f3565b600091935061356290863d8811610df657610de78183612acc565b9290613396565b6128c59150863d8811610dc757610db88183612acc565b613598919250853d8711610df657610de78183612acc565b903861332d565b6132d3929196506135bc90883d8a11610dc757610db88183612acc565b95909161326f565b6135dc919350843d8611610dc757610db88183612acc565b9138613230565b6135fb919650833d8511610df657610de78183612acc565b94386131d2565b8284517f83c1010a000000000000000000000000000000000000000000000000000000008152fd5b6136419150863d8811610df657610de78183612acc565b386131ad565b61365e9150833d8511610df657610de78183612acc565b3861318d565b6040517f4c7fc9d4000000000000000000000000000000000000000000000000000000008152fd5b6040517fb13b4eea000000000000000000000000000000000000000000000000000000008152fd5b346102e65760206003193601126102e6576004356136d181610439565b63389a75e1600c52600052602080600c2054604051908152f35b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b919081101561372a5760051b0190565b6136eb565b3561046f81610439565b908160209103126102e6575161046f816102dc565b6040513d6000823e3d90fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146137b65760010190565b61375a565b90604051918281549182825260209260208301916000526020600020936000905b8282106137f4575050506137f292500383612acc565b565b85546001600160a01b0316845260019586019588955093810193909101906137dc565b61385e906001600160a01b039182916001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604060002090565b54169060018214801561389c575b613874575090565b90507fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649105541690565b50811561386c565b67ffffffffffffffff8111612aab5760051b60200190565b906138c6826138a4565b6138d36040519182612acc565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe061390182946138a4565b0190602036910137565b805482101561372a5760005260206000200190600090565b908160209103126102e6575190565b805182101561372a5760209160051b010190565b908160209103126102e6575161046f81610439565b7fffffffff00000000000000000000000000000000000000000000000000000000903581811693926004811061399057505050565b60040360031b82901b16169150565b908092918237016000815290565b3d156139d8573d906139be82612b2d565b916139cc6040519384612acc565b82523d6000602084013e565b606090565b90357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1823603018112156102e657016020813591019167ffffffffffffffff82116102e65781360383136102e657565b601f82602094937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0938186528686013760008582860101520116010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b906005821015613aa85752565b613a6c565b909261046f95939492946001600160a01b038091168352608060208401528535613ad681610439565b1660808301526080613b3f613b02613af160208901896139dd565b60a080880152610120870191613a2d565b613b0f60408901896139dd565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808784030160c0880152613a2d565b95613b5b6060820135613b5181612bae565b60e0860190613a9b565b013561010083015260408201526060818503910152613a2d565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82019182116137b657565b919082039182116137b657565b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1813603018212156102e6570180359067ffffffffffffffff82116102e6576020019181360383136102e657565b3561046f81612bae565b9491613c4693613c5195613c389260a099949c9b9a9c8952602089015260c0604089015260c0880191613a2d565b918583036060870152613a2d565b956080830190613a9b565b0152565b60a090606061046f95936001600160a01b03808251168452602082015116602084015260408101516040840152015160608201528160808201520191613a2d565b7fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad864910490815468010000000000000000811015612aab576001810180845581101561372a576137f2926000527fcc963e9281187e610857e988900b0c72937ebb5122acc7f351ae2143b44e468201906001600160a01b03167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b9081549168010000000000000000831015612aab5782613d5d9160016137f29501815561390b565b9091906001600160a01b038084549260031b9316831b921b1916179055565b9192613e2890337fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927553360007f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a3613dd4614c98565b613ddc614c98565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0081541690556149c9565b6001600160a01b0380911680158015613ee2575b610658577fffffffffffffffffffffffff000000000000000000000000000000000000000092827fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad86491069116848254161790557fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad864910590838254161790557fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649107921690825416179055565b5081831615613e3c565b638b78c6d8600c523360005260016020600c20541615613f0857565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927543303613f3257565b6382b429006000526004601cfd5b60ff7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033005416613f6b57565b60046040517fd93c0665000000000000000000000000000000000000000000000000000000008152fd5b90939192936001600160a01b03928385169584613fe4886001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649103602052604060002090565b54161561122757613ff3613f40565b60405180977f6e553f65000000000000000000000000000000000000000000000000000000008252816000816140466020988997600484019092916001600160a01b036020916040840195845216910152565b03925af1958615610a3f57600096614178575b50851061414e578492614096611a237fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649107546001600160a01b031690565b9081166140aa575b50509161046f926144dc565b908092935060405180927f60cfb20400000000000000000000000000000000000000000000000000000000825281806140e560048201614197565b03915afa918215610a3f57600092614131575b5050614107578290388061409e565b60046040517fbf2af50b000000000000000000000000000000000000000000000000000000008152fd5b6141479250803d10610a3857610a298183612acc565b38806140f8565b60046040517ff15ed214000000000000000000000000000000000000000000000000000000008152fd5b614190919650823d8411610dc757610db88183612acc565b9438614059565b60208082016020835260407fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad864910493845480935201926000527fcc963e9281187e610857e988900b0c72937ebb5122acc7f351ae2143b44e4682916000905b828210614202575050505090565b83546001600160a01b0316855293840193600193840193909101906141f4565b9080156143c9576001600160a01b0382169181614275826104c4336001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649100602052604060002090565b541061414e576142bb816104c4336001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649100602052604060002090565b6142c6838254613ba2565b90556040517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018390526020816044816000885af18015610a3f576143aa575b50614352816104c4336001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649100602052604060002090565b541561439a575b50604080516001600160a01b0384168152602081019290925233917ffbbbd9facbad6d22caedbbc41b96121e94e21eb0fdc25f3279c686af9aa1c9f79190a3565b6143a490336147be565b38614359565b6143c29060203d602011610a3857610a298183612acc565b5038614311565b60046040517f9811e0c7000000000000000000000000000000000000000000000000000000008152fd5b3560ff811681036102e65790565b60646020929360006001600160a01b03809660405197889687957fba0876520000000000000000000000000000000000000000000000000000000087526004870152166024850152306044850152165af18015610a3f5761445f5750565b6144779060203d602011610dc757610db88183612acc565b50565b6001600160a01b03167fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b919082018092116137b657565b6001600160a01b038116156106585782156143c957614531826104c4836001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649100602052604060002090565b5415614587575b614583916104c461457b926001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649100602052604060002090565b9182546144cf565b9055565b60206145c5826001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649101602052604060002090565b54101561462657816104c48261461c6145839561461761457b966001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649101602052604060002090565b613d35565b9250509150614538565b60046040517f63923f0e000000000000000000000000000000000000000000000000000000008152fd5b9180156143c9576001600160a01b038316806000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649100806020526146ab846040600020906001600160a01b0316600052602052604060002090565b549182841161414e576000526020528181036146de846040600020906001600160a01b0316600052602052604060002090565b55146146e8575050565b6137f2916147be565b6040519061053b908183019083821067ffffffffffffffff831117612aab57604061472d928594614e6f86393081528160208201520190611c59565b03906000f08015610a3f576001600160a01b031690565b8054801561478f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190614779828261390b565b6001600160a01b0382549160031b1b1916905555565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b906147fb826001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649101602052604060002090565b54906000905b82821061487d575b50146148535761484e6137f2916001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649101602052604060002090565b614744565b60046040517fdee790fb000000000000000000000000000000000000000000000000000000008152fd5b9291906148c0816119ac856001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649101602052604060002090565b906001600160a01b0390548187169260031b1c16146148e457600101909192614801565b9091925061497c61493c6119b161492d866001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649101602052604060002090565b61493686613b75565b9061390b565b613d5d836119ac876001600160a01b03166000527fa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649101602052604060002090565b38614809565b638b78c6d8600c526000526020600c2090815490811618809155600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26600080a3565b638b78c6d8600c526000526020600c206001815417809155600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26600080a3565b60405190614a1b82612ab0565b600f82527f4b6172616b5f5661756c745f53757000000000000000000000000000000000006020830152565b60405190614a5482612ab0565b600282527f76310000000000000000000000000000000000000000000000000000000000006020830152565b909594939291428410614c6e57614c3095614c0892614c1492614bc4614aa4614a0e565b97614bb889516020809b012095614ab9614a47565b8051908c0120604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f818f01908152602081019a909a5290890191909152466060890152306080890152968760a082010397614b3d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0998a8101835282612acc565b519020996040519586948d8601988993917fffffffffffffffffffffffffffffffffffffffff00000000000000000000000060b49694927f94fb01b7061fcfca7a3e92b7604dda2f7f5f098146840ac40016cda24c3a8859875260601b16602086015260348501526054840152607483015260948201520190565b03848101835282612acc565b519020604051938491878301968790916042927f19010000000000000000000000000000000000000000000000000000000000008352600283015260228201520190565b03908101835282612acc565b51902090614c21836143f3565b90604084013593013591614cf1565b6001600160a01b03918216911603614c4457565b60046040517f8baa579f000000000000000000000000000000000000000000000000000000008152fd5b60046040517faf04a38e000000000000000000000000000000000000000000000000000000008152fd5b60ff7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005460401c1615614cc757565b60046040517fd7e6bcf8000000000000000000000000000000000000000000000000000000008152fd5b9161046f9391614d0093614d09565b90929192614d97565b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411614d8157926020929160ff608095604051948552168484015260408301526060820152600092839182805260015afa15610a3f5780516001600160a01b03811615614d7857918190565b50809160019190565b50505060009160039190565b60041115613aa857565b614da081614d8d565b80614da9575050565b614db281614d8d565b60018103614de45760046040517ff645eedf000000000000000000000000000000000000000000000000000000008152fd5b614ded81614d8d565b60028103614e27576040517ffce698f700000000000000000000000000000000000000000000000000000000815260048101839052602490fd5b80614e33600392614d8d565b14614e3b5750565b6040517fd78bce0c0000000000000000000000000000000000000000000000000000000081526004810191909152602490fdfe60a060409080825261053b803803809161001982856102ae565b8339810182828203126101e95761002f826102e7565b60208084015191939091906001600160401b0382116101e9570182601f820112156101e957805190610060826102fb565b9361006d875195866102ae565b8285528383830101116101e957829060005b83811061029a57505060009184010152823b1561027a577fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080546001600160a01b0319166001600160a01b038581169182179092558551635c60da1b60e01b8082529194928482600481895afa91821561026f57600092610238575b50813b1561021f5750508551847f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e600080a282511561020057508290600487518096819382525afa9283156101f5576000936101b3575b5091600080848461019096519101845af4903d156101aa573d610174816102fb565b90610181885192836102ae565b8152600081943d92013e610316565b505b608052516101c1908161037a82396080518160450152f35b60609250610316565b92508183813d83116101ee575b6101ca81836102ae565b810103126101e9576000806101e1610190956102e7565b945050610152565b600080fd5b503d6101c0565b85513d6000823e3d90fd5b9350505050346102105750610192565b63b398979f60e01b8152600490fd5b8751634c9c8ce360e01b81529116600482015260249150fd5b9091508481813d8311610268575b61025081836102ae565b810103126101e957610261906102e7565b90386100fb565b503d610246565b88513d6000823e3d90fd5b8351631933b43b60e21b81526001600160a01b0384166004820152602490fd5b81810183015186820184015284920161007f565b601f909101601f19168101906001600160401b038211908210176102d157604052565b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b03821682036101e957565b6001600160401b0381116102d157601f01601f191660200190565b9061033d575080511561032b57805190602001fd5b604051630a12f52160e11b8152600490fd5b81511580610370575b61034e575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b1561034656fe6080806040527f5c60da1b00000000000000000000000000000000000000000000000000000000815260208160048173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa90811561010e5760009161007c575b5061016c565b905060203d602011610107575b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f82011682019180831067ffffffffffffffff8411176100d8576100d2926040520161011a565b38610076565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b503d610089565b6040513d6000823e3d90fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8060209101126101675760805173ffffffffffffffffffffffffffffffffffffffff811681036101675790565b600080fd5b6000808092368280378136915af43d82803e15610187573d90f35b3d90fdfea26469706673582212205c3a93b519f16ade741beb6ae31c658bdfe28066a054905e94cb62950751c83a64736f6c63430008190033a264697066735822122037a7d98782473b8f0557c57945f8a6f2d3925e4eb83602fbb500d7c2980dcdbd64736f6c63430008190033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
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.