Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Advanced mode: Intended for advanced users or developers and will display all Internal Transactions including zero value transfers. Name tag integration is not available in advanced view.
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
||||
---|---|---|---|---|---|---|---|
21497949 | 4 hrs ago | 0 ETH | |||||
21496982 | 7 hrs ago | 0 ETH | |||||
21491750 | 25 hrs ago | 0 ETH | |||||
21487070 | 41 hrs ago | 0 ETH | |||||
21483658 | 2 days ago | 0 ETH | |||||
21481001 | 2 days ago | 0 ETH | |||||
21479514 | 2 days ago | 0 ETH | |||||
21479269 | 2 days ago | 0 ETH | |||||
21478473 | 2 days ago | 0 ETH | |||||
21478124 | 2 days ago | 0 ETH | |||||
21475419 | 3 days ago | 0 ETH | |||||
21473285 | 3 days ago | 0 ETH | |||||
21470098 | 4 days ago | 0 ETH | |||||
21468760 | 4 days ago | 0 ETH | |||||
21466890 | 4 days ago | 0 ETH | |||||
21463710 | 4 days ago | 0 ETH | |||||
21463017 | 5 days ago | 0 ETH | |||||
21461319 | 5 days ago | 0 ETH | |||||
21456364 | 6 days ago | 0 ETH | |||||
21456345 | 6 days ago | 0 ETH | |||||
21456324 | 6 days ago | 0 ETH | |||||
21453100 | 6 days ago | 0 ETH | |||||
21450930 | 6 days ago | 0 ETH | |||||
21447212 | 7 days ago | 0 ETH | |||||
21447187 | 7 days ago | 0 ETH |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
Vault
Compiler Version
v0.8.22+commit.4fc1097e
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 // SPDX-FileCopyrightText: 2024 Kiln <[email protected]> // // ██╗ ██╗██╗██╗ ███╗ ██╗ // ██║ ██╔╝██║██║ ████╗ ██║ // █████╔╝ ██║██║ ██╔██╗ ██║ // ██╔═██╗ ██║██║ ██║╚██╗██║ // ██║ ██╗██║███████╗██║ ╚████║ // ╚═╝ ╚═╝╚═╝╚══════╝╚═╝ ╚═══╝ // pragma solidity 0.8.22; import {Math} from "@openzeppelin/utils/math/Math.sol"; import {Address} from "@openzeppelin/utils/Address.sol"; import {IERC20} from "@openzeppelin/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/token/ERC20/utils/SafeERC20.sol"; import {IERC20Metadata} from "@openzeppelin/interfaces/IERC20Metadata.sol"; import { ERC20Upgradeable, ERC4626Upgradeable } from "@openzeppelin-upgradeable/token/ERC20/extensions/ERC4626Upgradeable.sol"; import {AccessControlDefaultAdminRulesUpgradeable} from "@openzeppelin-upgradeable/access/extensions/AccessControlDefaultAdminRulesUpgradeable.sol"; import {ReentrancyGuardUpgradeable} from "@openzeppelin-upgradeable/utils/ReentrancyGuardUpgradeable.sol"; import { AmountZero, AddressNotContract, AddressSanctioned, DepositPaused, InvalidConnectorName, MinimumTotalSupplyNotReached, NoAdditionalRewardsClaimed, NotDelegateCall, NothingToCollect, NotTransferable, OffsetTooHigh, PreviewZero, RemainderNotZero, TotalAssetsDecreased, WrongManagementFee, WrongPerformanceFee } from "./Errors.sol"; import {IConnector} from "./interfaces/IConnector.sol"; import {ISanctionsList} from "./interfaces/ISanctionsList.sol"; import {IConnectorRegistry} from "./interfaces/IConnectorRegistry.sol"; import {FeeDispatcher, IFeeDispatcher} from "./abstracts/FeeDispatcher.sol"; /// @title Kiln DeFi Integration Vault. /// @notice ERC-4626 Vault depositing assets into a protocol. /// @dev Using ERC-7201 standard. contract Vault is ERC4626Upgradeable, AccessControlDefaultAdminRulesUpgradeable, ReentrancyGuardUpgradeable, FeeDispatcher { using Address for address; using Math for uint256; /* -------------------------------------------------------------------------- */ /* CONSTANTS */ /* -------------------------------------------------------------------------- */ /// @dev Represents the maximum fee that can be charged for performance and management fees. uint256 internal constant _MAX_FEE = 35; /// @dev Represents the maximum offset. uint8 internal constant _MAX_OFFSET = 23; /// @notice The role code for the fee manager. bytes32 public constant FEE_MANAGER_ROLE = bytes32("FEE_MANAGER"); /// @notice The role code for the sanctions manager. bytes32 public constant SANCTIONS_MANAGER_ROLE = bytes32("SANCTIONS_MANAGER"); /// @notice The role code for the claim manager. bytes32 public constant CLAIM_MANAGER_ROLE = bytes32("CLAIM_MANAGER"); /// @notice The role code for the pauser role. bytes32 public constant PAUSER_ROLE = bytes32("PAUSER"); /// @notice The role code for the unpauser role. bytes32 public constant UNPAUSER_ROLE = bytes32("UNPAUSER"); /* -------------------------------------------------------------------------- */ /* IMMUTABLE */ /* -------------------------------------------------------------------------- */ /// @dev The address of the implementation (regardless of the context). address internal immutable _self = address(this); /* -------------------------------------------------------------------------- */ /* STORAGE (proxy) */ /* -------------------------------------------------------------------------- */ /// @notice The storage layout of the contract. /// @param _connectorRegistry The connector registry address. /// @param _connectorName The name of the connector used by the vault to interact with the proper protocol. /// @param _managementFee The management fee (between 0 and 100, scaled to the underlying asset decimals). /// @param _performanceFee The performance fee (between 0 and 100, scaled to the underlying asset decimals). /// @param _lastTotalAssets The last amount of the underlying asset that is “managed” by the vault. /// @param _minTotalSupply The minimum total supply of the vault shares. /// @param _transferable True if the vault shares are transferable, False if not. /// @param _offset The offset (inflation attack mitigation). /// @param _collectablePerformanceFeesShares The amount of performance fees shares that can be collected by the FeeManager. /// @param _sanctionsList The sanctions list contract from Chainalysis. struct VaultStorage { IConnectorRegistry _connectorRegistry; bytes32 _connectorName; uint256 _managementFee; uint256 _performanceFee; uint256 _lastTotalAssets; uint256 _minTotalSupply; bool _transferable; uint8 _offset; uint256 _collectablePerformanceFeesShares; ISanctionsList _sanctionsList; bool _depositPaused; } function _getVaultStorage() private pure returns (VaultStorage storage $) { assembly { $.slot := VaultStorageLocation } } /// @dev The storage slot of the VaultStorage struct in the proxy contract. /// keccak256(abi.encode(uint256(keccak256("kiln.storage.vault")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant VaultStorageLocation = 0x6bb5a2a0ae924c2ea94f037035a09f65614421e2a7d96c9bcbd59acdd32e6000; /* -------------------------------------------------------------------------- */ /* EVENTS */ /* -------------------------------------------------------------------------- */ /// @dev Emitted when the management fee is updated. /// @param newManagementFee The new management fee. event ManagementFeeUpdated(uint256 newManagementFee); /// @dev Emitted when the performance fee is updated. /// @param newPerformanceFee The new performance fee. event PerformanceFeeUpdated(uint256 newPerformanceFee); /// @dev Emitted when the connector registry is updated. /// @param newConnectorRegistry The new connector registry. event ConnectorRegistryUpdated(IConnectorRegistry newConnectorRegistry); /// @dev Emitted when the connector name is updated. /// @param newConnectorName The new connector name. event ConnectorNameUpdated(bytes32 newConnectorName); /// @dev Emitted when the transferable flag is updated. /// @param newTransferableFlag The new transferable flag. event TransferableUpdated(bool newTransferableFlag); /// @dev Emitted when the ERC4626 name is initialized. /// @param name The name of the ERC4626. event NameInitialized(string name); /// @dev Emitted when the ERC4626 symbol is initialized. /// @param symbol The symbol of the ERC4626. event SymbolInitialized(string symbol); /// @dev Emitted when an asset is initialized. /// @param asset The (ERC20) asset that is initialized. event AssetInitialized(IERC20 asset); /// @dev Emitted when the offset is initialized. /// @param offset The offset. event OffsetInitialized(uint8 offset); /// @dev Emitted when minimum supply state is updated. /// @param newMinTotalSupply The new minimum supply state. event MinTotalSupplyInitialized(uint256 newMinTotalSupply); /// @dev Emitted when the sanctions list is updated. /// @param newSanctionsList The new sanctions list. event SanctionsListUpdated(ISanctionsList newSanctionsList); /// @dev Emitted when addtionnal rewards are claimed to the underlying protocol. /// @param rewardsAsset The rewards asset claimed. /// @param amount The amount distributed to the vault. event RewardsClaimed(address indexed rewardsAsset, uint256 amount); /* -------------------------------------------------------------------------- */ /* MODIFIERS */ /* -------------------------------------------------------------------------- */ /// @dev Throws if the ERC4626 is not transferable. modifier whenTransferable() { if (!_getVaultStorage()._transferable) revert NotTransferable(); _; } /// @dev Throws if the call is not a delegate call. /// Allow to check if the contract is called from a proxy. modifier onlyDelegateCall() { if (address(this) == _self) revert NotDelegateCall(); _; } /// @dev Throws if the given address is sanctioned by Chainalysis. /// If the sanctions list is not set, the check is skipped. /// @param addr The address to check. modifier notSanctioned(address addr) { _notSanctioned(addr); _; } /// @dev Throws if the deposit is paused. modifier whenDepositNotPaused() { if (_getVaultStorage()._depositPaused) revert DepositPaused(); _; } /* -------------------------------------------------------------------------- */ /* PROXY LOGIC */ /* -------------------------------------------------------------------------- */ /// @notice Parameters for the `initialize()` function. struct InitializationParams { IERC20 asset_; string name_; string symbol_; bool transferable_; IConnectorRegistry connectorRegistry_; bytes32 connectorName_; FeeRecipient[] recipients_; uint256 managementFee_; uint256 performanceFee_; address initialDefaultAdmin_; address initialFeeManager_; address initialSanctionsManager_; address initialClaimManager_; address initialPauser_; address initialUnpauser_; uint48 initialDelay_; uint8 offset_; ISanctionsList sanctionsList_; uint256 minTotalSupply_; } /// @notice Initializes the contract in the proxy context. /// @param params The initialization parameters. function initialize(InitializationParams calldata params) public onlyDelegateCall initializer { __ERC4626_init(params.asset_); emit AssetInitialized(params.asset_); __ERC20_init(params.name_, params.symbol_); emit NameInitialized(params.name_); emit SymbolInitialized(params.symbol_); __ReentrancyGuard_init(); __AccessControlDefaultAdminRules_init(params.initialDelay_, params.initialDefaultAdmin_); __FeeDispatcher_init(params.recipients_, IERC20Metadata(asset()).decimals()); __Vault_init(params); } function __Vault_init(InitializationParams memory params) internal onlyInitializing { __Vault_init_unchained( params.transferable_, params.connectorRegistry_, params.connectorName_, params.managementFee_, params.performanceFee_, params.offset_, params.initialFeeManager_, params.initialSanctionsManager_, params.initialClaimManager_, params.initialPauser_, params.initialUnpauser_, params.sanctionsList_, params.minTotalSupply_ ); } function __Vault_init_unchained( bool _transferable, IConnectorRegistry _connectorRegistry, bytes32 _connectorName, uint256 _managementFee, uint256 _performanceFee, uint8 _offset, address _initialFeeManager, address _initialSanctionsManager, address _initialClaimManager, address _initialPauser, address _initialUnpauser, ISanctionsList _sanctionsList, uint256 _minTotalSupply ) internal onlyInitializing { _setOffset(_offset); _setPerformanceFee(_performanceFee); _setManagementFee(_managementFee); _setConnectorRegistry(_connectorRegistry); _setConnectorName(_connectorName); _setTransferable(_transferable); _setSanctionsList(_sanctionsList); _setMinTotalSupply(_minTotalSupply); _grantRole(FEE_MANAGER_ROLE, _initialFeeManager); _grantRole(SANCTIONS_MANAGER_ROLE, _initialSanctionsManager); _grantRole(CLAIM_MANAGER_ROLE, _initialClaimManager); _grantRole(PAUSER_ROLE, _initialPauser); _grantRole(UNPAUSER_ROLE, _initialUnpauser); } /* -------------------------------------------------------------------------- */ /* ERC4626 (PUBLIC) LOGIC */ /* -------------------------------------------------------------------------- */ /// @inheritdoc ERC4626Upgradeable function totalAssets() public view override returns (uint256) { return _getConnector().totalAssets(IERC20Metadata(asset())); } /// @inheritdoc ERC4626Upgradeable function maxDeposit(address) public view override returns (uint256) { VaultStorage storage $ = _getVaultStorage(); if ($._connectorRegistry.paused($._connectorName) || $._depositPaused) { return 0; } return _maxDeposit(); } /// @inheritdoc ERC4626Upgradeable function maxMint(address) public view override returns (uint256) { VaultStorage storage $ = _getVaultStorage(); if ($._connectorRegistry.paused($._connectorName) || $._depositPaused) { return 0; } return _maxMint(totalAssets(), totalSupply()); } /// @inheritdoc ERC4626Upgradeable function maxWithdraw(address owner) public view override returns (uint256) { VaultStorage storage $ = _getVaultStorage(); if ($._connectorRegistry.paused($._connectorName)) { return 0; } return _maxWithdraw(owner); } // @inheritdoc ERC4626Upgradeable function maxRedeem(address owner) public view override returns (uint256) { VaultStorage storage $ = _getVaultStorage(); if ($._connectorRegistry.paused($._connectorName)) { return 0; } return _maxRedeem(owner, totalAssets(), totalSupply()); } /// @inheritdoc ERC4626Upgradeable function previewDeposit(uint256 assets) public view override returns (uint256) { (uint256 _performanceFeeShares, uint256 _newTotalAssets) = _accruedPerformanceFeeShares(); (uint256 _shares,) = _previewDeposit(assets, _newTotalAssets, totalSupply() + _performanceFeeShares); return _shares; } /// @inheritdoc ERC4626Upgradeable function previewMint(uint256 shares) public view override returns (uint256) { (uint256 _performanceFeeShares, uint256 _newTotalAssets) = _accruedPerformanceFeeShares(); (uint256 _assets,) = _previewMint(shares, _newTotalAssets, totalSupply() + _performanceFeeShares); return _assets; } /// @inheritdoc ERC4626Upgradeable function previewWithdraw(uint256 assets) public view override returns (uint256) { (uint256 _performanceFeeShares, uint256 _newTotalAssets) = _accruedPerformanceFeeShares(); return assets.mulDiv( totalSupply() + _performanceFeeShares + 10 ** _decimalsOffset(), _newTotalAssets + 1, Math.Rounding.Ceil ); } /// @inheritdoc ERC4626Upgradeable function previewRedeem(uint256 shares) public view override returns (uint256) { (uint256 _performanceFeeShares, uint256 _newTotalAssets) = _accruedPerformanceFeeShares(); return shares.mulDiv( _newTotalAssets + 1, totalSupply() + _performanceFeeShares + 10 ** _decimalsOffset(), Math.Rounding.Floor ); } /// @inheritdoc ERC4626Upgradeable function deposit(uint256 assets, address receiver) public override nonReentrant notSanctioned(msg.sender) whenDepositNotPaused returns (uint256) { if (assets == 0) revert AmountZero(); uint256 _maxAssets = _maxDeposit(); if (assets > _maxAssets) revert ERC4626ExceededMaxDeposit(receiver, assets, _maxAssets); uint256 _newTotalAssets = _accruePerformanceFee(); (uint256 _shares, uint256 _managementFeeAmount) = _previewDeposit(assets, _newTotalAssets, totalSupply()); if (_shares == 0) revert PreviewZero(); _checkPartialShares(_shares); _deposit(_msgSender(), receiver, assets, _shares, _managementFeeAmount); return _shares; } /// @inheritdoc ERC4626Upgradeable function mint(uint256 shares, address receiver) public override nonReentrant notSanctioned(msg.sender) whenDepositNotPaused returns (uint256) { if (shares == 0) revert AmountZero(); _checkPartialShares(shares); uint256 _newTotalAssets = _accruePerformanceFee(); uint256 _newTotalSupply = totalSupply(); uint256 _maxShares = _maxMint(_newTotalAssets, _newTotalSupply); if (shares > _maxShares) revert ERC4626ExceededMaxMint(receiver, shares, _maxShares); (uint256 _assets, uint256 _managementFeeAmount) = _previewMint(shares, _newTotalAssets, _newTotalSupply); if (_assets == 0) revert PreviewZero(); _deposit(_msgSender(), receiver, _assets, shares, _managementFeeAmount); return _assets; } /// @inheritdoc ERC4626Upgradeable function withdraw(uint256 assets, address receiver, address owner) public override nonReentrant notSanctioned(msg.sender) returns (uint256) { if (assets == 0) revert AmountZero(); uint256 _maxAssets = _maxWithdraw(owner); if (assets > _maxAssets) revert ERC4626ExceededMaxWithdraw(owner, assets, _maxAssets); uint256 _newTotalAssets = _accruePerformanceFee(); uint256 _shares = _convertToShares(assets, Math.Rounding.Ceil, _newTotalAssets, totalSupply()); if (_shares == 0) revert PreviewZero(); _checkPartialShares(_shares); _withdraw(_msgSender(), receiver, owner, assets, _shares); return _shares; } /// @inheritdoc ERC4626Upgradeable function redeem(uint256 shares, address receiver, address owner) public override nonReentrant notSanctioned(msg.sender) returns (uint256) { if (shares == 0) revert AmountZero(); _checkPartialShares(shares); uint256 _newTotalAssets = _accruePerformanceFee(); uint256 _newTotalSupply = totalSupply(); uint256 _maxShares = _maxRedeem(owner, _newTotalAssets, _newTotalSupply); if (shares > _maxShares) revert ERC4626ExceededMaxRedeem(owner, shares, _maxShares); uint256 _assets = _convertToAssets(shares, Math.Rounding.Floor, _newTotalAssets, _newTotalSupply); if (_assets == 0) revert PreviewZero(); _withdraw(_msgSender(), receiver, owner, _assets, shares); return _assets; } /* -------------------------------------------------------------------------- */ /* ERC4626 (INTERNAL) LOGIC */ /* -------------------------------------------------------------------------- */ /// @dev Variant of ERC4626Upgradeable's _deposit but taking the management fee amount. /// See ERC4626Upgradeable. /// @param caller The caller of the function. /// @param receiver The receiver of the minted shares. /// @param assets The amount of assets to deposit. /// @param shares The number of shares to mint. /// @param managementFeeAmount The amount of management fee in asset terms, calculated based on the deposit amount. function _deposit(address caller, address receiver, uint256 assets, uint256 shares, uint256 managementFeeAmount) internal { uint256 _balanceBefore = IERC20(asset()).balanceOf(address(this)); SafeERC20.safeTransferFrom(IERC20(asset()), caller, address(this), assets); _mint(receiver, shares); VaultStorage storage $ = _getVaultStorage(); if (totalSupply() < $._minTotalSupply) revert MinimumTotalSupplyNotReached(); // Deposit to underlying protocol address _connector = $._connectorRegistry.getOrRevert($._connectorName); _connector.functionDelegateCall( abi.encodeCall( IConnector.deposit, (IERC20(asset()), IERC20(asset()).balanceOf(address(this)) - _balanceBefore - managementFeeAmount) ) ); $._lastTotalAssets = totalAssets(); _incrementPendingManagementFee(managementFeeAmount); emit Deposit(caller, receiver, assets, shares); } /// @dev Variant of ERC4626Upgradeable's _withdraw. See ERC4626Upgradeable. /// @param caller The caller of the function. /// @param receiver The receiver of the withdrawn assets. /// @param owner The owner of the shares to redeem. /// @param assets The amount of assets to withdraw from the underlying protocol. /// @param shares The number of shares to burn. function _withdraw(address caller, address receiver, address owner, uint256 assets, uint256 shares) internal override { if (caller != owner) { _spendAllowance(owner, caller, shares); } _burn(owner, shares); // Withdraw from underlying protocol VaultStorage storage $ = _getVaultStorage(); address _connector = $._connectorRegistry.getOrRevert($._connectorName); uint256 _balanceBefore = IERC20(asset()).balanceOf(address(this)); _connector.functionDelegateCall(abi.encodeCall(IConnector.withdraw, (IERC20(asset()), assets))); SafeERC20.safeTransfer(IERC20(asset()), receiver, IERC20(asset()).balanceOf(address(this)) - _balanceBefore); $._lastTotalAssets = totalAssets(); emit Withdraw(caller, receiver, owner, assets, shares); } /// @dev Internal function to retrieve the max depositable amount. /// Calls the connector to get the max depositable amount for the asset (e.g. the supply cap). function _maxDeposit() internal view returns (uint256) { return _getConnector().maxDeposit(IERC20(asset())); } /// @dev Internal function to retrieve the max mintable amount. /// @param newTotalAssets The Vault's total assets. /// @param newTotalSupply The (shares) total supply. function _maxMint(uint256 newTotalAssets, uint256 newTotalSupply) internal view returns (uint256) { uint256 _maxDepositable = _maxDeposit(); if (_maxDepositable == type(uint256).max - 1) { return type(uint256).max - 1; } return _convertToShares(_maxDepositable, Math.Rounding.Floor, newTotalAssets, newTotalSupply); } /// @dev Internal function to retrieve the max withdrawable amount for a given owner. /// @param owner The owner of the shares. function _maxWithdraw(address owner) internal view returns (uint256) { return Math.min(_getConnector().maxWithdraw(IERC20(asset())), previewRedeem(balanceOf(owner))); } /// @dev Internal function to retrieve the max redeemable amount for a given owner. /// @param owner The owner of the shares. /// @param newTotalAssets The Vault's total assets. /// @param newTotalSupply The (shares) total supply. function _maxRedeem(address owner, uint256 newTotalAssets, uint256 newTotalSupply) internal view returns (uint256) { uint256 _maxWithdrawable = _getConnector().maxWithdraw(IERC20(asset())); if (_maxWithdrawable == type(uint256).max - 1) { return balanceOf(owner); } return Math.min( _convertToShares(_maxWithdrawable, Math.Rounding.Floor, newTotalAssets, newTotalSupply), balanceOf(owner) ); } /// @dev Estimates the number of shares mintable from a given deposit and the associated management fee. /// @param assets The amount of assets to deposit. /// @param newTotalAssets The Vault's total assets /// @param supply The (shares) total supply. /// @return shares The number of shares that can be minted from the deposited assets, after deducting the management fee. /// @return managementFeeAmount The amount of management fee in asset terms, calculated based on the deposit amount. function _previewDeposit(uint256 assets, uint256 newTotalAssets, uint256 supply) internal view returns (uint256 shares, uint256 managementFeeAmount) { VaultStorage storage $ = _getVaultStorage(); // Calculate the management fee amount. // This is a portion of the deposited assets, scaled by the management fee rate and adjusted for the asset's decimals. managementFeeAmount = assets.mulDiv($._managementFee, _MAX_PERCENT * 10 ** IERC20Metadata(asset()).decimals()); // Convert the net asset amount (after deducting the management fee) to shares. // The conversion uses floor rounding to determine the number of shares that can be minted. shares = _convertToShares(assets - managementFeeAmount, Math.Rounding.Floor, newTotalAssets, supply); } /// @dev Estimates the asset amount and management fee for minting a specified number of shares. /// @param shares The number of shares to be minted. /// @param newTotalAssets The Vault's total assets. /// @param supply The (shares) total supply. /// @return assets The total amount of assets required to mint the specified number of shares, including the management fee. /// @return managementFeeAmount The amount of management fee in asset terms deducted when minting the shares. function _previewMint(uint256 shares, uint256 newTotalAssets, uint256 supply) internal view returns (uint256 assets, uint256 managementFeeAmount) { VaultStorage storage $ = _getVaultStorage(); uint256 _managementFee = $._managementFee; uint256 _decimals = IERC20Metadata(asset()).decimals(); // Convert the number of shares to assets with ceiling rounding. // This gives us a raw asset value equivalent to the shares before considering management fees. uint256 _rawAssetValue = _convertToAssets(shares, Math.Rounding.Ceil, newTotalAssets, supply); // To ensure accuracy in calculations, it's necessary to scale values up. uint256 _scaledRawAssetValue = _rawAssetValue * 10 ** _decimals; // The management fee is deducted from the maximum percent scale adjusted for decimals. uint256 _adjustedMaxPercent = (_MAX_PERCENT * 10 ** _decimals) - _managementFee; // Calculate the assets required to mint the shares, including the management fee. // // _MAX_PERCENT * (_rawAssetValue * 10 ** decimals) // assets = ----------------------------------------------------- // (_MAX_PERCENT * 10 ** decimals) - _managementFee // // Note: _managementFee is already scaled to asset decimals. // assets = _scaledRawAssetValue.mulDiv(_MAX_PERCENT, _adjustedMaxPercent, Math.Rounding.Ceil); // Calculate the management fee amount from the assets required to mint the shares. managementFeeAmount = assets.mulDiv(_managementFee, _MAX_PERCENT * 10 ** _decimals, Math.Rounding.Floor); } /// @dev Variant of _convertToShares from ERC4626Upgradeable but taking the totalAssets/totalSupply /// parameters instead of calling `totalAssets()` and `totalSupply()`. function _convertToShares(uint256 assets, Math.Rounding rounding, uint256 total, uint256 supply) internal view returns (uint256) { return assets.mulDiv(supply + 10 ** _decimalsOffset(), total + 1, rounding); } /// @dev Variant of _convertToAssets from ERC4626Upgradeable but taking the totalAssets/totalSupply /// parameters instead of calling `totalAssets()` and `totalSupply()`. function _convertToAssets(uint256 shares, Math.Rounding rounding, uint256 total, uint256 supply) internal view returns (uint256) { return shares.mulDiv(total + 1, supply + 10 ** _decimalsOffset(), rounding); } /// @inheritdoc ERC4626Upgradeable function _decimalsOffset() internal view override returns (uint8) { return _getVaultStorage()._offset; } /// @dev Internal function accrue the performance fee and mints the shares. /// @return newTotalAssets The vaults total assets after accruing the interest. function _accruePerformanceFee() internal returns (uint256 newTotalAssets) { VaultStorage storage $ = _getVaultStorage(); uint256 performanceFeeShares; (performanceFeeShares, newTotalAssets) = _accruedPerformanceFeeShares(); if (performanceFeeShares != 0) { _mint(address(this), performanceFeeShares); $._collectablePerformanceFeesShares += performanceFeeShares; } } /// @dev Computes and returns the performanceFee shares to mint and the new vault's total assets. /// @return performanceFeeShares The number of shares to mint as performance fee. /// @return newTotalAssets The vaults total assets after accruing the interest. function _accruedPerformanceFeeShares() internal view returns (uint256 performanceFeeShares, uint256 newTotalAssets) { VaultStorage storage $ = _getVaultStorage(); newTotalAssets = totalAssets(); (, uint256 _performance) = newTotalAssets.trySub($._lastTotalAssets); if (_performance != 0 && $._performanceFee != 0) { uint256 _performanceFeeAmount = _performance.mulDiv( $._performanceFee, _MAX_PERCENT * 10 ** IERC20Metadata(asset()).decimals(), Math.Rounding.Floor ); // Performance fee is subtracted from the total assets as it's already increased by total interest // (including performance fee). performanceFeeShares = _convertToShares( _performanceFeeAmount, Math.Rounding.Floor, newTotalAssets - _performanceFeeAmount, totalSupply() ); } } /// @dev Internal function that throws an error if the remainder of the shares is not zero. /// @param shares The number of shares to mint/transfer. function _checkPartialShares(uint256 shares) internal view { uint8 _offset = _decimalsOffset(); if (_offset > 0) { if (shares % 10 ** _offset > 0) revert RemainderNotZero(shares); } } /* -------------------------------------------------------------------------- */ /* ERC20 LOGIC */ /* -------------------------------------------------------------------------- */ /// @inheritdoc ERC20Upgradeable function transfer(address to, uint256 value) public override(ERC20Upgradeable, IERC20) whenTransferable notSanctioned(msg.sender) notSanctioned(to) returns (bool) { _checkPartialShares(value); return super.transfer(to, value); } /// @inheritdoc ERC20Upgradeable function transferFrom(address from, address to, uint256 value) public override(ERC20Upgradeable, IERC20) whenTransferable notSanctioned(msg.sender) notSanctioned(from) notSanctioned(to) returns (bool) { _checkPartialShares(value); return super.transferFrom(from, to, value); } /// @inheritdoc ERC20Upgradeable function approve(address spender, uint256 value) public override(ERC20Upgradeable, IERC20) whenTransferable notSanctioned(msg.sender) notSanctioned(spender) returns (bool) { return super.approve(spender, value); } /* -------------------------------------------------------------------------- */ /* FEE MANAGEMENT LOGIC */ /* -------------------------------------------------------------------------- */ /// @inheritdoc IFeeDispatcher function dispatchFees() external override nonReentrant { _dispatchFees(IERC20(asset()), IERC20Metadata(asset()).decimals()); } /// @notice Collects the performance fees function collectPerformanceFees() external nonReentrant onlyRole(FEE_MANAGER_ROLE) { VaultStorage storage $ = _getVaultStorage(); (uint256 _performanceFeeShares, uint256 _newTotalAssets) = _accruedPerformanceFeeShares(); uint256 _collectable = _convertToAssets( $._collectablePerformanceFeesShares + _performanceFeeShares, Math.Rounding.Floor, _newTotalAssets, totalSupply() + _performanceFeeShares ); if (_collectable == 0) revert NothingToCollect(); uint256 _balanceBefore = IERC20(asset()).balanceOf(address(this)); address _connector = $._connectorRegistry.getOrRevert($._connectorName); _connector.functionDelegateCall(abi.encodeCall(IConnector.withdraw, (IERC20(asset()), _collectable))); _incrementPendingPerformanceFee(IERC20(asset()).balanceOf(address(this)) - _balanceBefore); _burn(address(this), $._collectablePerformanceFeesShares); $._collectablePerformanceFeesShares = 0; $._lastTotalAssets = totalAssets(); } /* -------------------------------------------------------------------------- */ /* CLAIM LOGIC */ /* -------------------------------------------------------------------------- */ /// @notice Claims additional rewards to the underlying protocol. /// @dev Additional rewards are considered as yield, where the performance fee can be applied. /// @param rewardsAsset The rewards asset to claim. /// @param payload The payload to pass to the connector. function claimAdditionalRewards(address rewardsAsset, bytes calldata payload) external nonReentrant onlyRole(CLAIM_MANAGER_ROLE) { VaultStorage storage $ = _getVaultStorage(); uint256 _totalAssetsBefore = totalAssets(); address _connector = $._connectorRegistry.getOrRevert($._connectorName); _connector.functionDelegateCall( abi.encodeCall(IConnector.claim, (IERC20(asset()), IERC20(rewardsAsset), payload)) ); uint256 _totalAssets = totalAssets(); if (_totalAssetsBefore > _totalAssets) { revert TotalAssetsDecreased(_totalAssetsBefore, _totalAssets); } else if (_totalAssetsBefore == _totalAssets) { revert NoAdditionalRewardsClaimed(); } emit RewardsClaimed(rewardsAsset, _totalAssets - _totalAssetsBefore); } /* -------------------------------------------------------------------------- */ /* SANCTIONS LIST LOGIC */ /* -------------------------------------------------------------------------- */ /// @notice Sets the sanctions list. /// @param newSanctionsList The new sanctions list. function setSanctionsList(ISanctionsList newSanctionsList) external onlyRole(SANCTIONS_MANAGER_ROLE) { _setSanctionsList(newSanctionsList); } /// @dev Internal modifier logic to check if the given address is sanctioned. /// @param addr The address to check. function _notSanctioned(address addr) internal view { ISanctionsList _sanctionsList = _getVaultStorage()._sanctionsList; if (address(_sanctionsList) != address(0) && _sanctionsList.isSanctioned(addr)) { revert AddressSanctioned(addr); } } /* -------------------------------------------------------------------------- */ /* DEPOSIT PAUSE LOGIC */ /* -------------------------------------------------------------------------- */ /// @notice Pauses the deposit. function pauseDeposit() external onlyRole(PAUSER_ROLE) { _getVaultStorage()._depositPaused = true; } /// @notice Unpauses the deposit. function unpauseDeposit() external onlyRole(UNPAUSER_ROLE) { _getVaultStorage()._depositPaused = false; } /* -------------------------------------------------------------------------- */ /* (PUBLIC) SETTERS */ /* -------------------------------------------------------------------------- */ /// @notice Sets the fee recipients. /// @param recipients The new fee recipients. function setFeeRecipients(FeeRecipient[] memory recipients) external onlyRole(FEE_MANAGER_ROLE) { _setFeeRecipients(recipients, IERC20Metadata(asset()).decimals()); } /// @notice Sets the management fee. /// @param newManagementFee The new management fee. function setManagementFee(uint256 newManagementFee) external onlyRole(FEE_MANAGER_ROLE) { _setManagementFee(newManagementFee); } /// @notice Sets the performance fee. /// @dev This function also collects the last performance fees prior to updating the fee. /// @param newPerformanceFee The new performance fee. function setPerformanceFee(uint256 newPerformanceFee) external onlyRole(FEE_MANAGER_ROLE) { // Accrue the last performance fees prior to updating the fee amount. VaultStorage storage $ = _getVaultStorage(); $._lastTotalAssets = _accruePerformanceFee(); _setPerformanceFee(newPerformanceFee); } /* -------------------------------------------------------------------------- */ /* (INTERNAL) SETTERS */ /* -------------------------------------------------------------------------- */ /// @dev Internal logic to set the performance fee. /// @param newPerformanceFee The new performance fee. function _setPerformanceFee(uint256 newPerformanceFee) internal { if (newPerformanceFee > _MAX_FEE * 10 ** IERC20Metadata(asset()).decimals()) { revert WrongPerformanceFee(newPerformanceFee); } _getVaultStorage()._performanceFee = newPerformanceFee; emit PerformanceFeeUpdated(newPerformanceFee); } /// @dev Internal logic to set the management fee. /// @param newManagementFee The new management fee. function _setManagementFee(uint256 newManagementFee) internal { if (newManagementFee > _MAX_FEE * 10 ** IERC20Metadata(asset()).decimals()) { revert WrongManagementFee(newManagementFee); } _getVaultStorage()._managementFee = newManagementFee; emit ManagementFeeUpdated(newManagementFee); } /// @notice Internal logic to set the connector registry. /// @param newConnectorRegistry The new connector registry. function _setConnectorRegistry(IConnectorRegistry newConnectorRegistry) internal { VaultStorage storage $ = _getVaultStorage(); if (address(newConnectorRegistry).code.length == 0) revert AddressNotContract(address(newConnectorRegistry)); $._connectorRegistry = newConnectorRegistry; emit ConnectorRegistryUpdated(newConnectorRegistry); } /// @notice Internal logic to set the connector name. /// @param newConnectorName The new connector name. function _setConnectorName(bytes32 newConnectorName) internal { VaultStorage storage $ = _getVaultStorage(); if (!$._connectorRegistry.connectorExists(newConnectorName)) revert InvalidConnectorName(newConnectorName); $._connectorName = newConnectorName; emit ConnectorNameUpdated(newConnectorName); } /// @notice Internal logic to set the transferable flag. /// @param newTransferableFlag The new transferable flag. function _setTransferable(bool newTransferableFlag) internal { _getVaultStorage()._transferable = newTransferableFlag; emit TransferableUpdated(newTransferableFlag); } /// @notice Internal logic to set the offset. /// @param offset The new offset. function _setOffset(uint8 offset) internal { if (offset > _MAX_OFFSET) revert OffsetTooHigh(offset); _getVaultStorage()._offset = offset; emit OffsetInitialized(offset); } /// @notice Internal logic to set the sanctions list. /// @dev Possible to set the sanctions list to address(0) to disable it. /// @param newSanctionsList The new sanctions list. function _setSanctionsList(ISanctionsList newSanctionsList) internal { _getVaultStorage()._sanctionsList = newSanctionsList; emit SanctionsListUpdated(newSanctionsList); } /// @notice Internal logic to set the minimum supply state. /// @dev This is used to prevent a griefing attack. /// @param newMinTotalSupply The new minimum total supply required after a deposit. function _setMinTotalSupply(uint256 newMinTotalSupply) internal { _getVaultStorage()._minTotalSupply = newMinTotalSupply; emit MinTotalSupplyInitialized(newMinTotalSupply); } /* -------------------------------------------------------------------------- */ /* GETTERS */ /* -------------------------------------------------------------------------- */ /// @notice Returns if the ERC4626 share is transferable. /// @return transferable True if the ERC4626 share is transferable, False if not. function transferable() external view returns (bool) { return _getVaultStorage()._transferable; } /// @notice Returns the connector registry. /// @return connectorRegistry The connector registry. function connectorRegistry() external view returns (IConnectorRegistry) { return _getVaultStorage()._connectorRegistry; } /// @notice Returns the connector name. /// @return connectorName The connector name. function connectorName() external view returns (bytes32) { return _getVaultStorage()._connectorName; } /// @notice Returns the management fee. /// @return managementFee The management fee. function managementFee() external view returns (uint256) { return _getVaultStorage()._managementFee; } /// @notice Returns the performance fee. /// @return performanceFee The performance fee. function performanceFee() external view returns (uint256) { return _getVaultStorage()._performanceFee; } /// @notice Returns the collectable performance fees (when calling `collectPerformanceFees`). /// @return collectablePerformanceFees The amount of performance fees that can be collected by the FeeManager. function collectablePerformanceFees() external view returns (uint256) { (uint256 _accruedShares, uint256 _newTotalAssets) = _accruedPerformanceFeeShares(); uint256 _totalShares = _accruedShares + _getVaultStorage()._collectablePerformanceFeesShares; return _convertToAssets(_totalShares, Math.Rounding.Floor, _newTotalAssets, totalSupply() + _accruedShares); } /// @notice Returns the sanctions list. /// @return sanctionsList The sanctions list. function sanctionsList() external view returns (ISanctionsList) { return _getVaultStorage()._sanctionsList; } /// @dev Get the connector address. function _getConnector() internal view returns (IConnector) { VaultStorage storage $ = _getVaultStorage(); return IConnector($._connectorRegistry.get($._connectorName)); } }
// 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/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) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev An operation with an ERC20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value))); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value))); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20Metadata} from "../token/ERC20/extensions/IERC20Metadata.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC4626.sol) pragma solidity ^0.8.20; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import {ERC20Upgradeable} from "../ERC20Upgradeable.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {IERC4626} from "@openzeppelin/contracts/interfaces/IERC4626.sol"; import {Math} from "@openzeppelin/contracts/utils/math/Math.sol"; import {Initializable} from "../../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the ERC4626 "Tokenized Vault Standard" as defined in * https://eips.ethereum.org/EIPS/eip-4626[EIP-4626]. * * This extension allows the minting and burning of "shares" (represented using the ERC20 inheritance) in exchange for * underlying "assets" through standardized {deposit}, {mint}, {redeem} and {burn} workflows. This contract extends * the ERC20 standard. Any additional extensions included along it would affect the "shares" token represented by this * contract and not the "assets" token which is an independent contract. * * [CAUTION] * ==== * In empty (or nearly empty) ERC-4626 vaults, deposits are at high risk of being stolen through frontrunning * with a "donation" to the vault that inflates the price of a share. This is variously known as a donation or inflation * attack and is essentially a problem of slippage. Vault deployers can protect against this attack by making an initial * deposit of a non-trivial amount of the asset, such that price manipulation becomes infeasible. Withdrawals may * similarly be affected by slippage. Users can protect against this attack as well as unexpected slippage in general by * verifying the amount received is as expected, using a wrapper that performs these checks such as * https://github.com/fei-protocol/ERC4626#erc4626router-and-base[ERC4626Router]. * * Since v4.9, this implementation uses virtual assets and shares to mitigate that risk. The `_decimalsOffset()` * corresponds to an offset in the decimal representation between the underlying asset's decimals and the vault * decimals. This offset also determines the rate of virtual shares to virtual assets in the vault, which itself * determines the initial exchange rate. While not fully preventing the attack, analysis shows that the default offset * (0) makes it non-profitable, as a result of the value being captured by the virtual shares (out of the attacker's * donation) matching the attacker's expected gains. With a larger offset, the attack becomes orders of magnitude more * expensive than it is profitable. More details about the underlying math can be found * xref:erc4626.adoc#inflation-attack[here]. * * The drawback of this approach is that the virtual shares do capture (a very small) part of the value being accrued * to the vault. Also, if the vault experiences losses, the users try to exit the vault, the virtual shares and assets * will cause the first user to exit to experience reduced losses in detriment to the last users that will experience * bigger losses. Developers willing to revert back to the pre-v4.9 behavior just need to override the * `_convertToShares` and `_convertToAssets` functions. * * To learn more, check out our xref:ROOT:erc4626.adoc[ERC-4626 guide]. * ==== */ abstract contract ERC4626Upgradeable is Initializable, ERC20Upgradeable, IERC4626 { using Math for uint256; /// @custom:storage-location erc7201:openzeppelin.storage.ERC4626 struct ERC4626Storage { IERC20 _asset; uint8 _underlyingDecimals; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC4626")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ERC4626StorageLocation = 0x0773e532dfede91f04b12a73d3d2acd361424f41f76b4fb79f090161e36b4e00; function _getERC4626Storage() private pure returns (ERC4626Storage storage $) { assembly { $.slot := ERC4626StorageLocation } } /** * @dev Attempted to deposit more assets than the max amount for `receiver`. */ error ERC4626ExceededMaxDeposit(address receiver, uint256 assets, uint256 max); /** * @dev Attempted to mint more shares than the max amount for `receiver`. */ error ERC4626ExceededMaxMint(address receiver, uint256 shares, uint256 max); /** * @dev Attempted to withdraw more assets than the max amount for `receiver`. */ error ERC4626ExceededMaxWithdraw(address owner, uint256 assets, uint256 max); /** * @dev Attempted to redeem more shares than the max amount for `receiver`. */ error ERC4626ExceededMaxRedeem(address owner, uint256 shares, uint256 max); /** * @dev Set the underlying asset contract. This must be an ERC20-compatible contract (ERC20 or ERC777). */ function __ERC4626_init(IERC20 asset_) internal onlyInitializing { __ERC4626_init_unchained(asset_); } function __ERC4626_init_unchained(IERC20 asset_) internal onlyInitializing { ERC4626Storage storage $ = _getERC4626Storage(); (bool success, uint8 assetDecimals) = _tryGetAssetDecimals(asset_); $._underlyingDecimals = success ? assetDecimals : 18; $._asset = asset_; } /** * @dev Attempts to fetch the asset decimals. A return value of false indicates that the attempt failed in some way. */ function _tryGetAssetDecimals(IERC20 asset_) private view returns (bool, uint8) { (bool success, bytes memory encodedDecimals) = address(asset_).staticcall( abi.encodeCall(IERC20Metadata.decimals, ()) ); if (success && encodedDecimals.length >= 32) { uint256 returnedDecimals = abi.decode(encodedDecimals, (uint256)); if (returnedDecimals <= type(uint8).max) { return (true, uint8(returnedDecimals)); } } return (false, 0); } /** * @dev Decimals are computed by adding the decimal offset on top of the underlying asset's decimals. This * "original" value is cached during construction of the vault contract. If this read operation fails (e.g., the * asset has not been created yet), a default of 18 is used to represent the underlying asset's decimals. * * See {IERC20Metadata-decimals}. */ function decimals() public view virtual override(IERC20Metadata, ERC20Upgradeable) returns (uint8) { ERC4626Storage storage $ = _getERC4626Storage(); return $._underlyingDecimals + _decimalsOffset(); } /** @dev See {IERC4626-asset}. */ function asset() public view virtual returns (address) { ERC4626Storage storage $ = _getERC4626Storage(); return address($._asset); } /** @dev See {IERC4626-totalAssets}. */ function totalAssets() public view virtual returns (uint256) { ERC4626Storage storage $ = _getERC4626Storage(); return $._asset.balanceOf(address(this)); } /** @dev See {IERC4626-convertToShares}. */ function convertToShares(uint256 assets) public view virtual returns (uint256) { return _convertToShares(assets, Math.Rounding.Floor); } /** @dev See {IERC4626-convertToAssets}. */ function convertToAssets(uint256 shares) public view virtual returns (uint256) { return _convertToAssets(shares, Math.Rounding.Floor); } /** @dev See {IERC4626-maxDeposit}. */ function maxDeposit(address) public view virtual returns (uint256) { return type(uint256).max; } /** @dev See {IERC4626-maxMint}. */ function maxMint(address) public view virtual returns (uint256) { return type(uint256).max; } /** @dev See {IERC4626-maxWithdraw}. */ function maxWithdraw(address owner) public view virtual returns (uint256) { return _convertToAssets(balanceOf(owner), Math.Rounding.Floor); } /** @dev See {IERC4626-maxRedeem}. */ function maxRedeem(address owner) public view virtual returns (uint256) { return balanceOf(owner); } /** @dev See {IERC4626-previewDeposit}. */ function previewDeposit(uint256 assets) public view virtual returns (uint256) { return _convertToShares(assets, Math.Rounding.Floor); } /** @dev See {IERC4626-previewMint}. */ function previewMint(uint256 shares) public view virtual returns (uint256) { return _convertToAssets(shares, Math.Rounding.Ceil); } /** @dev See {IERC4626-previewWithdraw}. */ function previewWithdraw(uint256 assets) public view virtual returns (uint256) { return _convertToShares(assets, Math.Rounding.Ceil); } /** @dev See {IERC4626-previewRedeem}. */ function previewRedeem(uint256 shares) public view virtual returns (uint256) { return _convertToAssets(shares, Math.Rounding.Floor); } /** @dev See {IERC4626-deposit}. */ function deposit(uint256 assets, address receiver) public virtual returns (uint256) { uint256 maxAssets = maxDeposit(receiver); if (assets > maxAssets) { revert ERC4626ExceededMaxDeposit(receiver, assets, maxAssets); } uint256 shares = previewDeposit(assets); _deposit(_msgSender(), receiver, assets, shares); return shares; } /** @dev See {IERC4626-mint}. * * As opposed to {deposit}, minting is allowed even if the vault is in a state where the price of a share is zero. * In this case, the shares will be minted without requiring any assets to be deposited. */ function mint(uint256 shares, address receiver) public virtual returns (uint256) { uint256 maxShares = maxMint(receiver); if (shares > maxShares) { revert ERC4626ExceededMaxMint(receiver, shares, maxShares); } uint256 assets = previewMint(shares); _deposit(_msgSender(), receiver, assets, shares); return assets; } /** @dev See {IERC4626-withdraw}. */ function withdraw(uint256 assets, address receiver, address owner) public virtual returns (uint256) { uint256 maxAssets = maxWithdraw(owner); if (assets > maxAssets) { revert ERC4626ExceededMaxWithdraw(owner, assets, maxAssets); } uint256 shares = previewWithdraw(assets); _withdraw(_msgSender(), receiver, owner, assets, shares); return shares; } /** @dev See {IERC4626-redeem}. */ function redeem(uint256 shares, address receiver, address owner) public virtual returns (uint256) { uint256 maxShares = maxRedeem(owner); if (shares > maxShares) { revert ERC4626ExceededMaxRedeem(owner, shares, maxShares); } uint256 assets = previewRedeem(shares); _withdraw(_msgSender(), receiver, owner, assets, shares); return assets; } /** * @dev Internal conversion function (from assets to shares) with support for rounding direction. */ function _convertToShares(uint256 assets, Math.Rounding rounding) internal view virtual returns (uint256) { return assets.mulDiv(totalSupply() + 10 ** _decimalsOffset(), totalAssets() + 1, rounding); } /** * @dev Internal conversion function (from shares to assets) with support for rounding direction. */ function _convertToAssets(uint256 shares, Math.Rounding rounding) internal view virtual returns (uint256) { return shares.mulDiv(totalAssets() + 1, totalSupply() + 10 ** _decimalsOffset(), rounding); } /** * @dev Deposit/mint common workflow. */ function _deposit(address caller, address receiver, uint256 assets, uint256 shares) internal virtual { ERC4626Storage storage $ = _getERC4626Storage(); // If _asset is ERC777, `transferFrom` can trigger a reentrancy BEFORE the transfer happens through the // `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer, // calls the vault, which is assumed not malicious. // // Conclusion: we need to do the transfer before we mint so that any reentrancy would happen before the // assets are transferred and before the shares are minted, which is a valid state. // slither-disable-next-line reentrancy-no-eth SafeERC20.safeTransferFrom($._asset, caller, address(this), assets); _mint(receiver, shares); emit Deposit(caller, receiver, assets, shares); } /** * @dev Withdraw/redeem common workflow. */ function _withdraw( address caller, address receiver, address owner, uint256 assets, uint256 shares ) internal virtual { ERC4626Storage storage $ = _getERC4626Storage(); if (caller != owner) { _spendAllowance(owner, caller, shares); } // If _asset is ERC777, `transfer` can trigger a reentrancy AFTER the transfer happens through the // `tokensReceived` hook. On the other hand, the `tokensToSend` hook, that is triggered before the transfer, // calls the vault, which is assumed not malicious. // // Conclusion: we need to do the transfer after the burn so that any reentrancy would happen after the // shares are burned and after the assets are transferred, which is a valid state. _burn(owner, shares); SafeERC20.safeTransfer($._asset, receiver, assets); emit Withdraw(caller, receiver, owner, assets, shares); } function _decimalsOffset() internal view virtual returns (uint8) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlDefaultAdminRules.sol) pragma solidity ^0.8.20; import {IAccessControlDefaultAdminRules} from "@openzeppelin/contracts/access/extensions/IAccessControlDefaultAdminRules.sol"; import {AccessControlUpgradeable} from "../AccessControlUpgradeable.sol"; import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol"; import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol"; import {Math} from "@openzeppelin/contracts/utils/math/Math.sol"; import {IERC5313} from "@openzeppelin/contracts/interfaces/IERC5313.sol"; import {Initializable} from "../../proxy/utils/Initializable.sol"; /** * @dev Extension of {AccessControl} that allows specifying special rules to manage * the `DEFAULT_ADMIN_ROLE` holder, which is a sensitive role with special permissions * over other roles that may potentially have privileged rights in the system. * * If a specific role doesn't have an admin role assigned, the holder of the * `DEFAULT_ADMIN_ROLE` will have the ability to grant it and revoke it. * * This contract implements the following risk mitigations on top of {AccessControl}: * * * Only one account holds the `DEFAULT_ADMIN_ROLE` since deployment until it's potentially renounced. * * Enforces a 2-step process to transfer the `DEFAULT_ADMIN_ROLE` to another account. * * Enforces a configurable delay between the two steps, with the ability to cancel before the transfer is accepted. * * The delay can be changed by scheduling, see {changeDefaultAdminDelay}. * * It is not possible to use another role to manage the `DEFAULT_ADMIN_ROLE`. * * Example usage: * * ```solidity * contract MyToken is AccessControlDefaultAdminRules { * constructor() AccessControlDefaultAdminRules( * 3 days, * msg.sender // Explicit initial `DEFAULT_ADMIN_ROLE` holder * ) {} * } * ``` */ abstract contract AccessControlDefaultAdminRulesUpgradeable is Initializable, IAccessControlDefaultAdminRules, IERC5313, AccessControlUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.AccessControlDefaultAdminRules struct AccessControlDefaultAdminRulesStorage { // pending admin pair read/written together frequently address _pendingDefaultAdmin; uint48 _pendingDefaultAdminSchedule; // 0 == unset uint48 _currentDelay; address _currentDefaultAdmin; // pending delay pair read/written together frequently uint48 _pendingDelay; uint48 _pendingDelaySchedule; // 0 == unset } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControlDefaultAdminRules")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant AccessControlDefaultAdminRulesStorageLocation = 0xeef3dac4538c82c8ace4063ab0acd2d15cdb5883aa1dff7c2673abb3d8698400; function _getAccessControlDefaultAdminRulesStorage() private pure returns (AccessControlDefaultAdminRulesStorage storage $) { assembly { $.slot := AccessControlDefaultAdminRulesStorageLocation } } /** * @dev Sets the initial values for {defaultAdminDelay} and {defaultAdmin} address. */ function __AccessControlDefaultAdminRules_init(uint48 initialDelay, address initialDefaultAdmin) internal onlyInitializing { __AccessControlDefaultAdminRules_init_unchained(initialDelay, initialDefaultAdmin); } function __AccessControlDefaultAdminRules_init_unchained(uint48 initialDelay, address initialDefaultAdmin) internal onlyInitializing { AccessControlDefaultAdminRulesStorage storage $ = _getAccessControlDefaultAdminRulesStorage(); if (initialDefaultAdmin == address(0)) { revert AccessControlInvalidDefaultAdmin(address(0)); } $._currentDelay = initialDelay; _grantRole(DEFAULT_ADMIN_ROLE, initialDefaultAdmin); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlDefaultAdminRules).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC5313-owner}. */ function owner() public view virtual returns (address) { return defaultAdmin(); } /// /// Override AccessControl role management /// /** * @dev See {AccessControl-grantRole}. Reverts for `DEFAULT_ADMIN_ROLE`. */ function grantRole(bytes32 role, address account) public virtual override(AccessControlUpgradeable, IAccessControl) { if (role == DEFAULT_ADMIN_ROLE) { revert AccessControlEnforcedDefaultAdminRules(); } super.grantRole(role, account); } /** * @dev See {AccessControl-revokeRole}. Reverts for `DEFAULT_ADMIN_ROLE`. */ function revokeRole(bytes32 role, address account) public virtual override(AccessControlUpgradeable, IAccessControl) { if (role == DEFAULT_ADMIN_ROLE) { revert AccessControlEnforcedDefaultAdminRules(); } super.revokeRole(role, account); } /** * @dev See {AccessControl-renounceRole}. * * For the `DEFAULT_ADMIN_ROLE`, it only allows renouncing in two steps by first calling * {beginDefaultAdminTransfer} to the `address(0)`, so it's required that the {pendingDefaultAdmin} schedule * has also passed when calling this function. * * After its execution, it will not be possible to call `onlyRole(DEFAULT_ADMIN_ROLE)` functions. * * NOTE: Renouncing `DEFAULT_ADMIN_ROLE` will leave the contract without a {defaultAdmin}, * thereby disabling any functionality that is only available for it, and the possibility of reassigning a * non-administrated role. */ function renounceRole(bytes32 role, address account) public virtual override(AccessControlUpgradeable, IAccessControl) { AccessControlDefaultAdminRulesStorage storage $ = _getAccessControlDefaultAdminRulesStorage(); if (role == DEFAULT_ADMIN_ROLE && account == defaultAdmin()) { (address newDefaultAdmin, uint48 schedule) = pendingDefaultAdmin(); if (newDefaultAdmin != address(0) || !_isScheduleSet(schedule) || !_hasSchedulePassed(schedule)) { revert AccessControlEnforcedDefaultAdminDelay(schedule); } delete $._pendingDefaultAdminSchedule; } super.renounceRole(role, account); } /** * @dev See {AccessControl-_grantRole}. * * For `DEFAULT_ADMIN_ROLE`, it only allows granting if there isn't already a {defaultAdmin} or if the * role has been previously renounced. * * NOTE: Exposing this function through another mechanism may make the `DEFAULT_ADMIN_ROLE` * assignable again. Make sure to guarantee this is the expected behavior in your implementation. */ function _grantRole(bytes32 role, address account) internal virtual override returns (bool) { AccessControlDefaultAdminRulesStorage storage $ = _getAccessControlDefaultAdminRulesStorage(); if (role == DEFAULT_ADMIN_ROLE) { if (defaultAdmin() != address(0)) { revert AccessControlEnforcedDefaultAdminRules(); } $._currentDefaultAdmin = account; } return super._grantRole(role, account); } /** * @dev See {AccessControl-_revokeRole}. */ function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) { AccessControlDefaultAdminRulesStorage storage $ = _getAccessControlDefaultAdminRulesStorage(); if (role == DEFAULT_ADMIN_ROLE && account == defaultAdmin()) { delete $._currentDefaultAdmin; } return super._revokeRole(role, account); } /** * @dev See {AccessControl-_setRoleAdmin}. Reverts for `DEFAULT_ADMIN_ROLE`. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual override { if (role == DEFAULT_ADMIN_ROLE) { revert AccessControlEnforcedDefaultAdminRules(); } super._setRoleAdmin(role, adminRole); } /// /// AccessControlDefaultAdminRules accessors /// /** * @inheritdoc IAccessControlDefaultAdminRules */ function defaultAdmin() public view virtual returns (address) { AccessControlDefaultAdminRulesStorage storage $ = _getAccessControlDefaultAdminRulesStorage(); return $._currentDefaultAdmin; } /** * @inheritdoc IAccessControlDefaultAdminRules */ function pendingDefaultAdmin() public view virtual returns (address newAdmin, uint48 schedule) { AccessControlDefaultAdminRulesStorage storage $ = _getAccessControlDefaultAdminRulesStorage(); return ($._pendingDefaultAdmin, $._pendingDefaultAdminSchedule); } /** * @inheritdoc IAccessControlDefaultAdminRules */ function defaultAdminDelay() public view virtual returns (uint48) { AccessControlDefaultAdminRulesStorage storage $ = _getAccessControlDefaultAdminRulesStorage(); uint48 schedule = $._pendingDelaySchedule; return (_isScheduleSet(schedule) && _hasSchedulePassed(schedule)) ? $._pendingDelay : $._currentDelay; } /** * @inheritdoc IAccessControlDefaultAdminRules */ function pendingDefaultAdminDelay() public view virtual returns (uint48 newDelay, uint48 schedule) { AccessControlDefaultAdminRulesStorage storage $ = _getAccessControlDefaultAdminRulesStorage(); schedule = $._pendingDelaySchedule; return (_isScheduleSet(schedule) && !_hasSchedulePassed(schedule)) ? ($._pendingDelay, schedule) : (0, 0); } /** * @inheritdoc IAccessControlDefaultAdminRules */ function defaultAdminDelayIncreaseWait() public view virtual returns (uint48) { return 5 days; } /// /// AccessControlDefaultAdminRules public and internal setters for defaultAdmin/pendingDefaultAdmin /// /** * @inheritdoc IAccessControlDefaultAdminRules */ function beginDefaultAdminTransfer(address newAdmin) public virtual onlyRole(DEFAULT_ADMIN_ROLE) { _beginDefaultAdminTransfer(newAdmin); } /** * @dev See {beginDefaultAdminTransfer}. * * Internal function without access restriction. */ function _beginDefaultAdminTransfer(address newAdmin) internal virtual { uint48 newSchedule = SafeCast.toUint48(block.timestamp) + defaultAdminDelay(); _setPendingDefaultAdmin(newAdmin, newSchedule); emit DefaultAdminTransferScheduled(newAdmin, newSchedule); } /** * @inheritdoc IAccessControlDefaultAdminRules */ function cancelDefaultAdminTransfer() public virtual onlyRole(DEFAULT_ADMIN_ROLE) { _cancelDefaultAdminTransfer(); } /** * @dev See {cancelDefaultAdminTransfer}. * * Internal function without access restriction. */ function _cancelDefaultAdminTransfer() internal virtual { _setPendingDefaultAdmin(address(0), 0); } /** * @inheritdoc IAccessControlDefaultAdminRules */ function acceptDefaultAdminTransfer() public virtual { (address newDefaultAdmin, ) = pendingDefaultAdmin(); if (_msgSender() != newDefaultAdmin) { // Enforce newDefaultAdmin explicit acceptance. revert AccessControlInvalidDefaultAdmin(_msgSender()); } _acceptDefaultAdminTransfer(); } /** * @dev See {acceptDefaultAdminTransfer}. * * Internal function without access restriction. */ function _acceptDefaultAdminTransfer() internal virtual { AccessControlDefaultAdminRulesStorage storage $ = _getAccessControlDefaultAdminRulesStorage(); (address newAdmin, uint48 schedule) = pendingDefaultAdmin(); if (!_isScheduleSet(schedule) || !_hasSchedulePassed(schedule)) { revert AccessControlEnforcedDefaultAdminDelay(schedule); } _revokeRole(DEFAULT_ADMIN_ROLE, defaultAdmin()); _grantRole(DEFAULT_ADMIN_ROLE, newAdmin); delete $._pendingDefaultAdmin; delete $._pendingDefaultAdminSchedule; } /// /// AccessControlDefaultAdminRules public and internal setters for defaultAdminDelay/pendingDefaultAdminDelay /// /** * @inheritdoc IAccessControlDefaultAdminRules */ function changeDefaultAdminDelay(uint48 newDelay) public virtual onlyRole(DEFAULT_ADMIN_ROLE) { _changeDefaultAdminDelay(newDelay); } /** * @dev See {changeDefaultAdminDelay}. * * Internal function without access restriction. */ function _changeDefaultAdminDelay(uint48 newDelay) internal virtual { uint48 newSchedule = SafeCast.toUint48(block.timestamp) + _delayChangeWait(newDelay); _setPendingDelay(newDelay, newSchedule); emit DefaultAdminDelayChangeScheduled(newDelay, newSchedule); } /** * @inheritdoc IAccessControlDefaultAdminRules */ function rollbackDefaultAdminDelay() public virtual onlyRole(DEFAULT_ADMIN_ROLE) { _rollbackDefaultAdminDelay(); } /** * @dev See {rollbackDefaultAdminDelay}. * * Internal function without access restriction. */ function _rollbackDefaultAdminDelay() internal virtual { _setPendingDelay(0, 0); } /** * @dev Returns the amount of seconds to wait after the `newDelay` will * become the new {defaultAdminDelay}. * * The value returned guarantees that if the delay is reduced, it will go into effect * after a wait that honors the previously set delay. * * See {defaultAdminDelayIncreaseWait}. */ function _delayChangeWait(uint48 newDelay) internal view virtual returns (uint48) { uint48 currentDelay = defaultAdminDelay(); // When increasing the delay, we schedule the delay change to occur after a period of "new delay" has passed, up // to a maximum given by defaultAdminDelayIncreaseWait, by default 5 days. For example, if increasing from 1 day // to 3 days, the new delay will come into effect after 3 days. If increasing from 1 day to 10 days, the new // delay will come into effect after 5 days. The 5 day wait period is intended to be able to fix an error like // using milliseconds instead of seconds. // // When decreasing the delay, we wait the difference between "current delay" and "new delay". This guarantees // that an admin transfer cannot be made faster than "current delay" at the time the delay change is scheduled. // For example, if decreasing from 10 days to 3 days, the new delay will come into effect after 7 days. return newDelay > currentDelay ? uint48(Math.min(newDelay, defaultAdminDelayIncreaseWait())) // no need to safecast, both inputs are uint48 : currentDelay - newDelay; } /// /// Private setters /// /** * @dev Setter of the tuple for pending admin and its schedule. * * May emit a DefaultAdminTransferCanceled event. */ function _setPendingDefaultAdmin(address newAdmin, uint48 newSchedule) private { AccessControlDefaultAdminRulesStorage storage $ = _getAccessControlDefaultAdminRulesStorage(); (, uint48 oldSchedule) = pendingDefaultAdmin(); $._pendingDefaultAdmin = newAdmin; $._pendingDefaultAdminSchedule = newSchedule; // An `oldSchedule` from `pendingDefaultAdmin()` is only set if it hasn't been accepted. if (_isScheduleSet(oldSchedule)) { // Emit for implicit cancellations when another default admin was scheduled. emit DefaultAdminTransferCanceled(); } } /** * @dev Setter of the tuple for pending delay and its schedule. * * May emit a DefaultAdminDelayChangeCanceled event. */ function _setPendingDelay(uint48 newDelay, uint48 newSchedule) private { AccessControlDefaultAdminRulesStorage storage $ = _getAccessControlDefaultAdminRulesStorage(); uint48 oldSchedule = $._pendingDelaySchedule; if (_isScheduleSet(oldSchedule)) { if (_hasSchedulePassed(oldSchedule)) { // Materialize a virtual delay $._currentDelay = $._pendingDelay; } else { // Emit for implicit cancellations when another delay was scheduled. emit DefaultAdminDelayChangeCanceled(); } } $._pendingDelay = newDelay; $._pendingDelaySchedule = newSchedule; } /// /// Private helpers /// /** * @dev Defines if an `schedule` is considered set. For consistency purposes. */ function _isScheduleSet(uint48 schedule) private pure returns (bool) { return schedule != 0; } /** * @dev Defines if an `schedule` is considered passed. For consistency purposes. */ function _hasSchedulePassed(uint48 schedule) private view returns (bool) { return schedule < block.timestamp; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; /// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard struct ReentrancyGuardStorage { uint256 _status; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00; function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) { assembly { $.slot := ReentrancyGuardStorageLocation } } /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); $._status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); // On the first call to nonReentrant, _status will be NOT_ENTERED if ($._status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail $._status = ENTERED; } function _nonReentrantAfter() private { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) $._status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); return $._status == ENTERED; } }
// SPDX-License-Identifier: BUSL-1.1 // SPDX-FileCopyrightText: 2024 Kiln <[email protected]> // // ██╗ ██╗██╗██╗ ███╗ ██╗ // ██║ ██╔╝██║██║ ████╗ ██║ // █████╔╝ ██║██║ ██╔██╗ ██║ // ██╔═██╗ ██║██║ ██║╚██╗██║ // ██║ ██╗██║███████╗██║ ╚████║ // ╚═╝ ╚═╝╚═╝╚══════╝╚═╝ ╚═══╝ // pragma solidity 0.8.22; /* --------------------------------- Common --------------------------------- */ /// @dev Error emitted when the address is zero. error AddressZero(); /// @dev Error emitted when the address is not a contract. /// @param addr The address that was attempted to be used as a contract. error AddressNotContract(address addr); /// @dev Error emitted when a given amount is zero. error AmountZero(); /// @dev Error emitted when two array lengths do not match. error ArrayMismatch(); /// @dev Error emitted when the array is empty. error EmptyArray(); /// @dev Error emitted when the duration to pause for is invalid /// (before the current pauseTimestamp). /// @param timestamp The timestamp to pause for. error InvalidDuration(uint256 timestamp, uint256 currentTimestamp); /// @dev Error emitted when the claim function is not available on the connector or /// no additional rewards to claim at the moment. error NothingToClaim(); /* ----------------------- VaultUpgradeableBeacon.sol ----------------------- */ /// @dev The `implementation` of the beacon is invalid. /// @param implementation The address of the implementation that was attempted to be set. error BeaconInvalidImplementation(address implementation); /// @dev Error emitted when an operation is attempted on a paused contract. error isPaused(); /// @dev Error emitted when an operation is attempted on a not paused contract. error isNotPaused(); /// @dev Error emitted when an operation is attempted on a frozen contract. error isFrozen(); /* -------------------------------- Vault.sol ------------------------------- */ /// @dev Error emitted when the ERC4626 is not transferable. error NotTransferable(); /// @dev Error emitted when the management fee over 100%. error WrongManagementFee(uint256 managementFee); /// @dev Error emitted when the performance fee over 100%. error WrongPerformanceFee(uint256 performanceFee); /// @dev Error emitted when the connector name is invalid (not existing on the registry). error InvalidConnectorName(bytes32 name); /// @dev Error emitted when no rewards could be collected. error NothingToCollect(); /// @dev Error emitted when a call is not a delegate call. error NotDelegateCall(); /// @dev Error emitted when the preview result is zero (shares or assets). error PreviewZero(); /// @dev Error emitted when the given address is on the sanction list. error AddressSanctioned(address addr); /// @dev Error emitted when the total assets decreased. error TotalAssetsDecreased(uint256 totalAssets, uint256 newTotalAssets); /// @dev Error emitted when no additional rewards claimed (using the claim function). error NoAdditionalRewardsClaimed(); /// @dev Error emitted when the deposit is paused. error DepositPaused(); /// @dev Error emmited when the offset set is too high. error OffsetTooHigh(uint8 offset); /// @dev Error emitted when the remainder of transferred shares is not zero. error RemainderNotZero(uint256 shares); /// @dev Error emitted when the minimum totalSupply is not met after a deposit. error MinimumTotalSupplyNotReached(); /* --------------------------- ConnectorRegistry.sol ------------------------- */ /// @dev Error emitted when the connector already exists. /// @param name The name of the connector. /// @param connector The address of the connector. error ConnectorAlreadyExists(bytes32 name, address connector); /// @dev Error emitted when the connector does not exist. /// @param name The name of the connector. error ConnectorDoesNotExist(bytes32 name); /// @dev Error emitted when the connector is frozen. /// @param name The name of the connector. error ConnectorFrozen(bytes32 name); /// @dev Error emitted when the connector is paused. /// @param name The name of the connector. error ConnectorPaused(bytes32 name); /// @dev Error emitted when the connector is not paused. /// @param name The name of the connector. error ConnectorNotPaused(bytes32 name); /* ---------------------------- FeeDispatcher.sol --------------------------- */ /// @dev Error emitted when a given fee recipient does not exist. /// @param recipient The address of the given fee recipient. error FeeRecipientDoesNotExist(address recipient); /// @dev Error emitted when the total management fee split between the fee recipients is not 100%. /// @param totalSplit The total management fee split. error WrongManagementFeeSplit(uint256 totalSplit); /// @dev Error emitted when the total performance fee split between the fee recipients is not 100%. /// @param totalSplit The total performance fee split. error WrongPerformanceFeeSplit(uint256 totalSplit); /// @dev Error emitted when a fee recipient address is not unique (in the given array of fee recipients). /// @param recipient The address of the fee recipient. error FeeRecipientNotUnique(address recipient); /* ---------------------------- VaultFactory.sol ---------------------------- */ /// @dev Error emitted when the deployer already exists. /// @param deployer The address of the deployer. error DeployerAlreadyExists(address deployer); /// @dev Error emitted when the caller is not a deployer. /// @param caller The address of the caller. error NotDeployer(address caller); /// @dev Error emitted when the deployer does not exist. /// @param deployer The address of the deployer. error InvalidDeployer(address deployer); /* ----------------------------- *Connector.sol ----------------------------- */ /// @dev Error emitted when the given rewards asset is invalid. /// @param asset The address of the invalid rewards asset. error InvalidRewardsAsset(address asset); /// @dev Error emitted when the given address is an invalid 4626. /// @param addr The address of the invalid 4626. error Invalid4626(address addr); /* ------------------------ CompoundV2Connector.sol ------------------------- */ /// @dev Error emitted when the mint function fails. error MintFailed(); /// @dev Error emitted when the redeem function fails. error RedeemFailed(); /* ----------------------- MarketRegistry.sol ----------------------- */ /// @dev Error emitted when the market for a specific asset does not exist. error InvalidAsset(address asset); /// @dev Error emitted when an asset is already registered. /// @param asset The address of the asset. error AlreadyRegistered(address asset);
// SPDX-License-Identifier: BUSL-1.1 // SPDX-FileCopyrightText: 2024 Kiln <[email protected]> // // ██╗ ██╗██╗██╗ ███╗ ██╗ // ██║ ██╔╝██║██║ ████╗ ██║ // ██╔═██╗ ██║██║ ██║╚██╗██║ // ██║ ██╗██║███████╗██║ ╚████║ // ╚═╝ ╚═╝╚═╝╚══════╝╚═╝ ╚═══╝ // pragma solidity 0.8.22; import {IERC20} from "@openzeppelin/token/ERC20/IERC20.sol"; /// @title Interface for connectors. /// @author maximebrugel @ Kiln. interface IConnector { /// @notice Get the total balance (deposit + rewards). /// @param asset The asset to get the balance of. /// @dev Always called using `.call` (use `msg.sender` and not `address(this)`). function totalAssets(IERC20 asset) external view returns (uint256); /// @notice Deposit the asset in the underlying protocol. /// @param asset The asset to deposit. /// @param amount The amount to deposit. /// @dev Always called using `.delegatecall` (use `address(this)` and not `msg.sender`). function deposit(IERC20 asset, uint256 amount) external; /// @notice Withdraw the asset from the underlying protocol. /// @param asset The asset to withdraw. /// @param amount The amount to withdraw. /// @dev Always called using `.delegatecall` (use `address(this)` and not `msg.sender`). function withdraw(IERC20 asset, uint256 amount) external; /// @notice Claim additional rewards from the underlying protocol. /// @param asset The vault underlying asset. /// @param rewardsAsset The rewards asset to claim. function claim(IERC20 asset, IERC20 rewardsAsset, bytes calldata payload) external; /// @notice Get the maximum amount that can be deposited. /// @param asset The asset to get the maximum deposit amount of. function maxDeposit(IERC20 asset) external view returns (uint256); /// @notice Get the maximum amount that can be withdrawn (by the vault, not a specific user). /// @param asset The asset to get the maximum withdraw amount of. function maxWithdraw(IERC20 asset) external view returns (uint256); }
// SPDX-License-Identifier: BUSL-1.1 // SPDX-FileCopyrightText: 2024 Kiln <[email protected]> // // ██╗ ██╗██╗██╗ ███╗ ██╗ // ██║ ██╔╝██║██║ ████╗ ██║ // █████╔╝ ██║██║ ██╔██╗ ██║ // ██╔═██╗ ██║██║ ██║╚██╗██║ // ██║ ██╗██║███████╗██║ ╚████║ // ╚═╝ ╚═╝╚═╝╚══════╝╚═╝ ╚═══╝ // pragma solidity 0.8.22; /// @title Sanctions List Interface. /// @notice Interface for the sanctions list contract from Chainalysis. interface ISanctionsList { /// @notice Check if an address is sanctioned. /// @param addr The address to check. /// @return True if the address is sanctioned, false otherwise. function isSanctioned(address addr) external view returns (bool); /// @notice Add addresses to the sanctions list. /// @param newSanctions The addresses to add. function addToSanctionsList(address[] memory newSanctions) external; }
// SPDX-License-Identifier: BUSL-1.1 // SPDX-FileCopyrightText: 2024 Kiln <[email protected]> // // ██╗ ██╗██╗██╗ ███╗ ██╗ // ██║ ██╔╝██║██║ ████╗ ██║ // █████╔╝ ██║██║ ██╔██╗ ██║ // ██╔═██╗ ██║██║ ██║╚██╗██║ // ██║ ██╗██║███████╗██║ ╚████║ // ╚═╝ ╚═╝╚═╝╚══════╝╚═╝ ╚═══╝ // pragma solidity 0.8.22; /// @title ConnectorRegistry Interface. /// @author maximebrugel @ Kiln. interface IConnectorRegistry { /// @notice Get the address of a connector. /// @param name The name of the connector. function get(bytes32 name) external view returns (address); /// @notice Get the address of a connector or revert if it is paused. /// @param name The name of the connector. /// @dev revert if the connector is paused. function getOrRevert(bytes32 name) external view returns (address); /// @notice Check if a connector exists. /// @param name The name of the connector. /// @return True if the connector exists, false if not. function connectorExists(bytes32 name) external view returns (bool); /// @notice Adds a connector to the registry. /// @param name The name of the connector. /// @param connector The address of the connector. function add(bytes32 name, address connector) external; /// @notice Updates a connector in the registry. /// @param name The name of the connector. /// @param connector The address of the connector. /// @dev A connector can't be updated if it is frozen. function update(bytes32 name, address connector) external; /// @notice Removes a connector from the registry. /// @param name The name of the connector. /// @dev A connector can't be removed if it is frozen. function remove(bytes32 name) external; /// @notice Pauses a connector for an unspecified amount of time. /// @param name The name of the connector. function pause(bytes32 name) external; /// @notice Pauses a connector for a specified amount of time. /// @dev Cannot decrease the current pauseTimestamp of the connector. /// @param name The name of the connector. /// @param duration The duration until which the connector is paused. function pauseFor(bytes32 name, uint256 duration) external; /// @notice Unpauses a connector. /// @param name The name of the connector. function unPause(bytes32 name) external; /// @notice Checks if a connector is paused. /// @param name The name of the connector. /// @return True if the connector is paused, false if not. function paused(bytes32 name) external view returns (bool); /// @notice Freezes a connector. /// @param name The name of the connector. /// @dev A connector can't be unfrozen. function freeze(bytes32 name) external; }
// SPDX-License-Identifier: BUSL-1.1 // SPDX-FileCopyrightText: 2024 Kiln <[email protected]> // // ██╗ ██╗██╗██╗ ███╗ ██╗ // ██║ ██╔╝██║██║ ████╗ ██║ // █████╔╝ ██║██║ ██╔██╗ ██║ // ██╔═██╗ ██║██║ ██║╚██╗██║ // ██║ ██╗██║███████╗██║ ╚████║ // ╚═╝ ╚═╝╚═╝╚══════╝╚═╝ ╚═══╝ // pragma solidity 0.8.22; import {Math} from "@openzeppelin/utils/math/Math.sol"; import {IERC20} from "@openzeppelin/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/token/ERC20/utils/SafeERC20.sol"; import {Initializable} from "@openzeppelin-upgradeable/proxy/utils/Initializable.sol"; import { AddressZero, EmptyArray, FeeRecipientDoesNotExist, FeeRecipientNotUnique, WrongManagementFeeSplit, WrongPerformanceFeeSplit } from "../Errors.sol"; import {IFeeDispatcher} from "../interfaces/IFeeDispatcher.sol"; /// @title FeeDispatcher. /// @notice Dispatches the pending management and performance fees to the fee recipients. /// @dev Using ERC-7201 standard. /// @author maximebrugel @ Kiln. abstract contract FeeDispatcher is Initializable, IFeeDispatcher { using SafeERC20 for IERC20; using Math for uint256; /* -------------------------------------------------------------------------- */ /* CONSTANTS */ /* -------------------------------------------------------------------------- */ /// @dev Represents the maximum percentage value in calculations. /// This constant is used as a scaling factor for percentage-based computations. uint256 internal constant _MAX_PERCENT = 100; /* -------------------------------------------------------------------------- */ /* STORAGE (proxy) */ /* -------------------------------------------------------------------------- */ /// @notice The storage layout of the contract. /// @param _pendingManagementFee The pending management fee (to be dispatched). /// @param _pendingPerformanceFee The pending performance fee (to be dispatched). /// @param _feeRecipients Array of all the fee recipients. struct FeeDispatcherStorage { uint256 _pendingManagementFee; uint256 _pendingPerformanceFee; FeeRecipient[] _feeRecipients; } function _getFeeDispatcherStorage() private pure returns (FeeDispatcherStorage storage $) { assembly { $.slot := FeeDispatcherStorageLocation } } /// @dev The storage slot of the FeeDispatcherStorage struct in the proxy contract. /// keccak256(abi.encode(uint256(keccak256("kiln.storage.feedispatcher")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant FeeDispatcherStorageLocation = 0xfdd5e928c3467d3da929a44639dde8d54e0576a04fec4ff333caa67a6f243300; /* -------------------------------------------------------------------------- */ /* EVENTS */ /* -------------------------------------------------------------------------- */ /// @dev Emitted when the pending management fee is dispatched to a recipient. /// @param recipient The recipient of the management fee. /// @param managementFee The amount of the management fee dispatched. event ManagementFeeDispatched(address indexed recipient, uint256 managementFee); /// @dev Emitted when the pending performance fee is dispatched to a recipient. /// @param recipient The recipient of the performance fee. /// @param performanceFee The amount of the performance fee dispatched. event PerformanceFeeDispatched(address indexed recipient, uint256 performanceFee); /// @dev Emitted when the fee recipients are set. /// @param feeRecipients The fee recipients (array of structs). event FeeRecipientsSet(FeeRecipient[] feeRecipients); /// @dev Emitted performance fees are collected. /// @param performanceFeeAmount The amount of performance fees collected. event PerformanceFeesCollected(uint256 performanceFeeAmount); /// @dev Emitted management fees are collected. /// @param managementFeeAmount The amount of management fees collected. event ManagementFeesCollected(uint256 managementFeeAmount); /* -------------------------------------------------------------------------- */ /* PROXY LOGIC */ /* -------------------------------------------------------------------------- */ function __FeeDispatcher_init(FeeRecipient[] memory recipients, uint8 underlyingDecimal) internal onlyInitializing { __FeeDispatcher_init_unchained(recipients, underlyingDecimal); } function __FeeDispatcher_init_unchained(FeeRecipient[] memory recipients, uint8 underlyingDecimal) internal onlyInitializing { _setFeeRecipients(recipients, underlyingDecimal); } /* -------------------------------------------------------------------------- */ /* FEE DISPATCHER LOGIC */ /* -------------------------------------------------------------------------- */ /// @dev Dispatch the pending management/performance fee to the fee recipients. /// @param asset The asset to dispatch the fees in. /// @param underlyingDecimals The number of decimals of the underlying asset. function _dispatchFees(IERC20 asset, uint8 underlyingDecimals) internal { FeeDispatcherStorage storage $ = _getFeeDispatcherStorage(); uint256 _pendingManagementFee = $._pendingManagementFee; uint256 _pendingPerformanceFee = $._pendingPerformanceFee; uint256 _managementFeeTransferred; uint256 _performanceFeeTransferred; uint256 _recipientsLength = $._feeRecipients.length; FeeRecipient memory currentRecipient; for (uint256 i; i < _recipientsLength; i++) { currentRecipient = $._feeRecipients[i]; if (_pendingManagementFee > 0) { // Compute the management fee amount for the current recipient (based on the management // fee split between all recipients). uint256 _managementFeeAmount = _pendingManagementFee.mulDiv( currentRecipient.managementFeeSplit, _MAX_PERCENT * 10 ** underlyingDecimals ); if (_managementFeeAmount > 0) { asset.safeTransfer(currentRecipient.recipient, _managementFeeAmount); _managementFeeTransferred += _managementFeeAmount; emit ManagementFeeDispatched(currentRecipient.recipient, _managementFeeAmount); } } if (_pendingPerformanceFee > 0) { // Compute the performance fee amount for the current recipient (based on the performance // fee split between all recipients). uint256 _performanceFeeAmount = _pendingPerformanceFee.mulDiv( currentRecipient.performanceFeeSplit, _MAX_PERCENT * 10 ** underlyingDecimals ); if (_performanceFeeAmount > 0) { asset.safeTransfer(currentRecipient.recipient, _performanceFeeAmount); _performanceFeeTransferred += _performanceFeeAmount; emit PerformanceFeeDispatched(currentRecipient.recipient, _performanceFeeAmount); } } } $._pendingManagementFee = _pendingManagementFee - _managementFeeTransferred; $._pendingPerformanceFee = _pendingPerformanceFee - _performanceFeeTransferred; } /* -------------------------------------------------------------------------- */ /* GETTERS */ /* -------------------------------------------------------------------------- */ /// @inheritdoc IFeeDispatcher function pendingManagementFee() public view returns (uint256) { FeeDispatcherStorage storage $ = _getFeeDispatcherStorage(); return $._pendingManagementFee; } /// @inheritdoc IFeeDispatcher function pendingPerformanceFee() public view returns (uint256) { FeeDispatcherStorage storage $ = _getFeeDispatcherStorage(); return $._pendingPerformanceFee; } /// @inheritdoc IFeeDispatcher function feeRecipients() public view returns (FeeRecipient[] memory) { FeeDispatcherStorage storage $ = _getFeeDispatcherStorage(); return $._feeRecipients; } /// @inheritdoc IFeeDispatcher function feeRecipient(address recipient) public view returns (FeeRecipient memory) { FeeDispatcherStorage storage $ = _getFeeDispatcherStorage(); uint256 _recipientsLength = $._feeRecipients.length; for (uint256 i; i < _recipientsLength; i++) { if ($._feeRecipients[i].recipient == recipient) { return $._feeRecipients[i]; } } revert FeeRecipientDoesNotExist(recipient); } /// @inheritdoc IFeeDispatcher function feeRecipientAt(uint256 index) public view returns (FeeRecipient memory) { FeeDispatcherStorage storage $ = _getFeeDispatcherStorage(); return $._feeRecipients[index]; } /* -------------------------------------------------------------------------- */ /* SETTERS */ /* -------------------------------------------------------------------------- */ /// @dev Increment the pending management fee. /// @param amount The amount to increment the pending management fee by. function _incrementPendingManagementFee(uint256 amount) internal { FeeDispatcherStorage storage $ = _getFeeDispatcherStorage(); $._pendingManagementFee += amount; emit ManagementFeesCollected(amount); } /// @dev Increment the pending performance fee. /// @param amount The amount to increment the pending performance fee by. function _incrementPendingPerformanceFee(uint256 amount) internal { FeeDispatcherStorage storage $ = _getFeeDispatcherStorage(); $._pendingPerformanceFee += amount; emit PerformanceFeesCollected(amount); } /// @dev Set the fee recipients. /// The fee recipients must be unique and the total fee splits must be 100e18 (representing 100%). /// @param recipients The new fee recipients. /// @param underlyingDecimal The number of decimals of the underlying asset. function _setFeeRecipients(FeeRecipient[] memory recipients, uint8 underlyingDecimal) internal { FeeDispatcherStorage storage $ = _getFeeDispatcherStorage(); if (recipients.length == 0) { revert EmptyArray(); } delete $._feeRecipients; uint256 _totalManagementFeeSplit; uint256 _totalPerformanceFeeSplit; uint256 _recipientsLength = recipients.length; for (uint256 i; i < _recipientsLength; i++) { _totalManagementFeeSplit += recipients[i].managementFeeSplit; _totalPerformanceFeeSplit += recipients[i].performanceFeeSplit; if (recipients[i].recipient == address(0)) { revert AddressZero(); } for (uint256 j = i + 1; j < _recipientsLength; j++) { if (recipients[i].recipient == recipients[j].recipient) { revert FeeRecipientNotUnique(recipients[i].recipient); } } $._feeRecipients.push(recipients[i]); } if (_totalManagementFeeSplit != _MAX_PERCENT * 10 ** underlyingDecimal) { revert WrongManagementFeeSplit(_totalManagementFeeSplit); } if (_totalPerformanceFeeSplit != _MAX_PERCENT * 10 ** underlyingDecimal) { revert WrongPerformanceFeeSplit(_totalPerformanceFeeSplit); } emit FeeRecipientsSet($._feeRecipients); } }
// 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) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import {ContextUpgradeable} from "../../utils/ContextUpgradeable.sol"; import {IERC20Errors} from "@openzeppelin/contracts/interfaces/draft-IERC6093.sol"; import {Initializable} from "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. */ abstract contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20, IERC20Metadata, IERC20Errors { /// @custom:storage-location erc7201:openzeppelin.storage.ERC20 struct ERC20Storage { mapping(address account => uint256) _balances; mapping(address account => mapping(address spender => uint256)) _allowances; uint256 _totalSupply; string _name; string _symbol; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC20")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ERC20StorageLocation = 0x52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00; function _getERC20Storage() private pure returns (ERC20Storage storage $) { assembly { $.slot := ERC20StorageLocation } } /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC20_init_unchained(name_, symbol_); } function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { ERC20Storage storage $ = _getERC20Storage(); $._name = name_; $._symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { ERC20Storage storage $ = _getERC20Storage(); return $._name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { ERC20Storage storage $ = _getERC20Storage(); return $._symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual returns (uint256) { ERC20Storage storage $ = _getERC20Storage(); return $._totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual returns (uint256) { ERC20Storage storage $ = _getERC20Storage(); return $._balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `value`. */ function transfer(address to, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _transfer(owner, to, value); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual returns (uint256) { ERC20Storage storage $ = _getERC20Storage(); return $._allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, value); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `value`. * - the caller must have allowance for ``from``'s tokens of at least * `value`. */ function transferFrom(address from, address to, uint256 value) public virtual returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, value); _transfer(from, to, value); return true; } /** * @dev Moves a `value` amount of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value); } /** * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from` * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding * this function. * * Emits a {Transfer} event. */ function _update(address from, address to, uint256 value) internal virtual { ERC20Storage storage $ = _getERC20Storage(); if (from == address(0)) { // Overflow check required: The rest of the code assumes that totalSupply never overflows $._totalSupply += value; } else { uint256 fromBalance = $._balances[from]; if (fromBalance < value) { revert ERC20InsufficientBalance(from, fromBalance, value); } unchecked { // Overflow not possible: value <= fromBalance <= totalSupply. $._balances[from] = fromBalance - value; } } if (to == address(0)) { unchecked { // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply. $._totalSupply -= value; } } else { unchecked { // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. $._balances[to] += value; } } emit Transfer(from, to, value); } /** * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0). * Relies on the `_update` mechanism * * Emits a {Transfer} event with `from` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _mint(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(address(0), account, value); } /** * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply. * Relies on the `_update` mechanism. * * Emits a {Transfer} event with `to` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead */ function _burn(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidSender(address(0)); } _update(account, address(0), value); } /** * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address owner, address spender, uint256 value) internal { _approve(owner, spender, value, true); } /** * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event. * * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any * `Approval` event during `transferFrom` operations. * * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to * true using the following override: * ``` * function _approve(address owner, address spender, uint256 value, bool) internal virtual override { * super._approve(owner, spender, value, true); * } * ``` * * Requirements are the same as {_approve}. */ function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual { ERC20Storage storage $ = _getERC20Storage(); if (owner == address(0)) { revert ERC20InvalidApprover(address(0)); } if (spender == address(0)) { revert ERC20InvalidSpender(address(0)); } $._allowances[owner][spender] = value; if (emitEvent) { emit Approval(owner, spender, value); } } /** * @dev Updates `owner` s allowance for `spender` based on spent `value`. * * Does not update the allowance value in case of infinite allowance. * Revert if not enough allowance is available. * * Does not emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 value) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < value) { revert ERC20InsufficientAllowance(spender, currentAllowance, value); } unchecked { _approve(owner, spender, currentAllowance - value, false); } } } }
// 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) (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) (access/extensions/IAccessControlDefaultAdminRules.sol) pragma solidity ^0.8.20; import {IAccessControl} from "../IAccessControl.sol"; /** * @dev External interface of AccessControlDefaultAdminRules declared to support ERC165 detection. */ interface IAccessControlDefaultAdminRules is IAccessControl { /** * @dev The new default admin is not a valid default admin. */ error AccessControlInvalidDefaultAdmin(address defaultAdmin); /** * @dev At least one of the following rules was violated: * * - The `DEFAULT_ADMIN_ROLE` must only be managed by itself. * - The `DEFAULT_ADMIN_ROLE` must only be held by one account at the time. * - Any `DEFAULT_ADMIN_ROLE` transfer must be in two delayed steps. */ error AccessControlEnforcedDefaultAdminRules(); /** * @dev The delay for transferring the default admin delay is enforced and * the operation must wait until `schedule`. * * NOTE: `schedule` can be 0 indicating there's no transfer scheduled. */ error AccessControlEnforcedDefaultAdminDelay(uint48 schedule); /** * @dev Emitted when a {defaultAdmin} transfer is started, setting `newAdmin` as the next * address to become the {defaultAdmin} by calling {acceptDefaultAdminTransfer} only after `acceptSchedule` * passes. */ event DefaultAdminTransferScheduled(address indexed newAdmin, uint48 acceptSchedule); /** * @dev Emitted when a {pendingDefaultAdmin} is reset if it was never accepted, regardless of its schedule. */ event DefaultAdminTransferCanceled(); /** * @dev Emitted when a {defaultAdminDelay} change is started, setting `newDelay` as the next * delay to be applied between default admin transfer after `effectSchedule` has passed. */ event DefaultAdminDelayChangeScheduled(uint48 newDelay, uint48 effectSchedule); /** * @dev Emitted when a {pendingDefaultAdminDelay} is reset if its schedule didn't pass. */ event DefaultAdminDelayChangeCanceled(); /** * @dev Returns the address of the current `DEFAULT_ADMIN_ROLE` holder. */ function defaultAdmin() external view returns (address); /** * @dev Returns a tuple of a `newAdmin` and an accept schedule. * * After the `schedule` passes, the `newAdmin` will be able to accept the {defaultAdmin} role * by calling {acceptDefaultAdminTransfer}, completing the role transfer. * * A zero value only in `acceptSchedule` indicates no pending admin transfer. * * NOTE: A zero address `newAdmin` means that {defaultAdmin} is being renounced. */ function pendingDefaultAdmin() external view returns (address newAdmin, uint48 acceptSchedule); /** * @dev Returns the delay required to schedule the acceptance of a {defaultAdmin} transfer started. * * This delay will be added to the current timestamp when calling {beginDefaultAdminTransfer} to set * the acceptance schedule. * * NOTE: If a delay change has been scheduled, it will take effect as soon as the schedule passes, making this * function returns the new delay. See {changeDefaultAdminDelay}. */ function defaultAdminDelay() external view returns (uint48); /** * @dev Returns a tuple of `newDelay` and an effect schedule. * * After the `schedule` passes, the `newDelay` will get into effect immediately for every * new {defaultAdmin} transfer started with {beginDefaultAdminTransfer}. * * A zero value only in `effectSchedule` indicates no pending delay change. * * NOTE: A zero value only for `newDelay` means that the next {defaultAdminDelay} * will be zero after the effect schedule. */ function pendingDefaultAdminDelay() external view returns (uint48 newDelay, uint48 effectSchedule); /** * @dev Starts a {defaultAdmin} transfer by setting a {pendingDefaultAdmin} scheduled for acceptance * after the current timestamp plus a {defaultAdminDelay}. * * Requirements: * * - Only can be called by the current {defaultAdmin}. * * Emits a DefaultAdminRoleChangeStarted event. */ function beginDefaultAdminTransfer(address newAdmin) external; /** * @dev Cancels a {defaultAdmin} transfer previously started with {beginDefaultAdminTransfer}. * * A {pendingDefaultAdmin} not yet accepted can also be cancelled with this function. * * Requirements: * * - Only can be called by the current {defaultAdmin}. * * May emit a DefaultAdminTransferCanceled event. */ function cancelDefaultAdminTransfer() external; /** * @dev Completes a {defaultAdmin} transfer previously started with {beginDefaultAdminTransfer}. * * After calling the function: * * - `DEFAULT_ADMIN_ROLE` should be granted to the caller. * - `DEFAULT_ADMIN_ROLE` should be revoked from the previous holder. * - {pendingDefaultAdmin} should be reset to zero values. * * Requirements: * * - Only can be called by the {pendingDefaultAdmin}'s `newAdmin`. * - The {pendingDefaultAdmin}'s `acceptSchedule` should've passed. */ function acceptDefaultAdminTransfer() external; /** * @dev Initiates a {defaultAdminDelay} update by setting a {pendingDefaultAdminDelay} scheduled for getting * into effect after the current timestamp plus a {defaultAdminDelay}. * * This function guarantees that any call to {beginDefaultAdminTransfer} done between the timestamp this * method is called and the {pendingDefaultAdminDelay} effect schedule will use the current {defaultAdminDelay} * set before calling. * * The {pendingDefaultAdminDelay}'s effect schedule is defined in a way that waiting until the schedule and then * calling {beginDefaultAdminTransfer} with the new delay will take at least the same as another {defaultAdmin} * complete transfer (including acceptance). * * The schedule is designed for two scenarios: * * - When the delay is changed for a larger one the schedule is `block.timestamp + newDelay` capped by * {defaultAdminDelayIncreaseWait}. * - When the delay is changed for a shorter one, the schedule is `block.timestamp + (current delay - new delay)`. * * A {pendingDefaultAdminDelay} that never got into effect will be canceled in favor of a new scheduled change. * * Requirements: * * - Only can be called by the current {defaultAdmin}. * * Emits a DefaultAdminDelayChangeScheduled event and may emit a DefaultAdminDelayChangeCanceled event. */ function changeDefaultAdminDelay(uint48 newDelay) external; /** * @dev Cancels a scheduled {defaultAdminDelay} change. * * Requirements: * * - Only can be called by the current {defaultAdmin}. * * May emit a DefaultAdminDelayChangeCanceled event. */ function rollbackDefaultAdminDelay() external; /** * @dev Maximum time in seconds for an increase to {defaultAdminDelay} (that is scheduled using {changeDefaultAdminDelay}) * to take effect. Default to 5 days. * * When the {defaultAdminDelay} is scheduled to be increased, it goes into effect after the new delay has passed with * the purpose of giving enough time for reverting any accidental change (i.e. using milliseconds instead of seconds) * that may lock the contract. However, to avoid excessive schedules, the wait is capped by this function and it can * be overrode for a custom {defaultAdminDelay} increase scheduling. * * IMPORTANT: Make sure to add a reasonable amount of time while overriding this value, otherwise, * there's a risk of setting a high new delay that goes into effect almost immediately without the * possibility of human intervention in the case of an input error (eg. set milliseconds instead of seconds). */ function defaultAdminDelayIncreaseWait() external view returns (uint48); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol) pragma solidity ^0.8.20; import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol"; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {ERC165Upgradeable} from "../utils/introspection/ERC165Upgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControl, ERC165Upgradeable { struct RoleData { mapping(address account => bool) hasRole; bytes32 adminRole; } bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /// @custom:storage-location erc7201:openzeppelin.storage.AccessControl struct AccessControlStorage { mapping(bytes32 role => RoleData) _roles; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControl")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant AccessControlStorageLocation = 0x02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800; function _getAccessControlStorage() private pure returns (AccessControlStorage storage $) { assembly { $.slot := AccessControlStorageLocation } } /** * @dev Modifier that checks that an account has a specific role. Reverts * with an {AccessControlUnauthorizedAccount} error including the required role. */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); return $._roles[role].hasRole[account]; } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()` * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier. */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account` * is missing `role`. */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert AccessControlUnauthorizedAccount(account, role); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) { AccessControlStorage storage $ = _getAccessControlStorage(); return $._roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address callerConfirmation) public virtual { if (callerConfirmation != _msgSender()) { revert AccessControlBadConfirmation(); } _revokeRole(role, callerConfirmation); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { AccessControlStorage storage $ = _getAccessControlStorage(); bytes32 previousAdminRole = getRoleAdmin(role); $._roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); if (!hasRole(role, account)) { $._roles[role].hasRole[account] = true; emit RoleGranted(role, account, _msgSender()); return true; } else { return false; } } /** * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); if (hasRole(role, account)) { $._roles[role].hasRole[account] = false; emit RoleRevoked(role, account, _msgSender()); return true; } else { return false; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol) pragma solidity ^0.8.20; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev The `account` is missing a role. */ error AccessControlUnauthorizedAccount(address account, bytes32 neededRole); /** * @dev The caller of a function is not the expected one. * * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}. */ error AccessControlBadConfirmation(); /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. */ function renounceRole(bytes32 role, address callerConfirmation) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SafeCast.sol) // This file was procedurally generated from scripts/generate/templates/SafeCast.js. pragma solidity ^0.8.20; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeCast { /** * @dev Value doesn't fit in an uint of `bits` size. */ error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value); /** * @dev An int value doesn't fit in an uint of `bits` size. */ error SafeCastOverflowedIntToUint(int256 value); /** * @dev Value doesn't fit in an int of `bits` size. */ error SafeCastOverflowedIntDowncast(uint8 bits, int256 value); /** * @dev An uint value doesn't fit in an int of `bits` size. */ error SafeCastOverflowedUintToInt(uint256 value); /** * @dev Returns the downcasted uint248 from uint256, reverting on * overflow (when the input is greater than largest uint248). * * Counterpart to Solidity's `uint248` operator. * * Requirements: * * - input must fit into 248 bits */ function toUint248(uint256 value) internal pure returns (uint248) { if (value > type(uint248).max) { revert SafeCastOverflowedUintDowncast(248, value); } return uint248(value); } /** * @dev Returns the downcasted uint240 from uint256, reverting on * overflow (when the input is greater than largest uint240). * * Counterpart to Solidity's `uint240` operator. * * Requirements: * * - input must fit into 240 bits */ function toUint240(uint256 value) internal pure returns (uint240) { if (value > type(uint240).max) { revert SafeCastOverflowedUintDowncast(240, value); } return uint240(value); } /** * @dev Returns the downcasted uint232 from uint256, reverting on * overflow (when the input is greater than largest uint232). * * Counterpart to Solidity's `uint232` operator. * * Requirements: * * - input must fit into 232 bits */ function toUint232(uint256 value) internal pure returns (uint232) { if (value > type(uint232).max) { revert SafeCastOverflowedUintDowncast(232, value); } return uint232(value); } /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits */ function toUint224(uint256 value) internal pure returns (uint224) { if (value > type(uint224).max) { revert SafeCastOverflowedUintDowncast(224, value); } return uint224(value); } /** * @dev Returns the downcasted uint216 from uint256, reverting on * overflow (when the input is greater than largest uint216). * * Counterpart to Solidity's `uint216` operator. * * Requirements: * * - input must fit into 216 bits */ function toUint216(uint256 value) internal pure returns (uint216) { if (value > type(uint216).max) { revert SafeCastOverflowedUintDowncast(216, value); } return uint216(value); } /** * @dev Returns the downcasted uint208 from uint256, reverting on * overflow (when the input is greater than largest uint208). * * Counterpart to Solidity's `uint208` operator. * * Requirements: * * - input must fit into 208 bits */ function toUint208(uint256 value) internal pure returns (uint208) { if (value > type(uint208).max) { revert SafeCastOverflowedUintDowncast(208, value); } return uint208(value); } /** * @dev Returns the downcasted uint200 from uint256, reverting on * overflow (when the input is greater than largest uint200). * * Counterpart to Solidity's `uint200` operator. * * Requirements: * * - input must fit into 200 bits */ function toUint200(uint256 value) internal pure returns (uint200) { if (value > type(uint200).max) { revert SafeCastOverflowedUintDowncast(200, value); } return uint200(value); } /** * @dev Returns the downcasted uint192 from uint256, reverting on * overflow (when the input is greater than largest uint192). * * Counterpart to Solidity's `uint192` operator. * * Requirements: * * - input must fit into 192 bits */ function toUint192(uint256 value) internal pure returns (uint192) { if (value > type(uint192).max) { revert SafeCastOverflowedUintDowncast(192, value); } return uint192(value); } /** * @dev Returns the downcasted uint184 from uint256, reverting on * overflow (when the input is greater than largest uint184). * * Counterpart to Solidity's `uint184` operator. * * Requirements: * * - input must fit into 184 bits */ function toUint184(uint256 value) internal pure returns (uint184) { if (value > type(uint184).max) { revert SafeCastOverflowedUintDowncast(184, value); } return uint184(value); } /** * @dev Returns the downcasted uint176 from uint256, reverting on * overflow (when the input is greater than largest uint176). * * Counterpart to Solidity's `uint176` operator. * * Requirements: * * - input must fit into 176 bits */ function toUint176(uint256 value) internal pure returns (uint176) { if (value > type(uint176).max) { revert SafeCastOverflowedUintDowncast(176, value); } return uint176(value); } /** * @dev Returns the downcasted uint168 from uint256, reverting on * overflow (when the input is greater than largest uint168). * * Counterpart to Solidity's `uint168` operator. * * Requirements: * * - input must fit into 168 bits */ function toUint168(uint256 value) internal pure returns (uint168) { if (value > type(uint168).max) { revert SafeCastOverflowedUintDowncast(168, value); } return uint168(value); } /** * @dev Returns the downcasted uint160 from uint256, reverting on * overflow (when the input is greater than largest uint160). * * Counterpart to Solidity's `uint160` operator. * * Requirements: * * - input must fit into 160 bits */ function toUint160(uint256 value) internal pure returns (uint160) { if (value > type(uint160).max) { revert SafeCastOverflowedUintDowncast(160, value); } return uint160(value); } /** * @dev Returns the downcasted uint152 from uint256, reverting on * overflow (when the input is greater than largest uint152). * * Counterpart to Solidity's `uint152` operator. * * Requirements: * * - input must fit into 152 bits */ function toUint152(uint256 value) internal pure returns (uint152) { if (value > type(uint152).max) { revert SafeCastOverflowedUintDowncast(152, value); } return uint152(value); } /** * @dev Returns the downcasted uint144 from uint256, reverting on * overflow (when the input is greater than largest uint144). * * Counterpart to Solidity's `uint144` operator. * * Requirements: * * - input must fit into 144 bits */ function toUint144(uint256 value) internal pure returns (uint144) { if (value > type(uint144).max) { revert SafeCastOverflowedUintDowncast(144, value); } return uint144(value); } /** * @dev Returns the downcasted uint136 from uint256, reverting on * overflow (when the input is greater than largest uint136). * * Counterpart to Solidity's `uint136` operator. * * Requirements: * * - input must fit into 136 bits */ function toUint136(uint256 value) internal pure returns (uint136) { if (value > type(uint136).max) { revert SafeCastOverflowedUintDowncast(136, value); } return uint136(value); } /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits */ function toUint128(uint256 value) internal pure returns (uint128) { if (value > type(uint128).max) { revert SafeCastOverflowedUintDowncast(128, value); } return uint128(value); } /** * @dev Returns the downcasted uint120 from uint256, reverting on * overflow (when the input is greater than largest uint120). * * Counterpart to Solidity's `uint120` operator. * * Requirements: * * - input must fit into 120 bits */ function toUint120(uint256 value) internal pure returns (uint120) { if (value > type(uint120).max) { revert SafeCastOverflowedUintDowncast(120, value); } return uint120(value); } /** * @dev Returns the downcasted uint112 from uint256, reverting on * overflow (when the input is greater than largest uint112). * * Counterpart to Solidity's `uint112` operator. * * Requirements: * * - input must fit into 112 bits */ function toUint112(uint256 value) internal pure returns (uint112) { if (value > type(uint112).max) { revert SafeCastOverflowedUintDowncast(112, value); } return uint112(value); } /** * @dev Returns the downcasted uint104 from uint256, reverting on * overflow (when the input is greater than largest uint104). * * Counterpart to Solidity's `uint104` operator. * * Requirements: * * - input must fit into 104 bits */ function toUint104(uint256 value) internal pure returns (uint104) { if (value > type(uint104).max) { revert SafeCastOverflowedUintDowncast(104, value); } return uint104(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits */ function toUint96(uint256 value) internal pure returns (uint96) { if (value > type(uint96).max) { revert SafeCastOverflowedUintDowncast(96, value); } return uint96(value); } /** * @dev Returns the downcasted uint88 from uint256, reverting on * overflow (when the input is greater than largest uint88). * * Counterpart to Solidity's `uint88` operator. * * Requirements: * * - input must fit into 88 bits */ function toUint88(uint256 value) internal pure returns (uint88) { if (value > type(uint88).max) { revert SafeCastOverflowedUintDowncast(88, value); } return uint88(value); } /** * @dev Returns the downcasted uint80 from uint256, reverting on * overflow (when the input is greater than largest uint80). * * Counterpart to Solidity's `uint80` operator. * * Requirements: * * - input must fit into 80 bits */ function toUint80(uint256 value) internal pure returns (uint80) { if (value > type(uint80).max) { revert SafeCastOverflowedUintDowncast(80, value); } return uint80(value); } /** * @dev Returns the downcasted uint72 from uint256, reverting on * overflow (when the input is greater than largest uint72). * * Counterpart to Solidity's `uint72` operator. * * Requirements: * * - input must fit into 72 bits */ function toUint72(uint256 value) internal pure returns (uint72) { if (value > type(uint72).max) { revert SafeCastOverflowedUintDowncast(72, value); } return uint72(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits */ function toUint64(uint256 value) internal pure returns (uint64) { if (value > type(uint64).max) { revert SafeCastOverflowedUintDowncast(64, value); } return uint64(value); } /** * @dev Returns the downcasted uint56 from uint256, reverting on * overflow (when the input is greater than largest uint56). * * Counterpart to Solidity's `uint56` operator. * * Requirements: * * - input must fit into 56 bits */ function toUint56(uint256 value) internal pure returns (uint56) { if (value > type(uint56).max) { revert SafeCastOverflowedUintDowncast(56, value); } return uint56(value); } /** * @dev Returns the downcasted uint48 from uint256, reverting on * overflow (when the input is greater than largest uint48). * * Counterpart to Solidity's `uint48` operator. * * Requirements: * * - input must fit into 48 bits */ function toUint48(uint256 value) internal pure returns (uint48) { if (value > type(uint48).max) { revert SafeCastOverflowedUintDowncast(48, value); } return uint48(value); } /** * @dev Returns the downcasted uint40 from uint256, reverting on * overflow (when the input is greater than largest uint40). * * Counterpart to Solidity's `uint40` operator. * * Requirements: * * - input must fit into 40 bits */ function toUint40(uint256 value) internal pure returns (uint40) { if (value > type(uint40).max) { revert SafeCastOverflowedUintDowncast(40, value); } return uint40(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits */ function toUint32(uint256 value) internal pure returns (uint32) { if (value > type(uint32).max) { revert SafeCastOverflowedUintDowncast(32, value); } return uint32(value); } /** * @dev Returns the downcasted uint24 from uint256, reverting on * overflow (when the input is greater than largest uint24). * * Counterpart to Solidity's `uint24` operator. * * Requirements: * * - input must fit into 24 bits */ function toUint24(uint256 value) internal pure returns (uint24) { if (value > type(uint24).max) { revert SafeCastOverflowedUintDowncast(24, value); } return uint24(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits */ function toUint16(uint256 value) internal pure returns (uint16) { if (value > type(uint16).max) { revert SafeCastOverflowedUintDowncast(16, value); } return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits */ function toUint8(uint256 value) internal pure returns (uint8) { if (value > type(uint8).max) { revert SafeCastOverflowedUintDowncast(8, value); } return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. */ function toUint256(int256 value) internal pure returns (uint256) { if (value < 0) { revert SafeCastOverflowedIntToUint(value); } return uint256(value); } /** * @dev Returns the downcasted int248 from int256, reverting on * overflow (when the input is less than smallest int248 or * greater than largest int248). * * Counterpart to Solidity's `int248` operator. * * Requirements: * * - input must fit into 248 bits */ function toInt248(int256 value) internal pure returns (int248 downcasted) { downcasted = int248(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(248, value); } } /** * @dev Returns the downcasted int240 from int256, reverting on * overflow (when the input is less than smallest int240 or * greater than largest int240). * * Counterpart to Solidity's `int240` operator. * * Requirements: * * - input must fit into 240 bits */ function toInt240(int256 value) internal pure returns (int240 downcasted) { downcasted = int240(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(240, value); } } /** * @dev Returns the downcasted int232 from int256, reverting on * overflow (when the input is less than smallest int232 or * greater than largest int232). * * Counterpart to Solidity's `int232` operator. * * Requirements: * * - input must fit into 232 bits */ function toInt232(int256 value) internal pure returns (int232 downcasted) { downcasted = int232(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(232, value); } } /** * @dev Returns the downcasted int224 from int256, reverting on * overflow (when the input is less than smallest int224 or * greater than largest int224). * * Counterpart to Solidity's `int224` operator. * * Requirements: * * - input must fit into 224 bits */ function toInt224(int256 value) internal pure returns (int224 downcasted) { downcasted = int224(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(224, value); } } /** * @dev Returns the downcasted int216 from int256, reverting on * overflow (when the input is less than smallest int216 or * greater than largest int216). * * Counterpart to Solidity's `int216` operator. * * Requirements: * * - input must fit into 216 bits */ function toInt216(int256 value) internal pure returns (int216 downcasted) { downcasted = int216(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(216, value); } } /** * @dev Returns the downcasted int208 from int256, reverting on * overflow (when the input is less than smallest int208 or * greater than largest int208). * * Counterpart to Solidity's `int208` operator. * * Requirements: * * - input must fit into 208 bits */ function toInt208(int256 value) internal pure returns (int208 downcasted) { downcasted = int208(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(208, value); } } /** * @dev Returns the downcasted int200 from int256, reverting on * overflow (when the input is less than smallest int200 or * greater than largest int200). * * Counterpart to Solidity's `int200` operator. * * Requirements: * * - input must fit into 200 bits */ function toInt200(int256 value) internal pure returns (int200 downcasted) { downcasted = int200(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(200, value); } } /** * @dev Returns the downcasted int192 from int256, reverting on * overflow (when the input is less than smallest int192 or * greater than largest int192). * * Counterpart to Solidity's `int192` operator. * * Requirements: * * - input must fit into 192 bits */ function toInt192(int256 value) internal pure returns (int192 downcasted) { downcasted = int192(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(192, value); } } /** * @dev Returns the downcasted int184 from int256, reverting on * overflow (when the input is less than smallest int184 or * greater than largest int184). * * Counterpart to Solidity's `int184` operator. * * Requirements: * * - input must fit into 184 bits */ function toInt184(int256 value) internal pure returns (int184 downcasted) { downcasted = int184(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(184, value); } } /** * @dev Returns the downcasted int176 from int256, reverting on * overflow (when the input is less than smallest int176 or * greater than largest int176). * * Counterpart to Solidity's `int176` operator. * * Requirements: * * - input must fit into 176 bits */ function toInt176(int256 value) internal pure returns (int176 downcasted) { downcasted = int176(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(176, value); } } /** * @dev Returns the downcasted int168 from int256, reverting on * overflow (when the input is less than smallest int168 or * greater than largest int168). * * Counterpart to Solidity's `int168` operator. * * Requirements: * * - input must fit into 168 bits */ function toInt168(int256 value) internal pure returns (int168 downcasted) { downcasted = int168(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(168, value); } } /** * @dev Returns the downcasted int160 from int256, reverting on * overflow (when the input is less than smallest int160 or * greater than largest int160). * * Counterpart to Solidity's `int160` operator. * * Requirements: * * - input must fit into 160 bits */ function toInt160(int256 value) internal pure returns (int160 downcasted) { downcasted = int160(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(160, value); } } /** * @dev Returns the downcasted int152 from int256, reverting on * overflow (when the input is less than smallest int152 or * greater than largest int152). * * Counterpart to Solidity's `int152` operator. * * Requirements: * * - input must fit into 152 bits */ function toInt152(int256 value) internal pure returns (int152 downcasted) { downcasted = int152(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(152, value); } } /** * @dev Returns the downcasted int144 from int256, reverting on * overflow (when the input is less than smallest int144 or * greater than largest int144). * * Counterpart to Solidity's `int144` operator. * * Requirements: * * - input must fit into 144 bits */ function toInt144(int256 value) internal pure returns (int144 downcasted) { downcasted = int144(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(144, value); } } /** * @dev Returns the downcasted int136 from int256, reverting on * overflow (when the input is less than smallest int136 or * greater than largest int136). * * Counterpart to Solidity's `int136` operator. * * Requirements: * * - input must fit into 136 bits */ function toInt136(int256 value) internal pure returns (int136 downcasted) { downcasted = int136(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(136, value); } } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits */ function toInt128(int256 value) internal pure returns (int128 downcasted) { downcasted = int128(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(128, value); } } /** * @dev Returns the downcasted int120 from int256, reverting on * overflow (when the input is less than smallest int120 or * greater than largest int120). * * Counterpart to Solidity's `int120` operator. * * Requirements: * * - input must fit into 120 bits */ function toInt120(int256 value) internal pure returns (int120 downcasted) { downcasted = int120(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(120, value); } } /** * @dev Returns the downcasted int112 from int256, reverting on * overflow (when the input is less than smallest int112 or * greater than largest int112). * * Counterpart to Solidity's `int112` operator. * * Requirements: * * - input must fit into 112 bits */ function toInt112(int256 value) internal pure returns (int112 downcasted) { downcasted = int112(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(112, value); } } /** * @dev Returns the downcasted int104 from int256, reverting on * overflow (when the input is less than smallest int104 or * greater than largest int104). * * Counterpart to Solidity's `int104` operator. * * Requirements: * * - input must fit into 104 bits */ function toInt104(int256 value) internal pure returns (int104 downcasted) { downcasted = int104(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(104, value); } } /** * @dev Returns the downcasted int96 from int256, reverting on * overflow (when the input is less than smallest int96 or * greater than largest int96). * * Counterpart to Solidity's `int96` operator. * * Requirements: * * - input must fit into 96 bits */ function toInt96(int256 value) internal pure returns (int96 downcasted) { downcasted = int96(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(96, value); } } /** * @dev Returns the downcasted int88 from int256, reverting on * overflow (when the input is less than smallest int88 or * greater than largest int88). * * Counterpart to Solidity's `int88` operator. * * Requirements: * * - input must fit into 88 bits */ function toInt88(int256 value) internal pure returns (int88 downcasted) { downcasted = int88(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(88, value); } } /** * @dev Returns the downcasted int80 from int256, reverting on * overflow (when the input is less than smallest int80 or * greater than largest int80). * * Counterpart to Solidity's `int80` operator. * * Requirements: * * - input must fit into 80 bits */ function toInt80(int256 value) internal pure returns (int80 downcasted) { downcasted = int80(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(80, value); } } /** * @dev Returns the downcasted int72 from int256, reverting on * overflow (when the input is less than smallest int72 or * greater than largest int72). * * Counterpart to Solidity's `int72` operator. * * Requirements: * * - input must fit into 72 bits */ function toInt72(int256 value) internal pure returns (int72 downcasted) { downcasted = int72(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(72, value); } } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits */ function toInt64(int256 value) internal pure returns (int64 downcasted) { downcasted = int64(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(64, value); } } /** * @dev Returns the downcasted int56 from int256, reverting on * overflow (when the input is less than smallest int56 or * greater than largest int56). * * Counterpart to Solidity's `int56` operator. * * Requirements: * * - input must fit into 56 bits */ function toInt56(int256 value) internal pure returns (int56 downcasted) { downcasted = int56(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(56, value); } } /** * @dev Returns the downcasted int48 from int256, reverting on * overflow (when the input is less than smallest int48 or * greater than largest int48). * * Counterpart to Solidity's `int48` operator. * * Requirements: * * - input must fit into 48 bits */ function toInt48(int256 value) internal pure returns (int48 downcasted) { downcasted = int48(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(48, value); } } /** * @dev Returns the downcasted int40 from int256, reverting on * overflow (when the input is less than smallest int40 or * greater than largest int40). * * Counterpart to Solidity's `int40` operator. * * Requirements: * * - input must fit into 40 bits */ function toInt40(int256 value) internal pure returns (int40 downcasted) { downcasted = int40(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(40, value); } } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits */ function toInt32(int256 value) internal pure returns (int32 downcasted) { downcasted = int32(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(32, value); } } /** * @dev Returns the downcasted int24 from int256, reverting on * overflow (when the input is less than smallest int24 or * greater than largest int24). * * Counterpart to Solidity's `int24` operator. * * Requirements: * * - input must fit into 24 bits */ function toInt24(int256 value) internal pure returns (int24 downcasted) { downcasted = int24(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(24, value); } } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits */ function toInt16(int256 value) internal pure returns (int16 downcasted) { downcasted = int16(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(16, value); } } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits */ function toInt8(int256 value) internal pure returns (int8 downcasted) { downcasted = int8(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(8, value); } } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive if (value > uint256(type(int256).max)) { revert SafeCastOverflowedUintToInt(value); } return int256(value); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5313.sol) pragma solidity ^0.8.20; /** * @dev Interface for the Light Contract Ownership Standard. * * A standardized minimal interface required to identify an account that controls a contract */ interface IERC5313 { /** * @dev Gets the address of the owner. */ function owner() external view returns (address); }
// SPDX-License-Identifier: BUSL-1.1 // SPDX-FileCopyrightText: 2024 Kiln <[email protected]> // // ██╗ ██╗██╗██╗ ███╗ ██╗ // ██║ ██╔╝██║██║ ████╗ ██║ // █████╔╝ ██║██║ ██╔██╗ ██║ // ██╔═██╗ ██║██║ ██║╚██╗██║ // ██║ ██╗██║███████╗██║ ╚████║ // ╚═╝ ╚═╝╚═╝╚══════╝╚═╝ ╚═══╝ // pragma solidity 0.8.22; /// @title FeeDispatcher Interface. /// @author maximebrugel @ Kiln. interface IFeeDispatcher { /// @notice Entity eligible to receive a portion of fees. /// @param recipient The address of the fee recipient. /// @param managementFeeSplit The split percentage of the management fee allocated to this recipient. /// @param performanceFeeSplit The split percentage of the performance fee allocated to this recipient. struct FeeRecipient { address recipient; uint256 managementFeeSplit; uint256 performanceFeeSplit; } /// @notice Dispatch pending fees to the fee recipients. function dispatchFees() external; /// @notice Get the pending management fee. /// @return The pending management fee. function pendingManagementFee() external view returns (uint256); /// @notice Get the pending performance fee. /// @return The pending performance fee. function pendingPerformanceFee() external view returns (uint256); /// @notice Get the fee recipients. /// @return The fee recipients. function feeRecipients() external view returns (FeeRecipient[] memory); /// @notice Get the fee recipient of a given address. /// @param recipient The address of the fee recipient. /// @return The fee recipient. function feeRecipient(address recipient) external view returns (FeeRecipient memory); /// @notice Get the fee recipient at a given index. /// @param index The index of the fee recipient. /// @return The fee recipient. function feeRecipientAt(uint256 index) external view returns (FeeRecipient memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (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; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import {Initializable} from "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` */ abstract contract ERC165Upgradeable is Initializable, IERC165 { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
{ "remappings": [ "forge-std/=lib/forge-std/src/", "@openzeppelin/=lib/openzeppelin-contracts/contracts/", "@openzeppelin-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "vulcan/=lib/vulcan/src/", "deploy.sol/=lib/deploy.sol/src/", "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "ds-test/=lib/vulcan/lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "solmate/=lib/deploy.sol/lib/solmate/src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"uint48","name":"schedule","type":"uint48"}],"name":"AccessControlEnforcedDefaultAdminDelay","type":"error"},{"inputs":[],"name":"AccessControlEnforcedDefaultAdminRules","type":"error"},{"inputs":[{"internalType":"address","name":"defaultAdmin","type":"address"}],"name":"AccessControlInvalidDefaultAdmin","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"AddressNotContract","type":"error"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"AddressSanctioned","type":"error"},{"inputs":[],"name":"AddressZero","type":"error"},{"inputs":[],"name":"AmountZero","type":"error"},{"inputs":[],"name":"DepositPaused","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"ERC4626ExceededMaxDeposit","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"ERC4626ExceededMaxMint","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"ERC4626ExceededMaxRedeem","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"ERC4626ExceededMaxWithdraw","type":"error"},{"inputs":[],"name":"EmptyArray","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"FeeRecipientDoesNotExist","type":"error"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"FeeRecipientNotUnique","type":"error"},{"inputs":[{"internalType":"bytes32","name":"name","type":"bytes32"}],"name":"InvalidConnectorName","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"MathOverflowedMulDiv","type":"error"},{"inputs":[],"name":"MinimumTotalSupplyNotReached","type":"error"},{"inputs":[],"name":"NoAdditionalRewardsClaimed","type":"error"},{"inputs":[],"name":"NotDelegateCall","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"NotTransferable","type":"error"},{"inputs":[],"name":"NothingToCollect","type":"error"},{"inputs":[{"internalType":"uint8","name":"offset","type":"uint8"}],"name":"OffsetTooHigh","type":"error"},{"inputs":[],"name":"PreviewZero","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"RemainderNotZero","type":"error"},{"inputs":[{"internalType":"uint8","name":"bits","type":"uint8"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"SafeCastOverflowedUintDowncast","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[{"internalType":"uint256","name":"totalAssets","type":"uint256"},{"internalType":"uint256","name":"newTotalAssets","type":"uint256"}],"name":"TotalAssetsDecreased","type":"error"},{"inputs":[{"internalType":"uint256","name":"managementFee","type":"uint256"}],"name":"WrongManagementFee","type":"error"},{"inputs":[{"internalType":"uint256","name":"totalSplit","type":"uint256"}],"name":"WrongManagementFeeSplit","type":"error"},{"inputs":[{"internalType":"uint256","name":"performanceFee","type":"uint256"}],"name":"WrongPerformanceFee","type":"error"},{"inputs":[{"internalType":"uint256","name":"totalSplit","type":"uint256"}],"name":"WrongPerformanceFeeSplit","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IERC20","name":"asset","type":"address"}],"name":"AssetInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"newConnectorName","type":"bytes32"}],"name":"ConnectorNameUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IConnectorRegistry","name":"newConnectorRegistry","type":"address"}],"name":"ConnectorRegistryUpdated","type":"event"},{"anonymous":false,"inputs":[],"name":"DefaultAdminDelayChangeCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint48","name":"newDelay","type":"uint48"},{"indexed":false,"internalType":"uint48","name":"effectSchedule","type":"uint48"}],"name":"DefaultAdminDelayChangeScheduled","type":"event"},{"anonymous":false,"inputs":[],"name":"DefaultAdminTransferCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newAdmin","type":"address"},{"indexed":false,"internalType":"uint48","name":"acceptSchedule","type":"uint48"}],"name":"DefaultAdminTransferScheduled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"managementFeeSplit","type":"uint256"},{"internalType":"uint256","name":"performanceFeeSplit","type":"uint256"}],"indexed":false,"internalType":"struct IFeeDispatcher.FeeRecipient[]","name":"feeRecipients","type":"tuple[]"}],"name":"FeeRecipientsSet","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":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"managementFee","type":"uint256"}],"name":"ManagementFeeDispatched","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newManagementFee","type":"uint256"}],"name":"ManagementFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"managementFeeAmount","type":"uint256"}],"name":"ManagementFeesCollected","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newMinTotalSupply","type":"uint256"}],"name":"MinTotalSupplyInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"name","type":"string"}],"name":"NameInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"offset","type":"uint8"}],"name":"OffsetInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"performanceFee","type":"uint256"}],"name":"PerformanceFeeDispatched","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newPerformanceFee","type":"uint256"}],"name":"PerformanceFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"performanceFeeAmount","type":"uint256"}],"name":"PerformanceFeesCollected","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"rewardsAsset","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardsClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract ISanctionsList","name":"newSanctionsList","type":"address"}],"name":"SanctionsListUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"symbol","type":"string"}],"name":"SymbolInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"newTransferableFlag","type":"bool"}],"name":"TransferableUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"CLAIM_MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SANCTIONS_MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UNPAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptDefaultAdminTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"asset","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"beginDefaultAdminTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cancelDefaultAdminTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint48","name":"newDelay","type":"uint48"}],"name":"changeDefaultAdminDelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"rewardsAsset","type":"address"},{"internalType":"bytes","name":"payload","type":"bytes"}],"name":"claimAdditionalRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"collectPerformanceFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"collectablePerformanceFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"connectorName","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"connectorRegistry","outputs":[{"internalType":"contract IConnectorRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"convertToAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"convertToShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultAdminDelay","outputs":[{"internalType":"uint48","name":"","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultAdminDelayIncreaseWait","outputs":[{"internalType":"uint48","name":"","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dispatchFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"feeRecipient","outputs":[{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"managementFeeSplit","type":"uint256"},{"internalType":"uint256","name":"performanceFeeSplit","type":"uint256"}],"internalType":"struct IFeeDispatcher.FeeRecipient","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"feeRecipientAt","outputs":[{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"managementFeeSplit","type":"uint256"},{"internalType":"uint256","name":"performanceFeeSplit","type":"uint256"}],"internalType":"struct IFeeDispatcher.FeeRecipient","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeRecipients","outputs":[{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"managementFeeSplit","type":"uint256"},{"internalType":"uint256","name":"performanceFeeSplit","type":"uint256"}],"internalType":"struct IFeeDispatcher.FeeRecipient[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC20","name":"asset_","type":"address"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"bool","name":"transferable_","type":"bool"},{"internalType":"contract IConnectorRegistry","name":"connectorRegistry_","type":"address"},{"internalType":"bytes32","name":"connectorName_","type":"bytes32"},{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"managementFeeSplit","type":"uint256"},{"internalType":"uint256","name":"performanceFeeSplit","type":"uint256"}],"internalType":"struct IFeeDispatcher.FeeRecipient[]","name":"recipients_","type":"tuple[]"},{"internalType":"uint256","name":"managementFee_","type":"uint256"},{"internalType":"uint256","name":"performanceFee_","type":"uint256"},{"internalType":"address","name":"initialDefaultAdmin_","type":"address"},{"internalType":"address","name":"initialFeeManager_","type":"address"},{"internalType":"address","name":"initialSanctionsManager_","type":"address"},{"internalType":"address","name":"initialClaimManager_","type":"address"},{"internalType":"address","name":"initialPauser_","type":"address"},{"internalType":"address","name":"initialUnpauser_","type":"address"},{"internalType":"uint48","name":"initialDelay_","type":"uint48"},{"internalType":"uint8","name":"offset_","type":"uint8"},{"internalType":"contract ISanctionsList","name":"sanctionsList_","type":"address"},{"internalType":"uint256","name":"minTotalSupply_","type":"uint256"}],"internalType":"struct Vault.InitializationParams","name":"params","type":"tuple"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"managementFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"maxRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"maxWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauseDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pendingDefaultAdmin","outputs":[{"internalType":"address","name":"newAdmin","type":"address"},{"internalType":"uint48","name":"schedule","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingDefaultAdminDelay","outputs":[{"internalType":"uint48","name":"newDelay","type":"uint48"},{"internalType":"uint48","name":"schedule","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingManagementFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingPerformanceFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"performanceFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"previewDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"previewMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"previewRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"previewWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rollbackDefaultAdminDelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sanctionsList","outputs":[{"internalType":"contract ISanctionsList","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"managementFeeSplit","type":"uint256"},{"internalType":"uint256","name":"performanceFeeSplit","type":"uint256"}],"internalType":"struct IFeeDispatcher.FeeRecipient[]","name":"recipients","type":"tuple[]"}],"name":"setFeeRecipients","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newManagementFee","type":"uint256"}],"name":"setManagementFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPerformanceFee","type":"uint256"}],"name":"setPerformanceFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISanctionsList","name":"newSanctionsList","type":"address"}],"name":"setSanctionsList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"transferable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpauseDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a06040523060805234801561001457600080fd5b50608051615c8d620000316000396000610faf0152615c8d6000f3fe608060405234801561001057600080fd5b50600436106104125760003560e01c806384ef8ffc11610220578063c63d75b611610130578063d602b9fd116100b8578063e63ab1e911610087578063e63ab1e9146108b4578063ec571c6a146108c4578063ef8b30f7146108cc578063fb1bb9de146108df578063fe56e232146108f157600080fd5b8063d602b9fd14610873578063d78162e91461087b578063d905777e1461088e578063dd62ed3e146108a157600080fd5b8063ce96cb77116100ff578063ce96cb77146107fc578063cefc14291461080f578063cf6eefb714610817578063d1fcb50614610845578063d547741f1461086057600080fd5b8063c63d75b6146107b7578063c6e6f592146107ca578063c9581137146107dd578063cc8463c8146107f457600080fd5b8063a217fddf116101b3578063b3d7f6b911610182578063b3d7f6b914610763578063b460af9414610776578063b53c86d214610789578063ba08765214610791578063c37952cb146107a457600080fd5b8063a217fddf14610720578063a6f7f5d614610728578063a7b0912214610730578063a9059cbb1461075057600080fd5b806392ff0d31116101ef57806392ff0d31146106d657806394bf804d146106de57806395d89b41146106f1578063a1eda53c146106f957600080fd5b806384ef8ffc146106ab57806387788782146106b35780638da5cb5b146106bb57806391d14854146106c357600080fd5b806336568abe11610326578063634e93da116102ae57806370897b231161027d57806370897b231461063657806370a082311461064957806371c996191461065c57806379ad86291461066f578063818d81491461069657600080fd5b8063634e93da146105f5578063649a5ec71461060857806369026e881461061b5780636e553f651461062357600080fd5b806349dc5e8d116102f557806349dc5e8d146105b75780634cdad506146105ca5780634d8fea1f146105dd5780635157ced5146105e5578063607985fc146105ed57600080fd5b806336568abe1461055e57806338d52e0f14610571578063402d267d1461059157806348a4186d146105a457600080fd5b80630a28a477116103a95780632088cb64116103785780632088cb641461050357806323b872dd1461050b578063248a9ca31461051e5780632f2ff15d14610531578063313ce5671461054457600080fd5b80630a28a477146104cb5780630aa6220b146104de5780630adfdcb9146104e657806318160ddd146104fb57600080fd5b806305db2f41116103e557806305db2f411461047b57806306fdde031461049057806307a2d13a146104a5578063095ea7b3146104b857600080fd5b806301e1d1141461041757806301ffc9a714610432578063022d63fb1461045557806304fa1db214610471575b600080fd5b61041f610904565b6040519081526020015b60405180910390f35b610445610440366004614ecc565b610991565b6040519015158152602001610429565b620697805b60405165ffffffffffff9091168152602001610429565b6104796109bc565b005b61041f6a2322a2afa6a0a720a3a2a960a91b81565b610498610a56565b6040516104299190614f1a565b61041f6104b3366004614f4d565b610b19565b6104456104c6366004614f8b565b610b26565b61041f6104d9366004614f4d565b610b7b565b610479610bdc565b6104ee610bf2565b6040516104299190614fb7565b61041f610c86565b61041f610cab565b610445610519366004615022565b610cfd565b61041f61052c366004614f4d565b610d68565b61047961053f366004615063565b610d8a565b61054c610db6565b60405160ff9091168152602001610429565b61047961056c366004615063565b610dfd565b610579610ec6565b6040516001600160a01b039091168152602001610429565b61041f61059f366004615093565b610ef4565b6104796105b23660046150b0565b610fa5565b6104796105c5366004615093565b61137a565b61041f6105d8366004614f4d565b6113a1565b6104796113fb565b610479611698565b61041f6116d7565b610479610603366004615093565b6116ea565b610479610616366004615101565b6116fe565b610479611712565b61041f610631366004615063565b61172f565b610479610644366004614f4d565b611844565b61041f610657366004615093565b61187e565b61047961066a36600461527f565b6118a6565b7ffdd5e928c3467d3da929a44639dde8d54e0576a04fec4ff333caa67a6f2433015461041f565b600080516020615c388339815191525461041f565b610579611930565b61041f61194c565b61057961195f565b6104456106d1366004615063565b611969565b6104456119a1565b61041f6106ec366004615063565b6119b7565b610498611ad4565b610701611b13565b6040805165ffffffffffff938416815292909116602083015201610429565b61041f600081565b61041f611b86565b61074361073e366004614f4d565b611b99565b60405161042991906152b3565b61044561075e366004614f8b565b611c2f565b61041f610771366004614f4d565b611c84565b61041f6107843660046152dd565b611cbe565b610579611d9e565b61041f61079f3660046152dd565b611db7565b6104796107b236600461531f565b611e9f565b61041f6107c5366004615093565b61206b565b61041f6107d8366004614f4d565b612125565b61041f6c21a620a4a6afa6a0a720a3a2a960991b81565b61045a612132565b61041f61080a366004615093565b6121b0565b610479612245565b61081f612285565b604080516001600160a01b03909316835265ffffffffffff909116602083015201610429565b61041f7029a0a721aa24a7a729afa6a0a720a3a2a960791b81565b61047961086e366004615063565b6122b3565b6104796122db565b610743610889366004615093565b6122ee565b61041f61089c366004615093565b6123ff565b61041f6108af3660046153a3565b6124a4565b61041f652820aaa9a2a960d11b81565b6105796124ee565b61041f6108da366004614f4d565b61250a565b61041f672aa72820aaa9a2a960c11b81565b6104796108ff366004614f4d565b612535565b600061090e612556565b6001600160a01b031663f3e0ffbf610924610ec6565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015610968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098c91906153d1565b905090565b60006001600160e01b031982166318a4c3c360e11b14806109b657506109b6826125d4565b92915050565b6109c4612609565b610a3d6109cf610ec6565b6109d7610ec6565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3891906153f9565b612641565b610a546001600080516020615bf883398151915255565b565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace038054606091600080516020615b9883398151915291610a9590615416565b80601f0160208091040260200160405190810160405280929190818152602001828054610ac190615416565b8015610b0e5780601f10610ae357610100808354040283529160200191610b0e565b820191906000526020600020905b815481529060010190602001808311610af157829003601f168201915b505050505091505090565b60006109b682600061288a565b6000610b306128d0565b6006015460ff16610b545760405163dc8d8db760e01b815260040160405180910390fd5b33610b5e816128f4565b83610b68816128f4565b610b7285856129aa565b95945050505050565b6000806000610b886129c2565b91509150610bd4610b97612ac5565b610ba290600a61554a565b83610bab610c86565b610bb59190615559565b610bbf9190615559565b610bca836001615559565b8691906001612ae0565b949350505050565b6000610be781612b2f565b610bef612b39565b50565b60606000600080516020615c388339815191526002810180546040805160208084028201810190925282815293945060009084015b82821015610c7c576000848152602090819020604080516060810182526003860290920180546001600160a01b0316835260018082015484860152600290910154918301919091529083529092019101610c27565b5050505091505090565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace025490565b6000806000610cb86129c2565b915091506000610cc66128d0565b60070154610cd49084615559565b9050610cf58160008486610ce6610c86565b610cf09190615559565b612b44565b935050505090565b6000610d076128d0565b6006015460ff16610d2b5760405163dc8d8db760e01b815260040160405180910390fd5b33610d35816128f4565b84610d3f816128f4565b84610d49816128f4565b610d5285612b7a565b610d5d878787612bc8565b979650505050505050565b6000908152600080516020615bd8833981519152602052604090206001015490565b81610da857604051631fe1e13d60e11b815260040160405180910390fd5b610db28282612bec565b5050565b60007f0773e532dfede91f04b12a73d3d2acd361424f41f76b4fb79f090161e36b4e00610de1612ac5565b8154610df79190600160a01b900460ff1661556c565b91505090565b600080516020615bb883398151915282158015610e325750610e1d611930565b6001600160a01b0316826001600160a01b0316145b15610eb757600080610e42612285565b90925090506001600160a01b038216151580610e64575065ffffffffffff8116155b80610e7757504265ffffffffffff821610155b15610ea4576040516319ca5ebb60e01b815265ffffffffffff821660048201526024015b60405180910390fd5b5050805465ffffffffffff60a01b191681555b610ec18383612c0e565b505050565b7f0773e532dfede91f04b12a73d3d2acd361424f41f76b4fb79f090161e36b4e00546001600160a01b031690565b600080610eff6128d0565b80546001820154604051634f4f233360e11b815260048101919091529192506001600160a01b031690639e9e466690602401602060405180830381865afa158015610f4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f729190615593565b80610f8857506008810154600160a01b900460ff165b15610f965750600092915050565b610f9e612c41565b9392505050565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003610fee576040516327844c6960e11b815260040160405180910390fd5b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03166000811580156110335750825b90506000826001600160401b0316600114801561104f5750303b155b90508115801561105d575080155b1561107b5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff1916600117855583156110a557845460ff60401b1916600160401b1785555b6110ba6110b56020880188615093565b612c61565b7f271b4511ff4aaef63080ee912e106daf4730d4103103ece6b8945b8f63ee02496110e86020880188615093565b6040516001600160a01b03909116815260200160405180910390a161118f61111360208801886155b0565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506111559250505060408901896155b0565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612c7292505050565b7f1099e0381cc51a0e48f876169bdb9db942eb13641fd572c175c9c457c8861b136111bd60208801886155b0565b6040516111cb92919061561f565b60405180910390a17f9c2a4a58d55ab06d0ee30f916218eee44fe05a75841c6d46f3be938fa02d597861120160408801886155b0565b60405161120f92919061561f565b60405180910390a161121f612c84565b61124b61123461020088016101e08901615101565b61124661014089016101208a01615093565b612c94565b61131a61125b60c0880188615633565b808060200260200160405190810160405280939291908181526020016000905b828210156112a7576112986060830286013681900381019061567b565b8152602001906001019061127b565b50505050506112b4610ec6565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112f1573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131591906153f9565b612ca6565b61132b6113268761571c565b612cb8565b831561137257845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2906020015b60405180910390a15b505050505050565b7029a0a721aa24a7a729afa6a0a720a3a2a960791b61139881612b2f565b610db282612d12565b60008060006113ae6129c2565b9092509050610bd46113c1826001615559565b6113c9612ac5565b6113d490600a61554a565b846113dd610c86565b6113e79190615559565b6113f19190615559565b8691906000612ae0565b611403612609565b6a2322a2afa6a0a720a3a2a960a91b61141b81612b2f565b60006114256128d0565b90506000806114326129c2565b91509150600061145783856007015461144b9190615559565b60008486610ce6610c86565b90508060000361147a57604051637b2c2fef60e01b815260040160405180910390fd5b6000611484610ec6565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa1580156114ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ee91906153d1565b85546001870154604051632fdff5a360e11b81529293506000926001600160a01b0390921691635fbfeb469161152a9160040190815260200190565b602060405180830381865afa158015611547573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061156b91906158af565b90506115cf611578610ec6565b6040516001600160a01b0390911660248201526044810185905260640160408051601f198184030181529190526020810180516001600160e01b031663f3fef3a360e01b1790526001600160a01b03831690612d71565b50611655826115dc610ec6565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015611622573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061164691906153d1565b61165091906158cc565b612dde565b611663308760070154612e5e565b60006007870155611672610904565b866004018190555050505050505050610a546001600080516020615bf883398151915255565b672aa72820aaa9a2a960c11b6116ad81612b2f565b60006116b76128d0565b6008018054911515600160a01b0260ff60a01b1990921691909117905550565b60006116e16128d0565b60010154905090565b60006116f581612b2f565b610db282612e94565b600061170981612b2f565b610db282612f07565b652820aaa9a2a960d11b61172581612b2f565b60016116b76128d0565b6000611739612609565b33611743816128f4565b61174b6128d0565b60080154600160a01b900460ff16156117775760405163035edea360e41b815260040160405180910390fd5b83600003611798576040516365e52d5160e11b815260040160405180910390fd5b60006117a2612c41565b9050808511156117cb57838582604051633c8097d960e11b8152600401610e9b939291906158df565b60006117d5612f70565b90506000806117ec88846117e7610c86565b612fba565b915091508160000361181157604051630784f01960e01b815260040160405180910390fd5b61181a82612b7a565b61182733888a858561307b565b5093505050506109b66001600080516020615bf883398151915255565b6a2322a2afa6a0a720a3a2a960a91b61185c81612b2f565b60006118666128d0565b9050611870612f70565b6004820155610ec18361331a565b6001600160a01b03166000908152600080516020615b98833981519152602052604090205490565b6a2322a2afa6a0a720a3a2a960a91b6118be81612b2f565b610db2826118ca610ec6565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611907573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061192b91906153f9565b6133f9565b600080516020615c18833981519152546001600160a01b031690565b60006119566128d0565b60030154905090565b600061098c611930565b6000918252600080516020615bd8833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60006119ab6128d0565b6006015460ff16919050565b60006119c1612609565b336119cb816128f4565b6119d36128d0565b60080154600160a01b900460ff16156119ff5760405163035edea360e41b815260040160405180910390fd5b83600003611a20576040516365e52d5160e11b815260040160405180910390fd5b611a2984612b7a565b6000611a33612f70565b90506000611a3f610c86565b90506000611a4d83836136bb565b905080871115611a765785878260405163284ff66760e01b8152600401610e9b939291906158df565b600080611a848986866136fd565b9150915081600003611aa957604051630784f01960e01b815260040160405180910390fd5b611ab63389848c8561307b565b509450505050506109b66001600080516020615bf883398151915255565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace048054606091600080516020615b9883398151915291610a9590615416565b600080516020615c1883398151915254600090600160d01b900465ffffffffffff16600080516020615bb88339815191528115801590611b5b57504265ffffffffffff831610155b611b6757600080611b7d565b6001810154600160a01b900465ffffffffffff16825b92509250509091565b6000611b906128d0565b60020154905090565b611ba1614e59565b7ffdd5e928c3467d3da929a44639dde8d54e0576a04fec4ff333caa67a6f2433028054600080516020615c38833981519152919084908110611be557611be5615900565b600091825260209182902060408051606081018252600390930290910180546001600160a01b03168352600181015493830193909352600290920154918101919091529392505050565b6000611c396128d0565b6006015460ff16611c5d5760405163dc8d8db760e01b815260040160405180910390fd5b33611c67816128f4565b83611c71816128f4565b611c7a84612b7a565b610b728585613815565b6000806000611c916129c2565b915091506000611cb4858385611ca5610c86565b611caf9190615559565b6136fd565b5095945050505050565b6000611cc8612609565b33611cd2816128f4565b84600003611cf3576040516365e52d5160e11b815260040160405180910390fd5b6000611cfe84613823565b905080861115611d2757838682604051633fa733bb60e21b8152600401610e9b939291906158df565b6000611d31612f70565b90506000611d4988600184611d44610c86565b6138bf565b905080600003611d6c57604051630784f01960e01b815260040160405180910390fd5b611d7581612b7a565b611d823388888b856138ec565b9350505050610f9e6001600080516020615bf883398151915255565b6000611da86128d0565b546001600160a01b0316919050565b6000611dc1612609565b33611dcb816128f4565b84600003611dec576040516365e52d5160e11b815260040160405180910390fd5b611df585612b7a565b6000611dff612f70565b90506000611e0b610c86565b90506000611e1a868484613b6e565b905080881115611e4357858882604051632e52afbb60e21b8152600401610e9b939291906158df565b6000611e528960008686612b44565b905080600003611e7557604051630784f01960e01b815260040160405180910390fd5b611e82338989848d6138ec565b945050505050610f9e6001600080516020615bf883398151915255565b611ea7612609565b6c21a620a4a6afa6a0a720a3a2a960991b611ec181612b2f565b6000611ecb6128d0565b90506000611ed7610904565b82546001840154604051632fdff5a360e11b81529293506000926001600160a01b0390921691635fbfeb4691611f139160040190815260200190565b602060405180830381865afa158015611f30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f5491906158af565b9050611fb1611f61610ec6565b888888604051602401611f779493929190615916565b60408051601f198184030181529190526020810180516001600160e01b031663767081d160e01b1790526001600160a01b03831690612d71565b506000611fbc610904565b905080831115611fe9576040516388b8d67d60e01b81526004810184905260248101829052604401610e9b565b8083036120095760405163541ada2760e11b815260040160405180910390fd5b6001600160a01b0388167ffc30cddea38e2bf4d6ea7d3f9ed3b6ad7f176419f4963bd81318067a4aee73fe61203e85846158cc565b60405190815260200160405180910390a25050505050610ec16001600080516020615bf883398151915255565b6000806120766128d0565b80546001820154604051634f4f233360e11b815260048101919091529192506001600160a01b031690639e9e466690602401602060405180830381865afa1580156120c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120e99190615593565b806120ff57506008810154600160a01b900460ff165b1561210d5750600092915050565b610f9e612118610904565b612120610c86565b6136bb565b60006109b6826000613c36565b600080516020615c1883398151915254600090600080516020615bb883398151915290600160d01b900465ffffffffffff16801580159061217a57504265ffffffffffff8216105b612194578154600160d01b900465ffffffffffff166121a9565b6001820154600160a01b900465ffffffffffff165b9250505090565b6000806121bb6128d0565b80546001820154604051634f4f233360e11b815260048101919091529192506001600160a01b031690639e9e466690602401602060405180830381865afa15801561220a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061222e9190615593565b1561223c5750600092915050565b610f9e83613823565b600061224f612285565b509050336001600160a01b0382161461227d57604051636116401160e11b8152336004820152602401610e9b565b610bef613c73565b600080516020615bb8833981519152546001600160a01b03811691600160a01b90910465ffffffffffff1690565b816122d157604051631fe1e13d60e11b815260040160405180910390fd5b610db28282613d10565b60006122e681612b2f565b610bef613d2c565b6122f6614e59565b7ffdd5e928c3467d3da929a44639dde8d54e0576a04fec4ff333caa67a6f24330254600080516020615c388339815191529060005b818110156123da57846001600160a01b031683600201828154811061235257612352615900565b60009182526020909120600390910201546001600160a01b0316036123d25782600201818154811061238657612386615900565b600091825260209182902060408051606081018252600390930290910180546001600160a01b031683526001810154938301939093526002909201549181019190915295945050505050565b60010161232b565b50604051632e290d8760e21b81526001600160a01b0385166004820152602401610e9b565b60008061240a6128d0565b80546001820154604051634f4f233360e11b815260048101919091529192506001600160a01b031690639e9e466690602401602060405180830381865afa158015612459573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061247d9190615593565b1561248b5750600092915050565b610f9e83612497610904565b61249f610c86565b613b6e565b6001600160a01b0391821660009081527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace016020908152604080832093909416825291909152205490565b60006124f86128d0565b600801546001600160a01b0316919050565b60008060006125176129c2565b915091506000611cb485838561252b610c86565b6117e79190615559565b6a2322a2afa6a0a720a3a2a960a91b61254d81612b2f565b610db282613d37565b6000806125616128d0565b8054600182015460405163023aa9ab60e61b815260048101919091529192506001600160a01b031690638eaa6ac090602401602060405180830381865afa1580156125b0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df791906158af565b60006001600160e01b03198216637965db0b60e01b14806109b657506301ffc9a760e01b6001600160e01b03198316146109b6565b600080516020615bf883398151915280546001190161263b57604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b600080516020615c3883398151915280547ffdd5e928c3467d3da929a44639dde8d54e0576a04fec4ff333caa67a6f243301547ffdd5e928c3467d3da929a44639dde8d54e0576a04fec4ff333caa67a6f2433025460009081906126a3614e59565b60005b8281101561284c578760020181815481106126c3576126c3615900565b600091825260209182902060408051606081018252600390930290910180546001600160a01b0316835260018101549383019390935260029092015491810191909152915086156127a657600061273883602001518b600a612725919061554a565b612730906064615943565b8a9190613e16565b905080156127a4578251612757906001600160a01b038d169083613eda565b6127618187615559565b83516040518381529197506001600160a01b0316907f476a4dacd049a6bd4c92a8d77daf02092d5eb87000c942d526cb994585c5c4c99060200160405180910390a25b505b85156128445760006127d683604001518b600a6127c3919061554a565b6127ce906064615943565b899190613e16565b905080156128425782516127f5906001600160a01b038d169083613eda565b6127ff8186615559565b83516040518381529196506001600160a01b0316907fa020e4eff231c0579299eb7fae87f9cee68731ca8ab27f8437d3885c33313f259060200160405180910390a25b505b6001016126a6565b5061285784876158cc565b875561286383866158cc565b8760010181905550505050505050505050565b6001600080516020615bf883398151915255565b6000610f9e612897610904565b6128a2906001615559565b6128aa612ac5565b6128b590600a61554a565b6128bd610c86565b6128c79190615559565b85919085612ae0565b7f6bb5a2a0ae924c2ea94f037035a09f65614421e2a7d96c9bcbd59acdd32e600090565b60006128fe6128d0565b600801546001600160a01b031690508015801590612981575060405163df592f7d60e01b81526001600160a01b03838116600483015282169063df592f7d90602401602060405180830381865afa15801561295d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129819190615593565b15610db25760405163ae1427c160e01b81526001600160a01b0383166004820152602401610e9b565b6000336129b8818585613f39565b5060019392505050565b60008060006129cf6128d0565b90506129d9610904565b915060006129f4826004015484613f4690919063ffffffff16565b9150508015801590612a095750600382015415155b15612abf576000612aa18360030154612a20610ec6565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612a5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a8191906153f9565b612a8c90600a61554a565b612a97906064615943565b8491906000612ae0565b9050612abb816000612ab382886158cc565b611d44610c86565b9450505b50509091565b6000612acf6128d0565b60060154610100900460ff16919050565b600080612aee868686613e16565b9050612af983613f6c565b8015612b15575060008480612b1057612b1061595a565b868809115b15610b7257612b25600182615559565b9695505050505050565b610bef8133613f99565b610a54600080613fd2565b6000610b72612b54846001615559565b612b5c612ac5565b612b6790600a61554a565b612b719085615559565b87919087612ae0565b6000612b84612ac5565b905060ff811615610db2576000612b9c82600a61554a565b612ba69084615970565b1115610db257604051631562115760e21b815260048101839052602401610e9b565b600033612bd68582856140ad565b612be18585856140fa565b506001949350505050565b612bf582610d68565b612bfe81612b2f565b612c088383614159565b50505050565b6001600160a01b0381163314612c375760405163334bd91960e11b815260040160405180910390fd5b610ec182826141c8565b6000612c4b612556565b6001600160a01b031663402d267d610924610ec6565b612c69614221565b610bef8161426a565b612c7a614221565b610db282826142ee565b612c8c614221565b610a5461433f565b612c9c614221565b610db28282614347565b612cae614221565b610db282826143b0565b612cc0614221565b610bef816060015182608001518360a001518460e001518561010001518661020001518761014001518861016001518961018001518a6101a001518b6101c001518c61022001518d61024001516143c2565b80612d1b6128d0565b60080180546001600160a01b0319166001600160a01b0392831617905560405190821681527fb47193b090556b6d1d36f48b4299a6d170310487ba8ffd4cd5a69e4e0ac95a5f906020015b60405180910390a150565b6060600080846001600160a01b031684604051612d8e9190615984565b600060405180830381855af49150503d8060008114612dc9576040519150601f19603f3d011682016040523d82523d6000602084013e612dce565b606091505b5091509150610b7285838361449e565b7ffdd5e928c3467d3da929a44639dde8d54e0576a04fec4ff333caa67a6f2433018054600080516020615c38833981519152918391600090612e21908490615559565b90915550506040518281527fd7ce8685584f585bf40449b51d01a753c80397a4acf29cf86193d0136e0daba9906020015b60405180910390a15050565b6001600160a01b038216612e8857604051634b637e8f60e11b815260006004820152602401610e9b565b610db2826000836144fa565b6000612e9e612132565b612ea742614625565b612eb191906159a0565b9050612ebd828261465c565b60405165ffffffffffff821681526001600160a01b038316907f3377dc44241e779dd06afab5b788a35ca5f3b778836e2990bdb26a2a4b2e5ed69060200160405180910390a25050565b6000612f12826146e9565b612f1b42614625565b612f2591906159a0565b9050612f318282613fd2565b6040805165ffffffffffff8085168252831660208201527ff1038c18cf84a56e432fdbfaf746924b7ea511dfe03a6506a0ceba4888788d9b9101612e52565b600080612f7b6128d0565b90506000612f876129c2565b935090508015612fb557612f9b308261472c565b80826007016000828254612faf9190615559565b90915550505b505090565b6000806000612fc76128d0565b90506130588160020154612fd9610ec6565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015613016573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061303a91906153f9565b61304590600a61554a565b613050906064615943565b889190613e16565b915061307061306783886158cc565b600087876138bf565b925050935093915050565b6000613085610ec6565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa1580156130cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130ef91906153d1565b90506131046130fc610ec6565b873087614762565b61310e858461472c565b60006131186128d0565b90508060050154613127610c86565b10156131465760405163b086de1360e01b815260040160405180910390fd5b80546001820154604051632fdff5a360e11b815260048101919091526000916001600160a01b031690635fbfeb4690602401602060405180830381865afa158015613195573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131b991906158af565b90506132a36131c6610ec6565b85856131d0610ec6565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015613216573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061323a91906153d1565b61324491906158cc565b61324e91906158cc565b6040516001600160a01b039092166024830152604482015260640160408051601f198184030181529190526020810180516001600160e01b03166311f9fbc960e21b1790526001600160a01b03831690612d71565b506132ac610904565b60048301556132ba8461479b565b866001600160a01b0316886001600160a01b03167fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d78888604051613308929190918252602082015260400190565b60405180910390a35050505050505050565b613322610ec6565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561335f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061338391906153f9565b61338e90600a61554a565b613399906023615943565b8111156133bc5760405163ed171aeb60e01b815260048101829052602401610e9b565b806133c56128d0565b600301556040518181527f9b49d0cd76012d9c67241c2f68f836efbaf50ea29901a250040671402d5263f590602001612d66565b8151600080516020615c388339815191529060000361342b5760405163521299a960e01b815260040160405180910390fd5b613439600282016000614e83565b82516000908190815b818110156136185786818151811061345c5761345c615900565b602002602001015160200151846134739190615559565b935086818151811061348757613487615900565b6020026020010151604001518361349e9190615559565b925060006001600160a01b03168782815181106134bd576134bd615900565b6020026020010151600001516001600160a01b0316036134f057604051639fabe1c160e01b815260040160405180910390fd5b60006134fd826001615559565b90505b828110156135a65787818151811061351a5761351a615900565b6020026020010151600001516001600160a01b031688838151811061354157613541615900565b6020026020010151600001516001600160a01b03160361359e5787828151811061356d5761356d615900565b602090810291909101015151604051634b41b89360e11b81526001600160a01b039091166004820152602401610e9b565b600101613500565b50846002018782815181106135bd576135bd615900565b602090810291909101810151825460018082018555600094855293839020825160039092020180546001600160a01b0319166001600160a01b0390921691909117815591810151828401556040015160029091015501613442565b5061362485600a61554a565b61362f906064615943565b83146136515760405163a2e729d160e01b815260048101849052602401610e9b565b61365c85600a61554a565b613667906064615943565b8214613689576040516354a25f4f60e11b815260048101839052602401610e9b565b7fbadd5004db59fd88c7a4fcc2b3732279e901bd26a7962d21e9890cca923d76308460020160405161136991906159bf565b6000806136c6612c41565b90506136d560016000196158cc565b81036136f0576136e860016000196158cc565b9150506109b6565b610bd481600086866138bf565b600080600061370a6128d0565b6002810154909150600061371c610ec6565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015613759573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061377d91906153f9565b60ff16905060006137918960018a8a612b44565b905060006137a083600a615a2d565b6137aa9083615943565b90506000846137ba85600a615a2d565b6137c5906064615943565b6137cf91906158cc565b90506137df826064836001612ae0565b9750613805856137f086600a615a2d565b6137fb906064615943565b8a91906000612ae0565b9650505050505050935093915050565b6000336129b88185856140fa565b60006109b6613830612556565b6001600160a01b031663ce96cb77613846610ec6565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa15801561388a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138ae91906153d1565b6138ba6105d88561187e565b6147f3565b6000610b726138cc612ac5565b6138d790600a61554a565b6138e19084615559565b612b71856001615559565b826001600160a01b0316856001600160a01b031614613910576139108386836140ad565b61391a8382612e5e565b60006139246128d0565b80546001820154604051632fdff5a360e11b81529293506000926001600160a01b0390921691635fbfeb46916139609160040190815260200190565b602060405180830381865afa15801561397d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139a191906158af565b905060006139ad610ec6565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa1580156139f3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a1791906153d1565b9050613a7b613a24610ec6565b6040516001600160a01b0390911660248201526044810187905260640160408051601f198184030181529190526020810180516001600160e01b031663f3fef3a360e01b1790526001600160a01b03841690612d71565b50613b0a613a87610ec6565b8883613a91610ec6565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015613ad7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613afb91906153d1565b613b0591906158cc565b613eda565b613b12610904565b600484015560408051868152602081018690526001600160a01b03808916928a821692918c16917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a45050505050505050565b600080613b79612556565b6001600160a01b031663ce96cb77613b8f610ec6565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015613bd3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613bf791906153d1565b9050613c0660016000196158cc565b8103613c1d57613c158561187e565b915050610f9e565b610b72613c2d82600087876138bf565b6138ba8761187e565b6000610f9e613c43612ac5565b613c4e90600a61554a565b613c56610c86565b613c609190615559565b613c68610904565b6128c7906001615559565b600080516020615bb8833981519152600080613c8d612285565b91509150613ca28165ffffffffffff16151590565b1580613cb657504265ffffffffffff821610155b15613cde576040516319ca5ebb60e01b815265ffffffffffff82166004820152602401610e9b565b613cf06000613ceb611930565b6141c8565b50613cfc600083614159565b505081546001600160d01b03191690915550565b613d1982610d68565b613d2281612b2f565b612c0883836141c8565b610a5460008061465c565b613d3f610ec6565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015613d7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613da091906153f9565b613dab90600a61554a565b613db6906023615943565b811115613dd95760405163d163662960e01b815260048101829052602401610e9b565b80613de26128d0565b600201556040518181527f2147e2bc8c39e67f74b1a9e08896ea1485442096765942206af1f4bc8bcde91790602001612d66565b6000838302816000198587098281108382030391505080600003613e4d57838281613e4357613e4361595a565b0492505050610f9e565b808411613e6d5760405163227bc15360e01b815260040160405180910390fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b6040516001600160a01b03838116602483015260448201839052610ec191859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050614809565b610ec1838383600161486c565b60008083831115613f5c57506000905080613f65565b50600190508183035b9250929050565b60006002826003811115613f8257613f82615a39565b613f8c9190615a4f565b60ff166001149050919050565b613fa38282611969565b610db25760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610e9b565b600080516020615c1883398151915254600080516020615bb883398151915290600160d01b900465ffffffffffff16801561406f574265ffffffffffff8216101561404557600182015482546001600160d01b0316600160a01b90910465ffffffffffff16600160d01b0217825561406f565b6040517f2b1fa2edafe6f7b9e97c1a9e0c3660e645beb2dcaa2d45bdbf9beaf5472e1ec590600090a15b5060010180546001600160a01b0316600160a01b65ffffffffffff948516026001600160d01b031617600160d01b9290931691909102919091179055565b60006140b984846124a4565b90506000198114612c0857818110156140eb57828183604051637dc7a0d960e11b8152600401610e9b939291906158df565b612c088484848403600061486c565b6001600160a01b03831661412457604051634b637e8f60e11b815260006004820152602401610e9b565b6001600160a01b03821661414e5760405163ec442f0560e01b815260006004820152602401610e9b565b610ec18383836144fa565b6000600080516020615bb8833981519152836141be576000614179611930565b6001600160a01b0316146141a057604051631fe1e13d60e11b815260040160405180910390fd5b6001810180546001600160a01b0319166001600160a01b0385161790555b610bd48484614954565b6000600080516020615bb8833981519152831580156141ff57506141ea611930565b6001600160a01b0316836001600160a01b0316145b15614217576001810180546001600160a01b03191690555b610bd48484614a00565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff16610a5457604051631afcd79f60e31b815260040160405180910390fd5b614272614221565b7f0773e532dfede91f04b12a73d3d2acd361424f41f76b4fb79f090161e36b4e0060008061429f84614a7c565b91509150816142af5760126142b1565b805b83546001600160a81b031916600160a01b60ff92909216919091026001600160a01b031916176001600160a01b0394909416939093179091555050565b6142f6614221565b600080516020615b988339815191527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace036143308482615ab9565b5060048101612c088382615ab9565b612876614221565b61434f614221565b600080516020615bb88339815191526001600160a01b03821661438857604051636116401160e11b815260006004820152602401610e9b565b80546001600160d01b0316600160d01b65ffffffffffff851602178155612c08600083614159565b6143b8614221565b610db282826133f9565b6143ca614221565b6143d388614b58565b6143dc8961331a565b6143e58a613d37565b6143ee8c614bd3565b6143f78b614c60565b6144008d614d2e565b61440982612d12565b61441281614d7b565b61442a6a2322a2afa6a0a720a3a2a960a91b88614159565b506144497029a0a721aa24a7a729afa6a0a720a3a2a960791b87614159565b506144646c21a620a4a6afa6a0a720a3a2a960991b86614159565b50614478652820aaa9a2a960d11b85614159565b5061448e672aa72820aaa9a2a960c11b84614159565b5050505050505050505050505050565b6060826144b3576144ae82614db8565b610f9e565b81511580156144ca57506001600160a01b0384163b155b156144f357604051639996b31560e01b81526001600160a01b0385166004820152602401610e9b565b5080610f9e565b600080516020615b988339815191526001600160a01b038416614536578181600201600082825461452b9190615559565b909155506145959050565b6001600160a01b038416600090815260208290526040902054828110156145765784818460405163391434e360e21b8152600401610e9b939291906158df565b6001600160a01b03851660009081526020839052604090209083900390555b6001600160a01b0383166145b35760028101805483900390556145d2565b6001600160a01b03831660009081526020829052604090208054830190555b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161461791815260200190565b60405180910390a350505050565b600065ffffffffffff821115614658576040516306dfcc6560e41b81526030600482015260248101839052604401610e9b565b5090565b600080516020615bb88339815191526000614675612285565b835465ffffffffffff8616600160a01b026001600160d01b03199091166001600160a01b0388161717845591506146b590508165ffffffffffff16151590565b15612c08576040517f8886ebfc4259abdbc16601dd8fb5678e54878f47b3c34836cfc51154a960510990600090a150505050565b6000806146f4612132565b90508065ffffffffffff168365ffffffffffff1611614717576144ae8382615b78565b610f9e65ffffffffffff8416620697806147f3565b6001600160a01b0382166147565760405163ec442f0560e01b815260006004820152602401610e9b565b610db2600083836144fa565b6040516001600160a01b038481166024830152838116604483015260648201839052612c089186918216906323b872dd90608401613f07565b600080516020615c388339815191528054829082906000906147be908490615559565b90915550506040518281527fc8891b429f51b964c41c037370eaa5d4cb3d57c748e1569200de5fb0f37acb3b90602001612e52565b60008183106148025781610f9e565b5090919050565b600061481e6001600160a01b03841683614de1565b905080516000141580156148435750808060200190518101906148419190615593565b155b15610ec157604051635274afe760e01b81526001600160a01b0384166004820152602401610e9b565b600080516020615b988339815191526001600160a01b0385166148a55760405163e602df0560e01b815260006004820152602401610e9b565b6001600160a01b0384166148cf57604051634a1406b160e11b815260006004820152602401610e9b565b6001600160a01b0380861660009081526001830160209081526040808320938816835292905220839055811561494d57836001600160a01b0316856001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258560405161494491815260200190565b60405180910390a35b5050505050565b6000600080516020615bd883398151915261496f8484611969565b6149ef576000848152602082815260408083206001600160a01b03871684529091529020805460ff191660011790556149a53390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a460019150506109b6565b60009150506109b6565b5092915050565b6000600080516020615bd8833981519152614a1b8484611969565b156149ef576000848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a460019150506109b6565b60408051600481526024810182526020810180516001600160e01b031663313ce56760e01b17905290516000918291829182916001600160a01b03871691614ac391615984565b600060405180830381855afa9150503d8060008114614afe576040519150601f19603f3d011682016040523d82523d6000602084013e614b03565b606091505b5091509150818015614b1757506020815110155b15614b4b57600081806020019051810190614b3291906153d1565b905060ff8111614b49576001969095509350505050565b505b5060009485945092505050565b601760ff82161115614b8257604051631a042a9b60e11b815260ff82166004820152602401610e9b565b80614b8b6128d0565b600601805461ff00191661010060ff9384160217905560405190821681527fcae26de0225f46c9b6b05447dde633b5ec259388f11315f1f36dfe6205ff72c990602001612d66565b6000614bdd6128d0565b9050816001600160a01b03163b600003614c155760405163247e970160e01b81526001600160a01b0383166004820152602401610e9b565b80546001600160a01b0319166001600160a01b03831690811782556040519081527f5f61862de0422698d021adb6e8b65fd7edf95fe9d5840b3ffce3f020f62a86e390602001612e52565b6000614c6a6128d0565b805460405163da815abf60e01b8152600481018590529192506001600160a01b03169063da815abf90602401602060405180830381865afa158015614cb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614cd79190615593565b614cf7576040516303dbaa6560e31b815260048101839052602401610e9b565b600181018290556040518281527f89ba13bd0c39f5657fbebb3c7cc5a7bb264dc1f030c56b275381bb7dd810eb5c90602001612e52565b80614d376128d0565b600601805460ff191691151591909117905560405181151581527f34d27d83cc2d5a6f14e25903bef0a84bf83160f3da4cc5a19dbb121be47c099390602001612d66565b80614d846128d0565b600501556040518181527f1f19296f2755837d126ad32268eb42dcf2a74bde8c16a97c93faba80aacc02d090602001612d66565b805115614dc85780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6060610f9e8383600084600080856001600160a01b03168486604051614e079190615984565b60006040518083038185875af1925050503d8060008114614e44576040519150601f19603f3d011682016040523d82523d6000602084013e614e49565b606091505b5091509150612b2586838361449e565b604051806060016040528060006001600160a01b0316815260200160008152602001600081525090565b5080546000825560030290600052602060002090810190610bef91905b808211156146585780546001600160a01b03191681556000600182018190556002820155600301614ea0565b600060208284031215614ede57600080fd5b81356001600160e01b031981168114610f9e57600080fd5b60005b83811015614f11578181015183820152602001614ef9565b50506000910152565b6020815260008251806020840152614f39816040850160208701614ef6565b601f01601f19169190910160400192915050565b600060208284031215614f5f57600080fd5b5035919050565b6001600160a01b0381168114610bef57600080fd5b8035614f8681614f66565b919050565b60008060408385031215614f9e57600080fd5b8235614fa981614f66565b946020939093013593505050565b6020808252825182820181905260009190848201906040850190845b818110156150165761500383855180516001600160a01b0316825260208082015190830152604090810151910152565b9284019260609290920191600101614fd3565b50909695505050505050565b60008060006060848603121561503757600080fd5b833561504281614f66565b9250602084013561505281614f66565b929592945050506040919091013590565b6000806040838503121561507657600080fd5b82359150602083013561508881614f66565b809150509250929050565b6000602082840312156150a557600080fd5b8135610f9e81614f66565b6000602082840312156150c257600080fd5b81356001600160401b038111156150d857600080fd5b82016102608185031215610f9e57600080fd5b803565ffffffffffff81168114614f8657600080fd5b60006020828403121561511357600080fd5b610f9e826150eb565b634e487b7160e01b600052604160045260246000fd5b60405161026081016001600160401b03811182821017156151555761515561511c565b60405290565b604051601f8201601f191681016001600160401b03811182821017156151835761518361511c565b604052919050565b60006060828403121561519d57600080fd5b604051606081018181106001600160401b03821117156151bf576151bf61511c565b60405290508082356151d081614f66565b8082525060208301356020820152604083013560408201525092915050565b600082601f83011261520057600080fd5b813560206001600160401b0382111561521b5761521b61511c565b61522a60208360051b0161515b565b80838252602082019150606060206060860288010194508785111561524e57600080fd5b602087015b8581101561527257615265898261518b565b8452928401928101615253565b5090979650505050505050565b60006020828403121561529157600080fd5b81356001600160401b038111156152a757600080fd5b610bd4848285016151ef565b81516001600160a01b031681526020808301519082015260408083015190820152606081016109b6565b6000806000606084860312156152f257600080fd5b83359250602084013561530481614f66565b9150604084013561531481614f66565b809150509250925092565b60008060006040848603121561533457600080fd5b833561533f81614f66565b925060208401356001600160401b038082111561535b57600080fd5b818601915086601f83011261536f57600080fd5b81358181111561537e57600080fd5b87602082850101111561539057600080fd5b6020830194508093505050509250925092565b600080604083850312156153b657600080fd5b82356153c181614f66565b9150602083013561508881614f66565b6000602082840312156153e357600080fd5b5051919050565b60ff81168114610bef57600080fd5b60006020828403121561540b57600080fd5b8151610f9e816153ea565b600181811c9082168061542a57607f821691505b60208210810361544a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600181815b808511156154a157816000190482111561548757615487615450565b8085161561549457918102915b93841c939080029061546b565b509250929050565b6000826154b8575060016109b6565b816154c5575060006109b6565b81600181146154db57600281146154e557615501565b60019150506109b6565b60ff8411156154f6576154f6615450565b50506001821b6109b6565b5060208310610133831016604e8410600b8410161715615524575081810a6109b6565b61552e8383615466565b806000190482111561554257615542615450565b029392505050565b6000610f9e60ff8416836154a9565b808201808211156109b6576109b6615450565b60ff81811683821601908111156109b6576109b6615450565b8015158114610bef57600080fd5b6000602082840312156155a557600080fd5b8151610f9e81615585565b6000808335601e198436030181126155c757600080fd5b8301803591506001600160401b038211156155e157600080fd5b602001915036819003821315613f6557600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b602081526000610bd46020830184866155f6565b6000808335601e1984360301811261564a57600080fd5b8301803591506001600160401b0382111561566457600080fd5b6020019150606081023603821315613f6557600080fd5b60006060828403121561568d57600080fd5b610f9e838361518b565b600082601f8301126156a857600080fd5b81356001600160401b038111156156c1576156c161511c565b6156d4601f8201601f191660200161515b565b8181528460208386010111156156e957600080fd5b816020850160208301376000918101602001919091529392505050565b8035614f8681615585565b8035614f86816153ea565b6000610260823603121561572f57600080fd5b615737615132565b61574083614f7b565b815260208301356001600160401b038082111561575c57600080fd5b61576836838701615697565b6020840152604085013591508082111561578157600080fd5b61578d36838701615697565b604084015261579e60608601615706565b60608401526157af60808601614f7b565b608084015260a085013560a084015260c08501359150808211156157d257600080fd5b506157df368286016151ef565b60c08301525060e083013560e0820152610100808401358183015250610120615809818501614f7b565b9082015261014061581b848201614f7b565b9082015261016061582d848201614f7b565b9082015261018061583f848201614f7b565b908201526101a0615851848201614f7b565b908201526101c0615863848201614f7b565b908201526101e06158758482016150eb565b90820152610200615887848201615711565b90820152610220615899848201614f7b565b9082015261024092830135928101929092525090565b6000602082840312156158c157600080fd5b8151610f9e81614f66565b818103818111156109b6576109b6615450565b6001600160a01b039390931683526020830191909152604082015260600190565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b03858116825284166020820152606060408201819052600090612b2590830184866155f6565b80820281158282048414176109b6576109b6615450565b634e487b7160e01b600052601260045260246000fd5b60008261597f5761597f61595a565b500690565b60008251615996818460208701614ef6565b9190910192915050565b65ffffffffffff8181168382160190808211156149f9576149f9615450565b60006020808301602084528085548083526040925060408601915086600052602060002060005b82811015615a205781546001600160a01b0316845260018281015487860152600283015486860152606090940193600390920191016159e6565b5091979650505050505050565b6000610f9e83836154a9565b634e487b7160e01b600052602160045260246000fd5b600060ff831680615a6257615a6261595a565b8060ff84160691505092915050565b601f821115610ec1576000816000526020600020601f850160051c81016020861015615a9a5750805b601f850160051c820191505b8181101561137257828155600101615aa6565b81516001600160401b03811115615ad257615ad261511c565b615ae681615ae08454615416565b84615a71565b602080601f831160018114615b1b5760008415615b035750858301515b600019600386901b1c1916600185901b178555611372565b600085815260208120601f198616915b82811015615b4a57888601518255948401946001909101908401615b2b565b5085821015615b685787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b65ffffffffffff8281168282160390808211156149f9576149f961545056fe52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00eef3dac4538c82c8ace4063ab0acd2d15cdb5883aa1dff7c2673abb3d869840002dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00eef3dac4538c82c8ace4063ab0acd2d15cdb5883aa1dff7c2673abb3d8698401fdd5e928c3467d3da929a44639dde8d54e0576a04fec4ff333caa67a6f243300a2646970667358221220cb4a77ca17b133790f47545e57f55748c0c489d4a64f7df21e3348c883b2b7f464736f6c63430008160033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106104125760003560e01c806384ef8ffc11610220578063c63d75b611610130578063d602b9fd116100b8578063e63ab1e911610087578063e63ab1e9146108b4578063ec571c6a146108c4578063ef8b30f7146108cc578063fb1bb9de146108df578063fe56e232146108f157600080fd5b8063d602b9fd14610873578063d78162e91461087b578063d905777e1461088e578063dd62ed3e146108a157600080fd5b8063ce96cb77116100ff578063ce96cb77146107fc578063cefc14291461080f578063cf6eefb714610817578063d1fcb50614610845578063d547741f1461086057600080fd5b8063c63d75b6146107b7578063c6e6f592146107ca578063c9581137146107dd578063cc8463c8146107f457600080fd5b8063a217fddf116101b3578063b3d7f6b911610182578063b3d7f6b914610763578063b460af9414610776578063b53c86d214610789578063ba08765214610791578063c37952cb146107a457600080fd5b8063a217fddf14610720578063a6f7f5d614610728578063a7b0912214610730578063a9059cbb1461075057600080fd5b806392ff0d31116101ef57806392ff0d31146106d657806394bf804d146106de57806395d89b41146106f1578063a1eda53c146106f957600080fd5b806384ef8ffc146106ab57806387788782146106b35780638da5cb5b146106bb57806391d14854146106c357600080fd5b806336568abe11610326578063634e93da116102ae57806370897b231161027d57806370897b231461063657806370a082311461064957806371c996191461065c57806379ad86291461066f578063818d81491461069657600080fd5b8063634e93da146105f5578063649a5ec71461060857806369026e881461061b5780636e553f651461062357600080fd5b806349dc5e8d116102f557806349dc5e8d146105b75780634cdad506146105ca5780634d8fea1f146105dd5780635157ced5146105e5578063607985fc146105ed57600080fd5b806336568abe1461055e57806338d52e0f14610571578063402d267d1461059157806348a4186d146105a457600080fd5b80630a28a477116103a95780632088cb64116103785780632088cb641461050357806323b872dd1461050b578063248a9ca31461051e5780632f2ff15d14610531578063313ce5671461054457600080fd5b80630a28a477146104cb5780630aa6220b146104de5780630adfdcb9146104e657806318160ddd146104fb57600080fd5b806305db2f41116103e557806305db2f411461047b57806306fdde031461049057806307a2d13a146104a5578063095ea7b3146104b857600080fd5b806301e1d1141461041757806301ffc9a714610432578063022d63fb1461045557806304fa1db214610471575b600080fd5b61041f610904565b6040519081526020015b60405180910390f35b610445610440366004614ecc565b610991565b6040519015158152602001610429565b620697805b60405165ffffffffffff9091168152602001610429565b6104796109bc565b005b61041f6a2322a2afa6a0a720a3a2a960a91b81565b610498610a56565b6040516104299190614f1a565b61041f6104b3366004614f4d565b610b19565b6104456104c6366004614f8b565b610b26565b61041f6104d9366004614f4d565b610b7b565b610479610bdc565b6104ee610bf2565b6040516104299190614fb7565b61041f610c86565b61041f610cab565b610445610519366004615022565b610cfd565b61041f61052c366004614f4d565b610d68565b61047961053f366004615063565b610d8a565b61054c610db6565b60405160ff9091168152602001610429565b61047961056c366004615063565b610dfd565b610579610ec6565b6040516001600160a01b039091168152602001610429565b61041f61059f366004615093565b610ef4565b6104796105b23660046150b0565b610fa5565b6104796105c5366004615093565b61137a565b61041f6105d8366004614f4d565b6113a1565b6104796113fb565b610479611698565b61041f6116d7565b610479610603366004615093565b6116ea565b610479610616366004615101565b6116fe565b610479611712565b61041f610631366004615063565b61172f565b610479610644366004614f4d565b611844565b61041f610657366004615093565b61187e565b61047961066a36600461527f565b6118a6565b7ffdd5e928c3467d3da929a44639dde8d54e0576a04fec4ff333caa67a6f2433015461041f565b600080516020615c388339815191525461041f565b610579611930565b61041f61194c565b61057961195f565b6104456106d1366004615063565b611969565b6104456119a1565b61041f6106ec366004615063565b6119b7565b610498611ad4565b610701611b13565b6040805165ffffffffffff938416815292909116602083015201610429565b61041f600081565b61041f611b86565b61074361073e366004614f4d565b611b99565b60405161042991906152b3565b61044561075e366004614f8b565b611c2f565b61041f610771366004614f4d565b611c84565b61041f6107843660046152dd565b611cbe565b610579611d9e565b61041f61079f3660046152dd565b611db7565b6104796107b236600461531f565b611e9f565b61041f6107c5366004615093565b61206b565b61041f6107d8366004614f4d565b612125565b61041f6c21a620a4a6afa6a0a720a3a2a960991b81565b61045a612132565b61041f61080a366004615093565b6121b0565b610479612245565b61081f612285565b604080516001600160a01b03909316835265ffffffffffff909116602083015201610429565b61041f7029a0a721aa24a7a729afa6a0a720a3a2a960791b81565b61047961086e366004615063565b6122b3565b6104796122db565b610743610889366004615093565b6122ee565b61041f61089c366004615093565b6123ff565b61041f6108af3660046153a3565b6124a4565b61041f652820aaa9a2a960d11b81565b6105796124ee565b61041f6108da366004614f4d565b61250a565b61041f672aa72820aaa9a2a960c11b81565b6104796108ff366004614f4d565b612535565b600061090e612556565b6001600160a01b031663f3e0ffbf610924610ec6565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015610968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098c91906153d1565b905090565b60006001600160e01b031982166318a4c3c360e11b14806109b657506109b6826125d4565b92915050565b6109c4612609565b610a3d6109cf610ec6565b6109d7610ec6565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3891906153f9565b612641565b610a546001600080516020615bf883398151915255565b565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace038054606091600080516020615b9883398151915291610a9590615416565b80601f0160208091040260200160405190810160405280929190818152602001828054610ac190615416565b8015610b0e5780601f10610ae357610100808354040283529160200191610b0e565b820191906000526020600020905b815481529060010190602001808311610af157829003601f168201915b505050505091505090565b60006109b682600061288a565b6000610b306128d0565b6006015460ff16610b545760405163dc8d8db760e01b815260040160405180910390fd5b33610b5e816128f4565b83610b68816128f4565b610b7285856129aa565b95945050505050565b6000806000610b886129c2565b91509150610bd4610b97612ac5565b610ba290600a61554a565b83610bab610c86565b610bb59190615559565b610bbf9190615559565b610bca836001615559565b8691906001612ae0565b949350505050565b6000610be781612b2f565b610bef612b39565b50565b60606000600080516020615c388339815191526002810180546040805160208084028201810190925282815293945060009084015b82821015610c7c576000848152602090819020604080516060810182526003860290920180546001600160a01b0316835260018082015484860152600290910154918301919091529083529092019101610c27565b5050505091505090565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace025490565b6000806000610cb86129c2565b915091506000610cc66128d0565b60070154610cd49084615559565b9050610cf58160008486610ce6610c86565b610cf09190615559565b612b44565b935050505090565b6000610d076128d0565b6006015460ff16610d2b5760405163dc8d8db760e01b815260040160405180910390fd5b33610d35816128f4565b84610d3f816128f4565b84610d49816128f4565b610d5285612b7a565b610d5d878787612bc8565b979650505050505050565b6000908152600080516020615bd8833981519152602052604090206001015490565b81610da857604051631fe1e13d60e11b815260040160405180910390fd5b610db28282612bec565b5050565b60007f0773e532dfede91f04b12a73d3d2acd361424f41f76b4fb79f090161e36b4e00610de1612ac5565b8154610df79190600160a01b900460ff1661556c565b91505090565b600080516020615bb883398151915282158015610e325750610e1d611930565b6001600160a01b0316826001600160a01b0316145b15610eb757600080610e42612285565b90925090506001600160a01b038216151580610e64575065ffffffffffff8116155b80610e7757504265ffffffffffff821610155b15610ea4576040516319ca5ebb60e01b815265ffffffffffff821660048201526024015b60405180910390fd5b5050805465ffffffffffff60a01b191681555b610ec18383612c0e565b505050565b7f0773e532dfede91f04b12a73d3d2acd361424f41f76b4fb79f090161e36b4e00546001600160a01b031690565b600080610eff6128d0565b80546001820154604051634f4f233360e11b815260048101919091529192506001600160a01b031690639e9e466690602401602060405180830381865afa158015610f4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f729190615593565b80610f8857506008810154600160a01b900460ff165b15610f965750600092915050565b610f9e612c41565b9392505050565b6001600160a01b037f0000000000000000000000001d7f221965e68475d44d1a8357f3211799b55e24163003610fee576040516327844c6960e11b815260040160405180910390fd5b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03166000811580156110335750825b90506000826001600160401b0316600114801561104f5750303b155b90508115801561105d575080155b1561107b5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff1916600117855583156110a557845460ff60401b1916600160401b1785555b6110ba6110b56020880188615093565b612c61565b7f271b4511ff4aaef63080ee912e106daf4730d4103103ece6b8945b8f63ee02496110e86020880188615093565b6040516001600160a01b03909116815260200160405180910390a161118f61111360208801886155b0565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506111559250505060408901896155b0565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612c7292505050565b7f1099e0381cc51a0e48f876169bdb9db942eb13641fd572c175c9c457c8861b136111bd60208801886155b0565b6040516111cb92919061561f565b60405180910390a17f9c2a4a58d55ab06d0ee30f916218eee44fe05a75841c6d46f3be938fa02d597861120160408801886155b0565b60405161120f92919061561f565b60405180910390a161121f612c84565b61124b61123461020088016101e08901615101565b61124661014089016101208a01615093565b612c94565b61131a61125b60c0880188615633565b808060200260200160405190810160405280939291908181526020016000905b828210156112a7576112986060830286013681900381019061567b565b8152602001906001019061127b565b50505050506112b4610ec6565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112f1573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131591906153f9565b612ca6565b61132b6113268761571c565b612cb8565b831561137257845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2906020015b60405180910390a15b505050505050565b7029a0a721aa24a7a729afa6a0a720a3a2a960791b61139881612b2f565b610db282612d12565b60008060006113ae6129c2565b9092509050610bd46113c1826001615559565b6113c9612ac5565b6113d490600a61554a565b846113dd610c86565b6113e79190615559565b6113f19190615559565b8691906000612ae0565b611403612609565b6a2322a2afa6a0a720a3a2a960a91b61141b81612b2f565b60006114256128d0565b90506000806114326129c2565b91509150600061145783856007015461144b9190615559565b60008486610ce6610c86565b90508060000361147a57604051637b2c2fef60e01b815260040160405180910390fd5b6000611484610ec6565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa1580156114ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ee91906153d1565b85546001870154604051632fdff5a360e11b81529293506000926001600160a01b0390921691635fbfeb469161152a9160040190815260200190565b602060405180830381865afa158015611547573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061156b91906158af565b90506115cf611578610ec6565b6040516001600160a01b0390911660248201526044810185905260640160408051601f198184030181529190526020810180516001600160e01b031663f3fef3a360e01b1790526001600160a01b03831690612d71565b50611655826115dc610ec6565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015611622573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061164691906153d1565b61165091906158cc565b612dde565b611663308760070154612e5e565b60006007870155611672610904565b866004018190555050505050505050610a546001600080516020615bf883398151915255565b672aa72820aaa9a2a960c11b6116ad81612b2f565b60006116b76128d0565b6008018054911515600160a01b0260ff60a01b1990921691909117905550565b60006116e16128d0565b60010154905090565b60006116f581612b2f565b610db282612e94565b600061170981612b2f565b610db282612f07565b652820aaa9a2a960d11b61172581612b2f565b60016116b76128d0565b6000611739612609565b33611743816128f4565b61174b6128d0565b60080154600160a01b900460ff16156117775760405163035edea360e41b815260040160405180910390fd5b83600003611798576040516365e52d5160e11b815260040160405180910390fd5b60006117a2612c41565b9050808511156117cb57838582604051633c8097d960e11b8152600401610e9b939291906158df565b60006117d5612f70565b90506000806117ec88846117e7610c86565b612fba565b915091508160000361181157604051630784f01960e01b815260040160405180910390fd5b61181a82612b7a565b61182733888a858561307b565b5093505050506109b66001600080516020615bf883398151915255565b6a2322a2afa6a0a720a3a2a960a91b61185c81612b2f565b60006118666128d0565b9050611870612f70565b6004820155610ec18361331a565b6001600160a01b03166000908152600080516020615b98833981519152602052604090205490565b6a2322a2afa6a0a720a3a2a960a91b6118be81612b2f565b610db2826118ca610ec6565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611907573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061192b91906153f9565b6133f9565b600080516020615c18833981519152546001600160a01b031690565b60006119566128d0565b60030154905090565b600061098c611930565b6000918252600080516020615bd8833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60006119ab6128d0565b6006015460ff16919050565b60006119c1612609565b336119cb816128f4565b6119d36128d0565b60080154600160a01b900460ff16156119ff5760405163035edea360e41b815260040160405180910390fd5b83600003611a20576040516365e52d5160e11b815260040160405180910390fd5b611a2984612b7a565b6000611a33612f70565b90506000611a3f610c86565b90506000611a4d83836136bb565b905080871115611a765785878260405163284ff66760e01b8152600401610e9b939291906158df565b600080611a848986866136fd565b9150915081600003611aa957604051630784f01960e01b815260040160405180910390fd5b611ab63389848c8561307b565b509450505050506109b66001600080516020615bf883398151915255565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace048054606091600080516020615b9883398151915291610a9590615416565b600080516020615c1883398151915254600090600160d01b900465ffffffffffff16600080516020615bb88339815191528115801590611b5b57504265ffffffffffff831610155b611b6757600080611b7d565b6001810154600160a01b900465ffffffffffff16825b92509250509091565b6000611b906128d0565b60020154905090565b611ba1614e59565b7ffdd5e928c3467d3da929a44639dde8d54e0576a04fec4ff333caa67a6f2433028054600080516020615c38833981519152919084908110611be557611be5615900565b600091825260209182902060408051606081018252600390930290910180546001600160a01b03168352600181015493830193909352600290920154918101919091529392505050565b6000611c396128d0565b6006015460ff16611c5d5760405163dc8d8db760e01b815260040160405180910390fd5b33611c67816128f4565b83611c71816128f4565b611c7a84612b7a565b610b728585613815565b6000806000611c916129c2565b915091506000611cb4858385611ca5610c86565b611caf9190615559565b6136fd565b5095945050505050565b6000611cc8612609565b33611cd2816128f4565b84600003611cf3576040516365e52d5160e11b815260040160405180910390fd5b6000611cfe84613823565b905080861115611d2757838682604051633fa733bb60e21b8152600401610e9b939291906158df565b6000611d31612f70565b90506000611d4988600184611d44610c86565b6138bf565b905080600003611d6c57604051630784f01960e01b815260040160405180910390fd5b611d7581612b7a565b611d823388888b856138ec565b9350505050610f9e6001600080516020615bf883398151915255565b6000611da86128d0565b546001600160a01b0316919050565b6000611dc1612609565b33611dcb816128f4565b84600003611dec576040516365e52d5160e11b815260040160405180910390fd5b611df585612b7a565b6000611dff612f70565b90506000611e0b610c86565b90506000611e1a868484613b6e565b905080881115611e4357858882604051632e52afbb60e21b8152600401610e9b939291906158df565b6000611e528960008686612b44565b905080600003611e7557604051630784f01960e01b815260040160405180910390fd5b611e82338989848d6138ec565b945050505050610f9e6001600080516020615bf883398151915255565b611ea7612609565b6c21a620a4a6afa6a0a720a3a2a960991b611ec181612b2f565b6000611ecb6128d0565b90506000611ed7610904565b82546001840154604051632fdff5a360e11b81529293506000926001600160a01b0390921691635fbfeb4691611f139160040190815260200190565b602060405180830381865afa158015611f30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f5491906158af565b9050611fb1611f61610ec6565b888888604051602401611f779493929190615916565b60408051601f198184030181529190526020810180516001600160e01b031663767081d160e01b1790526001600160a01b03831690612d71565b506000611fbc610904565b905080831115611fe9576040516388b8d67d60e01b81526004810184905260248101829052604401610e9b565b8083036120095760405163541ada2760e11b815260040160405180910390fd5b6001600160a01b0388167ffc30cddea38e2bf4d6ea7d3f9ed3b6ad7f176419f4963bd81318067a4aee73fe61203e85846158cc565b60405190815260200160405180910390a25050505050610ec16001600080516020615bf883398151915255565b6000806120766128d0565b80546001820154604051634f4f233360e11b815260048101919091529192506001600160a01b031690639e9e466690602401602060405180830381865afa1580156120c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120e99190615593565b806120ff57506008810154600160a01b900460ff165b1561210d5750600092915050565b610f9e612118610904565b612120610c86565b6136bb565b60006109b6826000613c36565b600080516020615c1883398151915254600090600080516020615bb883398151915290600160d01b900465ffffffffffff16801580159061217a57504265ffffffffffff8216105b612194578154600160d01b900465ffffffffffff166121a9565b6001820154600160a01b900465ffffffffffff165b9250505090565b6000806121bb6128d0565b80546001820154604051634f4f233360e11b815260048101919091529192506001600160a01b031690639e9e466690602401602060405180830381865afa15801561220a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061222e9190615593565b1561223c5750600092915050565b610f9e83613823565b600061224f612285565b509050336001600160a01b0382161461227d57604051636116401160e11b8152336004820152602401610e9b565b610bef613c73565b600080516020615bb8833981519152546001600160a01b03811691600160a01b90910465ffffffffffff1690565b816122d157604051631fe1e13d60e11b815260040160405180910390fd5b610db28282613d10565b60006122e681612b2f565b610bef613d2c565b6122f6614e59565b7ffdd5e928c3467d3da929a44639dde8d54e0576a04fec4ff333caa67a6f24330254600080516020615c388339815191529060005b818110156123da57846001600160a01b031683600201828154811061235257612352615900565b60009182526020909120600390910201546001600160a01b0316036123d25782600201818154811061238657612386615900565b600091825260209182902060408051606081018252600390930290910180546001600160a01b031683526001810154938301939093526002909201549181019190915295945050505050565b60010161232b565b50604051632e290d8760e21b81526001600160a01b0385166004820152602401610e9b565b60008061240a6128d0565b80546001820154604051634f4f233360e11b815260048101919091529192506001600160a01b031690639e9e466690602401602060405180830381865afa158015612459573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061247d9190615593565b1561248b5750600092915050565b610f9e83612497610904565b61249f610c86565b613b6e565b6001600160a01b0391821660009081527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace016020908152604080832093909416825291909152205490565b60006124f86128d0565b600801546001600160a01b0316919050565b60008060006125176129c2565b915091506000611cb485838561252b610c86565b6117e79190615559565b6a2322a2afa6a0a720a3a2a960a91b61254d81612b2f565b610db282613d37565b6000806125616128d0565b8054600182015460405163023aa9ab60e61b815260048101919091529192506001600160a01b031690638eaa6ac090602401602060405180830381865afa1580156125b0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df791906158af565b60006001600160e01b03198216637965db0b60e01b14806109b657506301ffc9a760e01b6001600160e01b03198316146109b6565b600080516020615bf883398151915280546001190161263b57604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b600080516020615c3883398151915280547ffdd5e928c3467d3da929a44639dde8d54e0576a04fec4ff333caa67a6f243301547ffdd5e928c3467d3da929a44639dde8d54e0576a04fec4ff333caa67a6f2433025460009081906126a3614e59565b60005b8281101561284c578760020181815481106126c3576126c3615900565b600091825260209182902060408051606081018252600390930290910180546001600160a01b0316835260018101549383019390935260029092015491810191909152915086156127a657600061273883602001518b600a612725919061554a565b612730906064615943565b8a9190613e16565b905080156127a4578251612757906001600160a01b038d169083613eda565b6127618187615559565b83516040518381529197506001600160a01b0316907f476a4dacd049a6bd4c92a8d77daf02092d5eb87000c942d526cb994585c5c4c99060200160405180910390a25b505b85156128445760006127d683604001518b600a6127c3919061554a565b6127ce906064615943565b899190613e16565b905080156128425782516127f5906001600160a01b038d169083613eda565b6127ff8186615559565b83516040518381529196506001600160a01b0316907fa020e4eff231c0579299eb7fae87f9cee68731ca8ab27f8437d3885c33313f259060200160405180910390a25b505b6001016126a6565b5061285784876158cc565b875561286383866158cc565b8760010181905550505050505050505050565b6001600080516020615bf883398151915255565b6000610f9e612897610904565b6128a2906001615559565b6128aa612ac5565b6128b590600a61554a565b6128bd610c86565b6128c79190615559565b85919085612ae0565b7f6bb5a2a0ae924c2ea94f037035a09f65614421e2a7d96c9bcbd59acdd32e600090565b60006128fe6128d0565b600801546001600160a01b031690508015801590612981575060405163df592f7d60e01b81526001600160a01b03838116600483015282169063df592f7d90602401602060405180830381865afa15801561295d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129819190615593565b15610db25760405163ae1427c160e01b81526001600160a01b0383166004820152602401610e9b565b6000336129b8818585613f39565b5060019392505050565b60008060006129cf6128d0565b90506129d9610904565b915060006129f4826004015484613f4690919063ffffffff16565b9150508015801590612a095750600382015415155b15612abf576000612aa18360030154612a20610ec6565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612a5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a8191906153f9565b612a8c90600a61554a565b612a97906064615943565b8491906000612ae0565b9050612abb816000612ab382886158cc565b611d44610c86565b9450505b50509091565b6000612acf6128d0565b60060154610100900460ff16919050565b600080612aee868686613e16565b9050612af983613f6c565b8015612b15575060008480612b1057612b1061595a565b868809115b15610b7257612b25600182615559565b9695505050505050565b610bef8133613f99565b610a54600080613fd2565b6000610b72612b54846001615559565b612b5c612ac5565b612b6790600a61554a565b612b719085615559565b87919087612ae0565b6000612b84612ac5565b905060ff811615610db2576000612b9c82600a61554a565b612ba69084615970565b1115610db257604051631562115760e21b815260048101839052602401610e9b565b600033612bd68582856140ad565b612be18585856140fa565b506001949350505050565b612bf582610d68565b612bfe81612b2f565b612c088383614159565b50505050565b6001600160a01b0381163314612c375760405163334bd91960e11b815260040160405180910390fd5b610ec182826141c8565b6000612c4b612556565b6001600160a01b031663402d267d610924610ec6565b612c69614221565b610bef8161426a565b612c7a614221565b610db282826142ee565b612c8c614221565b610a5461433f565b612c9c614221565b610db28282614347565b612cae614221565b610db282826143b0565b612cc0614221565b610bef816060015182608001518360a001518460e001518561010001518661020001518761014001518861016001518961018001518a6101a001518b6101c001518c61022001518d61024001516143c2565b80612d1b6128d0565b60080180546001600160a01b0319166001600160a01b0392831617905560405190821681527fb47193b090556b6d1d36f48b4299a6d170310487ba8ffd4cd5a69e4e0ac95a5f906020015b60405180910390a150565b6060600080846001600160a01b031684604051612d8e9190615984565b600060405180830381855af49150503d8060008114612dc9576040519150601f19603f3d011682016040523d82523d6000602084013e612dce565b606091505b5091509150610b7285838361449e565b7ffdd5e928c3467d3da929a44639dde8d54e0576a04fec4ff333caa67a6f2433018054600080516020615c38833981519152918391600090612e21908490615559565b90915550506040518281527fd7ce8685584f585bf40449b51d01a753c80397a4acf29cf86193d0136e0daba9906020015b60405180910390a15050565b6001600160a01b038216612e8857604051634b637e8f60e11b815260006004820152602401610e9b565b610db2826000836144fa565b6000612e9e612132565b612ea742614625565b612eb191906159a0565b9050612ebd828261465c565b60405165ffffffffffff821681526001600160a01b038316907f3377dc44241e779dd06afab5b788a35ca5f3b778836e2990bdb26a2a4b2e5ed69060200160405180910390a25050565b6000612f12826146e9565b612f1b42614625565b612f2591906159a0565b9050612f318282613fd2565b6040805165ffffffffffff8085168252831660208201527ff1038c18cf84a56e432fdbfaf746924b7ea511dfe03a6506a0ceba4888788d9b9101612e52565b600080612f7b6128d0565b90506000612f876129c2565b935090508015612fb557612f9b308261472c565b80826007016000828254612faf9190615559565b90915550505b505090565b6000806000612fc76128d0565b90506130588160020154612fd9610ec6565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015613016573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061303a91906153f9565b61304590600a61554a565b613050906064615943565b889190613e16565b915061307061306783886158cc565b600087876138bf565b925050935093915050565b6000613085610ec6565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa1580156130cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130ef91906153d1565b90506131046130fc610ec6565b873087614762565b61310e858461472c565b60006131186128d0565b90508060050154613127610c86565b10156131465760405163b086de1360e01b815260040160405180910390fd5b80546001820154604051632fdff5a360e11b815260048101919091526000916001600160a01b031690635fbfeb4690602401602060405180830381865afa158015613195573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131b991906158af565b90506132a36131c6610ec6565b85856131d0610ec6565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015613216573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061323a91906153d1565b61324491906158cc565b61324e91906158cc565b6040516001600160a01b039092166024830152604482015260640160408051601f198184030181529190526020810180516001600160e01b03166311f9fbc960e21b1790526001600160a01b03831690612d71565b506132ac610904565b60048301556132ba8461479b565b866001600160a01b0316886001600160a01b03167fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d78888604051613308929190918252602082015260400190565b60405180910390a35050505050505050565b613322610ec6565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561335f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061338391906153f9565b61338e90600a61554a565b613399906023615943565b8111156133bc5760405163ed171aeb60e01b815260048101829052602401610e9b565b806133c56128d0565b600301556040518181527f9b49d0cd76012d9c67241c2f68f836efbaf50ea29901a250040671402d5263f590602001612d66565b8151600080516020615c388339815191529060000361342b5760405163521299a960e01b815260040160405180910390fd5b613439600282016000614e83565b82516000908190815b818110156136185786818151811061345c5761345c615900565b602002602001015160200151846134739190615559565b935086818151811061348757613487615900565b6020026020010151604001518361349e9190615559565b925060006001600160a01b03168782815181106134bd576134bd615900565b6020026020010151600001516001600160a01b0316036134f057604051639fabe1c160e01b815260040160405180910390fd5b60006134fd826001615559565b90505b828110156135a65787818151811061351a5761351a615900565b6020026020010151600001516001600160a01b031688838151811061354157613541615900565b6020026020010151600001516001600160a01b03160361359e5787828151811061356d5761356d615900565b602090810291909101015151604051634b41b89360e11b81526001600160a01b039091166004820152602401610e9b565b600101613500565b50846002018782815181106135bd576135bd615900565b602090810291909101810151825460018082018555600094855293839020825160039092020180546001600160a01b0319166001600160a01b0390921691909117815591810151828401556040015160029091015501613442565b5061362485600a61554a565b61362f906064615943565b83146136515760405163a2e729d160e01b815260048101849052602401610e9b565b61365c85600a61554a565b613667906064615943565b8214613689576040516354a25f4f60e11b815260048101839052602401610e9b565b7fbadd5004db59fd88c7a4fcc2b3732279e901bd26a7962d21e9890cca923d76308460020160405161136991906159bf565b6000806136c6612c41565b90506136d560016000196158cc565b81036136f0576136e860016000196158cc565b9150506109b6565b610bd481600086866138bf565b600080600061370a6128d0565b6002810154909150600061371c610ec6565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015613759573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061377d91906153f9565b60ff16905060006137918960018a8a612b44565b905060006137a083600a615a2d565b6137aa9083615943565b90506000846137ba85600a615a2d565b6137c5906064615943565b6137cf91906158cc565b90506137df826064836001612ae0565b9750613805856137f086600a615a2d565b6137fb906064615943565b8a91906000612ae0565b9650505050505050935093915050565b6000336129b88185856140fa565b60006109b6613830612556565b6001600160a01b031663ce96cb77613846610ec6565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa15801561388a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138ae91906153d1565b6138ba6105d88561187e565b6147f3565b6000610b726138cc612ac5565b6138d790600a61554a565b6138e19084615559565b612b71856001615559565b826001600160a01b0316856001600160a01b031614613910576139108386836140ad565b61391a8382612e5e565b60006139246128d0565b80546001820154604051632fdff5a360e11b81529293506000926001600160a01b0390921691635fbfeb46916139609160040190815260200190565b602060405180830381865afa15801561397d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139a191906158af565b905060006139ad610ec6565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa1580156139f3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a1791906153d1565b9050613a7b613a24610ec6565b6040516001600160a01b0390911660248201526044810187905260640160408051601f198184030181529190526020810180516001600160e01b031663f3fef3a360e01b1790526001600160a01b03841690612d71565b50613b0a613a87610ec6565b8883613a91610ec6565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015613ad7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613afb91906153d1565b613b0591906158cc565b613eda565b613b12610904565b600484015560408051868152602081018690526001600160a01b03808916928a821692918c16917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a45050505050505050565b600080613b79612556565b6001600160a01b031663ce96cb77613b8f610ec6565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015613bd3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613bf791906153d1565b9050613c0660016000196158cc565b8103613c1d57613c158561187e565b915050610f9e565b610b72613c2d82600087876138bf565b6138ba8761187e565b6000610f9e613c43612ac5565b613c4e90600a61554a565b613c56610c86565b613c609190615559565b613c68610904565b6128c7906001615559565b600080516020615bb8833981519152600080613c8d612285565b91509150613ca28165ffffffffffff16151590565b1580613cb657504265ffffffffffff821610155b15613cde576040516319ca5ebb60e01b815265ffffffffffff82166004820152602401610e9b565b613cf06000613ceb611930565b6141c8565b50613cfc600083614159565b505081546001600160d01b03191690915550565b613d1982610d68565b613d2281612b2f565b612c0883836141c8565b610a5460008061465c565b613d3f610ec6565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015613d7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613da091906153f9565b613dab90600a61554a565b613db6906023615943565b811115613dd95760405163d163662960e01b815260048101829052602401610e9b565b80613de26128d0565b600201556040518181527f2147e2bc8c39e67f74b1a9e08896ea1485442096765942206af1f4bc8bcde91790602001612d66565b6000838302816000198587098281108382030391505080600003613e4d57838281613e4357613e4361595a565b0492505050610f9e565b808411613e6d5760405163227bc15360e01b815260040160405180910390fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b6040516001600160a01b03838116602483015260448201839052610ec191859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050614809565b610ec1838383600161486c565b60008083831115613f5c57506000905080613f65565b50600190508183035b9250929050565b60006002826003811115613f8257613f82615a39565b613f8c9190615a4f565b60ff166001149050919050565b613fa38282611969565b610db25760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610e9b565b600080516020615c1883398151915254600080516020615bb883398151915290600160d01b900465ffffffffffff16801561406f574265ffffffffffff8216101561404557600182015482546001600160d01b0316600160a01b90910465ffffffffffff16600160d01b0217825561406f565b6040517f2b1fa2edafe6f7b9e97c1a9e0c3660e645beb2dcaa2d45bdbf9beaf5472e1ec590600090a15b5060010180546001600160a01b0316600160a01b65ffffffffffff948516026001600160d01b031617600160d01b9290931691909102919091179055565b60006140b984846124a4565b90506000198114612c0857818110156140eb57828183604051637dc7a0d960e11b8152600401610e9b939291906158df565b612c088484848403600061486c565b6001600160a01b03831661412457604051634b637e8f60e11b815260006004820152602401610e9b565b6001600160a01b03821661414e5760405163ec442f0560e01b815260006004820152602401610e9b565b610ec18383836144fa565b6000600080516020615bb8833981519152836141be576000614179611930565b6001600160a01b0316146141a057604051631fe1e13d60e11b815260040160405180910390fd5b6001810180546001600160a01b0319166001600160a01b0385161790555b610bd48484614954565b6000600080516020615bb8833981519152831580156141ff57506141ea611930565b6001600160a01b0316836001600160a01b0316145b15614217576001810180546001600160a01b03191690555b610bd48484614a00565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff16610a5457604051631afcd79f60e31b815260040160405180910390fd5b614272614221565b7f0773e532dfede91f04b12a73d3d2acd361424f41f76b4fb79f090161e36b4e0060008061429f84614a7c565b91509150816142af5760126142b1565b805b83546001600160a81b031916600160a01b60ff92909216919091026001600160a01b031916176001600160a01b0394909416939093179091555050565b6142f6614221565b600080516020615b988339815191527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace036143308482615ab9565b5060048101612c088382615ab9565b612876614221565b61434f614221565b600080516020615bb88339815191526001600160a01b03821661438857604051636116401160e11b815260006004820152602401610e9b565b80546001600160d01b0316600160d01b65ffffffffffff851602178155612c08600083614159565b6143b8614221565b610db282826133f9565b6143ca614221565b6143d388614b58565b6143dc8961331a565b6143e58a613d37565b6143ee8c614bd3565b6143f78b614c60565b6144008d614d2e565b61440982612d12565b61441281614d7b565b61442a6a2322a2afa6a0a720a3a2a960a91b88614159565b506144497029a0a721aa24a7a729afa6a0a720a3a2a960791b87614159565b506144646c21a620a4a6afa6a0a720a3a2a960991b86614159565b50614478652820aaa9a2a960d11b85614159565b5061448e672aa72820aaa9a2a960c11b84614159565b5050505050505050505050505050565b6060826144b3576144ae82614db8565b610f9e565b81511580156144ca57506001600160a01b0384163b155b156144f357604051639996b31560e01b81526001600160a01b0385166004820152602401610e9b565b5080610f9e565b600080516020615b988339815191526001600160a01b038416614536578181600201600082825461452b9190615559565b909155506145959050565b6001600160a01b038416600090815260208290526040902054828110156145765784818460405163391434e360e21b8152600401610e9b939291906158df565b6001600160a01b03851660009081526020839052604090209083900390555b6001600160a01b0383166145b35760028101805483900390556145d2565b6001600160a01b03831660009081526020829052604090208054830190555b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161461791815260200190565b60405180910390a350505050565b600065ffffffffffff821115614658576040516306dfcc6560e41b81526030600482015260248101839052604401610e9b565b5090565b600080516020615bb88339815191526000614675612285565b835465ffffffffffff8616600160a01b026001600160d01b03199091166001600160a01b0388161717845591506146b590508165ffffffffffff16151590565b15612c08576040517f8886ebfc4259abdbc16601dd8fb5678e54878f47b3c34836cfc51154a960510990600090a150505050565b6000806146f4612132565b90508065ffffffffffff168365ffffffffffff1611614717576144ae8382615b78565b610f9e65ffffffffffff8416620697806147f3565b6001600160a01b0382166147565760405163ec442f0560e01b815260006004820152602401610e9b565b610db2600083836144fa565b6040516001600160a01b038481166024830152838116604483015260648201839052612c089186918216906323b872dd90608401613f07565b600080516020615c388339815191528054829082906000906147be908490615559565b90915550506040518281527fc8891b429f51b964c41c037370eaa5d4cb3d57c748e1569200de5fb0f37acb3b90602001612e52565b60008183106148025781610f9e565b5090919050565b600061481e6001600160a01b03841683614de1565b905080516000141580156148435750808060200190518101906148419190615593565b155b15610ec157604051635274afe760e01b81526001600160a01b0384166004820152602401610e9b565b600080516020615b988339815191526001600160a01b0385166148a55760405163e602df0560e01b815260006004820152602401610e9b565b6001600160a01b0384166148cf57604051634a1406b160e11b815260006004820152602401610e9b565b6001600160a01b0380861660009081526001830160209081526040808320938816835292905220839055811561494d57836001600160a01b0316856001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258560405161494491815260200190565b60405180910390a35b5050505050565b6000600080516020615bd883398151915261496f8484611969565b6149ef576000848152602082815260408083206001600160a01b03871684529091529020805460ff191660011790556149a53390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a460019150506109b6565b60009150506109b6565b5092915050565b6000600080516020615bd8833981519152614a1b8484611969565b156149ef576000848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a460019150506109b6565b60408051600481526024810182526020810180516001600160e01b031663313ce56760e01b17905290516000918291829182916001600160a01b03871691614ac391615984565b600060405180830381855afa9150503d8060008114614afe576040519150601f19603f3d011682016040523d82523d6000602084013e614b03565b606091505b5091509150818015614b1757506020815110155b15614b4b57600081806020019051810190614b3291906153d1565b905060ff8111614b49576001969095509350505050565b505b5060009485945092505050565b601760ff82161115614b8257604051631a042a9b60e11b815260ff82166004820152602401610e9b565b80614b8b6128d0565b600601805461ff00191661010060ff9384160217905560405190821681527fcae26de0225f46c9b6b05447dde633b5ec259388f11315f1f36dfe6205ff72c990602001612d66565b6000614bdd6128d0565b9050816001600160a01b03163b600003614c155760405163247e970160e01b81526001600160a01b0383166004820152602401610e9b565b80546001600160a01b0319166001600160a01b03831690811782556040519081527f5f61862de0422698d021adb6e8b65fd7edf95fe9d5840b3ffce3f020f62a86e390602001612e52565b6000614c6a6128d0565b805460405163da815abf60e01b8152600481018590529192506001600160a01b03169063da815abf90602401602060405180830381865afa158015614cb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614cd79190615593565b614cf7576040516303dbaa6560e31b815260048101839052602401610e9b565b600181018290556040518281527f89ba13bd0c39f5657fbebb3c7cc5a7bb264dc1f030c56b275381bb7dd810eb5c90602001612e52565b80614d376128d0565b600601805460ff191691151591909117905560405181151581527f34d27d83cc2d5a6f14e25903bef0a84bf83160f3da4cc5a19dbb121be47c099390602001612d66565b80614d846128d0565b600501556040518181527f1f19296f2755837d126ad32268eb42dcf2a74bde8c16a97c93faba80aacc02d090602001612d66565b805115614dc85780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6060610f9e8383600084600080856001600160a01b03168486604051614e079190615984565b60006040518083038185875af1925050503d8060008114614e44576040519150601f19603f3d011682016040523d82523d6000602084013e614e49565b606091505b5091509150612b2586838361449e565b604051806060016040528060006001600160a01b0316815260200160008152602001600081525090565b5080546000825560030290600052602060002090810190610bef91905b808211156146585780546001600160a01b03191681556000600182018190556002820155600301614ea0565b600060208284031215614ede57600080fd5b81356001600160e01b031981168114610f9e57600080fd5b60005b83811015614f11578181015183820152602001614ef9565b50506000910152565b6020815260008251806020840152614f39816040850160208701614ef6565b601f01601f19169190910160400192915050565b600060208284031215614f5f57600080fd5b5035919050565b6001600160a01b0381168114610bef57600080fd5b8035614f8681614f66565b919050565b60008060408385031215614f9e57600080fd5b8235614fa981614f66565b946020939093013593505050565b6020808252825182820181905260009190848201906040850190845b818110156150165761500383855180516001600160a01b0316825260208082015190830152604090810151910152565b9284019260609290920191600101614fd3565b50909695505050505050565b60008060006060848603121561503757600080fd5b833561504281614f66565b9250602084013561505281614f66565b929592945050506040919091013590565b6000806040838503121561507657600080fd5b82359150602083013561508881614f66565b809150509250929050565b6000602082840312156150a557600080fd5b8135610f9e81614f66565b6000602082840312156150c257600080fd5b81356001600160401b038111156150d857600080fd5b82016102608185031215610f9e57600080fd5b803565ffffffffffff81168114614f8657600080fd5b60006020828403121561511357600080fd5b610f9e826150eb565b634e487b7160e01b600052604160045260246000fd5b60405161026081016001600160401b03811182821017156151555761515561511c565b60405290565b604051601f8201601f191681016001600160401b03811182821017156151835761518361511c565b604052919050565b60006060828403121561519d57600080fd5b604051606081018181106001600160401b03821117156151bf576151bf61511c565b60405290508082356151d081614f66565b8082525060208301356020820152604083013560408201525092915050565b600082601f83011261520057600080fd5b813560206001600160401b0382111561521b5761521b61511c565b61522a60208360051b0161515b565b80838252602082019150606060206060860288010194508785111561524e57600080fd5b602087015b8581101561527257615265898261518b565b8452928401928101615253565b5090979650505050505050565b60006020828403121561529157600080fd5b81356001600160401b038111156152a757600080fd5b610bd4848285016151ef565b81516001600160a01b031681526020808301519082015260408083015190820152606081016109b6565b6000806000606084860312156152f257600080fd5b83359250602084013561530481614f66565b9150604084013561531481614f66565b809150509250925092565b60008060006040848603121561533457600080fd5b833561533f81614f66565b925060208401356001600160401b038082111561535b57600080fd5b818601915086601f83011261536f57600080fd5b81358181111561537e57600080fd5b87602082850101111561539057600080fd5b6020830194508093505050509250925092565b600080604083850312156153b657600080fd5b82356153c181614f66565b9150602083013561508881614f66565b6000602082840312156153e357600080fd5b5051919050565b60ff81168114610bef57600080fd5b60006020828403121561540b57600080fd5b8151610f9e816153ea565b600181811c9082168061542a57607f821691505b60208210810361544a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600181815b808511156154a157816000190482111561548757615487615450565b8085161561549457918102915b93841c939080029061546b565b509250929050565b6000826154b8575060016109b6565b816154c5575060006109b6565b81600181146154db57600281146154e557615501565b60019150506109b6565b60ff8411156154f6576154f6615450565b50506001821b6109b6565b5060208310610133831016604e8410600b8410161715615524575081810a6109b6565b61552e8383615466565b806000190482111561554257615542615450565b029392505050565b6000610f9e60ff8416836154a9565b808201808211156109b6576109b6615450565b60ff81811683821601908111156109b6576109b6615450565b8015158114610bef57600080fd5b6000602082840312156155a557600080fd5b8151610f9e81615585565b6000808335601e198436030181126155c757600080fd5b8301803591506001600160401b038211156155e157600080fd5b602001915036819003821315613f6557600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b602081526000610bd46020830184866155f6565b6000808335601e1984360301811261564a57600080fd5b8301803591506001600160401b0382111561566457600080fd5b6020019150606081023603821315613f6557600080fd5b60006060828403121561568d57600080fd5b610f9e838361518b565b600082601f8301126156a857600080fd5b81356001600160401b038111156156c1576156c161511c565b6156d4601f8201601f191660200161515b565b8181528460208386010111156156e957600080fd5b816020850160208301376000918101602001919091529392505050565b8035614f8681615585565b8035614f86816153ea565b6000610260823603121561572f57600080fd5b615737615132565b61574083614f7b565b815260208301356001600160401b038082111561575c57600080fd5b61576836838701615697565b6020840152604085013591508082111561578157600080fd5b61578d36838701615697565b604084015261579e60608601615706565b60608401526157af60808601614f7b565b608084015260a085013560a084015260c08501359150808211156157d257600080fd5b506157df368286016151ef565b60c08301525060e083013560e0820152610100808401358183015250610120615809818501614f7b565b9082015261014061581b848201614f7b565b9082015261016061582d848201614f7b565b9082015261018061583f848201614f7b565b908201526101a0615851848201614f7b565b908201526101c0615863848201614f7b565b908201526101e06158758482016150eb565b90820152610200615887848201615711565b90820152610220615899848201614f7b565b9082015261024092830135928101929092525090565b6000602082840312156158c157600080fd5b8151610f9e81614f66565b818103818111156109b6576109b6615450565b6001600160a01b039390931683526020830191909152604082015260600190565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b03858116825284166020820152606060408201819052600090612b2590830184866155f6565b80820281158282048414176109b6576109b6615450565b634e487b7160e01b600052601260045260246000fd5b60008261597f5761597f61595a565b500690565b60008251615996818460208701614ef6565b9190910192915050565b65ffffffffffff8181168382160190808211156149f9576149f9615450565b60006020808301602084528085548083526040925060408601915086600052602060002060005b82811015615a205781546001600160a01b0316845260018281015487860152600283015486860152606090940193600390920191016159e6565b5091979650505050505050565b6000610f9e83836154a9565b634e487b7160e01b600052602160045260246000fd5b600060ff831680615a6257615a6261595a565b8060ff84160691505092915050565b601f821115610ec1576000816000526020600020601f850160051c81016020861015615a9a5750805b601f850160051c820191505b8181101561137257828155600101615aa6565b81516001600160401b03811115615ad257615ad261511c565b615ae681615ae08454615416565b84615a71565b602080601f831160018114615b1b5760008415615b035750858301515b600019600386901b1c1916600185901b178555611372565b600085815260208120601f198616915b82811015615b4a57888601518255948401946001909101908401615b2b565b5085821015615b685787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b65ffffffffffff8281168282160390808211156149f9576149f961545056fe52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00eef3dac4538c82c8ace4063ab0acd2d15cdb5883aa1dff7c2673abb3d869840002dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00eef3dac4538c82c8ace4063ab0acd2d15cdb5883aa1dff7c2673abb3d8698401fdd5e928c3467d3da929a44639dde8d54e0576a04fec4ff333caa67a6f243300a2646970667358221220cb4a77ca17b133790f47545e57f55748c0c489d4a64f7df21e3348c883b2b7f464736f6c63430008160033
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.