ERC-20
Overview
Max Total Supply
495,310.4265327852844538 ERC20 ***
Holders
28
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Balance
24.793317069384387008 ERC20 ***Value
$0.00Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
HighTableVault
Compiler Version
v0.8.16+commit.07a7930e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// contracts/HighTableVault.sol // SPDX-License-Identifier: BUSL // Teahouse Finance pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeCast.sol"; import "./IHighTableVault.sol"; /// @title An investment vault for working with TeaVaultV2 /// @author Teahouse Finance contract HighTableVault is IHighTableVault, AccessControl, ERC20 { using SafeERC20 for IERC20; uint256 public constant SECONDS_IN_A_YEAR = 365 * 86400; // for calculating management fee bytes32 public constant AUDITOR_ROLE = keccak256("AUDITOR_ROLE"); IERC20 internal immutable assetToken; FeeConfig public feeConfig; FundConfig public fundConfig; address[] public nftEnabled; GlobalState public globalState; mapping(uint32 => CycleState) public cycleState; mapping(address => UserState) public userState; Price public initialPrice; // initial price Price public closePrice; // price after fund is closed /// @param _name name of the vault token /// @param _symbol symbol of the vault token /// @param _asset address of the asset token /// @param _priceNumerator initial price for each vault token in asset token /// @param _priceDenominator price denominator (actual price = _initialPrice / _priceDenominator) /// @param _startTimestamp starting timestamp of the first cycle /// @param _initialAdmin address of the initial admin /// @notice To setup a HighTableVault, the procedure should be /// @notice 1. Deploy HighTableVault /// @notice 2. Set FeeConfig /// @notice 3. (optionally) Deploy TeaVaultV2 /// @notice 4. Set TeaVaultV2's investor to HighTableVault /// @notice 5. Set TeaVaultV2 address (setTeaVaultV2) /// @notice 6. Grant auditor role to an address (grantRole) /// @notice 7. Set fund locking timestamp for initial cycle (setFundLockingTimestamp) /// @notice 8. Set deposit limit for initial cycle (setDepositLimit) /// @notice 9. Set enabled NFT list, or disable NFT check (setEnabledNFTs or setDisableNFTChecks) /// @notice 10. Users will be able to request deposits /// @notice On initial price: the vault token has 18 decimals, so if the asset token is not 18 decimals, /// @notice should take extra care in setting the initial price. /// @notice For example, if using USDC (has 6 decimals), and want to have 1:1 inital price, /// @notice the initial price should be numerator = 1_000_000 and denominator = 1_000_000_000_000_000_000. constructor( string memory _name, string memory _symbol, address _asset, uint128 _priceNumerator, uint128 _priceDenominator, uint64 _startTimestamp, address _initialAdmin) ERC20(_name, _symbol) { if (_priceNumerator == 0 || _priceDenominator == 0) revert InvalidInitialPrice(); _grantRole(DEFAULT_ADMIN_ROLE, _initialAdmin); assetToken = IERC20(_asset); initialPrice = Price(_priceNumerator, _priceDenominator); globalState.cycleStartTimestamp = _startTimestamp; emit FundInitialized(msg.sender, _priceNumerator, _priceDenominator, _startTimestamp, _initialAdmin); } /// @inheritdoc IHighTableVault function setEnabledNFTs(address[] calldata _nfts) external override { if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert OnlyAvailableToAdmins(); nftEnabled = _nfts; emit NFTEnabled(msg.sender, globalState.cycleIndex, _nfts); } /// @inheritdoc IHighTableVault function setDisableNFTChecks(bool _checks) external override { if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert OnlyAvailableToAdmins(); fundConfig.disableNFTChecks = _checks; emit DisableNFTChecks(msg.sender, globalState.cycleIndex, _checks); } /// @inheritdoc IHighTableVault function setFeeConfig(FeeConfig calldata _feeConfig) external override { if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert OnlyAvailableToAdmins(); if (_feeConfig.managerEntryFee + _feeConfig.platformEntryFee + _feeConfig.managerExitFee + _feeConfig.platformExitFee > 1000000) revert InvalidFeePercentage(); if (_feeConfig.managerPerformanceFee + _feeConfig.platformPerformanceFee > 1000000) revert InvalidFeePercentage(); if (_feeConfig.managerManagementFee + _feeConfig.platformManagementFee > 1000000) revert InvalidFeePercentage(); feeConfig = _feeConfig; emit FeeConfigChanged(msg.sender, globalState.cycleIndex, _feeConfig); } /// @inheritdoc IHighTableVault function setTeaVaultV2(address _teaVaultV2) external override { if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert OnlyAvailableToAdmins(); fundConfig.teaVaultV2 = ITeaVaultV2(_teaVaultV2); emit UpdateTeaVaultV2(msg.sender, globalState.cycleIndex, _teaVaultV2); } /// @inheritdoc IHighTableVault /// @dev Does not use nonReentrant because it can only be called from auditors function enterNextCycle( uint32 _cycleIndex, uint128 _fundValue, uint128 _depositLimit, uint128 _withdrawAmount, uint64 _cycleStartTimestamp, uint64 _fundingLockTimestamp, bool _closeFund) external override returns (uint256 platformFee, uint256 managerFee) { // withdraw from vault if (_withdrawAmount > 0) { fundConfig.teaVaultV2.withdraw(address(this), address(assetToken), _withdrawAmount); } // permission checks are done in the internal function (platformFee, managerFee) = _internalEnterNextCycle(_cycleIndex, _fundValue, _depositLimit, _cycleStartTimestamp, _fundingLockTimestamp, _closeFund); // distribute fees if (platformFee > 0) { assetToken.safeTransfer(feeConfig.platformVault, platformFee); } if (managerFee > 0) { assetToken.safeTransfer(feeConfig.managerVault, managerFee); } // check if the remaining balance is enough for locked assets // and deposit extra balance back to the vault uint256 deposits = _internalCheckDeposits(); if (deposits > 0) { assetToken.safeApprove(address(fundConfig.teaVaultV2), deposits); fundConfig.teaVaultV2.deposit(address(assetToken), deposits); } } /// @inheritdoc IHighTableVault function previewNextCycle(uint128 _fundValue, uint64 _timestamp) external override view returns (uint256 withdrawAmount) { if (globalState.cycleIndex > 0) { // calculate performance and management fees (uint256 pFee, uint256 mFee) = _calculatePMFees(_fundValue, _timestamp); withdrawAmount += pFee + mFee; } uint32 cycleIndex = globalState.cycleIndex; // convert total withdrawals to assets if (cycleState[cycleIndex].requestedWithdrawals > 0) { // if requestedWithdrawals > 0, there must be some remaining shares so totalSupply() won't be zero uint256 fundValueAfterPMFee = _fundValue - withdrawAmount; withdrawAmount += uint256(cycleState[cycleIndex].requestedWithdrawals) * fundValueAfterPMFee / totalSupply(); } if (cycleState[cycleIndex].requestedDeposits > 0) { uint256 requestedDeposits = cycleState[cycleIndex].requestedDeposits; uint256 platformFee = requestedDeposits * feeConfig.platformEntryFee / 1000000; uint256 managerFee = requestedDeposits * feeConfig.managerEntryFee / 1000000; withdrawAmount += platformFee + managerFee; if (withdrawAmount > requestedDeposits) { withdrawAmount -= requestedDeposits; } else { withdrawAmount = 0; } } } /// @inheritdoc IHighTableVault function setFundLockingTimestamp(uint64 _fundLockingTimestamp) external override { if (!hasRole(AUDITOR_ROLE, msg.sender)) revert OnlyAvailableToAuditors(); globalState.fundingLockTimestamp = _fundLockingTimestamp; emit FundLockingTimestampUpdated(msg.sender, globalState.cycleIndex, _fundLockingTimestamp); } /// @inheritdoc IHighTableVault function setDepositLimit(uint128 _depositLimit) external override { if (!hasRole(AUDITOR_ROLE, msg.sender)) revert OnlyAvailableToAuditors(); globalState.depositLimit = _depositLimit; emit DepositLimitUpdated(msg.sender, globalState.cycleIndex, _depositLimit); } /// @inheritdoc IHighTableVault function setDisableFunding(bool _disableDepositing, bool _disableWithdrawing, bool _disableCancelDepositing, bool _disableCancelWithdrawing) external override { if (!hasRole(AUDITOR_ROLE, msg.sender)) revert OnlyAvailableToAuditors(); fundConfig.disableDepositing = _disableDepositing; fundConfig.disableWithdrawing = _disableWithdrawing; fundConfig.disableCancelDepositing = _disableCancelDepositing; fundConfig.disableCancelWithdrawing = _disableCancelWithdrawing; emit FundingChanged(msg.sender, globalState.cycleIndex, _disableDepositing, _disableWithdrawing, _disableCancelDepositing, _disableCancelWithdrawing); } /// @inheritdoc IHighTableVault /// @dev No need for nonReentrant because there is no danger of reentrance attack /// @dev since there is no checking nor recording of amount of assets function depositToVault(uint256 _value) external override { if (!hasRole(AUDITOR_ROLE, msg.sender)) revert OnlyAvailableToAuditors(); uint256 balance = assetToken.balanceOf(address(this)); if (balance - globalState.lockedAssets < _value) revert NotEnoughAssets(); assetToken.safeApprove(address(fundConfig.teaVaultV2), _value); fundConfig.teaVaultV2.deposit(address(assetToken), _value); emit DepositToVault(msg.sender, globalState.cycleIndex, address(fundConfig.teaVaultV2), _value); } /// @inheritdoc IHighTableVault /// @dev No need for nonReentrant because there is no danger of reentrance attack /// @dev since there is no checking nor recording of amount of assets function withdrawFromVault(uint256 _value) external override { if (!hasRole(AUDITOR_ROLE, msg.sender)) revert OnlyAvailableToAuditors(); fundConfig.teaVaultV2.withdraw(address(this), address(assetToken), _value); emit WithdrawFromVault(msg.sender, globalState.cycleIndex, address(fundConfig.teaVaultV2), _value); } /// @inheritdoc IHighTableVault function asset() external override view returns (address assetTokenAddress) { return address(assetToken); } /// @inheritdoc IHighTableVault /// @dev No need for nonReentrant because there is no danger of reentrance attack /// @dev since recording of deposited assets happens after receiving assets /// @dev and assetToken has to be attacked in some way to perform reentrance function requestDeposit(uint256 _assets, address _receiver) public override { assetToken.safeTransferFrom(msg.sender, address(this), _assets); _internalRequestDeposit(_assets, _receiver); } /// @inheritdoc IHighTableVault /// @dev No need for nonReentrant because there is no danger of reentrance attack /// @dev since recording of deposited assets happens after receiving assets /// @dev and assetToken has to be attacked in some way to perform reentrance function claimAndRequestDeposit(uint256 _assets, address _receiver) external override returns (uint256 assets) { assets = claimOwedAssets(msg.sender); requestDeposit(_assets, _receiver); } /// @inheritdoc IHighTableVault /// @dev No need for nonReentrant because there is no danger of reentrance attack /// @dev since removing of deposited assets happens before receiving assets /// @dev and assetToken has to be attacked in some way to perform reentrance function cancelDeposit(uint256 _assets, address _receiver) external override { _internalCancelDeposit(_assets, _receiver); assetToken.safeTransfer(_receiver, _assets); } /// @inheritdoc IHighTableVault /// @dev No need for nonReentrant because this function does not call other contracts function requestWithdraw(uint256 _shares, address _owner) public override { if (fundConfig.disableWithdrawing) revert WithdrawDisabled(); if (globalState.fundClosed) revert FundIsClosed(); if (block.timestamp > globalState.fundingLockTimestamp) revert FundingLocked(); if (_owner != msg.sender) { _spendAllowance(_owner, msg.sender, _shares); } _transfer(_owner, address(this), _shares); uint32 cycleIndex = globalState.cycleIndex; uint128 shares = SafeCast.toUint128(_shares); cycleState[cycleIndex].requestedWithdrawals += shares; // if user has previously requested deposits or withdrawals, convert them _convertPreviousRequests(_owner); userState[_owner].requestedWithdrawals += shares; userState[_owner].requestCycleIndex = cycleIndex; emit WithdrawalRequested(msg.sender, cycleIndex, _owner, _shares); } /// @inheritdoc IHighTableVault /// @dev No need for nonReentrant because this function does not call other contracts function claimAndRequestWithdraw(uint256 _shares, address _owner) external override returns (uint256 shares) { shares = claimOwedShares(msg.sender); requestWithdraw(_shares, _owner); } /// @inheritdoc IHighTableVault /// @dev No need for nonReentrant because this function does not call other contracts function cancelWithdraw(uint256 _shares, address _receiver) external override { if (block.timestamp > globalState.fundingLockTimestamp) revert FundingLocked(); if (fundConfig.disableCancelWithdrawing) revert CancelWithdrawDisabled(); uint32 cycleIndex = globalState.cycleIndex; if (userState[msg.sender].requestCycleIndex != cycleIndex) revert NotEnoughWithdrawals(); if (userState[msg.sender].requestedWithdrawals < _shares) revert NotEnoughWithdrawals(); uint128 shares = SafeCast.toUint128(_shares); cycleState[cycleIndex].requestedWithdrawals -= shares; userState[msg.sender].requestedWithdrawals -= shares; _transfer(address(this), _receiver, _shares); emit WithdrawalCanceled(msg.sender, cycleIndex, _receiver, _shares); } /// @inheritdoc IHighTableVault function requestedFunds(address _owner) external override view returns (uint256 assets, uint256 shares) { if (userState[_owner].requestCycleIndex != globalState.cycleIndex) { return (0, 0); } assets = userState[_owner].requestedDeposits; shares = userState[_owner].requestedWithdrawals; } /// @inheritdoc IHighTableVault /// @dev No need for nonReentrant because there is no danger of reentrance attack /// @dev since owed assets are cleared before sending out /// @dev and assetToken has to be attacked in some way to perform reentrance function claimOwedAssets(address _receiver) public override returns (uint256 assets) { assets = _internalClaimOwedAssets(_receiver); if (assets > 0) { assetToken.safeTransfer(_receiver, assets); } } /// @inheritdoc IHighTableVault /// @dev No need for nonReentrant because this function does not call other contracts function claimOwedShares(address _receiver) public override returns (uint256 shares) { _convertPreviousRequests(msg.sender); if (userState[msg.sender].owedShares > 0) { shares = userState[msg.sender].owedShares; userState[msg.sender].owedShares = 0; _transfer(address(this), _receiver, shares); emit ClaimOwedShares(msg.sender, _receiver, shares); } } /// @inheritdoc IHighTableVault function claimOwedFunds(address _receiver) external override returns (uint256 assets, uint256 shares) { assets = claimOwedAssets(_receiver); shares = claimOwedShares(_receiver); } /// @inheritdoc IHighTableVault function closePosition(uint256 _shares, address _owner) public override returns (uint256 assets) { if (!globalState.fundClosed) revert FundIsNotClosed(); if (_owner != msg.sender) { _spendAllowance(_owner, msg.sender, _shares); } _burn(_owner, _shares); // closePrice.denominator is the remaining amount of shares when the fund is closed // so if it's zero, no one would have any remaining shares to call closePosition assets = _shares * closePrice.numerator / closePrice.denominator; userState[_owner].owedAssets += SafeCast.toUint128(assets); } /// @inheritdoc IHighTableVault function closePositionAndClaim(address _receiver) external override returns (uint256 assets) { claimOwedShares(msg.sender); uint256 shares = balanceOf(msg.sender); closePosition(shares, msg.sender); assets = claimOwedAssets(_receiver); } /// @notice Internal function for entering next cycle function _internalEnterNextCycle( uint32 _cycleIndex, uint128 _fundValue, uint128 _depositLimit, uint64 _cycleStartTimestamp, uint64 _fundingLockTimestamp, bool _closeFund) internal returns (uint256 platformFee, uint256 managerFee) { if (!hasRole(AUDITOR_ROLE, msg.sender)) revert OnlyAvailableToAuditors(); if (address(fundConfig.teaVaultV2) == address(0)) revert IncorrectVaultAddress(); if (feeConfig.platformVault == address(0)) revert IncorrectVaultAddress(); if (feeConfig.managerVault == address(0)) revert IncorrectVaultAddress(); if (globalState.fundClosed) revert FundIsClosed(); if (_cycleIndex != globalState.cycleIndex) revert IncorrectCycleIndex(); if (_cycleStartTimestamp <= globalState.cycleStartTimestamp || _cycleStartTimestamp > block.timestamp) revert IncorrectCycleStartTimestamp(); // record current cycle state cycleState[_cycleIndex].totalFundValue = _fundValue; uint256 pFee; uint256 mFee; if (_cycleIndex > 0) { // distribute performance and management fees (pFee, mFee) = _calculatePMFees(_fundValue, _cycleStartTimestamp); platformFee += pFee; managerFee += mFee; } uint256 fundValueAfterPMFees = _fundValue - platformFee - managerFee; uint256 currentTotalSupply = totalSupply(); if (currentTotalSupply > 0 && fundValueAfterPMFees == 0) revert InvalidFundValue(); if (currentTotalSupply == 0 && cycleState[_cycleIndex].requestedDeposits == 0) revert NoDeposits(); (pFee, mFee) = _processRequests(fundValueAfterPMFees); platformFee += pFee; managerFee += mFee; if (_closeFund) { // calculate exit fees for all remaining funds (pFee, mFee) = _calculateCloseFundFees(); platformFee += pFee; managerFee += mFee; // set price for closing position uint128 finalFundValue = SafeCast.toUint128(cycleState[globalState.cycleIndex].fundValueAfterRequests - pFee - mFee); closePrice = Price(finalFundValue, SafeCast.toUint128(totalSupply())); globalState.lockedAssets += finalFundValue; globalState.fundClosed = true; } if (currentTotalSupply == 0) { emit EnterNextCycle( msg.sender, _cycleIndex, _fundValue, initialPrice.numerator, initialPrice.denominator, _depositLimit, _cycleStartTimestamp, _fundingLockTimestamp, _closeFund, platformFee, managerFee); } else { emit EnterNextCycle( msg.sender, _cycleIndex, _fundValue, fundValueAfterPMFees, currentTotalSupply, _depositLimit, _cycleStartTimestamp, _fundingLockTimestamp, _closeFund, platformFee, managerFee); } // enter next cycle globalState.cycleIndex ++; globalState.cycleStartTimestamp = _cycleStartTimestamp; globalState.depositLimit = _depositLimit; globalState.fundingLockTimestamp = _fundingLockTimestamp; } /// @notice Interal function for checking if the remaining balance is enough for locked assets function _internalCheckDeposits() internal view returns (uint256 deposits) { deposits = assetToken.balanceOf(address(this)); if (deposits < globalState.lockedAssets) revert NotEnoughAssets(); unchecked { deposits = deposits - globalState.lockedAssets; } } /// @notice Calculate performance and management fees function _calculatePMFees(uint128 _fundValue, uint64 _timestamp) internal view returns (uint256 platformFee, uint256 managerFee) { // calculate management fees uint256 fundValue = _fundValue; uint64 timeDiff = _timestamp - globalState.cycleStartTimestamp; unchecked { platformFee = fundValue * feeConfig.platformManagementFee * timeDiff / (SECONDS_IN_A_YEAR * 1000000); managerFee = fundValue * feeConfig.managerManagementFee * timeDiff / (SECONDS_IN_A_YEAR * 1000000); } // calculate and distribute performance fees if (fundValue > cycleState[globalState.cycleIndex - 1].fundValueAfterRequests) { unchecked { uint256 profits = fundValue - cycleState[globalState.cycleIndex - 1].fundValueAfterRequests; platformFee += profits * feeConfig.platformPerformanceFee / 1000000; managerFee += profits * feeConfig.managerPerformanceFee / 1000000; } } } /// @notice Calculate exit fees when closing fund function _calculateCloseFundFees() internal view returns (uint256 platformFee, uint256 managerFee) { // calculate exit fees for remaining funds uint256 fundValue = cycleState[globalState.cycleIndex].fundValueAfterRequests; unchecked { platformFee = fundValue * feeConfig.platformExitFee / 1000000; managerFee = fundValue * feeConfig.managerExitFee / 1000000; } } /// @notice Process requested withdrawals and deposits function _processRequests(uint256 _fundValueAfterPMFees) internal returns (uint256 platformFee, uint256 managerFee) { uint32 cycleIndex = globalState.cycleIndex; uint256 currentTotalSupply = totalSupply(); uint256 fundValueAfterRequests = _fundValueAfterPMFees; // convert total withdrawals to assets and calculate exit fees if (cycleState[cycleIndex].requestedWithdrawals > 0) { // if requestedWithdrawals > 0, there must be some remaining shares so totalSupply() won't be zero uint256 withdrawnAssets = _fundValueAfterPMFees * cycleState[cycleIndex].requestedWithdrawals / currentTotalSupply; uint256 pFee; uint256 mFee; unchecked { pFee = withdrawnAssets * feeConfig.platformExitFee / 1000000; mFee = withdrawnAssets * feeConfig.managerExitFee / 1000000; } // record remaining assets available for withdrawals cycleState[cycleIndex].convertedWithdrawals = SafeCast.toUint128(withdrawnAssets - pFee - mFee); globalState.lockedAssets += cycleState[cycleIndex].convertedWithdrawals; fundValueAfterRequests -= SafeCast.toUint128(withdrawnAssets); platformFee += pFee; managerFee += mFee; // burn converted share tokens _burn(address(this), cycleState[cycleIndex].requestedWithdrawals); } // convert total deposits to shares and calculate entry fees if (cycleState[cycleIndex].requestedDeposits > 0) { uint256 requestedDeposits = cycleState[cycleIndex].requestedDeposits; uint256 pFee; uint256 mFee; unchecked { pFee = requestedDeposits * feeConfig.platformEntryFee / 1000000; mFee = requestedDeposits * feeConfig.managerEntryFee / 1000000; } globalState.lockedAssets -= cycleState[cycleIndex].requestedDeposits; requestedDeposits = requestedDeposits - pFee - mFee; fundValueAfterRequests += SafeCast.toUint128(requestedDeposits); if (currentTotalSupply == 0) { // use initial price if there's no share tokens cycleState[cycleIndex].convertedDeposits = SafeCast.toUint128(requestedDeposits * initialPrice.denominator / initialPrice.numerator); } else { // _fundValueAfterPMFees is checked to be non-zero when total supply is non-zero cycleState[cycleIndex].convertedDeposits = SafeCast.toUint128(requestedDeposits * currentTotalSupply / _fundValueAfterPMFees); } platformFee += pFee; managerFee += mFee; // mint new share tokens _mint(address(this), cycleState[cycleIndex].convertedDeposits); } cycleState[cycleIndex].fundValueAfterRequests = SafeCast.toUint128(fundValueAfterRequests); } /// @notice Convert previous requested deposits and withdrawls function _convertPreviousRequests(address _receiver) internal { uint32 cycleIndex = userState[_receiver].requestCycleIndex; if (cycleIndex >= globalState.cycleIndex) { return; } if (userState[_receiver].requestedDeposits > 0) { // if requestedDeposits of a user > 0 then requestedDeposits of the cycle must be > 0 uint256 owedShares = uint256(userState[_receiver].requestedDeposits) * cycleState[cycleIndex].convertedDeposits / cycleState[cycleIndex].requestedDeposits; userState[_receiver].owedShares += SafeCast.toUint128(owedShares); emit ConvertToShares(_receiver, cycleIndex, userState[_receiver].requestedDeposits, owedShares); userState[_receiver].requestedDeposits = 0; } if (userState[_receiver].requestedWithdrawals > 0) { // if requestedWithdrawals of a user > 0 then requestedWithdrawals of the cycle must be > 0 uint256 owedAssets = uint256(userState[_receiver].requestedWithdrawals) * cycleState[cycleIndex].convertedWithdrawals / cycleState[cycleIndex].requestedWithdrawals; userState[_receiver].owedAssets += SafeCast.toUint128(owedAssets); emit ConvertToAssets(_receiver, cycleIndex, userState[_receiver].requestedWithdrawals, owedAssets); userState[_receiver].requestedWithdrawals = 0; } } /// @notice Internal function for processing deposit requests function _internalRequestDeposit(uint256 _assets, address _receiver) internal { if (fundConfig.disableDepositing) revert DepositDisabled(); if (globalState.fundClosed) revert FundIsClosed(); if (block.timestamp > globalState.fundingLockTimestamp) revert FundingLocked(); if (_assets + cycleState[globalState.cycleIndex].requestedDeposits > globalState.depositLimit) revert ExceedDepositLimit(); if (!_hasNFT(_receiver)) revert ReceiverDoNotHasNFT(); uint32 cycleIndex = globalState.cycleIndex; uint128 assets = SafeCast.toUint128(_assets); cycleState[cycleIndex].requestedDeposits += assets; globalState.lockedAssets += assets; // if user has previously requested deposits or withdrawals, convert them _convertPreviousRequests(_receiver); userState[_receiver].requestedDeposits += assets; userState[_receiver].requestCycleIndex = cycleIndex; emit DepositRequested(msg.sender, cycleIndex, _receiver, _assets); } /// @notice Internal function for canceling deposit requests function _internalCancelDeposit(uint256 _assets, address _receiver) internal { if (block.timestamp > globalState.fundingLockTimestamp) revert FundingLocked(); if (fundConfig.disableCancelDepositing) revert CancelDepositDisabled(); uint32 cycleIndex = globalState.cycleIndex; if (userState[msg.sender].requestCycleIndex != cycleIndex) revert NotEnoughDeposits(); if (userState[msg.sender].requestedDeposits < _assets) revert NotEnoughDeposits(); uint128 assets = SafeCast.toUint128(_assets); cycleState[cycleIndex].requestedDeposits -= assets; globalState.lockedAssets -= assets; userState[_receiver].requestedDeposits -= assets; emit DepositCanceled(msg.sender, cycleIndex, _receiver, _assets); } /// @notice Internal function for claiming owed assets function _internalClaimOwedAssets(address _receiver) internal returns (uint256 assets) { _convertPreviousRequests(msg.sender); if (userState[msg.sender].owedAssets > 0) { assets = userState[msg.sender].owedAssets; globalState.lockedAssets -= userState[msg.sender].owedAssets; userState[msg.sender].owedAssets = 0; emit ClaimOwedAssets(msg.sender, _receiver, assets); } } /// @notice Internal NFT checker /// @param _receiver address of the receiver /// @return hasNFT true if the receiver has at least one of the NFT, false if not /// @dev always returns true if disableNFTChecks is enabled function _hasNFT(address _receiver) internal view returns (bool hasNFT) { if (fundConfig.disableNFTChecks) { return true; } uint256 i; uint256 length = nftEnabled.length; for (i = 0; i < length; ) { if (IERC721(nftEnabled[i]).balanceOf(_receiver) > 0) { return true; } unchecked { ++i; } } return false; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.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: * * ``` * 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}: * * ``` * 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. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @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 override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @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 override returns (bytes32) { 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 override 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 override 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 `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.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}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * 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. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { 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 value {ERC20} uses, unless this function is * 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 override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` 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 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); 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 `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `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. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` 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. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../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; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @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, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/math/SafeCast.sol) pragma solidity ^0.8.0; /** * @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. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCast { /** * @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 * * _Available since v4.7._ */ function toUint248(uint256 value) internal pure returns (uint248) { require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits"); 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 * * _Available since v4.7._ */ function toUint240(uint256 value) internal pure returns (uint240) { require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits"); 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 * * _Available since v4.7._ */ function toUint232(uint256 value) internal pure returns (uint232) { require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits"); 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 * * _Available since v4.2._ */ function toUint224(uint256 value) internal pure returns (uint224) { require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits"); 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 * * _Available since v4.7._ */ function toUint216(uint256 value) internal pure returns (uint216) { require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits"); 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 * * _Available since v4.7._ */ function toUint208(uint256 value) internal pure returns (uint208) { require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits"); 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 * * _Available since v4.7._ */ function toUint200(uint256 value) internal pure returns (uint200) { require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits"); 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 * * _Available since v4.7._ */ function toUint192(uint256 value) internal pure returns (uint192) { require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits"); 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 * * _Available since v4.7._ */ function toUint184(uint256 value) internal pure returns (uint184) { require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits"); 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 * * _Available since v4.7._ */ function toUint176(uint256 value) internal pure returns (uint176) { require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits"); 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 * * _Available since v4.7._ */ function toUint168(uint256 value) internal pure returns (uint168) { require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits"); 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 * * _Available since v4.7._ */ function toUint160(uint256 value) internal pure returns (uint160) { require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits"); 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 * * _Available since v4.7._ */ function toUint152(uint256 value) internal pure returns (uint152) { require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits"); 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 * * _Available since v4.7._ */ function toUint144(uint256 value) internal pure returns (uint144) { require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits"); 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 * * _Available since v4.7._ */ function toUint136(uint256 value) internal pure returns (uint136) { require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits"); 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 * * _Available since v2.5._ */ function toUint128(uint256 value) internal pure returns (uint128) { require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits"); 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 * * _Available since v4.7._ */ function toUint120(uint256 value) internal pure returns (uint120) { require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits"); 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 * * _Available since v4.7._ */ function toUint112(uint256 value) internal pure returns (uint112) { require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits"); 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 * * _Available since v4.7._ */ function toUint104(uint256 value) internal pure returns (uint104) { require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits"); 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 * * _Available since v4.2._ */ function toUint96(uint256 value) internal pure returns (uint96) { require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits"); 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 * * _Available since v4.7._ */ function toUint88(uint256 value) internal pure returns (uint88) { require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits"); 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 * * _Available since v4.7._ */ function toUint80(uint256 value) internal pure returns (uint80) { require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits"); 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 * * _Available since v4.7._ */ function toUint72(uint256 value) internal pure returns (uint72) { require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits"); 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 * * _Available since v2.5._ */ function toUint64(uint256 value) internal pure returns (uint64) { require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits"); 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 * * _Available since v4.7._ */ function toUint56(uint256 value) internal pure returns (uint56) { require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits"); 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 * * _Available since v4.7._ */ function toUint48(uint256 value) internal pure returns (uint48) { require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits"); 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 * * _Available since v4.7._ */ function toUint40(uint256 value) internal pure returns (uint40) { require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits"); 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 * * _Available since v2.5._ */ function toUint32(uint256 value) internal pure returns (uint32) { require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits"); 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 * * _Available since v4.7._ */ function toUint24(uint256 value) internal pure returns (uint24) { require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits"); 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 * * _Available since v2.5._ */ function toUint16(uint256 value) internal pure returns (uint16) { require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits"); 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 * * _Available since v2.5._ */ function toUint8(uint256 value) internal pure returns (uint8) { require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. * * _Available since v3.0._ */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); 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 * * _Available since v4.7._ */ function toInt248(int256 value) internal pure returns (int248) { require(value >= type(int248).min && value <= type(int248).max, "SafeCast: value doesn't fit in 248 bits"); return int248(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 * * _Available since v4.7._ */ function toInt240(int256 value) internal pure returns (int240) { require(value >= type(int240).min && value <= type(int240).max, "SafeCast: value doesn't fit in 240 bits"); return int240(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 * * _Available since v4.7._ */ function toInt232(int256 value) internal pure returns (int232) { require(value >= type(int232).min && value <= type(int232).max, "SafeCast: value doesn't fit in 232 bits"); return int232(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 * * _Available since v4.7._ */ function toInt224(int256 value) internal pure returns (int224) { require(value >= type(int224).min && value <= type(int224).max, "SafeCast: value doesn't fit in 224 bits"); return int224(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 * * _Available since v4.7._ */ function toInt216(int256 value) internal pure returns (int216) { require(value >= type(int216).min && value <= type(int216).max, "SafeCast: value doesn't fit in 216 bits"); return int216(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 * * _Available since v4.7._ */ function toInt208(int256 value) internal pure returns (int208) { require(value >= type(int208).min && value <= type(int208).max, "SafeCast: value doesn't fit in 208 bits"); return int208(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 * * _Available since v4.7._ */ function toInt200(int256 value) internal pure returns (int200) { require(value >= type(int200).min && value <= type(int200).max, "SafeCast: value doesn't fit in 200 bits"); return int200(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 * * _Available since v4.7._ */ function toInt192(int256 value) internal pure returns (int192) { require(value >= type(int192).min && value <= type(int192).max, "SafeCast: value doesn't fit in 192 bits"); return int192(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 * * _Available since v4.7._ */ function toInt184(int256 value) internal pure returns (int184) { require(value >= type(int184).min && value <= type(int184).max, "SafeCast: value doesn't fit in 184 bits"); return int184(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 * * _Available since v4.7._ */ function toInt176(int256 value) internal pure returns (int176) { require(value >= type(int176).min && value <= type(int176).max, "SafeCast: value doesn't fit in 176 bits"); return int176(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 * * _Available since v4.7._ */ function toInt168(int256 value) internal pure returns (int168) { require(value >= type(int168).min && value <= type(int168).max, "SafeCast: value doesn't fit in 168 bits"); return int168(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 * * _Available since v4.7._ */ function toInt160(int256 value) internal pure returns (int160) { require(value >= type(int160).min && value <= type(int160).max, "SafeCast: value doesn't fit in 160 bits"); return int160(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 * * _Available since v4.7._ */ function toInt152(int256 value) internal pure returns (int152) { require(value >= type(int152).min && value <= type(int152).max, "SafeCast: value doesn't fit in 152 bits"); return int152(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 * * _Available since v4.7._ */ function toInt144(int256 value) internal pure returns (int144) { require(value >= type(int144).min && value <= type(int144).max, "SafeCast: value doesn't fit in 144 bits"); return int144(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 * * _Available since v4.7._ */ function toInt136(int256 value) internal pure returns (int136) { require(value >= type(int136).min && value <= type(int136).max, "SafeCast: value doesn't fit in 136 bits"); return int136(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 * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128) { require(value >= type(int128).min && value <= type(int128).max, "SafeCast: value doesn't fit in 128 bits"); return int128(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 * * _Available since v4.7._ */ function toInt120(int256 value) internal pure returns (int120) { require(value >= type(int120).min && value <= type(int120).max, "SafeCast: value doesn't fit in 120 bits"); return int120(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 * * _Available since v4.7._ */ function toInt112(int256 value) internal pure returns (int112) { require(value >= type(int112).min && value <= type(int112).max, "SafeCast: value doesn't fit in 112 bits"); return int112(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 * * _Available since v4.7._ */ function toInt104(int256 value) internal pure returns (int104) { require(value >= type(int104).min && value <= type(int104).max, "SafeCast: value doesn't fit in 104 bits"); return int104(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 * * _Available since v4.7._ */ function toInt96(int256 value) internal pure returns (int96) { require(value >= type(int96).min && value <= type(int96).max, "SafeCast: value doesn't fit in 96 bits"); return int96(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 * * _Available since v4.7._ */ function toInt88(int256 value) internal pure returns (int88) { require(value >= type(int88).min && value <= type(int88).max, "SafeCast: value doesn't fit in 88 bits"); return int88(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 * * _Available since v4.7._ */ function toInt80(int256 value) internal pure returns (int80) { require(value >= type(int80).min && value <= type(int80).max, "SafeCast: value doesn't fit in 80 bits"); return int80(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 * * _Available since v4.7._ */ function toInt72(int256 value) internal pure returns (int72) { require(value >= type(int72).min && value <= type(int72).max, "SafeCast: value doesn't fit in 72 bits"); return int72(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 * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64) { require(value >= type(int64).min && value <= type(int64).max, "SafeCast: value doesn't fit in 64 bits"); return int64(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 * * _Available since v4.7._ */ function toInt56(int256 value) internal pure returns (int56) { require(value >= type(int56).min && value <= type(int56).max, "SafeCast: value doesn't fit in 56 bits"); return int56(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 * * _Available since v4.7._ */ function toInt48(int256 value) internal pure returns (int48) { require(value >= type(int48).min && value <= type(int48).max, "SafeCast: value doesn't fit in 48 bits"); return int48(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 * * _Available since v4.7._ */ function toInt40(int256 value) internal pure returns (int40) { require(value >= type(int40).min && value <= type(int40).max, "SafeCast: value doesn't fit in 40 bits"); return int40(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 * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32) { require(value >= type(int32).min && value <= type(int32).max, "SafeCast: value doesn't fit in 32 bits"); return int32(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 * * _Available since v4.7._ */ function toInt24(int256 value) internal pure returns (int24) { require(value >= type(int24).min && value <= type(int24).max, "SafeCast: value doesn't fit in 24 bits"); return int24(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 * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16) { require(value >= type(int16).min && value <= type(int16).max, "SafeCast: value doesn't fit in 16 bits"); return int16(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 * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8) { require(value >= type(int8).min && value <= type(int8).max, "SafeCast: value doesn't fit in 8 bits"); return int8(value); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. * * _Available since v3.0._ */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256"); return int256(value); } }
// contracts/IHighTableVault.sol // SPDX-License-Identifier: BUSL // Teahouse Finance pragma solidity ^0.8.0; import "./ITeaVaultV2.sol"; error OnlyAvailableToAdmins(); // operation is available only to admins error OnlyAvailableToAuditors(); // operation is available only to auditors error ReceiverDoNotHasNFT(); // receiver does not have required NFT to deposit error IncorrectVaultAddress(); // TeaVaultV2, managerVault, or platformVault is 0 error IncorrectReceiverAddress(); // receiver address is 0 error NotEnoughAssets(); // does not have enough asset tokens error FundingLocked(); // deposit and withdraw are not allowed in locked period error ExceedDepositLimit(); // requested deposit exceeds current deposit limit error DepositDisabled(); // deposit request is disabled error WithdrawDisabled(); // withdraw request is disabled error NotEnoughDeposits(); // user does not have enough deposit requested to cancel error NotEnoughWithdrawals(); // user does not have enough withdrawals requested to cancel error InvalidInitialPrice(); // invalid initial price error FundIsClosed(); // fund is closed, requests are not allowed error FundIsNotClosed(); // fund is not closed, can't close position error InvalidFeePercentage(); // incorrect fee percentage error IncorrectCycleIndex(); // incorrect cycle index error IncorrectCycleStartTimestamp(); // incorrect cycle start timestamp (before previous cycle start timestamp or later than current time) error InvalidFundValue(); // incorrect fund value (zero or very close to zero) error NoDeposits(); // can not enter next cycle if there's no share and no requested deposits error CancelDepositDisabled(); // canceling deposit is disabled error CancelWithdrawDisabled(); // canceling withdraw is disabled interface IHighTableVault { struct Price { uint128 numerator; // numerator of the price uint128 denominator; // denominator of the price } struct FeeConfig { address platformVault; // platform fee goes here address managerVault; // manager fee goes here uint24 platformEntryFee; // platform entry fee in 0.0001% (collected when depositing) uint24 managerEntryFee; // manager entry fee in 0.0001% (colleceted when depositing) uint24 platformExitFee; // platform exit fee (collected when withdrawing) uint24 managerExitFee; // manager exit fee (collected when withdrawing) uint24 platformPerformanceFee; // platform performance fee (collected for each cycle, from profits) uint24 managerPerformanceFee; // manager performance fee (collected for each cycle, from profits) uint24 platformManagementFee; // platform yearly management fee (collected for each cycle, from total value) uint24 managerManagementFee; // manager yearly management fee (collected for each cycle, from total value) } struct FundConfig { ITeaVaultV2 teaVaultV2; // TeaVaultV2 address bool disableNFTChecks; // allow everyone to access the vault bool disableDepositing; // disable requesting depositing bool disableWithdrawing; // disable requesting withdrawing bool disableCancelDepositing; // disable canceling depositing bool disableCancelWithdrawing; // disable canceling withdrawing } struct GlobalState { uint128 depositLimit; // deposit limit (in asset) uint128 lockedAssets; // locked assets (assets waiting to be withdrawn, or deposited by users but not converted to shares yet) uint32 cycleIndex; // current cycle index uint64 cycleStartTimestamp; // start timestamp of current cycle uint64 fundingLockTimestamp; // timestamp for locking depositing/withdrawing bool fundClosed; // fund is closed } struct CycleState { uint128 totalFundValue; // total fund value in asset tokens, at the end of the cycle uint128 fundValueAfterRequests; // fund value after requests are processed in asset tokens, at the end of the cycle uint128 requestedDeposits; // total requested deposits during this cycle (in assets) uint128 convertedDeposits; // converted deposits at the end of the cycle (in shares) uint128 requestedWithdrawals; // total requested withdrawals during this cycle (in shares) uint128 convertedWithdrawals; // converted withdrawals at the end of the cycle (in assets) } struct UserState { uint128 requestedDeposits; // deposits requested but not converted (in assets) uint128 owedShares; // shares available to be withdrawn uint128 requestedWithdrawals; // withdrawals requested but not converted (in shares) uint128 owedAssets; // assets available to be withdrawn uint32 requestCycleIndex; // cycle index for requests (for both deposits and withdrawals) } // ------ // events // ------ event FundInitialized(address indexed caller, uint256 priceNumerator, uint256 priceDenominator, uint64 startTimestamp, address admin); event NFTEnabled(address indexed caller, uint32 indexed cycleIndex, address[] nfts); event DisableNFTChecks(address indexed caller, uint32 indexed cycleIndex, bool disableChecks); event FeeConfigChanged(address indexed caller, uint32 indexed cycleIndex, FeeConfig feeConfig); event EnterNextCycle(address indexed caller, uint32 indexed cycleIndex, uint256 fundValue, uint256 priceNumerator, uint256 priceDenominator, uint256 depositLimit, uint64 startTimestamp, uint64 lockTimestamp, bool fundClosed, uint256 platformFee, uint256 managerFee); event FundLockingTimestampUpdated(address indexed caller, uint32 indexed cycleIndex, uint64 lockTimestamp); event DepositLimitUpdated(address indexed caller, uint32 indexed cycleIndex, uint256 depositLimit); event UpdateTeaVaultV2(address indexed caller, uint32 indexed cycleIndex, address teaVaultV2); event DepositToVault(address indexed caller, uint32 indexed cycleIndex, address teaVaultV2, uint256 value); event WithdrawFromVault(address indexed caller, uint32 indexed cycleIndex, address teaVaultV2, uint256 value); event FundingChanged(address indexed caller, uint32 indexed cycleIndex, bool disableDepositing, bool disableWithdrawing, bool disableCancelDepositing, bool disableCancelWithdrawing); event DepositRequested(address indexed caller, uint32 indexed cycleIndex, address indexed receiver, uint256 assets); event DepositCanceled(address indexed caller, uint32 indexed cycleIndex, address indexed receiver, uint256 assets); event WithdrawalRequested(address indexed caller, uint32 indexed cycleIndex, address indexed owner, uint256 shares); event WithdrawalCanceled(address indexed caller, uint32 indexed cycleIndex, address indexed receiver, uint256 shares); event ClaimOwedAssets(address indexed caller, address indexed receiver, uint256 assets); event ClaimOwedShares(address indexed caller, address indexed receiver, uint256 shares); event ConvertToShares(address indexed owner, uint32 indexed cycleIndex, uint256 assets, uint256 shares); event ConvertToAssets(address indexed owner, uint32 indexed cycleIndex, uint256 shares, uint256 assets); // --------------- // admin functions // --------------- /// @notice Set the list of NFTs for allowing depositing /// @param _nfts addresses of the NFTs /// @notice Only available to admins function setEnabledNFTs(address[] memory _nfts) external; /// @notice Disable/enable NFT checks /// @param _checks true to disable NFT checks, false to enable /// @notice Only available to admins function setDisableNFTChecks(bool _checks) external; /// @notice Set fee structure and platform/manager vault addresses /// @param _feeConfig fee structure settings /// @notice Only available to admins function setFeeConfig(FeeConfig calldata _feeConfig) external; /// @notice Set TeaVaultV2 address /// @param _teaVaultV2 address to TeaVaultV2 /// @notice Only available to admins function setTeaVaultV2(address _teaVaultV2) external; // ----------------- // auditor functions // ----------------- /// @notice Enter next cycle /// @param _cycleIndex current cycle index (to prevent accidental replay) /// @param _fundValue total fund value for this cycle /// @param _withdrawAmount amount to withdraw from TeaVaultV2 /// @param _cycleStartTimestamp starting timestamp of the next cycle /// @param _fundingLockTimestamp funding lock timestamp for next cycle /// @param _closeFund true to close fund, irreversible /// @return platformFee total fee paid to the platform /// @return managerFee total fee paid to the manager /// @notice Only available to auditors /// @notice Use previewNextCycle function to get an estimation of required _withdrawAmount /// @notice _cycleStartTimestamp must be later than start timestamp of current cycle /// @notice and before the block timestamp when the transaction is confirmed /// @notice _fundValue can't be zero or close to zero except for the first first cycle function enterNextCycle( uint32 _cycleIndex, uint128 _fundValue, uint128 _depositLimit, uint128 _withdrawAmount, uint64 _cycleStartTimestamp, uint64 _fundingLockTimestamp, bool _closeFund) external returns (uint256 platformFee, uint256 managerFee); /// @notice Update fund locking timestamp /// @param _fundLockingTimestamp new timestamp for locking withdraw/deposits /// @notice Only available to auditors function setFundLockingTimestamp(uint64 _fundLockingTimestamp) external; /// @notice Update deposit limit /// @param _depositLimit new deposit limit /// @notice Only available to auditors function setDepositLimit(uint128 _depositLimit) external; /// @notice Allowing/disabling depositing/withdrawing /// @param _disableDepositing true to allow depositing, false to disallow /// @param _disableWithdrawing true to allow withdrawing, false to disallow /// @param _disableCancelDepositing true to allow withdrawing, false to disallow /// @param _disableCancelWithdrawing true to allow withdrawing, false to disallow /// @notice Only available to auditors function setDisableFunding(bool _disableDepositing, bool _disableWithdrawing, bool _disableCancelDepositing, bool _disableCancelWithdrawing) external; /// @notice Deposit fund to TeaVaultV2 /// @notice Can not deposit locked assets /// @param _value value to deposit /// @notice Only available to auditors function depositToVault(uint256 _value) external; /// @notice Withdraw fund from TeaVaultV2 /// @param _value value to withdraw /// @notice Only available to auditors function withdrawFromVault(uint256 _value) external; // -------------------------- // functions available to all // -------------------------- /// @notice Returns address of the asset token /// @return assetTokenAddress address of the asset token function asset() external view returns (address assetTokenAddress); /// @notice Request deposits /// @notice Actual deposits will be executed when entering the next cycle /// @param _assets amount of asset tokens to deposit /// @param _receiver address where the deposit is credited /// @notice _receiver need to have the required NFT /// @notice Request is disabled when time is later than fundingLockTimestamp function requestDeposit(uint256 _assets, address _receiver) external; /// @notice Claim owed assets and request deposits /// @notice Actual deposits will be executed when entering the next cycle /// @param _assets amount of asset tokens to deposit /// @param _receiver address where the deposit is credited /// @return assets amount of owed asset tokens claimed /// @notice _receiver need to have the required NFT /// @notice Request is disabled when time is later than fundingLockTimestamp function claimAndRequestDeposit(uint256 _assets, address _receiver) external returns (uint256 assets); /// @notice Cancel deposit requests /// @param _assets amount of asset tokens to cancel deposit /// @param _receiver address to receive the asset tokens /// @notice Request is disabled when time is later than fundingLockTimestamp function cancelDeposit(uint256 _assets, address _receiver) external; /// @notice Request withdrawals /// @notice Actual withdrawals will be executed when entering the next cycle /// @param _shares amount of share tokens to withdraw /// @param _owner owner address of share tokens /// @notice If _owner is different from msg.sender, _owner must approve msg.sender to spend share tokens /// @notice Request is disabled when time is later than fundingLockTimestamp function requestWithdraw(uint256 _shares, address _owner) external; /// @notice Claim owed shares and request withdrawals /// @notice Actual withdrawals will be executed when entering the next cycle /// @param _shares amount of share tokens to withdraw /// @param _owner owner address of share tokens /// @return shares amount of owed share tokens claimed /// @notice If _owner is different from msg.sender, _owner must approve msg.sender to spend share tokens /// @notice Request is disabled when time is later than fundingLockTimestamp function claimAndRequestWithdraw(uint256 _shares, address _owner) external returns (uint256 shares); /// @notice Cancel withdrawal requests /// @param _shares amount of share tokens to cancel withdrawal /// @param _receiver address to receive the share tokens /// @notice Request is disabled when time is later than fundingLockTimestamp function cancelWithdraw(uint256 _shares, address _receiver) external; /// @notice Returns currently requested deposits and withdrawals /// @param _owner address of the owner /// @return assets amount of asset tokens requested to be deposited /// @return shares amount of asset tokens requested to be withdrawn function requestedFunds(address _owner) external view returns (uint256 assets, uint256 shares); /// @notice Claim owed assets /// @param _receiver address to receive the tokens /// @return assets amount of owed asset tokens claimed function claimOwedAssets(address _receiver) external returns (uint256 assets); /// @notice Claim owed shares /// @param _receiver address to receive the tokens /// @return shares amount of owed share tokens claimed function claimOwedShares(address _receiver) external returns (uint256 shares); /// @notice Claim owed assets and shares /// @param _receiver address to receive the tokens /// @return assets amount of owed asset tokens claimed /// @return shares amount of owed share tokens claimed function claimOwedFunds(address _receiver) external returns (uint256 assets, uint256 shares); /// @notice Close positions /// @notice Converted assets are added to owed assets /// @notice Only available when fund is closed /// @param _shares amount of share tokens to close /// @param _owner owner address of share tokens /// @return assets amount of assets converted /// @notice If _owner is different from msg.sender, _owner must approve msg.sender to spend share tokens function closePosition(uint256 _shares, address _owner) external returns (uint256 assets); /// @notice Close positions and claim all assets /// @notice Only available when fund is closed /// @param _receiver address to receive asset tokens /// @return assets amount of asset tokens withdrawn function closePositionAndClaim(address _receiver) external returns (uint256 assets); /// @notice Preview how much assets is required for entering next cycle /// @param _fundValue total fund value for this cycle /// @param _timestamp predicted timestamp for start of next cycle /// @return withdrawAmount amount of assets required function previewNextCycle(uint128 _fundValue, uint64 _timestamp) external view returns (uint256 withdrawAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @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. * * _Available since v3.1._ */ 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 `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @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 Context { 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 v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.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); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @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://diligence.consensys.net/posts/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.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @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, it is bubbled up by this * function (like regular Solidity function calls). * * 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. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @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`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // 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(errorMessage); } } } }
// contracts/ITeaVaultV2.sol // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; interface ITeaVaultV2 { function deposit(address _token, uint256 _amount) external; function withdraw(address _recipient, address _token, uint256 _amount) external; function deposit721(address _token, uint256 _tokenId) external; function withdraw721(address _recipient, address _token, uint256 _tokenId) external; function deposit1155(address _token, uint256 _tokenId, uint256 _amount) external; function withdraw1155(address _recipient, address _token, uint256 _tokenId, uint256 _amount) external; function depositETH(uint256 _amount) external payable; function withdrawETH(address payable _recipient, uint256 _amount) external; }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_asset","type":"address"},{"internalType":"uint128","name":"_priceNumerator","type":"uint128"},{"internalType":"uint128","name":"_priceDenominator","type":"uint128"},{"internalType":"uint64","name":"_startTimestamp","type":"uint64"},{"internalType":"address","name":"_initialAdmin","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CancelDepositDisabled","type":"error"},{"inputs":[],"name":"CancelWithdrawDisabled","type":"error"},{"inputs":[],"name":"DepositDisabled","type":"error"},{"inputs":[],"name":"ExceedDepositLimit","type":"error"},{"inputs":[],"name":"FundIsClosed","type":"error"},{"inputs":[],"name":"FundIsNotClosed","type":"error"},{"inputs":[],"name":"FundingLocked","type":"error"},{"inputs":[],"name":"IncorrectCycleIndex","type":"error"},{"inputs":[],"name":"IncorrectCycleStartTimestamp","type":"error"},{"inputs":[],"name":"IncorrectVaultAddress","type":"error"},{"inputs":[],"name":"InvalidFeePercentage","type":"error"},{"inputs":[],"name":"InvalidFundValue","type":"error"},{"inputs":[],"name":"InvalidInitialPrice","type":"error"},{"inputs":[],"name":"NoDeposits","type":"error"},{"inputs":[],"name":"NotEnoughAssets","type":"error"},{"inputs":[],"name":"NotEnoughDeposits","type":"error"},{"inputs":[],"name":"NotEnoughWithdrawals","type":"error"},{"inputs":[],"name":"OnlyAvailableToAdmins","type":"error"},{"inputs":[],"name":"OnlyAvailableToAuditors","type":"error"},{"inputs":[],"name":"ReceiverDoNotHasNFT","type":"error"},{"inputs":[],"name":"WithdrawDisabled","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":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"}],"name":"ClaimOwedAssets","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"ClaimOwedShares","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint32","name":"cycleIndex","type":"uint32"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"}],"name":"ConvertToAssets","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint32","name":"cycleIndex","type":"uint32"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"ConvertToShares","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"uint32","name":"cycleIndex","type":"uint32"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"}],"name":"DepositCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"uint32","name":"cycleIndex","type":"uint32"},{"indexed":false,"internalType":"uint256","name":"depositLimit","type":"uint256"}],"name":"DepositLimitUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"uint32","name":"cycleIndex","type":"uint32"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"}],"name":"DepositRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"uint32","name":"cycleIndex","type":"uint32"},{"indexed":false,"internalType":"address","name":"teaVaultV2","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"DepositToVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"uint32","name":"cycleIndex","type":"uint32"},{"indexed":false,"internalType":"bool","name":"disableChecks","type":"bool"}],"name":"DisableNFTChecks","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"uint32","name":"cycleIndex","type":"uint32"},{"indexed":false,"internalType":"uint256","name":"fundValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"priceNumerator","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"priceDenominator","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"depositLimit","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"lockTimestamp","type":"uint64"},{"indexed":false,"internalType":"bool","name":"fundClosed","type":"bool"},{"indexed":false,"internalType":"uint256","name":"platformFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"managerFee","type":"uint256"}],"name":"EnterNextCycle","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"uint32","name":"cycleIndex","type":"uint32"},{"components":[{"internalType":"address","name":"platformVault","type":"address"},{"internalType":"address","name":"managerVault","type":"address"},{"internalType":"uint24","name":"platformEntryFee","type":"uint24"},{"internalType":"uint24","name":"managerEntryFee","type":"uint24"},{"internalType":"uint24","name":"platformExitFee","type":"uint24"},{"internalType":"uint24","name":"managerExitFee","type":"uint24"},{"internalType":"uint24","name":"platformPerformanceFee","type":"uint24"},{"internalType":"uint24","name":"managerPerformanceFee","type":"uint24"},{"internalType":"uint24","name":"platformManagementFee","type":"uint24"},{"internalType":"uint24","name":"managerManagementFee","type":"uint24"}],"indexed":false,"internalType":"struct IHighTableVault.FeeConfig","name":"feeConfig","type":"tuple"}],"name":"FeeConfigChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"priceNumerator","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"priceDenominator","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"indexed":false,"internalType":"address","name":"admin","type":"address"}],"name":"FundInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"uint32","name":"cycleIndex","type":"uint32"},{"indexed":false,"internalType":"uint64","name":"lockTimestamp","type":"uint64"}],"name":"FundLockingTimestampUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"uint32","name":"cycleIndex","type":"uint32"},{"indexed":false,"internalType":"bool","name":"disableDepositing","type":"bool"},{"indexed":false,"internalType":"bool","name":"disableWithdrawing","type":"bool"},{"indexed":false,"internalType":"bool","name":"disableCancelDepositing","type":"bool"},{"indexed":false,"internalType":"bool","name":"disableCancelWithdrawing","type":"bool"}],"name":"FundingChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"uint32","name":"cycleIndex","type":"uint32"},{"indexed":false,"internalType":"address[]","name":"nfts","type":"address[]"}],"name":"NFTEnabled","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":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":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"uint32","name":"cycleIndex","type":"uint32"},{"indexed":false,"internalType":"address","name":"teaVaultV2","type":"address"}],"name":"UpdateTeaVaultV2","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"uint32","name":"cycleIndex","type":"uint32"},{"indexed":false,"internalType":"address","name":"teaVaultV2","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"WithdrawFromVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"uint32","name":"cycleIndex","type":"uint32"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"WithdrawalCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"uint32","name":"cycleIndex","type":"uint32"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"WithdrawalRequested","type":"event"},{"inputs":[],"name":"AUDITOR_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":"SECONDS_IN_A_YEAR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"asset","outputs":[{"internalType":"address","name":"assetTokenAddress","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":"uint256","name":"_assets","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"cancelDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"cancelWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_assets","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"claimAndRequestDeposit","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"address","name":"_owner","type":"address"}],"name":"claimAndRequestWithdraw","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"}],"name":"claimOwedAssets","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"}],"name":"claimOwedFunds","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"}],"name":"claimOwedShares","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"address","name":"_owner","type":"address"}],"name":"closePosition","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"}],"name":"closePositionAndClaim","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"closePrice","outputs":[{"internalType":"uint128","name":"numerator","type":"uint128"},{"internalType":"uint128","name":"denominator","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"}],"name":"cycleState","outputs":[{"internalType":"uint128","name":"totalFundValue","type":"uint128"},{"internalType":"uint128","name":"fundValueAfterRequests","type":"uint128"},{"internalType":"uint128","name":"requestedDeposits","type":"uint128"},{"internalType":"uint128","name":"convertedDeposits","type":"uint128"},{"internalType":"uint128","name":"requestedWithdrawals","type":"uint128"},{"internalType":"uint128","name":"convertedWithdrawals","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"depositToVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_cycleIndex","type":"uint32"},{"internalType":"uint128","name":"_fundValue","type":"uint128"},{"internalType":"uint128","name":"_depositLimit","type":"uint128"},{"internalType":"uint128","name":"_withdrawAmount","type":"uint128"},{"internalType":"uint64","name":"_cycleStartTimestamp","type":"uint64"},{"internalType":"uint64","name":"_fundingLockTimestamp","type":"uint64"},{"internalType":"bool","name":"_closeFund","type":"bool"}],"name":"enterNextCycle","outputs":[{"internalType":"uint256","name":"platformFee","type":"uint256"},{"internalType":"uint256","name":"managerFee","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeConfig","outputs":[{"internalType":"address","name":"platformVault","type":"address"},{"internalType":"address","name":"managerVault","type":"address"},{"internalType":"uint24","name":"platformEntryFee","type":"uint24"},{"internalType":"uint24","name":"managerEntryFee","type":"uint24"},{"internalType":"uint24","name":"platformExitFee","type":"uint24"},{"internalType":"uint24","name":"managerExitFee","type":"uint24"},{"internalType":"uint24","name":"platformPerformanceFee","type":"uint24"},{"internalType":"uint24","name":"managerPerformanceFee","type":"uint24"},{"internalType":"uint24","name":"platformManagementFee","type":"uint24"},{"internalType":"uint24","name":"managerManagementFee","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fundConfig","outputs":[{"internalType":"contract ITeaVaultV2","name":"teaVaultV2","type":"address"},{"internalType":"bool","name":"disableNFTChecks","type":"bool"},{"internalType":"bool","name":"disableDepositing","type":"bool"},{"internalType":"bool","name":"disableWithdrawing","type":"bool"},{"internalType":"bool","name":"disableCancelDepositing","type":"bool"},{"internalType":"bool","name":"disableCancelWithdrawing","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"globalState","outputs":[{"internalType":"uint128","name":"depositLimit","type":"uint128"},{"internalType":"uint128","name":"lockedAssets","type":"uint128"},{"internalType":"uint32","name":"cycleIndex","type":"uint32"},{"internalType":"uint64","name":"cycleStartTimestamp","type":"uint64"},{"internalType":"uint64","name":"fundingLockTimestamp","type":"uint64"},{"internalType":"bool","name":"fundClosed","type":"bool"}],"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":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initialPrice","outputs":[{"internalType":"uint128","name":"numerator","type":"uint128"},{"internalType":"uint128","name":"denominator","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"nftEnabled","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint128","name":"_fundValue","type":"uint128"},{"internalType":"uint64","name":"_timestamp","type":"uint64"}],"name":"previewNextCycle","outputs":[{"internalType":"uint256","name":"withdrawAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_assets","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"requestDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"address","name":"_owner","type":"address"}],"name":"requestWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"requestedFunds","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"_depositLimit","type":"uint128"}],"name":"setDepositLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_disableDepositing","type":"bool"},{"internalType":"bool","name":"_disableWithdrawing","type":"bool"},{"internalType":"bool","name":"_disableCancelDepositing","type":"bool"},{"internalType":"bool","name":"_disableCancelWithdrawing","type":"bool"}],"name":"setDisableFunding","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_checks","type":"bool"}],"name":"setDisableNFTChecks","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_nfts","type":"address[]"}],"name":"setEnabledNFTs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"platformVault","type":"address"},{"internalType":"address","name":"managerVault","type":"address"},{"internalType":"uint24","name":"platformEntryFee","type":"uint24"},{"internalType":"uint24","name":"managerEntryFee","type":"uint24"},{"internalType":"uint24","name":"platformExitFee","type":"uint24"},{"internalType":"uint24","name":"managerExitFee","type":"uint24"},{"internalType":"uint24","name":"platformPerformanceFee","type":"uint24"},{"internalType":"uint24","name":"managerPerformanceFee","type":"uint24"},{"internalType":"uint24","name":"platformManagementFee","type":"uint24"},{"internalType":"uint24","name":"managerManagementFee","type":"uint24"}],"internalType":"struct IHighTableVault.FeeConfig","name":"_feeConfig","type":"tuple"}],"name":"setFeeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_fundLockingTimestamp","type":"uint64"}],"name":"setFundLockingTimestamp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_teaVaultV2","type":"address"}],"name":"setTeaVaultV2","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":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","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":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userState","outputs":[{"internalType":"uint128","name":"requestedDeposits","type":"uint128"},{"internalType":"uint128","name":"owedShares","type":"uint128"},{"internalType":"uint128","name":"requestedWithdrawals","type":"uint128"},{"internalType":"uint128","name":"owedAssets","type":"uint128"},{"internalType":"uint32","name":"requestCycleIndex","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"withdrawFromVault","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a06040523480156200001157600080fd5b50604051620052e4380380620052e48339810160408190526200003491620002f3565b8686600462000044838262000450565b50600562000053828262000450565b5050506001600160801b03841615806200007457506001600160801b038316155b1562000093576040516359e6ae3360e11b815260040160405180910390fd5b620000a060008262000158565b6001600160a01b0385811660809081526040805180820182526001600160801b038881168083529088166020928301819052600160801b81028217600f55600c8054600160201b600160601b0319166401000000006001600160401b038b169081029190911790915584519283529282015291820152918316606083015233917f4e07e37b84f6fb6508c80e62827b021711c8115ba5b0a6122717f0f924fa0811910160405180910390a2505050505050506200051c565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620001f5576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001b43390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200022157600080fd5b81516001600160401b03808211156200023e576200023e620001f9565b604051601f8301601f19908116603f01168101908282118183101715620002695762000269620001f9565b816040528381526020925086838588010111156200028657600080fd5b600091505b83821015620002aa57858201830151818301840152908201906200028b565b600093810190920192909252949350505050565b80516001600160a01b0381168114620002d657600080fd5b919050565b80516001600160801b0381168114620002d657600080fd5b600080600080600080600060e0888a0312156200030f57600080fd5b87516001600160401b03808211156200032757600080fd5b620003358b838c016200020f565b985060208a01519150808211156200034c57600080fd5b6200035a8b838c016200020f565b97506200036a60408b01620002be565b96506200037a60608b01620002db565b95506200038a60808b01620002db565b945060a08a015191508082168214620003a257600080fd5b509150620003b360c08901620002be565b905092959891949750929550565b600181811c90821680620003d657607f821691505b602082108103620003f757634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200044b57600081815260208120601f850160051c81016020861015620004265750805b601f850160051c820191505b81811015620004475782815560010162000432565b5050505b505050565b81516001600160401b038111156200046c576200046c620001f9565b62000484816200047d8454620003c1565b84620003fd565b602080601f831160018114620004bc5760008415620004a35750858301515b600019600386901b1c1916600185901b17855562000447565b600085815260208120601f198616915b82811015620004ed57888601518255948401946001909101908401620004cc565b50858210156200050c5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b608051614d51620005936000396000818161065301528181610b9f01528181610d5701528181610df601528181610e3601528181610e8201528181610ec501528181611027015281816116cc0152818161174b01528181611853015281816119180152818161195b0152612cfd0152614d516000f3fe608060405234801561001057600080fd5b506004361061030c5760003560e01c80636297817f1161019d578063c4fa17a4116100e9578063e22857ce116100a2578063e98270171161007c578063e982701714610a0b578063ec8ad8e814610a1e578063f3ad740114610a31578063f807f6d614610a4457600080fd5b8063e22857ce146108cb578063e28d1d2e146108de578063e76c01e41461096757600080fd5b8063c4fa17a414610856578063ccc143b814610861578063ccdf429914610874578063d547741f14610892578063dd62ed3e146108a5578063e02ff7fe146108b857600080fd5b806395d89b4111610156578063a457c2d711610130578063a457c2d71461080a578063a9059cbb1461081d578063b046229614610830578063b5e0ecac1461084357600080fd5b806395d89b41146107e757806398000ff7146107ef578063a217fddf1461080257600080fd5b80636297817f1461075d5780636e1d616e1461077057806370a082311461078557806373601719146107ae5780638fffd8b2146107c157806391d14854146107d457600080fd5b8063248a9ca31161025c57806336568abe1161021557806341295a5d116101ef57806341295a5d1461068a5780634643d4241461069d5780634923d29e146106b0578063578f2bcc1461074a57600080fd5b806336568abe1461063e57806338d52e0f14610651578063395093511461067757600080fd5b8063248a9ca3146105c057806326c113fb146105e357806329344f08146105f65780632f2ff15d14610609578063313ce5671461061c57806335cb739e1461062b57600080fd5b80631696adc8116102c95780631d0806ae116102a35780631d0806ae146104865780631e5eb1d0146104c45780631fd468981461059a57806323b872dd146105ad57600080fd5b80631696adc81461043557806318160ddd146104565780631987b0451461045e57600080fd5b806301ffc9a71461031157806306297eab1461033957806306fdde0314610364578063076d081514610379578063095ea7b31461038e5780630c8f81b5146103a1575b600080fd5b61032461031f366004614322565b610a57565b60405190151581526020015b60405180910390f35b61034c61034736600461434c565b610a8e565b6040516001600160a01b039091168152602001610330565b61036c610ab8565b6040516103309190614389565b61038c61038736600461434c565b610b4a565b005b61032461039c3660046143dc565b610c63565b6103f56103af366004614408565b600e602052600090815260409020805460018201546002909201546001600160801b0380831693600160801b938490048216938183169391049091169063ffffffff1685565b604080516001600160801b039687168152948616602086015292851692840192909252909216606082015263ffffffff909116608082015260a001610330565b610448610443366004614408565b610c7b565b604051908152602001610330565b600354610448565b61047161046c366004614475565b610d25565b60408051928352602083019190915201610330565b600f546104a4906001600160801b0380821691600160801b90041682565b604080516001600160801b03938416815292909116602083015201610330565b600654600754600854610534926001600160a01b03908116929081169162ffffff600160a01b8304811692600160b81b8104821692600160d01b8204831692600160e81b909204821691818116916301000000810482169166010000000000008204811691600160481b9004168a565b604080516001600160a01b039b8c1681529a90991660208b015262ffffff978816988a01989098529486166060890152928516608088015290841660a0870152831660c0860152821660e085015281166101008401521661012082015261014001610330565b61038c6105a83660046144ff565b610f3f565b6103246105bb36600461451a565b610fdd565b6104486105ce36600461434c565b60009081526020819052604090206001015490565b6104486105f136600461455b565b611003565b61038c61060436600461455b565b61101a565b61038c61061736600461455b565b61105d565b60405160128152602001610330565b61038c61063936600461455b565b611087565b61038c61064c36600461455b565b61126f565b7f000000000000000000000000000000000000000000000000000000000000000061034c565b6103246106853660046143dc565b6112ee565b61038c61069836600461458b565b611310565b61038c6106ab3660046145a4565b6114b4565b6107086106be366004614618565b600d602052600090815260409020805460018201546002909201546001600160801b0380831693600160801b93849004821693818316939181900483169282811692919091041686565b604080516001600160801b03978816815295871660208701529386169385019390935290841660608401528316608083015290911660a082015260c001610330565b610471610758366004614408565b611535565b61047161076b366004614408565b611553565b610448600080516020614cfc83398151915281565b610448610793366004614408565b6001600160a01b031660009081526001602052604090205490565b61038c6107bc366004614633565b6115c2565b61038c6107cf36600461455b565b6116b5565b6103246107e236600461455b565b6116f3565b61036c61171c565b6104486107fd366004614408565b61172b565b610448600081565b6103246108183660046143dc565b611772565b61032461082b3660046143dc565b6117f8565b61038c61083e36600461434c565b611806565b61044861085136600461455b565b611a18565b6104486301e1338081565b61038c61086f36600461455b565b611b04565b6010546104a4906001600160801b0380821691600160801b90041682565b61038c6108a036600461455b565b611ce6565b6104486108b336600461468f565b611d0b565b61038c6108c63660046146bd565b611d36565b61038c6108d9366004614408565b611dc5565b600954610926906001600160a01b0381169060ff600160a01b8204811691600160a81b8104821691600160b01b8204811691600160b81b8104821691600160c01b9091041686565b604080516001600160a01b039097168752941515602087015292151593850193909352151560608401529015156080830152151560a082015260c001610330565b600b54600c546109bb916001600160801b0380821692600160801b909204169063ffffffff8116906001600160401b036401000000008204811691600160601b81049091169060ff600160a01b9091041686565b604080516001600160801b03978816815296909516602087015263ffffffff909316938501939093526001600160401b0390811660608501529091166080830152151560a082015260c001610330565b610448610a19366004614408565b611e47565b61038c610a2c3660046146d8565b611e79565b610448610a3f3660046146f5565b611efa565b610448610a5236600461455b565b6120a8565b60006001600160e01b03198216637965db0b60e01b1480610a8857506301ffc9a760e01b6001600160e01b03198316145b92915050565b600a8181548110610a9e57600080fd5b6000918252602090912001546001600160a01b0316905081565b606060048054610ac790614728565b80601f0160208091040260200160405190810160405280929190818152602001828054610af390614728565b8015610b405780601f10610b1557610100808354040283529160200191610b40565b820191906000526020600020905b815481529060010190602001808311610b2357829003601f168201915b5050505050905090565b610b62600080516020614cfc833981519152336116f3565b610b7f576040516312dd957560e31b815260040160405180910390fd5b600954604051636ce5768960e11b81523060048201526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166024830152604482018490529091169063d9caed1290606401600060405180830381600087803b158015610bf357600080fd5b505af1158015610c07573d6000803e3d6000fd5b5050600c54600954604080516001600160a01b0390921682526020820186905263ffffffff90921693503392507f07673397b18958e624a46b92034a2a5d69ee7ef570059d4d2dc692349216395291015b60405180910390a350565b600033610c718185856120bf565b5060019392505050565b6000610c86336121e3565b336000908152600e6020526040902054600160801b90046001600160801b031615610d205750336000908152600e6020526040902080546001600160801b03808216909255600160801b900416610cde3083836124fc565b6040518181526001600160a01b0383169033907f438df5737634ab0704853a9f34ac7b2b5878a6e872a2cd85e097221d151b9e74906020015b60405180910390a35b919050565b6000806001600160801b03861615610dcc57600954604051636ce5768960e11b81523060048201526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660248301526001600160801b03891660448301529091169063d9caed1290606401600060405180830381600087803b158015610db357600080fd5b505af1158015610dc7573d6000803e3d6000fd5b505050505b610dda8989898888886126c3565b90925090508115610e1f57600654610e1f906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116911684612c82565b8015610e5f57600754610e5f906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116911683612c82565b6000610e69612ce5565b90508015610f3257600954610eab906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116911683612dbe565b6009546040516311f9fbc960e21b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116600483015260248201849052909116906347e7ef2490604401600060405180830381600087803b158015610f1957600080fd5b505af1158015610f2d573d6000803e3d6000fd5b505050505b5097509795505050505050565b610f57600080516020614cfc833981519152336116f3565b610f74576040516312dd957560e31b815260040160405180910390fd5b600c805467ffffffffffffffff60601b198116600160601b6001600160401b03851690810291821790935560405192835263ffffffff9182169116179033907f1cced4c455e5e9eb599e2636157518cf49e3253f25025d686fceed9b09db415390602001610c58565b600033610feb858285612ed3565b610ff68585856124fc565b60019150505b9392505050565b600061100e33610c7b565b9050610a888383611b04565b61104f6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016333085612f47565b6110598282612f7f565b5050565b600082815260208190526040902060010154611078816131fd565b611082838361320a565b505050565b600c54600160601b90046001600160401b03164211156110ba57604051631154791f60e31b815260040160405180910390fd5b600954600160c01b900460ff16156110e5576040516370d38fdb60e11b815260040160405180910390fd5b600c54336000908152600e602052604090206002015463ffffffff91821691168114611124576040516308018a9d60e11b815260040160405180910390fd5b336000908152600e60205260409020600101546001600160801b0316831115611160576040516308018a9d60e11b815260040160405180910390fd5b600061116b8461328e565b63ffffffff83166000908152600d60205260408120600201805492935083929091906111a19084906001600160801b0316614772565b82546101009290920a6001600160801b03818102199093169183160217909155336000908152600e60205260408120600101805485945090926111e691859116614772565b92506101000a8154816001600160801b0302191690836001600160801b031602179055506112153084866124fc565b826001600160a01b03168263ffffffff16336001600160a01b03167f26691efbd563db4f0ef52c831c675b90138ae4905406c87c2b0f4563e1dd83a98760405161126191815260200190565b60405180910390a450505050565b6001600160a01b03811633146112e45760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b61105982826132fb565b600033610c718185856113018383611d0b565b61130b9190614792565b6120bf565b61131b6000336116f3565b6113385760405163026a32f560e01b815260040160405180910390fd5b620f424061134c60a08301608084016147c1565b61135c60c0840160a085016147c1565b61136c60608501604086016147c1565b61137c60808601606087016147c1565b61138691906147de565b61139091906147de565b61139a91906147de565b62ffffff1611156113be5760405163390edff560e11b815260040160405180910390fd5b620f42406113d260e0830160c084016147c1565b6113e3610100840160e085016147c1565b6113ed91906147de565b62ffffff1611156114115760405163390edff560e11b815260040160405180910390fd5b620f4240611427610120830161010084016147c1565b611439610140840161012085016147c1565b61144391906147de565b62ffffff1611156114675760405163390edff560e11b815260040160405180910390fd5b8060066114748282614827565b5050600c5460405163ffffffff9091169033907f20d90a0fb35da673e55fe1e68cfbd15031f646dfdb88fca5da5d5b5aa1737c9190610c589085906149dd565b6114bf6000336116f3565b6114dc5760405163026a32f560e01b815260040160405180910390fd5b6114e8600a83836142b3565b50600c5460405163ffffffff9091169033907fdbacfed7331c1f7d5ea718f12281a7cddbe34f9191280d075171555ae205556f906115299086908690614acf565b60405180910390a35050565b6000806115418361172b565b915061154c83610c7b565b9050915091565b600c546001600160a01b0382166000908152600e60205260408120600201549091829163ffffffff90811691161461159057506000928392509050565b50506001600160a01b03166000908152600e6020526040902080546001909101546001600160801b0391821692911690565b6115da600080516020614cfc833981519152336116f3565b6115f7576040516312dd957560e31b815260040160405180910390fd5b6009805461ffff60a81b1916600160a81b86151590810260ff60b01b191691909117600160b01b8615159081029190911761ffff60b81b1916600160b81b86151590810260ff60c01b191691909117600160c01b86151590810291909117909455600c5460408051948552602085019390935291830152606082019290925263ffffffff9091169033907f756dd9c69469d2afa95e813c93b1b5e013030da6125e8deba169cac0b05be95b906080015b60405180910390a350505050565b6116bf8282613360565b6110596001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168284612c82565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b606060058054610ac790614728565b60006117368261357d565b90508015610d2057610d206001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168383612c82565b600033816117808286611d0b565b9050838110156117e05760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016112db565b6117ed82868684036120bf565b506001949350505050565b600033610c718185856124fc565b61181e600080516020614cfc833981519152336116f3565b61183b576040516312dd957560e31b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156118a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118c69190614b1d565b600b5490915082906118e890600160801b90046001600160801b031683614b36565b101561190757604051630de1bf7560e21b815260040160405180910390fd5b600954611941906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116911684612dbe565b6009546040516311f9fbc960e21b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116600483015260248201859052909116906347e7ef2490604401600060405180830381600087803b1580156119af57600080fd5b505af11580156119c3573d6000803e3d6000fd5b5050600c54600954604080516001600160a01b0390921682526020820187905263ffffffff90921693503392507f5d1dfc1839b0efecd070cb1dffe5619e5eee01414217e375af83ab539f8674699101611529565b600c54600090600160a01b900460ff16611a45576040516362fa8aa560e01b815260040160405180910390fd5b6001600160a01b0382163314611a6057611a60823385612ed3565b611a6a8284613667565b6010546001600160801b03600160801b8204811691611a8a911685614b49565b611a949190614b68565b9050611a9f8161328e565b6001600160a01b0383166000908152600e602052604090206001018054601090611ada908490600160801b90046001600160801b0316614b8a565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555092915050565b600954600160b01b900460ff1615611b2f576040516337ae717b60e01b815260040160405180910390fd5b600c54600160a01b900460ff1615611b5a576040516333cd40f760e21b815260040160405180910390fd5b600c54600160601b90046001600160401b0316421115611b8d57604051631154791f60e31b815260040160405180910390fd5b6001600160a01b0381163314611ba857611ba8813384612ed3565b611bb38130846124fc565b600c5463ffffffff166000611bc78461328e565b63ffffffff83166000908152600d6020526040812060020180549293508392909190611bfd9084906001600160801b0316614b8a565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550611c2a836121e3565b6001600160a01b0383166000908152600e602052604081206001018054839290611c5e9084906001600160801b0316614b8a565b82546101009290920a6001600160801b03818102199093169190921691909102179055506001600160a01b0383166000818152600e6020908152604091829020600201805463ffffffff191663ffffffff8716908117909155915187815233917f3810ab7906acf68459e21d2bda4204d1ea974be908fbafd94960af3e65f574069101611261565b600082815260208190526040902060010154611d01816131fd565b61108283836132fb565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b611d4e600080516020614cfc833981519152336116f3565b611d6b576040516312dd957560e31b815260040160405180910390fd5b600b80546001600160801b0319166001600160801b038316908117909155600c5460405191825263ffffffff169033907fa16b5549c22000d0e01e72b956bb87da3bfe261ae97db12a513c1c8389415c4090602001610c58565b611dd06000336116f3565b611ded5760405163026a32f560e01b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b038316908117909155600c5460405191825263ffffffff169033907f176fab7d1785c2fd0f77b65b7bd24a50e28206d75f8f9cc841a6f73c339d6f8790602001610c58565b6000611e5233610c7b565b50336000908152600160205260408120549050611e6f8133611a18565b50610ffc8361172b565b611e846000336116f3565b611ea15760405163026a32f560e01b815260040160405180910390fd5b6009805460ff60a01b1916600160a01b83151590810291909117909155600c5460405191825263ffffffff169033907f3b93f6236a5ca20626fa185941c647a5f2eb017a57d5e06f61a46026e0913a7490602001610c58565b600c5460009063ffffffff1615611f3657600080611f1885856137b5565b9092509050611f278183614792565b611f319084614792565b925050505b600c5463ffffffff166000818152600d60205260409020600201546001600160801b031615611fc4576000611f74836001600160801b038716614b36565b9050611f7f60035490565b63ffffffff83166000908152600d6020526040902060020154611fac9083906001600160801b0316614b49565b611fb69190614b68565b611fc09084614792565b9250505b63ffffffff81166000908152600d60205260409020600101546001600160801b0316156120a15763ffffffff81166000908152600d60205260408120600101546007546001600160801b039091169190620f42409061202f90600160a01b900462ffffff1684614b49565b6120399190614b68565b600754909150600090620f42409061205d90600160b81b900462ffffff1685614b49565b6120679190614b68565b90506120738183614792565b61207d9086614792565b945082851115612098576120918386614b36565b945061209d565b600094505b5050505b5092915050565b60006120b33361172b565b9050610a88838361101a565b6001600160a01b0383166121215760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016112db565b6001600160a01b0382166121825760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016112db565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0381166000908152600e6020526040902060020154600c5463ffffffff91821691168110612216575050565b6001600160a01b0382166000908152600e60205260409020546001600160801b0316156123815763ffffffff81166000908152600d60209081526040808320600101546001600160a01b0386168452600e9092528220546001600160801b038083169261228e92600160801b90910482169116614b49565b6122989190614b68565b90506122a38161328e565b6001600160a01b0384166000908152600e6020526040902080546010906122db908490600160801b90046001600160801b0316614b8a565b82546101009290920a6001600160801b038181021990931691831602179091556001600160a01b0385166000818152600e602090815260409182902054825194168452830185905263ffffffff8616935090917fd9afe7596a53cbdd5895a926034be7e90058aeffbd6d142b7e4669c4cdeb59db910160405180910390a3506001600160a01b0382166000908152600e6020526040902080546001600160801b03191690555b6001600160a01b0382166000908152600e60205260409020600101546001600160801b0316156110595763ffffffff81166000908152600d60209081526040808320600201546001600160a01b0386168452600e9092528220600101546001600160801b03808316926123ff92600160801b90910482169116614b49565b6124099190614b68565b90506124148161328e565b6001600160a01b0384166000908152600e60205260409020600101805460109061244f908490600160801b90046001600160801b0316614b8a565b82546101009290920a6001600160801b038181021990931691831602179091556001600160a01b0385166000818152600e602090815260409182902060010154825194168452830185905263ffffffff8616935090917f03d70ca23b379999d618a0b320f816f1bb4011e3d167124ee74ba6b67025ccc0910160405180910390a350506001600160a01b03166000908152600e6020526040902060010180546001600160801b0319169055565b6001600160a01b0383166125605760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016112db565b6001600160a01b0382166125c25760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016112db565b6001600160a01b0383166000908152600160205260409020548181101561263a5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016112db565b6001600160a01b03808516600090815260016020526040808220858503905591851681529081208054849290612671908490614792565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116a791815260200190565b50505050565b6000806126de600080516020614cfc833981519152336116f3565b6126fb576040516312dd957560e31b815260040160405180910390fd5b6009546001600160a01b031661272457604051633240c75d60e11b815260040160405180910390fd5b6006546001600160a01b031661274d57604051633240c75d60e11b815260040160405180910390fd5b6007546001600160a01b031661277657604051633240c75d60e11b815260040160405180910390fd5b600c54600160a01b900460ff16156127a1576040516333cd40f760e21b815260040160405180910390fd5b600c5463ffffffff8981169116146127cc576040516359d9c8e760e11b815260040160405180910390fd5b600c546001600160401b0364010000000090910481169086161115806127fa575042856001600160401b0316115b15612818576040516306f0300360e01b815260040160405180910390fd5b63ffffffff88166000818152600d6020526040812080546001600160801b0319166001600160801b038b16179055908190156128765761285889886137b5565b90925090506128678285614792565b93506128738184614792565b92505b60008361288c866001600160801b038d16614b36565b6128969190614b36565b905060006128a360035490565b90506000811180156128b3575081155b156128d157604051631a43347b60e01b815260040160405180910390fd5b801580156128fe575063ffffffff8c166000908152600d60205260409020600101546001600160801b0316155b1561291c57604051630558800760e21b815260040160405180910390fd5b612925826138e3565b90945092506129348487614792565b95506129408386614792565b94508615612a9c57600c5463ffffffff166000908152600d6020526040902054600754620f4240600160801b9092046001600160801b0316600160d01b820462ffffff908116820284900493600160e81b90930416020490945092506129a68487614792565b95506129b28386614792565b600c5463ffffffff166000908152600d6020526040812054919650906129fe9085906129ef908890600160801b90046001600160801b0316614b36565b6129f99190614b36565b61328e565b90506040518060400160405280826001600160801b03168152602001612a266129f960035490565b6001600160801b039081169091528151602090920151918116600160801b9282168302176010908155600b805485949193612a649286920416614b8a565b82546001600160801b039182166101009390930a92830291909202199091161790555050600c805460ff60a01b1916600160a01b1790555b80600003612b3f57600f54604080516001600160801b038e811682528084166020830152600160801b909304831681830152918c1660608301526001600160401b038b811660808401528a1660a083015288151560c083015260e0820188905261010082018790525163ffffffff8e169133917f9218348c215ae6efb0182d0a67ae857e1c1efadb71ca49e42fbebb0cefa34ced918190036101200190a3612bca565b604080516001600160801b038d81168252602082018590528183018490528c1660608201526001600160401b038b811660808301528a1660a082015288151560c082015260e081018890526101008101879052905163ffffffff8e169133917f9218348c215ae6efb0182d0a67ae857e1c1efadb71ca49e42fbebb0cefa34ced918190036101200190a35b600c805463ffffffff16906000612be083614baa565b82546101009290920a63ffffffff8181021990931691909216919091021790555050600c8054600b80546001600160801b0319166001600160801b039c909c169b909b17909a5573ffffffffffffffffffffffffffffffff00000000199099166401000000006001600160401b03998a160267ffffffffffffffff60601b191617600160601b9790981696909602969096179096559097909650945050505050565b6040516001600160a01b03831660248201526044810182905261108290849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613ca5565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015612d4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d709190614b1d565b600b54909150600160801b90046001600160801b0316811015612da657604051630de1bf7560e21b815260040160405180910390fd5b600b54600160801b90046001600160801b0316900390565b801580612e385750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612e12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e369190614b1d565b155b612ea35760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016112db565b6040516001600160a01b03831660248201526044810182905261108290849063095ea7b360e01b90606401612cae565b6000612edf8484611d0b565b905060001981146126bd5781811015612f3a5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016112db565b6126bd84848484036120bf565b6040516001600160a01b03808516602483015283166044820152606481018290526126bd9085906323b872dd60e01b90608401612cae565b600954600160a81b900460ff1615612faa57604051633eca454160e21b815260040160405180910390fd5b600c54600160a01b900460ff1615612fd5576040516333cd40f760e21b815260040160405180910390fd5b600c54600160601b90046001600160401b031642111561300857604051631154791f60e31b815260040160405180910390fd5b600b54600c5463ffffffff166000908152600d60205260409020600101546001600160801b039182169161303d911684614792565b111561305c576040516325d16c5160e01b815260040160405180910390fd5b61306581613d77565b61308257604051631e84063d60e21b815260040160405180910390fd5b600c5463ffffffff1660006130968461328e565b63ffffffff83166000908152600d60205260408120600101805492935083929091906130cc9084906001600160801b0316614b8a565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555080600b60000160108282829054906101000a90046001600160801b03166131179190614b8a565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550613144836121e3565b6001600160a01b0383166000908152600e6020526040812080548392906131759084906001600160801b0316614b8a565b82546101009290920a6001600160801b03818102199093169190921691909102179055506001600160a01b0383166000818152600e6020908152604091829020600201805463ffffffff191663ffffffff8716908117909155915187815233917fbfe5941e15cff302c0267251043bf2848ebc12b8259e8c065ba97644923497b59101611261565b6132078133613e54565b50565b61321482826116f3565b611059576000828152602081815260408083206001600160a01b03851684529091529020805460ff1916600117905561324a3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006001600160801b038211156132f75760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b60648201526084016112db565b5090565b61330582826116f3565b15611059576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600c54600160601b90046001600160401b031642111561339357604051631154791f60e31b815260040160405180910390fd5b600954600160b81b900460ff16156133be57604051638da7160560e01b815260040160405180910390fd5b600c54336000908152600e602052604090206002015463ffffffff918216911681146133fd57604051631648a98f60e31b815260040160405180910390fd5b336000908152600e60205260409020546001600160801b031683111561343657604051631648a98f60e31b815260040160405180910390fd5b60006134418461328e565b63ffffffff83166000908152600d60205260408120600101805492935083929091906134779084906001600160801b0316614772565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555080600b60000160108282829054906101000a90046001600160801b03166134c29190614772565b82546101009290920a6001600160801b038181021990931691831602179091556001600160a01b0385166000908152600e602052604081208054859450909261350d91859116614772565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550826001600160a01b03168263ffffffff16336001600160a01b03167f52bcf77e4201d50a5a56cbac4a5eadb29047a1f2866e4896b737d2ab7ec06b498760405161126191815260200190565b6000613588336121e3565b336000908152600e6020526040902060010154600160801b90046001600160801b031615610d205750336000908152600e6020526040902060010154600b80546001600160801b03600160801b938490048116938493926010926135ef9286920416614772565b82546101009290920a6001600160801b03818102199093169183160217909155336000818152600e60209081526040918290206001018054909416909355518481526001600160a01b038616935090917f1e82b8552efdf1dbc6131cc7346db181a113c1cf3885db8b7d9db0e60311a1079101610d17565b6001600160a01b0382166136c75760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016112db565b6001600160a01b0382166000908152600160205260409020548181101561373b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016112db565b6001600160a01b038316600090815260016020526040812083830390556003805484929061376a908490614b36565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b600c5460009081906001600160801b0385169082906137e59064010000000090046001600160401b031686614bcd565b600854600c54651cae8c13e00062ffffff66010000000000008404811687026001600160401b0386169081028390049950600160481b909404168602909202919091049450909150600d906000906138459060019063ffffffff16614bed565b63ffffffff168152602081019190915260400160002054600160801b90046001600160801b03168211156138da57600c5463ffffffff90811660001901166000908152600d6020526040902054600854600160801b9091046001600160801b0316830390620f42409062ffffff1682026008549190049590950194620f4240906301000000900462ffffff1682020484019350505b50509250929050565b600c54600090819063ffffffff16816138fb60035490565b63ffffffff83166000908152600d602052604090206002015490915085906001600160801b031615613a725763ffffffff83166000908152600d60205260408120600201548390613955906001600160801b031689614b49565b61395f9190614b68565b600754909150620f424062ffffff600160d01b83048116840282900492600160e81b900416830204613995816129ef8486614b36565b63ffffffff87166000908152600d6020526040902060020180546001600160801b03908116600160801b93821684021791829055600b80549284900482169390926010926139e69286920416614b8a565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550613a138361328e565b613a26906001600160801b031685614b36565b9350613a328289614792565b9750613a3e8188614792565b63ffffffff87166000908152600d6020526040902060020154909750613a6e9030906001600160801b0316613667565b5050505b63ffffffff83166000908152600d60205260409020600101546001600160801b031615613c605763ffffffff83166000908152600d6020526040902060010154600754600b80546001600160801b0393841693620f424062ffffff600160a01b86048116870282900495600160b81b9004168602049285929091601091613b02918591600160801b900416614772565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550808284613b339190614b36565b613b3d9190614b36565b9250613b488361328e565b613b5b906001600160801b031685614792565b935084600003613bcd57600f54613b95906001600160801b0380821691613b8b91600160801b9091041686614b49565b6129f99190614b68565b63ffffffff87166000908152600d6020526040902060010180546001600160801b03928316600160801b029216919091179055613c0f565b613bdb89613b8b8786614b49565b63ffffffff87166000908152600d6020526040902060010180546001600160801b03928316600160801b0292169190911790555b613c198289614792565b9750613c258188614792565b63ffffffff87166000908152600d6020526040902060010154909750613c5c903090600160801b90046001600160801b0316613eb8565b5050505b613c698161328e565b63ffffffff9093166000908152600d6020526040902080546001600160801b03948516600160801b029416939093179092555091939092509050565b6000613cfa826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613f979092919063ffffffff16565b8051909150156110825780806020019051810190613d189190614c0a565b6110825760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016112db565b600954600090600160a01b900460ff1615613d9457506001919050565b600a546000905b80821015613e4a576000600a8381548110613db857613db8614c27565b6000918252602090912001546040516370a0823160e01b81526001600160a01b038781166004830152909116906370a0823190602401602060405180830381865afa158015613e0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e2f9190614b1d565b1115613e3f575060019392505050565b816001019150613d9b565b5060009392505050565b613e5e82826116f3565b61105957613e76816001600160a01b03166014613fae565b613e81836020613fae565b604051602001613e92929190614c3d565b60408051601f198184030181529082905262461bcd60e51b82526112db91600401614389565b6001600160a01b038216613f0e5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016112db565b8060036000828254613f209190614792565b90915550506001600160a01b03821660009081526001602052604081208054839290613f4d908490614792565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6060613fa68484600085614149565b949350505050565b60606000613fbd836002614b49565b613fc8906002614792565b6001600160401b03811115613fdf57613fdf614cb2565b6040519080825280601f01601f191660200182016040528015614009576020820181803683370190505b509050600360fc1b8160008151811061402457614024614c27565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061405357614053614c27565b60200101906001600160f81b031916908160001a9053506000614077846002614b49565b614082906001614792565b90505b60018111156140fa576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106140b6576140b6614c27565b1a60f81b8282815181106140cc576140cc614c27565b60200101906001600160f81b031916908160001a90535060049490941c936140f381614cc8565b9050614085565b508315610ffc5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016112db565b6060824710156141aa5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016112db565b6001600160a01b0385163b6142015760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016112db565b600080866001600160a01b0316858760405161421d9190614cdf565b60006040518083038185875af1925050503d806000811461425a576040519150601f19603f3d011682016040523d82523d6000602084013e61425f565b606091505b509150915061426f82828661427a565b979650505050505050565b60608315614289575081610ffc565b8251156142995782518084602001fd5b8160405162461bcd60e51b81526004016112db9190614389565b828054828255906000526020600020908101928215614306579160200282015b828111156143065781546001600160a01b0319166001600160a01b038435161782556020909201916001909101906142d3565b506132f79291505b808211156132f7576000815560010161430e565b60006020828403121561433457600080fd5b81356001600160e01b031981168114610ffc57600080fd5b60006020828403121561435e57600080fd5b5035919050565b60005b83811015614380578181015183820152602001614368565b50506000910152565b60208152600082518060208401526143a8816040850160208701614365565b601f01601f19169190910160400192915050565b6001600160a01b038116811461320757600080fd5b8035610d20816143bc565b600080604083850312156143ef57600080fd5b82356143fa816143bc565b946020939093013593505050565b60006020828403121561441a57600080fd5b8135610ffc816143bc565b803563ffffffff81168114610d2057600080fd5b80356001600160801b0381168114610d2057600080fd5b80356001600160401b0381168114610d2057600080fd5b801515811461320757600080fd5b600080600080600080600060e0888a03121561449057600080fd5b61449988614425565b96506144a760208901614439565b95506144b560408901614439565b94506144c360608901614439565b93506144d160808901614450565b92506144df60a08901614450565b915060c08801356144ef81614467565b8091505092959891949750929550565b60006020828403121561451157600080fd5b610ffc82614450565b60008060006060848603121561452f57600080fd5b833561453a816143bc565b9250602084013561454a816143bc565b929592945050506040919091013590565b6000806040838503121561456e57600080fd5b823591506020830135614580816143bc565b809150509250929050565b6000610140828403121561459e57600080fd5b50919050565b600080602083850312156145b757600080fd5b82356001600160401b03808211156145ce57600080fd5b818501915085601f8301126145e257600080fd5b8135818111156145f157600080fd5b8660208260051b850101111561460657600080fd5b60209290920196919550909350505050565b60006020828403121561462a57600080fd5b610ffc82614425565b6000806000806080858703121561464957600080fd5b843561465481614467565b9350602085013561466481614467565b9250604085013561467481614467565b9150606085013561468481614467565b939692955090935050565b600080604083850312156146a257600080fd5b82356146ad816143bc565b91506020830135614580816143bc565b6000602082840312156146cf57600080fd5b610ffc82614439565b6000602082840312156146ea57600080fd5b8135610ffc81614467565b6000806040838503121561470857600080fd5b61471183614439565b915061471f60208401614450565b90509250929050565b600181811c9082168061473c57607f821691505b60208210810361459e57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6001600160801b038281168282160390808211156120a1576120a161475c565b80820180821115610a8857610a8861475c565b62ffffff8116811461320757600080fd5b8035610d20816147a5565b6000602082840312156147d357600080fd5b8135610ffc816147a5565b62ffffff8181168382160190808211156120a1576120a161475c565b80546001600160a01b0319166001600160a01b0392909216919091179055565b60008135610a88816147a5565b8135614832816143bc565b61483c81836147fa565b5060018101602083013561484f816143bc565b61485981836147fa565b506040830135614868816147a5565b815462ffffff60a01b191660a09190911b62ffffff60a01b161781556148b56148936060850161481a565b82805462ffffff60b81b191660b89290921b62ffffff60b81b16919091179055565b6148e66148c46080850161481a565b82805462ffffff60d01b191660d09290921b62ffffff60d01b16919091179055565b6149196148f560a0850161481a565b8280546001600160e81b031660e89290921b6001600160e81b031916919091179055565b506002810161494261492d60c0850161481a565b825462ffffff191662ffffff91909116178255565b61496f61495160e0850161481a565b825465ffffff000000191660189190911b65ffffff00000016178255565b6149a361497f610100850161481a565b825468ffffff000000000000191660309190911b68ffffff00000000000016178255565b6110826149b3610120850161481a565b82546bffffff000000000000000000191660489190911b6bffffff00000000000000000016178255565b61014081016149fc826149ef856143d1565b6001600160a01b03169052565b614a08602084016143d1565b6001600160a01b03166020830152614a22604084016147b6565b62ffffff166040830152614a38606084016147b6565b62ffffff166060830152614a4e608084016147b6565b62ffffff166080830152614a6460a084016147b6565b62ffffff1660a0830152614a7a60c084016147b6565b62ffffff1660c0830152614a9060e084016147b6565b62ffffff1660e0830152610100614aa88482016147b6565b62ffffff1690830152610120614abf8482016147b6565b62ffffff16920191909152919050565b60208082528181018390526000908460408401835b86811015614b12578235614af7816143bc565b6001600160a01b031682529183019190830190600101614ae4565b509695505050505050565b600060208284031215614b2f57600080fd5b5051919050565b81810381811115610a8857610a8861475c565b6000816000190483118215151615614b6357614b6361475c565b500290565b600082614b8557634e487b7160e01b600052601260045260246000fd5b500490565b6001600160801b038181168382160190808211156120a1576120a161475c565b600063ffffffff808316818103614bc357614bc361475c565b6001019392505050565b6001600160401b038281168282160390808211156120a1576120a161475c565b63ffffffff8281168282160390808211156120a1576120a161475c565b600060208284031215614c1c57600080fd5b8151610ffc81614467565b634e487b7160e01b600052603260045260246000fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614c75816017850160208801614365565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614ca6816028840160208801614365565b01602801949350505050565b634e487b7160e01b600052604160045260246000fd5b600081614cd757614cd761475c565b506000190190565b60008251614cf1818460208701614365565b919091019291505056fe59a1c48e5837ad7a7f3dcedcbe129bf3249ec4fbf651fd4f5e2600ead39fe2f5a2646970667358221220e626a44ecc3a12eaddf6d29540e681b8429a6e67e7bbd948eac0a696714c303c64736f6c6343000810003300000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000630dd960000000000000000000000000f3808680917524cd1346b12e4845830076eb7001000000000000000000000000000000000000000000000000000000000000000d48542d555344432d4d4e4c50530000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000054f50544541000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061030c5760003560e01c80636297817f1161019d578063c4fa17a4116100e9578063e22857ce116100a2578063e98270171161007c578063e982701714610a0b578063ec8ad8e814610a1e578063f3ad740114610a31578063f807f6d614610a4457600080fd5b8063e22857ce146108cb578063e28d1d2e146108de578063e76c01e41461096757600080fd5b8063c4fa17a414610856578063ccc143b814610861578063ccdf429914610874578063d547741f14610892578063dd62ed3e146108a5578063e02ff7fe146108b857600080fd5b806395d89b4111610156578063a457c2d711610130578063a457c2d71461080a578063a9059cbb1461081d578063b046229614610830578063b5e0ecac1461084357600080fd5b806395d89b41146107e757806398000ff7146107ef578063a217fddf1461080257600080fd5b80636297817f1461075d5780636e1d616e1461077057806370a082311461078557806373601719146107ae5780638fffd8b2146107c157806391d14854146107d457600080fd5b8063248a9ca31161025c57806336568abe1161021557806341295a5d116101ef57806341295a5d1461068a5780634643d4241461069d5780634923d29e146106b0578063578f2bcc1461074a57600080fd5b806336568abe1461063e57806338d52e0f14610651578063395093511461067757600080fd5b8063248a9ca3146105c057806326c113fb146105e357806329344f08146105f65780632f2ff15d14610609578063313ce5671461061c57806335cb739e1461062b57600080fd5b80631696adc8116102c95780631d0806ae116102a35780631d0806ae146104865780631e5eb1d0146104c45780631fd468981461059a57806323b872dd146105ad57600080fd5b80631696adc81461043557806318160ddd146104565780631987b0451461045e57600080fd5b806301ffc9a71461031157806306297eab1461033957806306fdde0314610364578063076d081514610379578063095ea7b31461038e5780630c8f81b5146103a1575b600080fd5b61032461031f366004614322565b610a57565b60405190151581526020015b60405180910390f35b61034c61034736600461434c565b610a8e565b6040516001600160a01b039091168152602001610330565b61036c610ab8565b6040516103309190614389565b61038c61038736600461434c565b610b4a565b005b61032461039c3660046143dc565b610c63565b6103f56103af366004614408565b600e602052600090815260409020805460018201546002909201546001600160801b0380831693600160801b938490048216938183169391049091169063ffffffff1685565b604080516001600160801b039687168152948616602086015292851692840192909252909216606082015263ffffffff909116608082015260a001610330565b610448610443366004614408565b610c7b565b604051908152602001610330565b600354610448565b61047161046c366004614475565b610d25565b60408051928352602083019190915201610330565b600f546104a4906001600160801b0380821691600160801b90041682565b604080516001600160801b03938416815292909116602083015201610330565b600654600754600854610534926001600160a01b03908116929081169162ffffff600160a01b8304811692600160b81b8104821692600160d01b8204831692600160e81b909204821691818116916301000000810482169166010000000000008204811691600160481b9004168a565b604080516001600160a01b039b8c1681529a90991660208b015262ffffff978816988a01989098529486166060890152928516608088015290841660a0870152831660c0860152821660e085015281166101008401521661012082015261014001610330565b61038c6105a83660046144ff565b610f3f565b6103246105bb36600461451a565b610fdd565b6104486105ce36600461434c565b60009081526020819052604090206001015490565b6104486105f136600461455b565b611003565b61038c61060436600461455b565b61101a565b61038c61061736600461455b565b61105d565b60405160128152602001610330565b61038c61063936600461455b565b611087565b61038c61064c36600461455b565b61126f565b7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4861034c565b6103246106853660046143dc565b6112ee565b61038c61069836600461458b565b611310565b61038c6106ab3660046145a4565b6114b4565b6107086106be366004614618565b600d602052600090815260409020805460018201546002909201546001600160801b0380831693600160801b93849004821693818316939181900483169282811692919091041686565b604080516001600160801b03978816815295871660208701529386169385019390935290841660608401528316608083015290911660a082015260c001610330565b610471610758366004614408565b611535565b61047161076b366004614408565b611553565b610448600080516020614cfc83398151915281565b610448610793366004614408565b6001600160a01b031660009081526001602052604090205490565b61038c6107bc366004614633565b6115c2565b61038c6107cf36600461455b565b6116b5565b6103246107e236600461455b565b6116f3565b61036c61171c565b6104486107fd366004614408565b61172b565b610448600081565b6103246108183660046143dc565b611772565b61032461082b3660046143dc565b6117f8565b61038c61083e36600461434c565b611806565b61044861085136600461455b565b611a18565b6104486301e1338081565b61038c61086f36600461455b565b611b04565b6010546104a4906001600160801b0380821691600160801b90041682565b61038c6108a036600461455b565b611ce6565b6104486108b336600461468f565b611d0b565b61038c6108c63660046146bd565b611d36565b61038c6108d9366004614408565b611dc5565b600954610926906001600160a01b0381169060ff600160a01b8204811691600160a81b8104821691600160b01b8204811691600160b81b8104821691600160c01b9091041686565b604080516001600160a01b039097168752941515602087015292151593850193909352151560608401529015156080830152151560a082015260c001610330565b600b54600c546109bb916001600160801b0380821692600160801b909204169063ffffffff8116906001600160401b036401000000008204811691600160601b81049091169060ff600160a01b9091041686565b604080516001600160801b03978816815296909516602087015263ffffffff909316938501939093526001600160401b0390811660608501529091166080830152151560a082015260c001610330565b610448610a19366004614408565b611e47565b61038c610a2c3660046146d8565b611e79565b610448610a3f3660046146f5565b611efa565b610448610a5236600461455b565b6120a8565b60006001600160e01b03198216637965db0b60e01b1480610a8857506301ffc9a760e01b6001600160e01b03198316145b92915050565b600a8181548110610a9e57600080fd5b6000918252602090912001546001600160a01b0316905081565b606060048054610ac790614728565b80601f0160208091040260200160405190810160405280929190818152602001828054610af390614728565b8015610b405780601f10610b1557610100808354040283529160200191610b40565b820191906000526020600020905b815481529060010190602001808311610b2357829003601f168201915b5050505050905090565b610b62600080516020614cfc833981519152336116f3565b610b7f576040516312dd957560e31b815260040160405180910390fd5b600954604051636ce5768960e11b81523060048201526001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881166024830152604482018490529091169063d9caed1290606401600060405180830381600087803b158015610bf357600080fd5b505af1158015610c07573d6000803e3d6000fd5b5050600c54600954604080516001600160a01b0390921682526020820186905263ffffffff90921693503392507f07673397b18958e624a46b92034a2a5d69ee7ef570059d4d2dc692349216395291015b60405180910390a350565b600033610c718185856120bf565b5060019392505050565b6000610c86336121e3565b336000908152600e6020526040902054600160801b90046001600160801b031615610d205750336000908152600e6020526040902080546001600160801b03808216909255600160801b900416610cde3083836124fc565b6040518181526001600160a01b0383169033907f438df5737634ab0704853a9f34ac7b2b5878a6e872a2cd85e097221d151b9e74906020015b60405180910390a35b919050565b6000806001600160801b03861615610dcc57600954604051636ce5768960e11b81523060048201526001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48811660248301526001600160801b03891660448301529091169063d9caed1290606401600060405180830381600087803b158015610db357600080fd5b505af1158015610dc7573d6000803e3d6000fd5b505050505b610dda8989898888886126c3565b90925090508115610e1f57600654610e1f906001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb488116911684612c82565b8015610e5f57600754610e5f906001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb488116911683612c82565b6000610e69612ce5565b90508015610f3257600954610eab906001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb488116911683612dbe565b6009546040516311f9fbc960e21b81526001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb488116600483015260248201849052909116906347e7ef2490604401600060405180830381600087803b158015610f1957600080fd5b505af1158015610f2d573d6000803e3d6000fd5b505050505b5097509795505050505050565b610f57600080516020614cfc833981519152336116f3565b610f74576040516312dd957560e31b815260040160405180910390fd5b600c805467ffffffffffffffff60601b198116600160601b6001600160401b03851690810291821790935560405192835263ffffffff9182169116179033907f1cced4c455e5e9eb599e2636157518cf49e3253f25025d686fceed9b09db415390602001610c58565b600033610feb858285612ed3565b610ff68585856124fc565b60019150505b9392505050565b600061100e33610c7b565b9050610a888383611b04565b61104f6001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4816333085612f47565b6110598282612f7f565b5050565b600082815260208190526040902060010154611078816131fd565b611082838361320a565b505050565b600c54600160601b90046001600160401b03164211156110ba57604051631154791f60e31b815260040160405180910390fd5b600954600160c01b900460ff16156110e5576040516370d38fdb60e11b815260040160405180910390fd5b600c54336000908152600e602052604090206002015463ffffffff91821691168114611124576040516308018a9d60e11b815260040160405180910390fd5b336000908152600e60205260409020600101546001600160801b0316831115611160576040516308018a9d60e11b815260040160405180910390fd5b600061116b8461328e565b63ffffffff83166000908152600d60205260408120600201805492935083929091906111a19084906001600160801b0316614772565b82546101009290920a6001600160801b03818102199093169183160217909155336000908152600e60205260408120600101805485945090926111e691859116614772565b92506101000a8154816001600160801b0302191690836001600160801b031602179055506112153084866124fc565b826001600160a01b03168263ffffffff16336001600160a01b03167f26691efbd563db4f0ef52c831c675b90138ae4905406c87c2b0f4563e1dd83a98760405161126191815260200190565b60405180910390a450505050565b6001600160a01b03811633146112e45760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b61105982826132fb565b600033610c718185856113018383611d0b565b61130b9190614792565b6120bf565b61131b6000336116f3565b6113385760405163026a32f560e01b815260040160405180910390fd5b620f424061134c60a08301608084016147c1565b61135c60c0840160a085016147c1565b61136c60608501604086016147c1565b61137c60808601606087016147c1565b61138691906147de565b61139091906147de565b61139a91906147de565b62ffffff1611156113be5760405163390edff560e11b815260040160405180910390fd5b620f42406113d260e0830160c084016147c1565b6113e3610100840160e085016147c1565b6113ed91906147de565b62ffffff1611156114115760405163390edff560e11b815260040160405180910390fd5b620f4240611427610120830161010084016147c1565b611439610140840161012085016147c1565b61144391906147de565b62ffffff1611156114675760405163390edff560e11b815260040160405180910390fd5b8060066114748282614827565b5050600c5460405163ffffffff9091169033907f20d90a0fb35da673e55fe1e68cfbd15031f646dfdb88fca5da5d5b5aa1737c9190610c589085906149dd565b6114bf6000336116f3565b6114dc5760405163026a32f560e01b815260040160405180910390fd5b6114e8600a83836142b3565b50600c5460405163ffffffff9091169033907fdbacfed7331c1f7d5ea718f12281a7cddbe34f9191280d075171555ae205556f906115299086908690614acf565b60405180910390a35050565b6000806115418361172b565b915061154c83610c7b565b9050915091565b600c546001600160a01b0382166000908152600e60205260408120600201549091829163ffffffff90811691161461159057506000928392509050565b50506001600160a01b03166000908152600e6020526040902080546001909101546001600160801b0391821692911690565b6115da600080516020614cfc833981519152336116f3565b6115f7576040516312dd957560e31b815260040160405180910390fd5b6009805461ffff60a81b1916600160a81b86151590810260ff60b01b191691909117600160b01b8615159081029190911761ffff60b81b1916600160b81b86151590810260ff60c01b191691909117600160c01b86151590810291909117909455600c5460408051948552602085019390935291830152606082019290925263ffffffff9091169033907f756dd9c69469d2afa95e813c93b1b5e013030da6125e8deba169cac0b05be95b906080015b60405180910390a350505050565b6116bf8282613360565b6110596001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48168284612c82565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b606060058054610ac790614728565b60006117368261357d565b90508015610d2057610d206001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48168383612c82565b600033816117808286611d0b565b9050838110156117e05760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016112db565b6117ed82868684036120bf565b506001949350505050565b600033610c718185856124fc565b61181e600080516020614cfc833981519152336116f3565b61183b576040516312dd957560e31b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000907f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486001600160a01b0316906370a0823190602401602060405180830381865afa1580156118a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118c69190614b1d565b600b5490915082906118e890600160801b90046001600160801b031683614b36565b101561190757604051630de1bf7560e21b815260040160405180910390fd5b600954611941906001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb488116911684612dbe565b6009546040516311f9fbc960e21b81526001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb488116600483015260248201859052909116906347e7ef2490604401600060405180830381600087803b1580156119af57600080fd5b505af11580156119c3573d6000803e3d6000fd5b5050600c54600954604080516001600160a01b0390921682526020820187905263ffffffff90921693503392507f5d1dfc1839b0efecd070cb1dffe5619e5eee01414217e375af83ab539f8674699101611529565b600c54600090600160a01b900460ff16611a45576040516362fa8aa560e01b815260040160405180910390fd5b6001600160a01b0382163314611a6057611a60823385612ed3565b611a6a8284613667565b6010546001600160801b03600160801b8204811691611a8a911685614b49565b611a949190614b68565b9050611a9f8161328e565b6001600160a01b0383166000908152600e602052604090206001018054601090611ada908490600160801b90046001600160801b0316614b8a565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555092915050565b600954600160b01b900460ff1615611b2f576040516337ae717b60e01b815260040160405180910390fd5b600c54600160a01b900460ff1615611b5a576040516333cd40f760e21b815260040160405180910390fd5b600c54600160601b90046001600160401b0316421115611b8d57604051631154791f60e31b815260040160405180910390fd5b6001600160a01b0381163314611ba857611ba8813384612ed3565b611bb38130846124fc565b600c5463ffffffff166000611bc78461328e565b63ffffffff83166000908152600d6020526040812060020180549293508392909190611bfd9084906001600160801b0316614b8a565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550611c2a836121e3565b6001600160a01b0383166000908152600e602052604081206001018054839290611c5e9084906001600160801b0316614b8a565b82546101009290920a6001600160801b03818102199093169190921691909102179055506001600160a01b0383166000818152600e6020908152604091829020600201805463ffffffff191663ffffffff8716908117909155915187815233917f3810ab7906acf68459e21d2bda4204d1ea974be908fbafd94960af3e65f574069101611261565b600082815260208190526040902060010154611d01816131fd565b61108283836132fb565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b611d4e600080516020614cfc833981519152336116f3565b611d6b576040516312dd957560e31b815260040160405180910390fd5b600b80546001600160801b0319166001600160801b038316908117909155600c5460405191825263ffffffff169033907fa16b5549c22000d0e01e72b956bb87da3bfe261ae97db12a513c1c8389415c4090602001610c58565b611dd06000336116f3565b611ded5760405163026a32f560e01b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b038316908117909155600c5460405191825263ffffffff169033907f176fab7d1785c2fd0f77b65b7bd24a50e28206d75f8f9cc841a6f73c339d6f8790602001610c58565b6000611e5233610c7b565b50336000908152600160205260408120549050611e6f8133611a18565b50610ffc8361172b565b611e846000336116f3565b611ea15760405163026a32f560e01b815260040160405180910390fd5b6009805460ff60a01b1916600160a01b83151590810291909117909155600c5460405191825263ffffffff169033907f3b93f6236a5ca20626fa185941c647a5f2eb017a57d5e06f61a46026e0913a7490602001610c58565b600c5460009063ffffffff1615611f3657600080611f1885856137b5565b9092509050611f278183614792565b611f319084614792565b925050505b600c5463ffffffff166000818152600d60205260409020600201546001600160801b031615611fc4576000611f74836001600160801b038716614b36565b9050611f7f60035490565b63ffffffff83166000908152600d6020526040902060020154611fac9083906001600160801b0316614b49565b611fb69190614b68565b611fc09084614792565b9250505b63ffffffff81166000908152600d60205260409020600101546001600160801b0316156120a15763ffffffff81166000908152600d60205260408120600101546007546001600160801b039091169190620f42409061202f90600160a01b900462ffffff1684614b49565b6120399190614b68565b600754909150600090620f42409061205d90600160b81b900462ffffff1685614b49565b6120679190614b68565b90506120738183614792565b61207d9086614792565b945082851115612098576120918386614b36565b945061209d565b600094505b5050505b5092915050565b60006120b33361172b565b9050610a88838361101a565b6001600160a01b0383166121215760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016112db565b6001600160a01b0382166121825760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016112db565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0381166000908152600e6020526040902060020154600c5463ffffffff91821691168110612216575050565b6001600160a01b0382166000908152600e60205260409020546001600160801b0316156123815763ffffffff81166000908152600d60209081526040808320600101546001600160a01b0386168452600e9092528220546001600160801b038083169261228e92600160801b90910482169116614b49565b6122989190614b68565b90506122a38161328e565b6001600160a01b0384166000908152600e6020526040902080546010906122db908490600160801b90046001600160801b0316614b8a565b82546101009290920a6001600160801b038181021990931691831602179091556001600160a01b0385166000818152600e602090815260409182902054825194168452830185905263ffffffff8616935090917fd9afe7596a53cbdd5895a926034be7e90058aeffbd6d142b7e4669c4cdeb59db910160405180910390a3506001600160a01b0382166000908152600e6020526040902080546001600160801b03191690555b6001600160a01b0382166000908152600e60205260409020600101546001600160801b0316156110595763ffffffff81166000908152600d60209081526040808320600201546001600160a01b0386168452600e9092528220600101546001600160801b03808316926123ff92600160801b90910482169116614b49565b6124099190614b68565b90506124148161328e565b6001600160a01b0384166000908152600e60205260409020600101805460109061244f908490600160801b90046001600160801b0316614b8a565b82546101009290920a6001600160801b038181021990931691831602179091556001600160a01b0385166000818152600e602090815260409182902060010154825194168452830185905263ffffffff8616935090917f03d70ca23b379999d618a0b320f816f1bb4011e3d167124ee74ba6b67025ccc0910160405180910390a350506001600160a01b03166000908152600e6020526040902060010180546001600160801b0319169055565b6001600160a01b0383166125605760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016112db565b6001600160a01b0382166125c25760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016112db565b6001600160a01b0383166000908152600160205260409020548181101561263a5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016112db565b6001600160a01b03808516600090815260016020526040808220858503905591851681529081208054849290612671908490614792565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116a791815260200190565b50505050565b6000806126de600080516020614cfc833981519152336116f3565b6126fb576040516312dd957560e31b815260040160405180910390fd5b6009546001600160a01b031661272457604051633240c75d60e11b815260040160405180910390fd5b6006546001600160a01b031661274d57604051633240c75d60e11b815260040160405180910390fd5b6007546001600160a01b031661277657604051633240c75d60e11b815260040160405180910390fd5b600c54600160a01b900460ff16156127a1576040516333cd40f760e21b815260040160405180910390fd5b600c5463ffffffff8981169116146127cc576040516359d9c8e760e11b815260040160405180910390fd5b600c546001600160401b0364010000000090910481169086161115806127fa575042856001600160401b0316115b15612818576040516306f0300360e01b815260040160405180910390fd5b63ffffffff88166000818152600d6020526040812080546001600160801b0319166001600160801b038b16179055908190156128765761285889886137b5565b90925090506128678285614792565b93506128738184614792565b92505b60008361288c866001600160801b038d16614b36565b6128969190614b36565b905060006128a360035490565b90506000811180156128b3575081155b156128d157604051631a43347b60e01b815260040160405180910390fd5b801580156128fe575063ffffffff8c166000908152600d60205260409020600101546001600160801b0316155b1561291c57604051630558800760e21b815260040160405180910390fd5b612925826138e3565b90945092506129348487614792565b95506129408386614792565b94508615612a9c57600c5463ffffffff166000908152600d6020526040902054600754620f4240600160801b9092046001600160801b0316600160d01b820462ffffff908116820284900493600160e81b90930416020490945092506129a68487614792565b95506129b28386614792565b600c5463ffffffff166000908152600d6020526040812054919650906129fe9085906129ef908890600160801b90046001600160801b0316614b36565b6129f99190614b36565b61328e565b90506040518060400160405280826001600160801b03168152602001612a266129f960035490565b6001600160801b039081169091528151602090920151918116600160801b9282168302176010908155600b805485949193612a649286920416614b8a565b82546001600160801b039182166101009390930a92830291909202199091161790555050600c805460ff60a01b1916600160a01b1790555b80600003612b3f57600f54604080516001600160801b038e811682528084166020830152600160801b909304831681830152918c1660608301526001600160401b038b811660808401528a1660a083015288151560c083015260e0820188905261010082018790525163ffffffff8e169133917f9218348c215ae6efb0182d0a67ae857e1c1efadb71ca49e42fbebb0cefa34ced918190036101200190a3612bca565b604080516001600160801b038d81168252602082018590528183018490528c1660608201526001600160401b038b811660808301528a1660a082015288151560c082015260e081018890526101008101879052905163ffffffff8e169133917f9218348c215ae6efb0182d0a67ae857e1c1efadb71ca49e42fbebb0cefa34ced918190036101200190a35b600c805463ffffffff16906000612be083614baa565b82546101009290920a63ffffffff8181021990931691909216919091021790555050600c8054600b80546001600160801b0319166001600160801b039c909c169b909b17909a5573ffffffffffffffffffffffffffffffff00000000199099166401000000006001600160401b03998a160267ffffffffffffffff60601b191617600160601b9790981696909602969096179096559097909650945050505050565b6040516001600160a01b03831660248201526044810182905261108290849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613ca5565b6040516370a0823160e01b81523060048201526000907f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486001600160a01b0316906370a0823190602401602060405180830381865afa158015612d4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d709190614b1d565b600b54909150600160801b90046001600160801b0316811015612da657604051630de1bf7560e21b815260040160405180910390fd5b600b54600160801b90046001600160801b0316900390565b801580612e385750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612e12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e369190614b1d565b155b612ea35760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016112db565b6040516001600160a01b03831660248201526044810182905261108290849063095ea7b360e01b90606401612cae565b6000612edf8484611d0b565b905060001981146126bd5781811015612f3a5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016112db565b6126bd84848484036120bf565b6040516001600160a01b03808516602483015283166044820152606481018290526126bd9085906323b872dd60e01b90608401612cae565b600954600160a81b900460ff1615612faa57604051633eca454160e21b815260040160405180910390fd5b600c54600160a01b900460ff1615612fd5576040516333cd40f760e21b815260040160405180910390fd5b600c54600160601b90046001600160401b031642111561300857604051631154791f60e31b815260040160405180910390fd5b600b54600c5463ffffffff166000908152600d60205260409020600101546001600160801b039182169161303d911684614792565b111561305c576040516325d16c5160e01b815260040160405180910390fd5b61306581613d77565b61308257604051631e84063d60e21b815260040160405180910390fd5b600c5463ffffffff1660006130968461328e565b63ffffffff83166000908152600d60205260408120600101805492935083929091906130cc9084906001600160801b0316614b8a565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555080600b60000160108282829054906101000a90046001600160801b03166131179190614b8a565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550613144836121e3565b6001600160a01b0383166000908152600e6020526040812080548392906131759084906001600160801b0316614b8a565b82546101009290920a6001600160801b03818102199093169190921691909102179055506001600160a01b0383166000818152600e6020908152604091829020600201805463ffffffff191663ffffffff8716908117909155915187815233917fbfe5941e15cff302c0267251043bf2848ebc12b8259e8c065ba97644923497b59101611261565b6132078133613e54565b50565b61321482826116f3565b611059576000828152602081815260408083206001600160a01b03851684529091529020805460ff1916600117905561324a3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006001600160801b038211156132f75760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b60648201526084016112db565b5090565b61330582826116f3565b15611059576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600c54600160601b90046001600160401b031642111561339357604051631154791f60e31b815260040160405180910390fd5b600954600160b81b900460ff16156133be57604051638da7160560e01b815260040160405180910390fd5b600c54336000908152600e602052604090206002015463ffffffff918216911681146133fd57604051631648a98f60e31b815260040160405180910390fd5b336000908152600e60205260409020546001600160801b031683111561343657604051631648a98f60e31b815260040160405180910390fd5b60006134418461328e565b63ffffffff83166000908152600d60205260408120600101805492935083929091906134779084906001600160801b0316614772565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555080600b60000160108282829054906101000a90046001600160801b03166134c29190614772565b82546101009290920a6001600160801b038181021990931691831602179091556001600160a01b0385166000908152600e602052604081208054859450909261350d91859116614772565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550826001600160a01b03168263ffffffff16336001600160a01b03167f52bcf77e4201d50a5a56cbac4a5eadb29047a1f2866e4896b737d2ab7ec06b498760405161126191815260200190565b6000613588336121e3565b336000908152600e6020526040902060010154600160801b90046001600160801b031615610d205750336000908152600e6020526040902060010154600b80546001600160801b03600160801b938490048116938493926010926135ef9286920416614772565b82546101009290920a6001600160801b03818102199093169183160217909155336000818152600e60209081526040918290206001018054909416909355518481526001600160a01b038616935090917f1e82b8552efdf1dbc6131cc7346db181a113c1cf3885db8b7d9db0e60311a1079101610d17565b6001600160a01b0382166136c75760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016112db565b6001600160a01b0382166000908152600160205260409020548181101561373b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016112db565b6001600160a01b038316600090815260016020526040812083830390556003805484929061376a908490614b36565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b600c5460009081906001600160801b0385169082906137e59064010000000090046001600160401b031686614bcd565b600854600c54651cae8c13e00062ffffff66010000000000008404811687026001600160401b0386169081028390049950600160481b909404168602909202919091049450909150600d906000906138459060019063ffffffff16614bed565b63ffffffff168152602081019190915260400160002054600160801b90046001600160801b03168211156138da57600c5463ffffffff90811660001901166000908152600d6020526040902054600854600160801b9091046001600160801b0316830390620f42409062ffffff1682026008549190049590950194620f4240906301000000900462ffffff1682020484019350505b50509250929050565b600c54600090819063ffffffff16816138fb60035490565b63ffffffff83166000908152600d602052604090206002015490915085906001600160801b031615613a725763ffffffff83166000908152600d60205260408120600201548390613955906001600160801b031689614b49565b61395f9190614b68565b600754909150620f424062ffffff600160d01b83048116840282900492600160e81b900416830204613995816129ef8486614b36565b63ffffffff87166000908152600d6020526040902060020180546001600160801b03908116600160801b93821684021791829055600b80549284900482169390926010926139e69286920416614b8a565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550613a138361328e565b613a26906001600160801b031685614b36565b9350613a328289614792565b9750613a3e8188614792565b63ffffffff87166000908152600d6020526040902060020154909750613a6e9030906001600160801b0316613667565b5050505b63ffffffff83166000908152600d60205260409020600101546001600160801b031615613c605763ffffffff83166000908152600d6020526040902060010154600754600b80546001600160801b0393841693620f424062ffffff600160a01b86048116870282900495600160b81b9004168602049285929091601091613b02918591600160801b900416614772565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550808284613b339190614b36565b613b3d9190614b36565b9250613b488361328e565b613b5b906001600160801b031685614792565b935084600003613bcd57600f54613b95906001600160801b0380821691613b8b91600160801b9091041686614b49565b6129f99190614b68565b63ffffffff87166000908152600d6020526040902060010180546001600160801b03928316600160801b029216919091179055613c0f565b613bdb89613b8b8786614b49565b63ffffffff87166000908152600d6020526040902060010180546001600160801b03928316600160801b0292169190911790555b613c198289614792565b9750613c258188614792565b63ffffffff87166000908152600d6020526040902060010154909750613c5c903090600160801b90046001600160801b0316613eb8565b5050505b613c698161328e565b63ffffffff9093166000908152600d6020526040902080546001600160801b03948516600160801b029416939093179092555091939092509050565b6000613cfa826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613f979092919063ffffffff16565b8051909150156110825780806020019051810190613d189190614c0a565b6110825760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016112db565b600954600090600160a01b900460ff1615613d9457506001919050565b600a546000905b80821015613e4a576000600a8381548110613db857613db8614c27565b6000918252602090912001546040516370a0823160e01b81526001600160a01b038781166004830152909116906370a0823190602401602060405180830381865afa158015613e0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e2f9190614b1d565b1115613e3f575060019392505050565b816001019150613d9b565b5060009392505050565b613e5e82826116f3565b61105957613e76816001600160a01b03166014613fae565b613e81836020613fae565b604051602001613e92929190614c3d565b60408051601f198184030181529082905262461bcd60e51b82526112db91600401614389565b6001600160a01b038216613f0e5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016112db565b8060036000828254613f209190614792565b90915550506001600160a01b03821660009081526001602052604081208054839290613f4d908490614792565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6060613fa68484600085614149565b949350505050565b60606000613fbd836002614b49565b613fc8906002614792565b6001600160401b03811115613fdf57613fdf614cb2565b6040519080825280601f01601f191660200182016040528015614009576020820181803683370190505b509050600360fc1b8160008151811061402457614024614c27565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061405357614053614c27565b60200101906001600160f81b031916908160001a9053506000614077846002614b49565b614082906001614792565b90505b60018111156140fa576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106140b6576140b6614c27565b1a60f81b8282815181106140cc576140cc614c27565b60200101906001600160f81b031916908160001a90535060049490941c936140f381614cc8565b9050614085565b508315610ffc5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016112db565b6060824710156141aa5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016112db565b6001600160a01b0385163b6142015760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016112db565b600080866001600160a01b0316858760405161421d9190614cdf565b60006040518083038185875af1925050503d806000811461425a576040519150601f19603f3d011682016040523d82523d6000602084013e61425f565b606091505b509150915061426f82828661427a565b979650505050505050565b60608315614289575081610ffc565b8251156142995782518084602001fd5b8160405162461bcd60e51b81526004016112db9190614389565b828054828255906000526020600020908101928215614306579160200282015b828111156143065781546001600160a01b0319166001600160a01b038435161782556020909201916001909101906142d3565b506132f79291505b808211156132f7576000815560010161430e565b60006020828403121561433457600080fd5b81356001600160e01b031981168114610ffc57600080fd5b60006020828403121561435e57600080fd5b5035919050565b60005b83811015614380578181015183820152602001614368565b50506000910152565b60208152600082518060208401526143a8816040850160208701614365565b601f01601f19169190910160400192915050565b6001600160a01b038116811461320757600080fd5b8035610d20816143bc565b600080604083850312156143ef57600080fd5b82356143fa816143bc565b946020939093013593505050565b60006020828403121561441a57600080fd5b8135610ffc816143bc565b803563ffffffff81168114610d2057600080fd5b80356001600160801b0381168114610d2057600080fd5b80356001600160401b0381168114610d2057600080fd5b801515811461320757600080fd5b600080600080600080600060e0888a03121561449057600080fd5b61449988614425565b96506144a760208901614439565b95506144b560408901614439565b94506144c360608901614439565b93506144d160808901614450565b92506144df60a08901614450565b915060c08801356144ef81614467565b8091505092959891949750929550565b60006020828403121561451157600080fd5b610ffc82614450565b60008060006060848603121561452f57600080fd5b833561453a816143bc565b9250602084013561454a816143bc565b929592945050506040919091013590565b6000806040838503121561456e57600080fd5b823591506020830135614580816143bc565b809150509250929050565b6000610140828403121561459e57600080fd5b50919050565b600080602083850312156145b757600080fd5b82356001600160401b03808211156145ce57600080fd5b818501915085601f8301126145e257600080fd5b8135818111156145f157600080fd5b8660208260051b850101111561460657600080fd5b60209290920196919550909350505050565b60006020828403121561462a57600080fd5b610ffc82614425565b6000806000806080858703121561464957600080fd5b843561465481614467565b9350602085013561466481614467565b9250604085013561467481614467565b9150606085013561468481614467565b939692955090935050565b600080604083850312156146a257600080fd5b82356146ad816143bc565b91506020830135614580816143bc565b6000602082840312156146cf57600080fd5b610ffc82614439565b6000602082840312156146ea57600080fd5b8135610ffc81614467565b6000806040838503121561470857600080fd5b61471183614439565b915061471f60208401614450565b90509250929050565b600181811c9082168061473c57607f821691505b60208210810361459e57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6001600160801b038281168282160390808211156120a1576120a161475c565b80820180821115610a8857610a8861475c565b62ffffff8116811461320757600080fd5b8035610d20816147a5565b6000602082840312156147d357600080fd5b8135610ffc816147a5565b62ffffff8181168382160190808211156120a1576120a161475c565b80546001600160a01b0319166001600160a01b0392909216919091179055565b60008135610a88816147a5565b8135614832816143bc565b61483c81836147fa565b5060018101602083013561484f816143bc565b61485981836147fa565b506040830135614868816147a5565b815462ffffff60a01b191660a09190911b62ffffff60a01b161781556148b56148936060850161481a565b82805462ffffff60b81b191660b89290921b62ffffff60b81b16919091179055565b6148e66148c46080850161481a565b82805462ffffff60d01b191660d09290921b62ffffff60d01b16919091179055565b6149196148f560a0850161481a565b8280546001600160e81b031660e89290921b6001600160e81b031916919091179055565b506002810161494261492d60c0850161481a565b825462ffffff191662ffffff91909116178255565b61496f61495160e0850161481a565b825465ffffff000000191660189190911b65ffffff00000016178255565b6149a361497f610100850161481a565b825468ffffff000000000000191660309190911b68ffffff00000000000016178255565b6110826149b3610120850161481a565b82546bffffff000000000000000000191660489190911b6bffffff00000000000000000016178255565b61014081016149fc826149ef856143d1565b6001600160a01b03169052565b614a08602084016143d1565b6001600160a01b03166020830152614a22604084016147b6565b62ffffff166040830152614a38606084016147b6565b62ffffff166060830152614a4e608084016147b6565b62ffffff166080830152614a6460a084016147b6565b62ffffff1660a0830152614a7a60c084016147b6565b62ffffff1660c0830152614a9060e084016147b6565b62ffffff1660e0830152610100614aa88482016147b6565b62ffffff1690830152610120614abf8482016147b6565b62ffffff16920191909152919050565b60208082528181018390526000908460408401835b86811015614b12578235614af7816143bc565b6001600160a01b031682529183019190830190600101614ae4565b509695505050505050565b600060208284031215614b2f57600080fd5b5051919050565b81810381811115610a8857610a8861475c565b6000816000190483118215151615614b6357614b6361475c565b500290565b600082614b8557634e487b7160e01b600052601260045260246000fd5b500490565b6001600160801b038181168382160190808211156120a1576120a161475c565b600063ffffffff808316818103614bc357614bc361475c565b6001019392505050565b6001600160401b038281168282160390808211156120a1576120a161475c565b63ffffffff8281168282160390808211156120a1576120a161475c565b600060208284031215614c1c57600080fd5b8151610ffc81614467565b634e487b7160e01b600052603260045260246000fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614c75816017850160208801614365565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614ca6816028840160208801614365565b01602801949350505050565b634e487b7160e01b600052604160045260246000fd5b600081614cd757614cd761475c565b506000190190565b60008251614cf1818460208701614365565b919091019291505056fe59a1c48e5837ad7a7f3dcedcbe129bf3249ec4fbf651fd4f5e2600ead39fe2f5a2646970667358221220e626a44ecc3a12eaddf6d29540e681b8429a6e67e7bbd948eac0a696714c303c64736f6c63430008100033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000630dd960000000000000000000000000f3808680917524cd1346b12e4845830076eb7001000000000000000000000000000000000000000000000000000000000000000d48542d555344432d4d4e4c50530000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000054f50544541000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _name (string): HT-USDC-MNLPS
Arg [1] : _symbol (string): OPTEA
Arg [2] : _asset (address): 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
Arg [3] : _priceNumerator (uint128): 1000000
Arg [4] : _priceDenominator (uint128): 1000000000000000000
Arg [5] : _startTimestamp (uint64): 1661852000
Arg [6] : _initialAdmin (address): 0xF3808680917524CD1346b12e4845830076eB7001
-----Encoded View---------------
11 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [2] : 000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
Arg [3] : 00000000000000000000000000000000000000000000000000000000000f4240
Arg [4] : 0000000000000000000000000000000000000000000000000de0b6b3a7640000
Arg [5] : 00000000000000000000000000000000000000000000000000000000630dd960
Arg [6] : 000000000000000000000000f3808680917524cd1346b12e4845830076eb7001
Arg [7] : 000000000000000000000000000000000000000000000000000000000000000d
Arg [8] : 48542d555344432d4d4e4c505300000000000000000000000000000000000000
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [10] : 4f50544541000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.