Overview
S Balance
0 S
S Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
Frontend
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 200 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import {IPlatform} from "../interfaces/IPlatform.sol"; import {IVaultManager} from "../interfaces/IVaultManager.sol"; import {IVault} from "../interfaces/IVault.sol"; import {IStrategy} from "../interfaces/IStrategy.sol"; import {ISwapper} from "../interfaces/ISwapper.sol"; import {IPriceReader} from "../interfaces/IPriceReader.sol"; import {IFactory} from "../interfaces/IFactory.sol"; import {VaultTypeLib} from "../core/libs/VaultTypeLib.sol"; import {CommonLib} from "../core/libs/CommonLib.sol"; import {IFrontend} from "../interfaces/IFrontend.sol"; /// @notice Front-end and back-end viewers for platform /// @author Alien Deployer (https://github.com/a17) contract Frontend is IFrontend { string public constant VERSION = "1.0.0"; error IncorrectParams(); address public immutable platform; struct VaultsVars { IPlatform platform; IVaultManager vaultManager; address[] allVaultAddresses; uint len; uint k; } struct WhatToBuildVars { bytes32[] strategyIdHashes; uint strategyIdHashesLen; uint len; IPlatform platform; IFactory.Farm[] farms; uint farmsLen; string[] vaultTypes; uint vaultTypesLen; // getVaultInitParamsVariants returns string[] vaultType; uint[] usedAddresses; uint[] usedNums; address[] allVaultInitAddresses; uint[] allVaultInitNums; uint allVaultInitAddressesIndex; uint allVaultInitNumsIndex; // strategy initVariants returns string[] strategyVariantDesc; uint strategyVariantDescLen; address[] allStrategyInitAddresses; uint[] allStrategyInitNums; int24[] allStrategyInitTicks; uint allStrategyInitAddressesIndex; uint allStrategyInitNumsIndex; uint allStrategyInitTicksIndex; // target vault init params address[] vaultInitAddresses; uint[] vaultInitNums; // target strategy init params address[] strategyInitAddresses; uint[] strategyInitNums; int24[] strategyInitTicks; uint usedStrategyInitAddresses; uint usedStrategyInitNums; uint usedStrategyInitTicks; // total results, used for counters too uint total; uint totalVaultInitAddresses; uint totalVaultInitNums; uint totalStrategyInitAddresses; uint totalStrategyInitNums; uint totalStrategyInitTicks; // counters and length uint i; uint j; uint c; } struct GetVaultInitParamsVariantsVars { string[] vaultTypes; uint total; uint totalVaultInitAddresses; uint totalVaultInitNums; uint len; } constructor(address platform_) { platform = platform_; } /// @inheritdoc IFrontend function vaults( uint start, uint pageSize ) external view returns ( uint total, address[] memory vaultAddress, string[] memory name, string[] memory symbol, string[] memory vaultType, uint[] memory sharePrice, uint[] memory tvl, address[] memory strategy, string[] memory strategyId, string[] memory strategySpecific ) { VaultsVars memory v; v.platform = IPlatform(platform); v.vaultManager = IVaultManager(v.platform.vaultManager()); v.allVaultAddresses = v.vaultManager.vaultAddresses(); total = v.allVaultAddresses.length; if (start >= total) { revert IncorrectParams(); } v.len = total - start; if (v.len > pageSize) { v.len = pageSize; } vaultAddress = new address[](v.len); name = new string[](v.len); symbol = new string[](v.len); vaultType = new string[](v.len); tvl = new uint[](v.len); sharePrice = new uint[](v.len); strategy = new address[](v.len); strategyId = new string[](v.len); strategySpecific = new string[](v.len); for (uint i = start; i < start + v.len; ++i) { vaultAddress[v.k] = v.vaultManager.tokenVault(i); IVault vault = IVault(vaultAddress[v.k]); name[v.k] = IERC20Metadata(vaultAddress[v.k]).name(); symbol[v.k] = IERC20Metadata(vaultAddress[v.k]).symbol(); vaultType[v.k] = vault.vaultType(); strategy[v.k] = address(vault.strategy()); strategyId[v.k] = IStrategy(strategy[v.k]).strategyLogicId(); (strategySpecific[v.k],) = IStrategy(strategy[v.k]).getSpecificName(); (sharePrice[v.k],) = vault.price(); (tvl[v.k],) = vault.tvl(); v.k++; } } /// @inheritdoc IFrontend function getBalanceAssets( address userAccount, uint start, uint pageSize ) external view returns (uint total, address[] memory asset, uint[] memory assetPrice, uint[] memory assetUserBalance) { IPlatform _platform = IPlatform(platform); IPriceReader priceReader = IPriceReader(_platform.priceReader()); address[] memory allAssets = ISwapper(_platform.swapper()).allAssets(); total = allAssets.length; if (start >= total) { revert IncorrectParams(); } uint len = total - start; if (len > pageSize) { len = pageSize; } asset = new address[](len); assetPrice = new uint[](len); assetUserBalance = new uint[](len); uint k; for (uint i = start; i < start + len; ++i) { asset[k] = allAssets[i]; (assetPrice[k],) = priceReader.getPrice(asset[k]); assetUserBalance[k] = IERC20(asset[k]).balanceOf(userAccount); k++; } } /// @inheritdoc IFrontend function getBalanceVaults( address userAccount, uint start, uint pageSize ) external view returns (uint total, address[] memory vault, uint[] memory vaultSharePrice, uint[] memory vaultUserBalance) { IPlatform _platform = IPlatform(platform); address[] memory allVaultAddresses = IVaultManager(_platform.vaultManager()).vaultAddresses(); total = allVaultAddresses.length; if (start >= total) { revert IncorrectParams(); } uint len = total - start; if (len > pageSize) { len = pageSize; } vault = new address[](len); vaultSharePrice = new uint[](len); vaultUserBalance = new uint[](len); uint k; for (uint i = start; i < start + len; ++i) { vault[k] = allVaultAddresses[i]; (vaultSharePrice[k],) = IVault(vault[k]).price(); vaultUserBalance[k] = IERC20(vault[k]).balanceOf(userAccount); k++; } } /// @inheritdoc IFrontend function whatToBuild( uint startStrategy, uint step ) external view returns ( uint totalStrategies, string[] memory desc, string[] memory vaultType, string[] memory strategyId, uint[10][] memory initIndexes, address[] memory vaultInitAddresses, uint[] memory vaultInitNums, address[] memory strategyInitAddresses, uint[] memory strategyInitNums, int24[] memory strategyInitTicks ) { WhatToBuildVars memory vars; vars.platform = IPlatform(platform); IFactory factory = IFactory(vars.platform.factory()); vars.strategyIdHashes = factory.strategyLogicIdHashes(); vars.strategyIdHashesLen = vars.strategyIdHashes.length; totalStrategies = vars.strategyIdHashesLen; vars.farms = factory.farms(); vars.farmsLen = vars.farms.length; if (startStrategy >= totalStrategies) { revert IncorrectParams(); } vars.len = totalStrategies - startStrategy; if (vars.len > step) { vars.len = step; } for (vars.i = startStrategy; vars.i < vars.len; ++vars.i) { IFactory.StrategyLogicConfig memory strategyConfig; //slither-disable-next-line unused-return strategyConfig = factory.strategyLogicConfig(vars.strategyIdHashes[vars.i]); if (strategyConfig.deployAllowed) { (vars.vaultType, vars.usedAddresses, vars.usedNums, vars.allVaultInitAddresses, vars.allVaultInitNums) = _getVaultInitParamsVariants(address(vars.platform), strategyConfig.implementation); // nosemgrep vars.vaultTypesLen = vars.vaultType.length; vars.allVaultInitAddressesIndex = 0; vars.allVaultInitNumsIndex = 0; // nosemgrep for (uint k; k < vars.vaultTypesLen; ++k) { vars.vaultInitAddresses = new address[](vars.usedAddresses[k]); vars.vaultInitNums = new uint[](vars.usedNums[k]); // nosemgrep for (uint j; j < vars.usedAddresses[k]; ++j) { vars.vaultInitAddresses[j] = vars.allVaultInitAddresses[vars.allVaultInitAddressesIndex]; ++vars.allVaultInitAddressesIndex; } // nosemgrep for (uint j; j < vars.usedNums[k]; ++j) { vars.vaultInitNums[j] = vars.allVaultInitNums[vars.allVaultInitNumsIndex]; ++vars.allVaultInitNumsIndex; } ( vars.strategyVariantDesc, vars.allStrategyInitAddresses, vars.allStrategyInitNums, vars.allStrategyInitTicks ) = IStrategy(strategyConfig.implementation).initVariants(address(vars.platform)); vars.allStrategyInitAddressesIndex = 0; vars.allStrategyInitNumsIndex = 0; vars.allStrategyInitTicksIndex = 0; // nosemgrep uint len = vars.strategyVariantDesc.length; for (vars.j = 0; vars.j < len; ++vars.j) { // nosemgrep uint size = vars.allStrategyInitAddresses.length / len; vars.usedStrategyInitAddresses = 0; vars.usedStrategyInitNums = 0; vars.usedStrategyInitTicks = 0; vars.strategyInitAddresses = new address[](size); // nosemgrep for (uint c; c < size; ++c) { vars.strategyInitAddresses[c] = vars.allStrategyInitAddresses[vars.allStrategyInitAddressesIndex]; ++vars.allStrategyInitAddressesIndex; ++vars.usedStrategyInitAddresses; } // nosemgrep size = vars.allStrategyInitNums.length / len; vars.strategyInitNums = new uint[](size); // nosemgrep for (uint c; c < size; ++c) { vars.strategyInitNums[c] = vars.allStrategyInitNums[vars.allStrategyInitNumsIndex]; ++vars.allStrategyInitNumsIndex; ++vars.usedStrategyInitNums; } // nosemgrep size = vars.allStrategyInitTicks.length / len; vars.strategyInitTicks = new int24[](size); // nosemgrep for (uint c; c < size; ++c) { vars.strategyInitTicks[c] = vars.allStrategyInitTicks[vars.allStrategyInitTicksIndex]; ++vars.allStrategyInitTicksIndex; ++vars.usedStrategyInitTicks; } bytes32 _deploymentKey = factory.getDeploymentKey( vars.vaultType[k], strategyConfig.id, vars.vaultInitAddresses, vars.vaultInitNums, vars.strategyInitAddresses, vars.strategyInitNums, vars.strategyInitTicks ); if (factory.deploymentKey(_deploymentKey) == address(0)) { ++vars.total; vars.totalVaultInitAddresses += vars.usedAddresses[k]; vars.totalVaultInitNums += vars.usedNums[k]; vars.totalStrategyInitAddresses += vars.usedStrategyInitAddresses; vars.totalStrategyInitNums += vars.usedStrategyInitNums; vars.totalStrategyInitTicks += vars.usedStrategyInitTicks; } } } } } desc = new string[](vars.total); vaultType = new string[](vars.total); strategyId = new string[](vars.total); initIndexes = new uint[10][](vars.total); vaultInitAddresses = new address[](vars.totalVaultInitAddresses); vaultInitNums = new uint[](vars.totalVaultInitNums); strategyInitAddresses = new address[](vars.totalStrategyInitAddresses); strategyInitNums = new uint[](vars.totalStrategyInitNums); strategyInitTicks = new int24[](vars.totalStrategyInitTicks); vars.total = 0; vars.totalVaultInitAddresses = 0; vars.totalVaultInitNums = 0; vars.totalStrategyInitAddresses = 0; vars.totalStrategyInitNums = 0; vars.totalStrategyInitTicks = 0; for (vars.i = startStrategy; vars.i < vars.len; ++vars.i) { IFactory.StrategyLogicConfig memory strategyConfig; //slither-disable-next-line unused-return strategyConfig = factory.strategyLogicConfig(vars.strategyIdHashes[vars.i]); if (strategyConfig.deployAllowed) { (vars.vaultType, vars.usedAddresses, vars.usedNums, vars.allVaultInitAddresses, vars.allVaultInitNums) = _getVaultInitParamsVariants(address(vars.platform), strategyConfig.implementation); // nosemgrep vars.vaultTypesLen = vars.vaultType.length; vars.allVaultInitAddressesIndex = 0; vars.allVaultInitNumsIndex = 0; // nosemgrep for (uint k; k < vars.vaultTypesLen; ++k) { vars.vaultInitAddresses = new address[](vars.usedAddresses[k]); vars.vaultInitNums = new uint[](vars.usedNums[k]); // nosemgrep for (uint j; j < vars.usedAddresses[k]; ++j) { vars.vaultInitAddresses[j] = vars.allVaultInitAddresses[vars.allVaultInitAddressesIndex]; ++vars.allVaultInitAddressesIndex; } // nosemgrep for (uint j; j < vars.usedNums[k]; ++j) { vars.vaultInitNums[j] = vars.allVaultInitNums[vars.allVaultInitNumsIndex]; ++vars.allVaultInitNumsIndex; } ( vars.strategyVariantDesc, vars.allStrategyInitAddresses, vars.allStrategyInitNums, vars.allStrategyInitTicks ) = IStrategy(strategyConfig.implementation).initVariants(address(vars.platform)); vars.allStrategyInitAddressesIndex = 0; vars.allStrategyInitNumsIndex = 0; vars.allStrategyInitTicksIndex = 0; // nosemgrep vars.strategyVariantDescLen = vars.strategyVariantDesc.length; for (vars.j = 0; vars.j < vars.strategyVariantDescLen; ++vars.j) { // nosemgrep uint size = vars.allStrategyInitAddresses.length / vars.strategyVariantDescLen; vars.usedStrategyInitAddresses = 0; vars.usedStrategyInitNums = 0; vars.usedStrategyInitTicks = 0; vars.strategyInitAddresses = new address[](size); // nosemgrep for (uint c; c < size; ++c) { vars.strategyInitAddresses[c] = vars.allStrategyInitAddresses[vars.allStrategyInitAddressesIndex]; ++vars.allStrategyInitAddressesIndex; ++vars.usedStrategyInitAddresses; } // nosemgrep size = vars.allStrategyInitNums.length / vars.strategyVariantDescLen; vars.strategyInitNums = new uint[](size); // nosemgrep for (uint c; c < size; ++c) { vars.strategyInitNums[c] = vars.allStrategyInitNums[vars.allStrategyInitNumsIndex]; ++vars.allStrategyInitNumsIndex; ++vars.usedStrategyInitNums; } // nosemgrep size = vars.allStrategyInitTicks.length / vars.strategyVariantDescLen; vars.strategyInitTicks = new int24[](size); // nosemgrep for (uint c; c < size; ++c) { vars.strategyInitTicks[c] = vars.allStrategyInitTicks[vars.allStrategyInitTicksIndex]; ++vars.allStrategyInitTicksIndex; ++vars.usedStrategyInitTicks; } bytes32 _deploymentKey = factory.getDeploymentKey( vars.vaultType[k], strategyConfig.id, vars.vaultInitAddresses, vars.vaultInitNums, vars.strategyInitAddresses, vars.strategyInitNums, vars.strategyInitTicks ); if (factory.deploymentKey(_deploymentKey) == address(0)) { desc[vars.total] = vars.strategyVariantDesc[vars.j]; vaultType[vars.total] = vars.vaultType[k]; strategyId[vars.total] = strategyConfig.id; initIndexes[vars.total][0] = vars.totalVaultInitAddresses; initIndexes[vars.total][1] = vars.totalVaultInitAddresses + vars.usedAddresses[k]; initIndexes[vars.total][2] = vars.totalVaultInitNums; initIndexes[vars.total][3] = vars.totalVaultInitNums + vars.usedNums[k]; initIndexes[vars.total][4] = vars.totalStrategyInitAddresses; initIndexes[vars.total][5] = vars.totalStrategyInitAddresses + vars.usedStrategyInitAddresses; initIndexes[vars.total][6] = vars.totalStrategyInitNums; initIndexes[vars.total][7] = vars.totalStrategyInitNums + vars.usedStrategyInitNums; initIndexes[vars.total][8] = vars.totalStrategyInitTicks; initIndexes[vars.total][9] = vars.totalStrategyInitTicks + vars.usedStrategyInitTicks; // nosemgrep for (uint c; c < vars.usedAddresses[k]; ++c) { vaultInitAddresses[vars.totalVaultInitAddresses + c] = vars.vaultInitAddresses[c]; } // nosemgrep for (uint c; c < vars.usedNums[k]; ++c) { vaultInitNums[vars.totalVaultInitNums + c] = vars.vaultInitNums[c]; } // nosemgrep for (uint c; c < vars.usedStrategyInitAddresses; ++c) { strategyInitAddresses[vars.totalStrategyInitAddresses + c] = vars.strategyInitAddresses[c]; } // nosemgrep for (uint c; c < vars.usedStrategyInitNums; ++c) { strategyInitNums[vars.totalStrategyInitNums + c] = vars.strategyInitNums[c]; } // nosemgrep for (uint c; c < vars.usedStrategyInitTicks; ++c) { strategyInitTicks[vars.totalStrategyInitTicks + c] = vars.strategyInitTicks[c]; } ++vars.total; vars.totalVaultInitAddresses += vars.usedAddresses[k]; vars.totalVaultInitNums += vars.usedNums[k]; vars.totalStrategyInitAddresses += vars.usedStrategyInitAddresses; vars.totalStrategyInitNums += vars.usedStrategyInitNums; vars.totalStrategyInitTicks += vars.usedStrategyInitTicks; } } } } } } function _getVaultInitParamsVariants( address platform_, address strategyImplementation ) internal view returns ( string[] memory vaultType, uint[] memory usedAddresses, uint[] memory usedNums, address[] memory allVaultInitAddresses, uint[] memory allVaultInitNums ) { GetVaultInitParamsVariantsVars memory vars; vars.vaultTypes = IStrategy(strategyImplementation).supportedVaultTypes(); vars.len = vars.vaultTypes.length; //slither-disable-next-line unused-return (address[] memory allowedBBTokens,) = IPlatform(platform_).allowedBBTokenVaultsFiltered(); uint allowedBBTokensLen = allowedBBTokens.length; // nosemgrep for (uint i; i < vars.len; ++i) { if (CommonLib.eq(vars.vaultTypes[i], VaultTypeLib.COMPOUNDING)) { ++vars.total; } else if ( CommonLib.eq(vars.vaultTypes[i], VaultTypeLib.REWARDING) || CommonLib.eq(vars.vaultTypes[i], VaultTypeLib.REWARDING_MANAGED) ) { vars.total += allowedBBTokensLen; vars.totalVaultInitAddresses += allowedBBTokensLen; } } vaultType = new string[](vars.total); usedAddresses = new uint[](vars.total); usedNums = new uint[](vars.total); allVaultInitAddresses = new address[](vars.totalVaultInitAddresses); allVaultInitNums = new uint[](vars.totalVaultInitNums); // now its always 0, but function can be upgraded without changing interface // vaultType index, allVaultInitAddresses index, allVaultInitNums index uint[3] memory indexes; // nosemgrep for (uint i; i < vars.len; ++i) { if (CommonLib.eq(vars.vaultTypes[i], VaultTypeLib.COMPOUNDING)) { vaultType[indexes[0]] = vars.vaultTypes[i]; ++indexes[0]; } else if ( CommonLib.eq(vars.vaultTypes[i], VaultTypeLib.REWARDING) || CommonLib.eq(vars.vaultTypes[i], VaultTypeLib.REWARDING_MANAGED) ) { // nosemgrep for (uint k; k < allowedBBTokensLen; ++k) { vaultType[indexes[0]] = vars.vaultTypes[i]; allVaultInitAddresses[indexes[1]] = allowedBBTokens[k]; usedAddresses[indexes[0]] = 1; ++indexes[0]; ++indexes[1]; } } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; /// @notice Interface of the main contract and entry point to the platform. /// @author Alien Deployer (https://github.com/a17) /// @author Jude (https://github.com/iammrjude) /// @author JodsMigel (https://github.com/JodsMigel) interface IPlatform { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ error AlreadyAnnounced(); error SameVersion(); error NoNewVersion(); error UpgradeTimerIsNotOver(uint TimerTimestamp); error IncorrectFee(uint minFee, uint maxFee); error NotEnoughAllowedBBToken(); error TokenAlreadyExistsInSet(address token); error AggregatorNotExists(address dexAggRouter); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ event PlatformVersion(string version); event UpgradeAnnounce( string oldVersion, string newVersion, address[] proxies, address[] newImplementations, uint timelock ); event CancelUpgrade(string oldVersion, string newVersion); event ProxyUpgraded( address indexed proxy, address implementation, string oldContractVersion, string newContractVersion ); event Addresses( address multisig_, address factory_, address priceReader_, address swapper_, address buildingPermitToken_, address vaultManager_, address strategyLogic_, address aprOracle_, address hardWorker, address rebalancer, address zap, address bridge ); event OperatorAdded(address operator); event OperatorRemoved(address operator); event FeesChanged(uint fee, uint feeShareVaultManager, uint feeShareStrategyLogic, uint feeShareEcosystem); event MinInitialBoostChanged(uint minInitialBoostPerDay, uint minInitialBoostDuration); event NewAmmAdapter(string id, address proxy); event EcosystemRevenueReceiver(address receiver); event SetAllowedBBTokenVaults(address bbToken, uint vaultsToBuild, bool firstSet); event RemoveAllowedBBToken(address bbToken); event AddAllowedBoostRewardToken(address token); event RemoveAllowedBoostRewardToken(address token); event AddDefaultBoostRewardToken(address token); event RemoveDefaultBoostRewardToken(address token); event AddBoostTokens(address[] allowedBoostRewardToken, address[] defaultBoostRewardToken); event AllowedBBTokenVaultUsed(address bbToken, uint vaultToUse); event AddDexAggregator(address router); event RemoveDexAggregator(address router); event MinTvlForFreeHardWorkChanged(uint oldValue, uint newValue); event CustomVaultFee(address vault, uint platformFee); event Rebalancer(address rebalancer_); event Bridge(address bridge_); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* DATA TYPES */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ struct PlatformUpgrade { string newVersion; address[] proxies; address[] newImplementations; } struct PlatformSettings { string networkName; bytes32 networkExtra; uint fee; uint feeShareVaultManager; uint feeShareStrategyLogic; uint feeShareEcosystem; uint minInitialBoostPerDay; uint minInitialBoostDuration; } struct AmmAdapter { string id; address proxy; } struct SetupAddresses { address factory; address priceReader; address swapper; address buildingPermitToken; address buildingPayPerVaultToken; address vaultManager; address strategyLogic; address aprOracle; address targetExchangeAsset; address hardWorker; address zap; address bridge; address rebalancer; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* VIEW FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @notice Platform version in CalVer scheme: YY.MM.MINOR-tag. Updates on core contract upgrades. function platformVersion() external view returns (string memory); /// @notice Time delay for proxy upgrades of core contracts and changing important platform settings by multisig //slither-disable-next-line naming-convention function TIME_LOCK() external view returns (uint); /// @notice DAO governance function governance() external view returns (address); /// @notice Core team multi signature wallet. Development and operations fund function multisig() external view returns (address); /// @notice This NFT allow user to build limited number of vaults per week function buildingPermitToken() external view returns (address); /// @notice This ERC20 token is used as payment token for vault building function buildingPayPerVaultToken() external view returns (address); /// @notice Receiver of ecosystem revenue function ecosystemRevenueReceiver() external view returns (address); /// @dev The best asset in a network for swaps between strategy assets and farms rewards assets /// The target exchange asset is used for finding the best strategy's exchange asset. /// Rhe fewer routes needed to swap to the target exchange asset, the better. function targetExchangeAsset() external view returns (address); /// @notice Platform factory assembling vaults. Stores settings, strategy logic, farms. /// Provides the opportunity to upgrade vaults and strategies. /// @return Address of Factory proxy function factory() external view returns (address); /// @notice The holders of these NFT receive a share of the vault revenue /// @return Address of VaultManager proxy function vaultManager() external view returns (address); /// @notice The holders of these tokens receive a share of the revenue received in all vaults using this strategy logic. function strategyLogic() external view returns (address); /// @notice Combining oracle and DeX spot prices /// @return Address of PriceReader proxy function priceReader() external view returns (address); /// @notice Providing underlying assets APRs on-chain /// @return Address of AprOracle proxy function aprOracle() external view returns (address); /// @notice On-chain price quoter and swapper /// @return Address of Swapper proxy function swapper() external view returns (address); /// @notice HardWork resolver and caller /// @return Address of HardWorker proxy function hardWorker() external view returns (address); /// @notice Rebalance resolver /// @return Address of Rebalancer proxy function rebalancer() external view returns (address); /// @notice ZAP feature /// @return Address of Zap proxy function zap() external view returns (address); /// @notice Stability Bridge /// @return Address of Bridge proxy function bridge() external view returns (address); /// @notice Name of current EVM network function networkName() external view returns (string memory); /// @notice Minimal initial boost rewards per day USD amount which needs to create rewarding vault function minInitialBoostPerDay() external view returns (uint); /// @notice Minimal boost rewards vesting duration for initial boost function minInitialBoostDuration() external view returns (uint); /// @notice This function provides the timestamp of the platform upgrade timelock. /// @dev This function is an external view function, meaning it doesn't modify the state. /// @return uint representing the timestamp of the platform upgrade timelock. function platformUpgradeTimelock() external view returns (uint); /// @dev Extra network data /// @return 0-2 bytes - color /// 3-5 bytes - background color /// 6-31 bytes - free function networkExtra() external view returns (bytes32); /// @notice Pending platform upgrade data function pendingPlatformUpgrade() external view returns (PlatformUpgrade memory); /// @notice Get platform revenue fee settings /// @return fee Revenue fee % (between MIN_FEE - MAX_FEE) with DENOMINATOR precision. /// @return feeShareVaultManager Revenue fee share % of VaultManager tokenId owner /// @return feeShareStrategyLogic Revenue fee share % of StrategyLogic tokenId owner /// @return feeShareEcosystem Revenue fee share % of ecosystemFeeReceiver function getFees() external view returns (uint fee, uint feeShareVaultManager, uint feeShareStrategyLogic, uint feeShareEcosystem); /// @notice Get custom vault platform fee /// @return fee revenue fee % with DENOMINATOR precision function getCustomVaultFee(address vault) external view returns (uint fee); /// @notice Platform settings function getPlatformSettings() external view returns (PlatformSettings memory); /// @notice AMM adapters of the platform function getAmmAdapters() external view returns (string[] memory id, address[] memory proxy); /// @notice Get AMM adapter data by hash /// @param ammAdapterIdHash Keccak256 hash of adapter ID string /// @return ID string and proxy address of AMM adapter function ammAdapter(bytes32 ammAdapterIdHash) external view returns (AmmAdapter memory); /// @notice Allowed buy-back tokens for rewarding vaults function allowedBBTokens() external view returns (address[] memory); /// @notice Vaults building limit for buy-back token. /// This limit decrements when a vault for BB-token is built. /// @param token Allowed buy-back token /// @return vaultsLimit Number of vaults that can be built for BB-token function allowedBBTokenVaults(address token) external view returns (uint vaultsLimit); /// @notice Vaults building limits for allowed buy-back tokens. /// @return bbToken Allowed buy-back tokens /// @return vaultsLimit Number of vaults that can be built for BB-tokens function allowedBBTokenVaults() external view returns (address[] memory bbToken, uint[] memory vaultsLimit); /// @notice Non-zero vaults building limits for allowed buy-back tokens. /// @return bbToken Allowed buy-back tokens /// @return vaultsLimit Number of vaults that can be built for BB-tokens function allowedBBTokenVaultsFiltered() external view returns (address[] memory bbToken, uint[] memory vaultsLimit); /// @notice Check address for existance in operators list /// @param operator Address /// @return True if this address is Stability Operator function isOperator(address operator) external view returns (bool); /// @notice Tokens that can be used for boost rewards of rewarding vaults /// @return Addresses of tokens function allowedBoostRewardTokens() external view returns (address[] memory); /// @notice Allowed boost reward tokens that used for unmanaged rewarding vaults creation /// @return Addresses of tokens function defaultBoostRewardTokens() external view returns (address[] memory); /// @notice Allowed boost reward tokens that used for unmanaged rewarding vaults creation /// @param addressToRemove This address will be removed from default boost reward tokens /// @return Addresses of tokens function defaultBoostRewardTokensFiltered(address addressToRemove) external view returns (address[] memory); /// @notice Allowed DeX aggregators /// @return Addresses of DeX aggregator rounters function dexAggregators() external view returns (address[] memory); /// @notice DeX aggregator router address is allowed to be used in the platform /// @param dexAggRouter Address of DeX aggreagator router /// @return Can be used function isAllowedDexAggregatorRouter(address dexAggRouter) external view returns (bool); /// @notice Show minimum TVL for compensate if vault has not enough ETH /// @return Minimum TVL for compensate. function minTvlForFreeHardWork() external view returns (uint); /// @notice Front-end platform viewer /// @return platformAddresses Platform core addresses /// platformAddresses[0] factory /// platformAddresses[1] vaultManager /// platformAddresses[2] strategyLogic /// platformAddresses[3] buildingPermitToken /// platformAddresses[4] buildingPayPerVaultToken /// platformAddresses[5] governance /// platformAddresses[6] multisig /// platformAddresses[7] zap /// platformAddresses[8] bridge /// @return bcAssets Blue chip token addresses /// @return dexAggregators_ DeX aggregators allowed to be used entire the platform /// @return vaultType Vault type ID strings /// @return vaultExtra Vault color, background color and other extra data. Index of vault same as in previous array. /// @return vaultBulldingPrice Price of creating new vault in buildingPayPerVaultToken. Index of vault same as in previous array. /// @return strategyId Strategy logic ID strings /// @return isFarmingStrategy True if strategy is farming strategy. Index of strategy same as in previous array. /// @return strategyTokenURI StrategyLogic NFT tokenId metadata and on-chain image. Index of strategy same as in previous array. /// @return strategyExtra Strategy color, background color and other extra data. Index of strategy same as in previous array. function getData() external view returns ( address[] memory platformAddresses, address[] memory bcAssets, address[] memory dexAggregators_, string[] memory vaultType, bytes32[] memory vaultExtra, uint[] memory vaultBulldingPrice, string[] memory strategyId, bool[] memory isFarmingStrategy, string[] memory strategyTokenURI, bytes32[] memory strategyExtra ); /// @notice Front-end balances, prices and vault list viewer /// DEPRECATED: use IFrontend.getBalanceAssets and IFrontend.getBalanceVaults /// @param yourAccount Address of account to query balances /// @return token Tokens supported by the platform /// @return tokenPrice USD price of token. Index of token same as in previous array. /// @return tokenUserBalance User balance of token. Index of token same as in previous array. /// @return vault Deployed vaults /// @return vaultSharePrice Price 1.0 vault share. Index of vault same as in previous array. /// @return vaultUserBalance User balance of vault. Index of vault same as in previous array. /// @return nft Ecosystem NFTs /// nft[0] BuildingPermitToken /// nft[1] VaultManager /// nft[2] StrategyLogic /// @return nftUserBalance User balance of NFT. Index of NFT same as in previous array. /// @return buildingPayPerVaultTokenBalance User balance of vault creation paying token function getBalance(address yourAccount) external view returns ( address[] memory token, uint[] memory tokenPrice, uint[] memory tokenUserBalance, address[] memory vault, uint[] memory vaultSharePrice, uint[] memory vaultUserBalance, address[] memory nft, uint[] memory nftUserBalance, uint buildingPayPerVaultTokenBalance ); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* WRITE FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @notice Add platform operator. /// Only governance and multisig can add operator. /// @param operator Address of new operator function addOperator(address operator) external; /// @notice Remove platform operator. /// Only governance and multisig can remove operator. /// @param operator Address of operator to remove function removeOperator(address operator) external; /// @notice Announce upgrade of platform proxies implementations /// Only governance and multisig can announce platform upgrades. /// @param newVersion New platform version. Version must be changed when upgrading. /// @param proxies Addresses of core contract proxies /// @param newImplementations New implementation for proxy. Index of proxy same as in previous array. function announcePlatformUpgrade( string memory newVersion, address[] memory proxies, address[] memory newImplementations ) external; /// @notice Upgrade platform /// Only operator (multisig is operator too) can ececute pending platform upgrade function upgrade() external; /// @notice Cancel pending platform upgrade /// Only operator (multisig is operator too) can ececute pending platform upgrade function cancelUpgrade() external; /// @notice Register AMM adapter in platform /// @param id AMM adapter ID string from AmmAdapterIdLib /// @param proxy Address of AMM adapter proxy function addAmmAdapter(string memory id, address proxy) external; // todo Only governance and multisig can set allowed bb-token vaults building limit /// @notice Set new vaults building limit for buy-back token /// @param bbToken Address of allowed buy-back token /// @param vaultsToBuild Number of vaults that can be built for BB-token function setAllowedBBTokenVaults(address bbToken, uint vaultsToBuild) external; // todo Only governance and multisig can add allowed boost reward token /// @notice Add new allowed boost reward token /// @param token Address of token function addAllowedBoostRewardToken(address token) external; // todo Only governance and multisig can remove allowed boost reward token /// @notice Remove allowed boost reward token /// @param token Address of allowed boost reward token function removeAllowedBoostRewardToken(address token) external; // todo Only governance and multisig can add default boost reward token /// @notice Add default boost reward token /// @param token Address of default boost reward token function addDefaultBoostRewardToken(address token) external; // todo Only governance and multisig can remove default boost reward token /// @notice Remove default boost reward token /// @param token Address of allowed boost reward token function removeDefaultBoostRewardToken(address token) external; // todo Only governance and multisig can add allowed boost reward token // todo Only governance and multisig can add default boost reward token /// @notice Add new allowed boost reward token /// @notice Add default boost reward token /// @param allowedBoostRewardToken Address of allowed boost reward token /// @param defaultBoostRewardToken Address of default boost reward token function addBoostTokens( address[] memory allowedBoostRewardToken, address[] memory defaultBoostRewardToken ) external; /// @notice Decrease allowed BB-token vault building limit when vault is built /// Only Factory can do it. /// @param bbToken Address of allowed buy-back token function useAllowedBBTokenVault(address bbToken) external; /// @notice Allow DeX aggregator routers to be used in the platform /// @param dexAggRouter Addresses of DeX aggreagator routers function addDexAggregators(address[] memory dexAggRouter) external; /// @notice Remove allowed DeX aggregator router from the platform /// @param dexAggRouter Address of DeX aggreagator router function removeDexAggregator(address dexAggRouter) external; /// @notice Change initial boost rewards settings /// @param minInitialBoostPerDay_ Minimal initial boost rewards per day USD amount which needs to create rewarding vault /// @param minInitialBoostDuration_ Minimal boost rewards vesting duration for initial boost function setInitialBoost(uint minInitialBoostPerDay_, uint minInitialBoostDuration_) external; /// @notice Update new minimum TVL for compensate. /// @param value New minimum TVL for compensate. function setMinTvlForFreeHardWork(uint value) external; /// @notice Set custom platform fee for vault /// @param vault Vault address /// @param platformFee Custom platform fee function setCustomVaultFee(address vault, uint platformFee) external; /// @notice Setup Rebalancer. /// Only Goverannce or Multisig can do this when Rebalancer is not set. /// @param rebalancer_ Proxy address of Bridge function setupRebalancer(address rebalancer_) external; /// @notice Setup Bridge. /// Only Goverannce or Multisig can do this when Bridge is not set. /// @param bridge_ Proxy address of Bridge function setupBridge(address bridge_) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; /// @notice The vaults are assembled at the factory by users through UI. /// Deployment rights of a vault are tokenized in VaultManager NFT. /// The holders of these tokens receive a share of the vault revenue and can manage vault if possible. /// @dev Rewards transfers to token owner or revenue receiver address managed by token owner. /// @author Alien Deployer (https://github.com/a17) /// @author Jude (https://github.com/iammrjude) /// @author JodsMigel (https://github.com/JodsMigel) interface IVaultManager is IERC721Metadata { //region ----- Events ----- event ChangeVaultParams(uint tokenId, address[] addresses, uint[] nums); event SetRevenueReceiver(uint tokenId, address receiver); //endregion -- Events ----- struct VaultData { // vault uint tokenId; address vault; string vaultType; string name; string symbol; string[] assetsSymbols; string[] rewardAssetsSymbols; uint sharePrice; uint tvl; uint totalApr; bytes32 vaultExtra; // strategy uint strategyTokenId; string strategyId; string strategySpecific; uint strategyApr; bytes32 strategyExtra; } //region ----- View functions ----- /// @notice Vault address managed by token /// @param tokenId ID of NFT. Starts from 0 and increments on mints. /// @return vault Address of vault proxy function tokenVault(uint tokenId) external view returns (address vault); /// @notice Receiver of token owner's platform revenue share /// @param tokenId ID of NFT /// @return receiver Address of vault manager fees receiver function getRevenueReceiver(uint tokenId) external view returns (address receiver); /// @notice All vaults data. /// DEPRECATED: use IFrontend.vaults /// The output values are matched by index in the arrays. /// @param vaultAddress Vault addresses /// @param name Vault name /// @param symbol Vault symbol /// @param vaultType Vault type ID string /// @param strategyId Strategy logic ID string /// @param sharePrice Current vault share price in USD. 18 decimals /// @param tvl Current vault TVL in USD. 18 decimals /// @param totalApr Last total vault APR. Denominator is 100_00. /// @param strategyApr Last strategy APR. Denominator is 100_00. /// @param strategySpecific Strategy specific name function vaults() external view returns ( address[] memory vaultAddress, string[] memory name, string[] memory symbol, string[] memory vaultType, string[] memory strategyId, uint[] memory sharePrice, uint[] memory tvl, uint[] memory totalApr, uint[] memory strategyApr, string[] memory strategySpecific ); /// @notice All deployed vault addresses /// @return vaultAddress Addresses of vault proxy function vaultAddresses() external view returns (address[] memory vaultAddress); /// @notice Vault extended info getter /// @param vault Address of vault proxy /// @return strategy /// @return strategyAssets /// @return underlying /// @return assetsWithApr Assets with underlying APRs that can be provided by AprOracle /// @return assetsAprs APRs of assets with APR. Matched by index wuth previous param. /// @return lastHardWork Last HardWork time function vaultInfo(address vault) external view returns ( address strategy, address[] memory strategyAssets, address underlying, address[] memory assetsWithApr, uint[] memory assetsAprs, uint lastHardWork ); //endregion -- View functions ----- //region ----- Write functions ----- /// @notice Changing managed vault init parameters by Vault Manager (owner of VaultManager NFT) /// @param tokenId ID of VaultManager NFT /// @param addresses Vault init addresses. Must contain also not changeable init addresses /// @param nums Vault init numbers. Must contant also not changeable init numbers function changeVaultParams(uint tokenId, address[] memory addresses, uint[] memory nums) external; /// @notice Minting of new token on deploying vault by Factory /// Only Factory can call this. /// @param to User which creates vault /// @param vault Address of vault proxy /// @return tokenId Minted token ID function mint(address to, address vault) external returns (uint tokenId); /// @notice Owner of token can change revenue reciever of platform fee share /// @param tokenId Owned token ID /// @param receiver New revenue receiver address function setRevenueReceiver(uint tokenId, address receiver) external; //endregion -- Write functions ----- }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; import "./IStrategy.sol"; /// @notice Vault core interface. /// Derived implementations can be effective for building tokenized vaults with single or multiple underlying liquidity mining position. /// Fungible, static non-fungible and actively re-balancing liquidity is supported, as well as single token liquidity provided to lending protocols. /// Vaults can be used for active concentrated liquidity management and market making. /// @author Jude (https://github.com/iammrjude) /// @author JodsMigel (https://github.com/JodsMigel) interface IVault is IERC165 { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ error NotEnoughBalanceToPay(); error FuseTrigger(); error ExceedSlippage(uint mintToUser, uint minToMint); error ExceedSlippageExactAsset(address asset, uint mintToUser, uint minToMint); error ExceedMaxSupply(uint maxSupply); error NotEnoughAmountToInitSupply(uint mintAmount, uint initialShares); error WaitAFewBlocks(); error StrategyZeroDeposit(); error NotSupported(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ event DepositAssets(address indexed account, address[] assets, uint[] amounts, uint mintAmount); event WithdrawAssets( address indexed sender, address indexed owner, address[] assets, uint sharesAmount, uint[] amountsOut ); event HardWorkGas(uint gasUsed, uint gasCost, bool compensated); event DoHardWorkOnDepositChanged(bool oldValue, bool newValue); event MaxSupply(uint maxShares); event VaultName(string newName); event VaultSymbol(string newSymbol); event MintFees( uint vaultManagerReceiverFee, uint strategyLogicReceiverFee, uint ecosystemRevenueReceiverFee, uint multisigReceiverFee ); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* DATA TYPES */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @custom:storage-location erc7201:stability.VaultBase struct VaultBaseStorage { /// @dev Prevents manipulations with deposit and withdraw in short time. /// For simplification we are setup new withdraw request on each deposit/transfer. mapping(address msgSender => uint blockNumber) withdrawRequests; /// @inheritdoc IVault IStrategy strategy; /// @inheritdoc IVault uint maxSupply; /// @inheritdoc IVault uint tokenId; /// @inheritdoc IVault bool doHardWorkOnDeposit; /// @dev Immutable vault type ID string _type; /// @dev Changed ERC20 name string changedName; /// @dev Changed ERC20 symbol string changedSymbol; } /// @title Vault Initialization Data /// @notice Data structure containing parameters for initializing a new vault. /// @dev This struct is commonly used as a parameter for the `initialize` function in vault contracts. /// @param platform Platform address providing access control, infrastructure addresses, fee settings, and upgrade capability. /// @param strategy Immutable strategy proxy used by the vault. /// @param name ERC20 name for the vault token. /// @param symbol ERC20 symbol for the vault token. /// @param tokenId NFT ID associated with the VaultManager. /// @param vaultInitAddresses Array of addresses used during vault initialization. /// @param vaultInitNums Array of uint values corresponding to initialization parameters. struct VaultInitializationData { address platform; address strategy; string name; string symbol; uint tokenId; address[] vaultInitAddresses; uint[] vaultInitNums; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* VIEW FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @notice Immutable vault type ID function vaultType() external view returns (string memory); /// @return uniqueInitAddresses Return required unique init addresses /// @return uniqueInitNums Return required unique init nums function getUniqueInitParamLength() external view returns (uint uniqueInitAddresses, uint uniqueInitNums); /// @notice Vault type extra data /// @return Vault type color, background color and other extra data function extra() external view returns (bytes32); /// @notice Immutable strategy proxy used by the vault /// @return Linked strategy function strategy() external view returns (IStrategy); /// @notice Max supply of shares in the vault. /// Since the starting share price is $1, this ceiling can be considered as an approximate TVL limit. /// @return Max total supply of vault function maxSupply() external view returns (uint); /// @dev VaultManager token ID. This tokenId earn feeVaultManager provided by Platform. function tokenId() external view returns (uint); /// @dev Trigger doHardwork on invest action. Enabled by default. function doHardWorkOnDeposit() external view returns (bool); /// @dev USD price of share with 18 decimals. /// ONLY FOR OFF-CHAIN USE. /// Not trusted vault share price can be manipulated. /// @return price_ Price of 1e18 shares with 18 decimals precision /// @return trusted True means oracle price, false means AMM spot price function price() external view returns (uint price_, bool trusted); /// @dev USD price of assets managed by strategy with 18 decimals /// ONLY FOR OFF-CHAIN USE. /// Not trusted TVL can be manipulated. /// @return tvl_ Total USD value of final assets in vault /// @return trusted True means TVL calculated based only on oracle prices, false means AMM spot price was used. function tvl() external view returns (uint tvl_, bool trusted); /// @dev Calculation of consumed amounts, shares amount and liquidity/underlying value for provided available amounts of strategy assets /// @param assets_ Assets suitable for vault strategy. Can be strategy assets, underlying asset or specific set of assets depending on strategy logic. /// @param amountsMax Available amounts of assets_ that user wants to invest in vault /// @return amountsConsumed Amounts of strategy assets that can be deposited by providing amountsMax /// @return sharesOut Amount of vault shares that will be minted /// @return valueOut Liquidity value or underlying token amount that will be received by the strategy function previewDepositAssets( address[] memory assets_, uint[] memory amountsMax ) external view returns (uint[] memory amountsConsumed, uint sharesOut, uint valueOut); /// @notice All available data on the latest declared APR (annual percentage rate) /// @return totalApr Total APR of investing money to vault. 18 decimals: 1e18 - +100% per year. /// @return strategyApr Strategy investmnt APR declared on last HardWork. /// @return assetsWithApr Assets with underlying APR /// @return assetsAprs Underlying APR of asset function getApr() external view returns (uint totalApr, uint strategyApr, address[] memory assetsWithApr, uint[] memory assetsAprs); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* WRITE FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @notice Write version of previewDepositAssets /// @param assets_ Assets suitable for vault strategy. Can be strategy assets, underlying asset or specific set of assets depending on strategy logic. /// @param amountsMax Available amounts of assets_ that user wants to invest in vault /// @return amountsConsumed Amounts of strategy assets that can be deposited by providing amountsMax /// @return sharesOut Amount of vault shares that will be minted /// @return valueOut Liquidity value or underlying token amount that will be received by the strategy function previewDepositAssetsWrite( address[] memory assets_, uint[] memory amountsMax ) external returns (uint[] memory amountsConsumed, uint sharesOut, uint valueOut); /// @dev Mint fee shares callback /// @param revenueAssets Assets returned by _claimRevenue function that was earned during HardWork /// @param revenueAmounts Assets amounts returned from _claimRevenue function that was earned during HardWork /// Only strategy can call this function hardWorkMintFeeCallback(address[] memory revenueAssets, uint[] memory revenueAmounts) external; /// @dev Deposit final assets (pool assets) to the strategy and minting of vault shares. /// If the strategy interacts with a pool or farms through an underlying token, then it will be minted. /// Emits a {DepositAssets} event with consumed amounts. /// @param assets_ Assets suitable for the strategy. Can be strategy assets, underlying asset or specific set of assets depending on strategy logic. /// @param amountsMax Available amounts of assets_ that user wants to invest in vault /// @param minSharesOut Slippage tolerance. Minimal shares amount which must be received by user. /// @param receiver Receiver of deposit. If receiver is zero address, receiver is msg.sender. function depositAssets( address[] memory assets_, uint[] memory amountsMax, uint minSharesOut, address receiver ) external; /// @dev Burning shares of vault and obtaining strategy assets. /// @param assets_ Assets suitable for the strategy. Can be strategy assets, underlying asset or specific set of assets depending on strategy logic. /// @param amountShares Shares amount for burning /// @param minAssetAmountsOut Slippage tolerance. Minimal amounts of strategy assets that user must receive. /// @return Amount of assets for withdraw. It's related to assets_ one-by-one. function withdrawAssets( address[] memory assets_, uint amountShares, uint[] memory minAssetAmountsOut ) external returns (uint[] memory); /// @dev Burning shares of vault and obtaining strategy assets. /// @param assets_ Assets suitable for the strategy. Can be strategy assets, underlying asset or specific set of assets depending on strategy logic. /// @param amountShares Shares amount for burning /// @param minAssetAmountsOut Slippage tolerance. Minimal amounts of strategy assets that user must receive. /// @param receiver Receiver of assets /// @param owner Owner of vault shares /// @return Amount of assets for withdraw. It's related to assets_ one-by-one. function withdrawAssets( address[] memory assets_, uint amountShares, uint[] memory minAssetAmountsOut, address receiver, address owner ) external returns (uint[] memory); /// @dev Setting of vault capacity /// @param maxShares If totalSupply() exceeds this value, deposits will not be possible function setMaxSupply(uint maxShares) external; /// @dev If activated will call doHardWork on strategy on some deposit actions /// @param value HardWork on deposit is enabled function setDoHardWorkOnDeposit(bool value) external; /// @notice Initialization function for the vault. /// @dev This function is usually called by the Factory during the creation of a new vault. /// @param vaultInitializationData Data structure containing parameters for vault initialization. function initialize(VaultInitializationData memory vaultInitializationData) external; /// @dev Calling the strategy HardWork by operator with optional compensation for spent gas from the vault balance function doHardWork() external; /// @dev Changing ERC20 name of vault function setName(string calldata newName) external; /// @dev Changing ERC20 symbol of vault function setSymbol(string calldata newSymbol) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; /// @dev Core interface of strategy logic interface IStrategy is IERC165 { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ event HardWork( uint apr, uint compoundApr, uint earned, uint tvl, uint duration, uint sharePrice, uint[] assetPrices ); event ExtractFees( uint vaultManagerReceiverFee, uint strategyLogicReceiverFee, uint ecosystemRevenueReceiverFee, uint multisigReceiverFee ); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ error NotReadyForHardWork(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* DATA TYPES */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @custom:storage-location erc7201:stability.StrategyBase struct StrategyBaseStorage { /// @inheritdoc IStrategy address vault; /// @inheritdoc IStrategy uint total; /// @inheritdoc IStrategy uint lastHardWork; /// @inheritdoc IStrategy uint lastApr; /// @inheritdoc IStrategy uint lastAprCompound; /// @inheritdoc IStrategy address[] _assets; /// @inheritdoc IStrategy address _underlying; string _id; uint _exchangeAssetIndex; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* VIEW FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Strategy logic string ID function strategyLogicId() external view returns (string memory); /// @dev Extra data /// @return 0-2 bytes - strategy color /// 3-5 bytes - strategy background color /// 6-31 bytes - free function extra() external view returns (bytes32); /// @dev Types of vault that supported by strategy implementation /// @return types Vault type ID strings function supportedVaultTypes() external view returns (string[] memory types); /// @dev Linked vault address function vault() external view returns (address); /// @dev Final assets that strategy invests function assets() external view returns (address[] memory); /// @notice Final assets and amounts that strategy manages function assetsAmounts() external view returns (address[] memory assets_, uint[] memory amounts_); /// @notice Priced invested assets proportions /// @return proportions Proportions of assets with 18 decimals. Min is 0, max is 1e18. function getAssetsProportions() external view returns (uint[] memory proportions); /// @notice Underlying token address /// @dev Can be used for liquidity farming strategies where AMM has fungible liquidity token (Solidly forks, etc), /// for concentrated liquidity tokenized vaults (Gamma, G-UNI etc) and for other needs. /// @return Address of underlying token or zero address if no underlying in strategy function underlying() external view returns (address); /// @dev Balance of liquidity token or liquidity value function total() external view returns (uint); /// @dev Last HardWork time /// @return Timestamp function lastHardWork() external view returns (uint); /// @dev Last APR of earned USD amount registered by HardWork /// ONLY FOR OFF-CHAIN USE. /// Not trusted asset price can be manipulated. /// @return APR with 18 decimals. 1e18 - 100%. function lastApr() external view returns (uint); /// @dev Last APR of compounded assets registered by HardWork. /// Can be used on-chain. /// @return APR with 18 decimals. 1e18 - 100%. function lastAprCompound() external view returns (uint); /// @notice Calculation of consumed amounts and liquidity/underlying value for provided strategy assets and amounts. /// @param assets_ Strategy assets or part of them, if necessary /// @param amountsMax Amounts of specified assets available for investing /// @return amountsConsumed Cosumed amounts of assets when investing /// @return value Liquidity value or underlying token amount minted when investing function previewDepositAssets( address[] memory assets_, uint[] memory amountsMax ) external view returns (uint[] memory amountsConsumed, uint value); /// @notice Write version of previewDepositAssets /// @param assets_ Strategy assets or part of them, if necessary /// @param amountsMax Amounts of specified assets available for investing /// @return amountsConsumed Cosumed amounts of assets when investing /// @return value Liquidity value or underlying token amount minted when investing function previewDepositAssetsWrite( address[] memory assets_, uint[] memory amountsMax ) external returns (uint[] memory amountsConsumed, uint value); /// @notice All strategy revenue (pool fees, farm rewards etc) that not claimed by strategy yet /// @return assets_ Revenue assets /// @return amounts Amounts. Index of asset same as in previous array. function getRevenue() external view returns (address[] memory assets_, uint[] memory amounts); /// @notice Optional specific name of investing strategy, underyling type, setup variation etc /// @return name Empty string or specific name /// @return showInVaultSymbol Show specific in linked vault symbol function getSpecificName() external view returns (string memory name, bool showInVaultSymbol); /// @notice Variants pf strategy initializations with description of money making mechanic. /// As example, if strategy need farm, then number of variations is number of available farms. /// If CAMM strategy have set of available widths (tick ranges), then number of variations is number of available farms. /// If both example conditions are met then total number or variations = total farms * total widths. /// @param platform_ Need this param because method called when strategy implementation is not initialized /// @return variants Descriptions of the strategy for making money /// @return addresses Init strategy addresses. Indexes for each variants depends of copmpared arrays lengths. /// @return nums Init strategy numbers. Indexes for each variants depends of copmpared arrays lengths. /// @return ticks Init strategy ticks. Indexes for each variants depends of copmpared arrays lengths. function initVariants(address platform_) external view returns (string[] memory variants, address[] memory addresses, uint[] memory nums, int24[] memory ticks); /// @notice How does the strategy make money? /// @return Description in free form function description() external view returns (string memory); /// @notice Is HardWork on vault deposits can be enabled function isHardWorkOnDepositAllowed() external view returns (bool); /// @notice Is HardWork can be executed function isReadyForHardWork() external view returns (bool); /// @notice Strategy not need to process revenue on HardWorks function autoCompoundingByUnderlyingProtocol() external view returns (bool); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* WRITE FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev A single universal initializer for all strategy implementations. /// @param addresses All addresses that strategy requires for initialization. Min array length is 2. /// addresses[0]: platform (required) /// addresses[1]: vault (required) /// addresses[2]: initStrategyAddresses[0] (optional) /// addresses[3]: initStrategyAddresses[1] (optional) /// addresses[n]: initStrategyAddresses[n - 2] (optional) /// @param nums All uint values that strategy requires for initialization. Min array length is 0. /// @param ticks All int24 values that strategy requires for initialization. Min array length is 0. function initialize(address[] memory addresses, uint[] memory nums, int24[] memory ticks) external; /// @notice Invest strategy assets. Amounts of assets must be already on strategy contract balance. /// Only vault can call this. /// @param amounts Anounts of strategy assets /// @return value Liquidity value or underlying token amount function depositAssets(uint[] memory amounts) external returns (uint value); /// @notice Invest underlying asset. Asset must be already on strategy contract balance. /// Only vault can call this. /// @param amount Amount of underlying asset to invest /// @return amountsConsumed Cosumed amounts of invested assets function depositUnderlying(uint amount) external returns (uint[] memory amountsConsumed); /// @dev For specified amount of shares and assets_, withdraw strategy assets from farm/pool/staking and send to receiver if possible /// Only vault can call this. /// @param assets_ Here we give the user a choice of assets to withdraw if strategy support it /// @param value Part of strategy total value to withdraw /// @param receiver User address /// @return amountsOut Amounts of assets sent to user function withdrawAssets( address[] memory assets_, uint value, address receiver ) external returns (uint[] memory amountsOut); /// @notice Wothdraw underlying invested and send to receiver /// Only vault can call this. /// @param amount Ampunt of underlying asset to withdraw /// @param receiver User of vault which withdraw underlying from the vault function withdrawUnderlying(uint amount, address receiver) external; /// @dev For specified amount of shares, transfer strategy assets from contract balance and send to receiver if possible /// This method is called by vault w/o underlying on triggered fuse mode. /// Only vault can call this. /// @param amount Ampunt of liquidity value that user withdraw /// @param totalAmount Total amount of strategy liquidity /// @param receiver User of vault which withdraw assets /// @return amountsOut Amounts of strategy assets sent to user function transferAssets( uint amount, uint totalAmount, address receiver ) external returns (uint[] memory amountsOut); /// @notice Execute HardWork /// During HardWork strategy claiming revenue and processing it. /// Only vault can call this. function doHardWork() external; /// @notice Emergency stop investing by strategy, withdraw liquidity without rewards. /// This action triggers FUSE mode. /// Only governance or multisig can call this. function emergencyStopInvesting() external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; /// @notice On-chain price quoter and swapper by predefined routes /// @author Alien Deployer (https://github.com/a17) /// @author Jude (https://github.com/iammrjude) /// @author JodsMigel (https://github.com/JodsMigel) /// @author 0xhokugava (https://github.com/0xhokugava) interface ISwapper { event Swap(address indexed tokenIn, address indexed tokenOut, uint amount); event PoolAdded(PoolData poolData, bool assetAdded); event PoolRemoved(address token); event BlueChipAdded(PoolData poolData); event ThresholdChanged(address[] tokenIn, uint[] thresholdAmount); event BlueChipPoolRemoved(address tokenIn, address tokenOut); //region ----- Custom Errors ----- error UnknownAMMAdapter(); error LessThenThreshold(uint minimumAmount); error NoRouteFound(); error NoRoutesForAssets(); //endregion -- Custom Errors ----- struct PoolData { address pool; address ammAdapter; address tokenIn; address tokenOut; } struct AddPoolData { address pool; string ammAdapterId; address tokenIn; address tokenOut; } /// @notice All assets in pools added to Swapper /// @return Addresses of assets function assets() external view returns (address[] memory); /// @notice All blue chip assets in blue chip pools added to Swapper /// @return Addresses of blue chip assets function bcAssets() external view returns (address[] memory); /// @notice All assets in Swapper /// @return Addresses of assets and blue chip assets function allAssets() external view returns (address[] memory); /// @notice Add pools with largest TVL /// @param pools Largest pools with AMM adapter addresses /// @param rewrite Rewrite pool for tokenIn function addPools(PoolData[] memory pools, bool rewrite) external; /// @notice Add pools with largest TVL /// @param pools Largest pools with AMM adapter ID string /// @param rewrite Rewrite pool for tokenIn function addPools(AddPoolData[] memory pools, bool rewrite) external; /// @notice Add largest pools with the most popular tokens on the current network /// @param pools_ PoolData array with pool, tokens and AMM adapter address /// @param rewrite Change exist pool records function addBlueChipsPools(PoolData[] memory pools_, bool rewrite) external; /// @notice Add largest pools with the most popular tokens on the current network /// @param pools_ AddPoolData array with pool, tokens and AMM adapter string ID /// @param rewrite Change exist pool records function addBlueChipsPools(AddPoolData[] memory pools_, bool rewrite) external; /// @notice Retrieves pool data for a specified token swap in Blue Chip Pools. /// @dev This function provides information about the pool associated with the specified input and output tokens. /// @param tokenIn The input token address. /// @param tokenOut The output token address. /// @return poolData The data structure containing information about the Blue Chip Pool. /// @custom:opcodes view function blueChipsPools(address tokenIn, address tokenOut) external view returns (PoolData memory poolData); /// @notice Set swap threshold for token /// @dev Prevents dust swap. /// @param tokenIn Swap input token /// @param thresholdAmount Minimum amount of token for executing swap function setThresholds(address[] memory tokenIn, uint[] memory thresholdAmount) external; /// @notice Swap threshold for token /// @param token Swap input token /// @return threshold_ Minimum amount of token for executing swap function threshold(address token) external view returns (uint threshold_); /// @notice Price of given tokenIn against tokenOut /// @param tokenIn Swap input token /// @param tokenOut Swap output token /// @param amount Amount of tokenIn. If provide zero then amount is 1.0. /// @return Amount of tokenOut with decimals of tokenOut function getPrice(address tokenIn, address tokenOut, uint amount) external view returns (uint); /// @notice Return price the first poolData.tokenIn against the last poolData.tokenOut in decimals of tokenOut. /// @param route Array of pool address, swapper address tokenIn, tokenOut /// @param amount Amount of tokenIn. If provide zero then amount is 1.0. function getPriceForRoute(PoolData[] memory route, uint amount) external view returns (uint); /// @notice Check possibility of swap tokenIn for tokenOut /// @param tokenIn Swap input token /// @param tokenOut Swap output token /// @return Swap route exists function isRouteExist(address tokenIn, address tokenOut) external view returns (bool); /// @notice Build route for swap. No reverts inside. /// @param tokenIn Swap input token /// @param tokenOut Swap output token /// @return route Array of pools for swap tokenIn to tokenOut. Zero length indicate an error. /// @return errorMessage Possible reason why the route was not found. Empty for success routes. function buildRoute( address tokenIn, address tokenOut ) external view returns (PoolData[] memory route, string memory errorMessage); /// @notice Sell tokenIn for tokenOut /// @dev Assume approve on this contract exist /// @param tokenIn Swap input token /// @param tokenOut Swap output token /// @param amount Amount of tokenIn for swap. /// @param priceImpactTolerance Price impact tolerance. Must include fees at least. Denominator is 100_000. function swap(address tokenIn, address tokenOut, uint amount, uint priceImpactTolerance) external; /// @notice Swap by predefined route /// @param route Array of pool address, swapper address tokenIn, tokenOut. /// TokenIn from first item will be swaped to tokenOut of last . /// @param amount Amount of first item tokenIn. /// @param priceImpactTolerance Price impact tolerance. Must include fees at least. Denominator is 100_000. function swapWithRoute(PoolData[] memory route, uint amount, uint priceImpactTolerance) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; /// @dev Combining oracle and DeX spot prices /// @author Alien Deployer (https://github.com/a17) /// @author Jude (https://github.com/iammrjude) /// @author JodsMigel (https://github.com/JodsMigel) interface IPriceReader { //region ----- Events ----- event AdapterAdded(address adapter); event AdapterRemoved(address adapter); //endregion -- Events ----- /// @notice Price of asset /// @dev Price of 1.0 amount of asset in USD /// @param asset Address of asset /// @return price USD price with 18 decimals /// @return trusted Price from oracle function getPrice(address asset) external view returns (uint price, bool trusted); /// @notice Get USD price of specified assets and amounts /// @param assets_ Addresses of assets /// @param amounts_ Amount of asset. Index of asset same as in previous parameter. /// @return total Total USD value with 18 decimals /// @return assetAmountPrice USD price of asset amount. Index of assetAmountPrice same as in assets_ parameters. /// @return assetPrice USD price of asset. Index of assetAmountPrice same as in assets_ parameters. /// @return trusted True if only oracle prices was used for calculation. function getAssetsPrice( address[] memory assets_, uint[] memory amounts_ ) external view returns (uint total, uint[] memory assetAmountPrice, uint[] memory assetPrice, bool trusted); /// @notice Add oracle adapter to PriceReader /// Only operator (multisig is operator too) can add adapter /// @param adapter_ Address of price oracle proxy function addAdapter(address adapter_) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; /// @notice Creating vaults, upgrading vaults and strategies, vault list, farms and strategy logics management /// @author Alien Deployer (https://github.com/a17) /// @author Jude (https://github.com/iammrjude) /// @author JodsMigel (https://github.com/JodsMigel) /// @author HCrypto7 (https://github.com/hcrypto7) interface IFactory { //region ----- Custom Errors ----- error VaultImplementationIsNotAvailable(); error VaultNotAllowedToDeploy(); error StrategyImplementationIsNotAvailable(); error StrategyLogicNotAllowedToDeploy(); error YouDontHaveEnoughTokens(uint userBalance, uint requireBalance, address payToken); error SuchVaultAlreadyDeployed(bytes32 key); error NotActiveVault(); error UpgradeDenied(bytes32 _hash); error AlreadyLastVersion(bytes32 _hash); error NotStrategy(); error BoostDurationTooLow(); error BoostAmountTooLow(); error BoostAmountIsZero(); //endregion ----- Custom Errors ----- //region ----- Events ----- event VaultAndStrategy( address indexed deployer, string vaultType, string strategyId, address vault, address strategy, string name, string symbol, address[] assets, bytes32 deploymentKey, uint vaultManagerTokenId ); event StrategyProxyUpgraded(address proxy, address oldImplementation, address newImplementation); event VaultProxyUpgraded(address proxy, address oldImplementation, address newImplementation); event VaultConfigChanged( string type_, address implementation, bool deployAllowed, bool upgradeAllowed, bool newVaultType ); event StrategyLogicConfigChanged( string id, address implementation, bool deployAllowed, bool upgradeAllowed, bool newStrategy ); event VaultStatus(address indexed vault, uint newStatus); event NewFarm(Farm[] farms); event UpdateFarm(uint id, Farm farm); event SetStrategyAvailableInitParams(string id, address[] initAddresses, uint[] initNums, int24[] initTicks); event AliasNameChanged(address indexed operator, address indexed tokenAddress, string newAliasName); //endregion -- Events ----- //region ----- Data types ----- /// @custom:storage-location erc7201:stability.Factory struct FactoryStorage { /// @inheritdoc IFactory mapping(bytes32 typeHash => VaultConfig) vaultConfig; /// @inheritdoc IFactory mapping(bytes32 idHash => StrategyLogicConfig) strategyLogicConfig; /// @inheritdoc IFactory mapping(bytes32 deploymentKey => address vaultProxy) deploymentKey; /// @inheritdoc IFactory mapping(address vault => uint status) vaultStatus; /// @inheritdoc IFactory mapping(address address_ => bool isStrategy_) isStrategy; EnumerableSet.Bytes32Set vaultTypeHashes; EnumerableSet.Bytes32Set strategyLogicIdHashes; mapping(uint week => mapping(uint builderPermitTokenId => uint vaultsBuilt)) vaultsBuiltByPermitTokenId; address[] deployedVaults; Farm[] farms; /// @inheritdoc IFactory mapping(bytes32 idHash => StrategyAvailableInitParams) strategyAvailableInitParams; mapping(address tokenAddress => string aliasName) aliasNames; } struct VaultConfig { string vaultType; address implementation; bool deployAllowed; bool upgradeAllowed; uint buildingPrice; } struct StrategyLogicConfig { string id; address implementation; bool deployAllowed; bool upgradeAllowed; bool farming; uint tokenId; } struct Farm { uint status; address pool; string strategyLogicId; address[] rewardAssets; address[] addresses; uint[] nums; int24[] ticks; } struct StrategyAvailableInitParams { address[] initAddresses; uint[] initNums; int24[] initTicks; } //endregion -- Data types ----- //region ----- View functions ----- /// @notice All vaults deployed by the factory /// @return Vault proxy addresses function deployedVaults() external view returns (address[] memory); /// @notice Total vaults deployed function deployedVaultsLength() external view returns (uint); /// @notice Get vault by VaultManager tokenId /// @param id Vault array index. Same as tokenId of VaultManager NFT /// @return Address of VaultProxy function deployedVault(uint id) external view returns (address); /// @notice All farms known by the factory in current network function farms() external view returns (Farm[] memory); /// @notice Total farms known by the factory in current network function farmsLength() external view returns (uint); /// @notice Farm data by farm index /// @param id Index of farm function farm(uint id) external view returns (Farm memory); /// @notice Strategy logic settings /// @param idHash keccak256 hash of strategy logic string ID /// @return config Strategy logic settings function strategyLogicConfig(bytes32 idHash) external view returns (StrategyLogicConfig memory config); /// @notice All known strategies /// @return Array of keccak256 hashes of strategy logic string ID function strategyLogicIdHashes() external view returns (bytes32[] memory); // todo remove, use new function without calculating vault symbol on the fly for not initialized vaults // factory required that special functionally only internally, not for interface function getStrategyData( string memory vaultType, address strategyAddress, address bbAsset ) external view returns ( string memory strategyId, address[] memory assets, string[] memory assetsSymbols, string memory specificName, string memory vaultSymbol ); /// @dev Get best asset of assets to be strategy exchange asset function getExchangeAssetIndex(address[] memory assets) external view returns (uint); /// @notice Deployment key of created vault /// @param deploymentKey_ Hash of concatenated unique vault and strategy initialization parameters /// @return Address of deployed vault function deploymentKey(bytes32 deploymentKey_) external view returns (address); /// @notice Calculating deployment key based on unique vault and strategy initialization parameters /// @param vaultType Vault type string /// @param strategyId Strategy logic Id string /// @param vaultInitAddresses Vault initialization addresses for deployVaultAndStrategy method /// @param vaultInitNums Vault initialization uint numbers for deployVaultAndStrategy method /// @param strategyInitAddresses Strategy initialization addresses for deployVaultAndStrategy method /// @param strategyInitNums Strategy initialization uint numbers for deployVaultAndStrategy method /// @param strategyInitTicks Strategy initialization int24 ticks for deployVaultAndStrategy method function getDeploymentKey( string memory vaultType, string memory strategyId, address[] memory vaultInitAddresses, uint[] memory vaultInitNums, address[] memory strategyInitAddresses, uint[] memory strategyInitNums, int24[] memory strategyInitTicks ) external view returns (bytes32); /// @notice Available variants of new vault for creating. /// DEPRECATED: use IFrontend.whatToBuild /// The structure of the function's output values is complex, /// but after parsing them, the front end has all the data to generate a list of vaults to create. /// @return desc Descriptions of the strategy for making money /// @return vaultType Vault type strings. Output values are matched by index with previous array. /// @return strategyId Strategy logic ID strings. Output values are matched by index with previous array. /// @return initIndexes Map of start and end indexes in next 5 arrays. Output values are matched by index with previous array. /// [0] Start index in vaultInitAddresses /// [1] End index in vaultInitAddresses /// [2] Start index in vaultInitNums /// [3] End index in vaultInitNums /// [4] Start index in strategyInitAddresses /// [5] End index in strategyInitAddresses /// [6] Start index in strategyInitNums /// [7] End index in strategyInitNums /// [8] Start index in strategyInitTicks /// [9] End index in strategyInitTicks /// @return vaultInitAddresses Vault initialization addresses for deployVaultAndStrategy method for all building variants. /// @return vaultInitNums Vault initialization uint numbers for deployVaultAndStrategy method for all building variants. /// @return strategyInitAddresses Strategy initialization addresses for deployVaultAndStrategy method for all building variants. /// @return strategyInitNums Strategy initialization uint numbers for deployVaultAndStrategy method for all building variants. /// @return strategyInitTicks Strategy initialization int24 ticks for deployVaultAndStrategy method for all building variants. function whatToBuild() external view returns ( string[] memory desc, string[] memory vaultType, string[] memory strategyId, uint[10][] memory initIndexes, address[] memory vaultInitAddresses, uint[] memory vaultInitNums, address[] memory strategyInitAddresses, uint[] memory strategyInitNums, int24[] memory strategyInitTicks ); /// @notice Governance and multisig can set a vault status other than Active - the default status. /// HardWorker only works with active vaults. /// @return status Constant from VaultStatusLib function vaultStatus(address vault) external view returns (uint status); /// @notice Check that strategy proxy deployed by the Factory /// @param address_ Address of contract /// @return This address is our strategy proxy function isStrategy(address address_) external view returns (bool); /// @notice How much vaults was built by builderPermitToken NFT tokenId in week /// @param week Week index (timestamp / (86400 * 7)) /// @param builderPermitTokenId Token ID of buildingPermitToken NFT /// @return vaultsBuilt Vaults built function vaultsBuiltByPermitTokenId( uint week, uint builderPermitTokenId ) external view returns (uint vaultsBuilt); /// @notice Data on all factory strategies. /// The output values are matched by index in the arrays. /// @return id Strategy logic ID strings /// @return deployAllowed New vaults can be deployed /// @return upgradeAllowed Strategy can be upgraded /// @return farming It is farming strategy (earns farming/gauge rewards) /// @return tokenId Token ID of StrategyLogic NFT /// @return tokenURI StrategyLogic NFT tokenId metadata and on-chain image /// @return extra Strategy color, background color and other extra data function strategies() external view returns ( string[] memory id, bool[] memory deployAllowed, bool[] memory upgradeAllowed, bool[] memory farming, uint[] memory tokenId, string[] memory tokenURI, bytes32[] memory extra ); /// @notice Get config of vault type /// @param typeHash Keccak256 hash of vault type string /// @return vaultType Vault type string /// @return implementation Vault implementation address /// @return deployAllowed New vaults can be deployed /// @return upgradeAllowed Vaults can be upgraded /// @return buildingPrice Price of building new vault function vaultConfig(bytes32 typeHash) external view returns ( string memory vaultType, address implementation, bool deployAllowed, bool upgradeAllowed, uint buildingPrice ); /// @notice Data on all factory vault types /// The output values are matched by index in the arrays. /// @return vaultType Vault type string /// @return implementation Address of vault implemented logic /// @return deployAllowed New vaults can be deployed /// @return upgradeAllowed Vaults can be upgraded /// @return buildingPrice Price of building new vault /// @return extra Vault type color, background color and other extra data function vaultTypes() external view returns ( string[] memory vaultType, address[] memory implementation, bool[] memory deployAllowed, bool[] memory upgradeAllowed, uint[] memory buildingPrice, bytes32[] memory extra ); /// @notice Initialization strategy params store function strategyAvailableInitParams(bytes32 idHash) external view returns (StrategyAvailableInitParams memory); /// @notice Retrieves the alias name associated with a given address /// @param tokenAddress_ The address to query for its alias name /// @return The alias name associated with the provided address function getAliasName(address tokenAddress_) external view returns (string memory); //endregion -- View functions ----- //region ----- Write functions ----- /// @notice Main method of the Factory - new vault creation by user. /// @param vaultType Vault type ID string /// @param strategyId Strategy logic ID string /// Different types of vaults and strategies have different lengths of input arrays. /// @param vaultInitAddresses Addresses for vault initialization /// @param vaultInitNums Numbers for vault initialization /// @param strategyInitAddresses Addresses for strategy initialization /// @param strategyInitNums Numbers for strategy initialization /// @param strategyInitTicks Ticks for strategy initialization /// @return vault Deployed VaultProxy address /// @return strategy Deployed StrategyProxy address function deployVaultAndStrategy( string memory vaultType, string memory strategyId, address[] memory vaultInitAddresses, uint[] memory vaultInitNums, address[] memory strategyInitAddresses, uint[] memory strategyInitNums, int24[] memory strategyInitTicks ) external returns (address vault, address strategy); /// @notice Upgrade vault proxy. Can be called by any address. /// @param vault Address of vault proxy for upgrade function upgradeVaultProxy(address vault) external; /// @notice Upgrade strategy proxy. Can be called by any address. /// @param strategy Address of strategy proxy for upgrade function upgradeStrategyProxy(address strategy) external; /// @notice Add farm to factory /// @param farms_ Settings and data required to work with the farm. function addFarms(Farm[] memory farms_) external; /// @notice Update farm /// @param id Farm index /// @param farm_ Settings and data required to work with the farm. function updateFarm(uint id, Farm memory farm_) external; /// @notice Initial addition or change of vault type settings. /// Operator can add new vault type. Governance or multisig can change existing vault type config. /// @param vaultConfig_ Vault type settings function setVaultConfig(VaultConfig memory vaultConfig_) external; /// @notice Initial addition or change of strategy logic settings. /// Operator can add new strategy logic. Governance or multisig can change existing logic config. /// @param config Strategy logic settings /// @param developer Strategy developer is receiver of minted StrategyLogic NFT on initial addition function setStrategyLogicConfig(StrategyLogicConfig memory config, address developer) external; /// @notice Governance and multisig can set a vault status other than Active - the default status. /// @param vaults Addresses of vault proxy /// @param statuses New vault statuses. Constant from VaultStatusLib function setVaultStatus(address[] memory vaults, uint[] memory statuses) external; /// @notice Initial addition or change of strategy available init params /// @param id Strategy ID string /// @param initParams Init params variations that will be parsed by strategy function setStrategyAvailableInitParams(string memory id, StrategyAvailableInitParams memory initParams) external; /// @notice Assigns a new alias name to a specific address /// @dev This function may require certain permissions to be called successfully. /// @param tokenAddress_ The address to assign an alias name to /// @param aliasName_ The alias name to assign to the given address function setAliasName(address tokenAddress_, string memory aliasName_) external; //endregion -- Write functions ----- }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; library VaultTypeLib { string internal constant COMPOUNDING = "Compounding"; string internal constant REWARDING = "Rewarding"; string internal constant REWARDING_MANAGED = "Rewarding Managed"; string internal constant SPLITTER_MANAGED = "Splitter Managed"; string internal constant SPLITTER_AUTO = "Splitter Automatic"; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "./ConstantsLib.sol"; library CommonLib { function filterAddresses( address[] memory addresses, address addressToRemove ) external pure returns (address[] memory filteredAddresses) { uint len = addresses.length; uint newLen; // nosemgrep for (uint i; i < len; ++i) { if (addresses[i] != addressToRemove) { ++newLen; } } filteredAddresses = new address[](newLen); uint k; // nosemgrep for (uint i; i < len; ++i) { if (addresses[i] != addressToRemove) { filteredAddresses[k] = addresses[i]; ++k; } } } function formatUsdAmount(uint amount) external pure returns (string memory formattedPrice) { uint dollars = amount / 10 ** 18; string memory priceStr; if (dollars >= 1000) { uint kDollars = dollars / 1000; uint kDollarsFraction = (dollars - kDollars * 1000) / 10; string memory delimiter = "."; if (kDollarsFraction < 10) { delimiter = ".0"; } priceStr = string.concat(Strings.toString(kDollars), delimiter, Strings.toString(kDollarsFraction), "k"); } else if (dollars >= 100) { priceStr = Strings.toString(dollars); } else { uint dollarsFraction = (amount - dollars * 10 ** 18) / 10 ** 14; if (dollarsFraction > 0) { string memory dollarsFractionDelimiter = "."; if (dollarsFraction < 10) { dollarsFractionDelimiter = ".000"; } else if (dollarsFraction < 100) { dollarsFractionDelimiter = ".00"; } else if (dollarsFraction < 1000) { dollarsFractionDelimiter = ".0"; } priceStr = string.concat( Strings.toString(dollars), dollarsFractionDelimiter, Strings.toString(dollarsFraction) ); } else { priceStr = Strings.toString(dollars); } } formattedPrice = string.concat("$", priceStr); } function formatApr(uint apr) external pure returns (string memory formattedApr) { uint aprInt = apr * 100 / ConstantsLib.DENOMINATOR; uint aprFraction = (apr - aprInt * ConstantsLib.DENOMINATOR / 100) / 10; string memory delimiter = "."; if (aprFraction < 10) { delimiter = ".0"; } formattedApr = string.concat(Strings.toString(aprInt), delimiter, Strings.toString(aprFraction), "%"); } function implodeSymbols( address[] memory assets, string memory delimiter ) external view returns (string memory outString) { return implode(getSymbols(assets), delimiter); } function implode(string[] memory strings, string memory delimiter) public pure returns (string memory outString) { uint len = strings.length; if (len == 0) { return ""; } outString = strings[0]; // nosemgrep for (uint i = 1; i < len; ++i) { outString = string.concat(outString, delimiter, strings[i]); } return outString; } function getSymbols(address[] memory assets) public view returns (string[] memory symbols) { uint len = assets.length; symbols = new string[](len); // nosemgrep for (uint i; i < len; ++i) { symbols[i] = IERC20Metadata(assets[i]).symbol(); } } function bytesToBytes32(bytes memory b) external pure returns (bytes32 out) { // nosemgrep for (uint i; i < b.length; ++i) { out |= bytes32(b[i] & 0xFF) >> (i * 8); } // return out; } function bToHex(bytes memory buffer) external pure returns (string memory) { // Fixed buffer size for hexadecimal convertion bytes memory converted = new bytes(buffer.length * 2); bytes memory _base = "0123456789abcdef"; uint baseLength = _base.length; // nosemgrep for (uint i; i < buffer.length; ++i) { converted[i * 2] = _base[uint8(buffer[i]) / baseLength]; converted[i * 2 + 1] = _base[uint8(buffer[i]) % baseLength]; } return string(abi.encodePacked(converted)); } function shortId(string memory id) external pure returns (string memory) { uint words = 1; bytes memory idBytes = bytes(id); uint idBytesLength = idBytes.length; // nosemgrep for (uint i; i < idBytesLength; ++i) { if (keccak256(bytes(abi.encodePacked(idBytes[i]))) == keccak256(bytes(" "))) { ++words; } } bytes memory _shortId = new bytes(words); uint k = 1; _shortId[0] = idBytes[0]; // nosemgrep for (uint i = 1; i < idBytesLength; ++i) { if (keccak256(bytes(abi.encodePacked(idBytes[i]))) == keccak256(bytes(" "))) { if (keccak256(bytes(abi.encodePacked(idBytes[i + 1]))) == keccak256(bytes("0"))) { _shortId[k] = idBytes[i + 3]; } else { _shortId[k] = idBytes[i + 1]; } ++k; } } return string(abi.encodePacked(_shortId)); } function eq(string memory a, string memory b) external pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } function u2s(uint num) external pure returns (string memory) { return Strings.toString(num); } function i2s(int num) external pure returns (string memory) { return Strings.toString(num > 0 ? uint(num) : uint(-num)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; interface IFrontend { /// @notice Platform address function platform() external view returns (address); /// @notice Version of Frontend contract function VERSION() external view returns (string memory); /// @notice Main vaults data /// @param start Start vault number on page /// @param pageSize Size of page /// @return total Total vaults in current chain /// The output values are matched by index in the arrays. /// @return vaultAddress Vault addresses /// @return name Vault name /// @return symbol Vault symbol /// @return vaultType Vault type ID string /// @return sharePrice Current vault share price in USD. 18 decimals /// @return tvl Current vault TVL in USD. 18 decimals /// @return strategy Linked strategy address /// @return strategyId Strategy logic ID string /// @return strategySpecific Strategy specific name function vaults( uint start, uint pageSize ) external view returns ( uint total, address[] memory vaultAddress, string[] memory name, string[] memory symbol, string[] memory vaultType, uint[] memory sharePrice, uint[] memory tvl, address[] memory strategy, string[] memory strategyId, string[] memory strategySpecific ); /// @notice Get user balance of all supported assets with asset prices /// @param userAccount Address of account to query balances /// @param start Start asset number on page /// @param pageSize Size of page /// @return total Total assets /// @return asset Asset addresses /// @return assetPrice USD price of asset. Index of asset same as in previous array. /// @return assetUserBalance User balance of token. Index of token same as in previous array. function getBalanceAssets( address userAccount, uint start, uint pageSize ) external view returns (uint total, address[] memory asset, uint[] memory assetPrice, uint[] memory assetUserBalance); /// @notice Get user balance of vaults with vault share prices /// @param userAccount Address of account to query balances /// @param start Start asset number on page /// @param pageSize Size of page /// @return total Total vaults /// @return vault Deployed vaults /// @return vaultSharePrice Price of 1.0 vault share. Index of vault same as in previous array. /// @return vaultUserBalance User balance of vault. Index of vault same as in previous array. function getBalanceVaults( address userAccount, uint start, uint pageSize ) external view returns (uint total, address[] memory vault, uint[] memory vaultSharePrice, uint[] memory vaultUserBalance); /// @notice Available variants of new vault for creating. /// @param startStrategy Start number of strategy to query /// @param step Size of page /// @return totalStrategies Total strategies in chain /// @return desc Descriptions of the strategy for making money /// @return vaultType Vault type strings. Output values are matched by index with previous array. /// @return strategyId Strategy logic ID strings. Output values are matched by index with previous array. /// @return initIndexes Map of start and end indexes in next 5 arrays. Output values are matched by index with previous array. /// [0] Start index in vaultInitAddresses /// [1] End index in vaultInitAddresses /// [2] Start index in vaultInitNums /// [3] End index in vaultInitNums /// [4] Start index in strategyInitAddresses /// [5] End index in strategyInitAddresses /// [6] Start index in strategyInitNums /// [7] End index in strategyInitNums /// [8] Start index in strategyInitTicks /// [9] End index in strategyInitTicks /// @return vaultInitAddresses Vault initialization addresses for deployVaultAndStrategy method for all building variants. /// @return vaultInitNums Vault initialization uint numbers for deployVaultAndStrategy method for all building variants. /// @return strategyInitAddresses Strategy initialization addresses for deployVaultAndStrategy method for all building variants. /// @return strategyInitNums Strategy initialization uint numbers for deployVaultAndStrategy method for all building variants. /// @return strategyInitTicks Strategy initialization int24 ticks for deployVaultAndStrategy method for all building variants. function whatToBuild( uint startStrategy, uint step ) external view returns ( uint totalStrategies, string[] memory desc, string[] memory vaultType, string[] memory strategyId, uint[10][] memory initIndexes, address[] memory vaultInitAddresses, uint[] memory vaultInitNums, address[] memory strategyInitAddresses, uint[] memory strategyInitNums, int24[] memory strategyInitTicks ); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.20; import {IERC721} from "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.20; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position is the index of the value in the `values` array plus 1. // Position 0 is used to mean a value is not in the set. mapping(bytes32 value => uint256) _positions; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._positions[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We cache the value's position to prevent multiple reads from the same storage slot uint256 position = set._positions[value]; if (position != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 valueIndex = position - 1; uint256 lastIndex = set._values.length - 1; if (valueIndex != lastIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the lastValue to the index where the value to delete is set._values[valueIndex] = lastValue; // Update the tracked position of the lastValue (that was just moved) set._positions[lastValue] = position; } // Delete the slot where the moved value was stored set._values.pop(); // Delete the tracked position for the deleted slot delete set._positions[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._positions[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { uint256 localValue = value; bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = HEX_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal * representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; library ConstantsLib { uint internal constant DENOMINATOR = 100_000; address internal constant DEAD_ADDRESS = 0xdEad000000000000000000000000000000000000; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.20; import {IERC165} from "../../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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * 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 address zero. * * 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 v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
{ "remappings": [ "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "@solady/=lib/solady/src/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "openzeppelin/=lib/openzeppelin-contracts-upgradeable/contracts/", "solady/=lib/solady/", "openzeppelin-contracts/=lib/openzeppelin-contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "shanghai", "viaIR": false, "libraries": { "src/core/libs/CommonLib.sol": { "CommonLib": "0x4f76ADd676c04ecA837130CeB58Bc173de8799dE" } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"platform_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"IncorrectParams","type":"error"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAccount","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"pageSize","type":"uint256"}],"name":"getBalanceAssets","outputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"address[]","name":"asset","type":"address[]"},{"internalType":"uint256[]","name":"assetPrice","type":"uint256[]"},{"internalType":"uint256[]","name":"assetUserBalance","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAccount","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"pageSize","type":"uint256"}],"name":"getBalanceVaults","outputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"address[]","name":"vault","type":"address[]"},{"internalType":"uint256[]","name":"vaultSharePrice","type":"uint256[]"},{"internalType":"uint256[]","name":"vaultUserBalance","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"platform","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"pageSize","type":"uint256"}],"name":"vaults","outputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"address[]","name":"vaultAddress","type":"address[]"},{"internalType":"string[]","name":"name","type":"string[]"},{"internalType":"string[]","name":"symbol","type":"string[]"},{"internalType":"string[]","name":"vaultType","type":"string[]"},{"internalType":"uint256[]","name":"sharePrice","type":"uint256[]"},{"internalType":"uint256[]","name":"tvl","type":"uint256[]"},{"internalType":"address[]","name":"strategy","type":"address[]"},{"internalType":"string[]","name":"strategyId","type":"string[]"},{"internalType":"string[]","name":"strategySpecific","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"startStrategy","type":"uint256"},{"internalType":"uint256","name":"step","type":"uint256"}],"name":"whatToBuild","outputs":[{"internalType":"uint256","name":"totalStrategies","type":"uint256"},{"internalType":"string[]","name":"desc","type":"string[]"},{"internalType":"string[]","name":"vaultType","type":"string[]"},{"internalType":"string[]","name":"strategyId","type":"string[]"},{"internalType":"uint256[10][]","name":"initIndexes","type":"uint256[10][]"},{"internalType":"address[]","name":"vaultInitAddresses","type":"address[]"},{"internalType":"uint256[]","name":"vaultInitNums","type":"uint256[]"},{"internalType":"address[]","name":"strategyInitAddresses","type":"address[]"},{"internalType":"uint256[]","name":"strategyInitNums","type":"uint256[]"},{"internalType":"int24[]","name":"strategyInitTicks","type":"int24[]"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60a060405234801562000010575f80fd5b506040516200480d3803806200480d833981016040819052620000339162000045565b6001600160a01b031660805262000074565b5f6020828403121562000056575f80fd5b81516001600160a01b03811681146200006d575f80fd5b9392505050565b608051614765620000a85f395f818160950152818161016e015281816105ef01528181610f91015261146e01526147655ff3fe608060405234801561000f575f80fd5b5060043610610060575f3560e01c806302b878b4146100645780634bde38c81461009057806366a82a51146100cf578063c80729b9146100f8578063f33ddef01461010b578063ffa1ad7414610134575b5f80fd5b610077610072366004613a03565b610165565b6040516100879493929190613aa7565b60405180910390f35b6100b77f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610087565b6100e26100dd366004613af0565b610596565b6040516100879a99989796959493929190613bb5565b610077610106366004613a03565b610f88565b61011e610119366004613af0565b61133b565b6040516100879a99989796959493929190613d07565b610158604051806040016040528060058152602001640312e302e360dc1b81525081565b6040516100879190613dc2565b5f60608060605f7f000000000000000000000000000000000000000000000000000000000000000090505f816001600160a01b03166349b5fdb46040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101cc573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101f09190613deb565b90505f826001600160a01b0316632b3297f96040518163ffffffff1660e01b8152600401602060405180830381865afa15801561022f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102539190613deb565b6001600160a01b03166376d708d76040518163ffffffff1660e01b81526004015f60405180830381865afa15801561028d573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526102b49190810190613f2b565b9050805196508689106102da5760405163586be56960e01b815260040160405180910390fd5b5f6102e58a89613f78565b9050888111156102f25750875b806001600160401b0381111561030a5761030a613e06565b604051908082528060200260200182016040528015610333578160200160208202803683370190505b509650806001600160401b0381111561034e5761034e613e06565b604051908082528060200260200182016040528015610377578160200160208202803683370190505b509550806001600160401b0381111561039257610392613e06565b6040519080825280602002602001820160405280156103bb578160200160208202803683370190505b5094505f8a5b6103cb838d613f91565b811015610587578381815181106103e4576103e4613fa4565b60200260200101518983815181106103fe576103fe613fa4565b60200260200101906001600160a01b031690816001600160a01b031681525050846001600160a01b03166341976e098a848151811061043f5761043f613fa4565b60200260200101516040518263ffffffff1660e01b815260040161047291906001600160a01b0391909116815260200190565b6040805180830381865afa15801561048c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104b09190613fc7565b508883815181106104c3576104c3613fa4565b6020026020010181815250508882815181106104e1576104e1613fa4565b60209081029190910101516040516370a0823160e01b81526001600160a01b038f81166004830152909116906370a0823190602401602060405180830381865afa158015610531573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105559190613ff1565b87838151811061056757610567613fa4565b60209081029190910101528161057c81614008565b9250506001016103c1565b50505050505093509350935093565b5f60608060608060608060608060606105e56040518060a001604052805f6001600160a01b031681526020015f6001600160a01b03168152602001606081526020015f81526020015f81525090565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001680825260408051632292b7c960e21b81529051638a4adf24916004808201926020929091908290030181865afa15801561064b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061066f9190613deb565b6001600160a01b031660208201819052604080516377205b6360e01b815290516377205b63916004808201925f929091908290030181865afa1580156106b7573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526106de9190810190613f2b565b60408201819052519a508a8d106107085760405163586be56960e01b815260040160405180910390fd5b6107128d8c613f78565b606082018190528c101561072857606081018c90525b80606001516001600160401b0381111561074457610744613e06565b60405190808252806020026020018201604052801561076d578160200160208202803683370190505b50995080606001516001600160401b0381111561078c5761078c613e06565b6040519080825280602002602001820160405280156107bf57816020015b60608152602001906001900390816107aa5790505b50985080606001516001600160401b038111156107de576107de613e06565b60405190808252806020026020018201604052801561081157816020015b60608152602001906001900390816107fc5790505b50975080606001516001600160401b0381111561083057610830613e06565b60405190808252806020026020018201604052801561086357816020015b606081526020019060019003908161084e5790505b50965080606001516001600160401b0381111561088257610882613e06565b6040519080825280602002602001820160405280156108ab578160200160208202803683370190505b50945080606001516001600160401b038111156108ca576108ca613e06565b6040519080825280602002602001820160405280156108f3578160200160208202803683370190505b50955080606001516001600160401b0381111561091257610912613e06565b60405190808252806020026020018201604052801561093b578160200160208202803683370190505b50935080606001516001600160401b0381111561095a5761095a613e06565b60405190808252806020026020018201604052801561098d57816020015b60608152602001906001900390816109785790505b50925080606001516001600160401b038111156109ac576109ac613e06565b6040519080825280602002602001820160405280156109df57816020015b60608152602001906001900390816109ca5790505b5091508c5b60608201516109f3908f613f91565b811015610f775760208201516040516310c7e0f360e11b8152600481018390526001600160a01b039091169063218fc1e690602401602060405180830381865afa158015610a43573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a679190613deb565b8b836080015181518110610a7d57610a7d613fa4565b60200260200101906001600160a01b031690816001600160a01b0316815250505f8b836080015181518110610ab457610ab4613fa4565b602002602001015190508b836080015181518110610ad457610ad4613fa4565b60200260200101516001600160a01b03166306fdde036040518163ffffffff1660e01b81526004015f60405180830381865afa158015610b16573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610b3d9190810190614080565b8b846080015181518110610b5357610b53613fa4565b60200260200101819052508b836080015181518110610b7457610b74613fa4565b60200260200101516001600160a01b03166395d89b416040518163ffffffff1660e01b81526004015f60405180830381865afa158015610bb6573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610bdd9190810190614080565b8a846080015181518110610bf357610bf3613fa4565b6020026020010181905250806001600160a01b0316634ac032be6040518163ffffffff1660e01b81526004015f60405180830381865afa158015610c39573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610c609190810190614080565b89846080015181518110610c7657610c76613fa4565b6020026020010181905250806001600160a01b031663a8c62e766040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cbd573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ce19190613deb565b86846080015181518110610cf757610cf7613fa4565b60200260200101906001600160a01b031690816001600160a01b03168152505085836080015181518110610d2d57610d2d613fa4565b60200260200101516001600160a01b0316634875c9686040518163ffffffff1660e01b81526004015f60405180830381865afa158015610d6f573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610d969190810190614080565b85846080015181518110610dac57610dac613fa4565b602002602001018190525085836080015181518110610dcd57610dcd613fa4565b60200260200101516001600160a01b0316631ec71e056040518163ffffffff1660e01b81526004015f60405180830381865afa158015610e0f573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610e3691908101906140b1565b5084846080015181518110610e4d57610e4d613fa4565b6020026020010181905250806001600160a01b031663a035b1fe6040518163ffffffff1660e01b81526004016040805180830381865afa158015610e93573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610eb79190613fc7565b5088846080015181518110610ece57610ece613fa4565b602002602001018181525050806001600160a01b031663e5328e066040518163ffffffff1660e01b81526004016040805180830381865afa158015610f15573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f399190613fc7565b5087846080015181518110610f5057610f50613fa4565b602090810291909101015260808301805190610f6b82614008565b905250506001016109e4565b50509295989b9194979a5092959850565b5f60608060605f7f000000000000000000000000000000000000000000000000000000000000000090505f816001600160a01b0316638a4adf246040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fef573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110139190613deb565b6001600160a01b03166377205b636040518163ffffffff1660e01b81526004015f60405180830381865afa15801561104d573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526110749190810190613f2b565b90508051955085881061109a5760405163586be56960e01b815260040160405180910390fd5b5f6110a58988613f78565b9050878111156110b25750865b806001600160401b038111156110ca576110ca613e06565b6040519080825280602002602001820160405280156110f3578160200160208202803683370190505b509550806001600160401b0381111561110e5761110e613e06565b604051908082528060200260200182016040528015611137578160200160208202803683370190505b509450806001600160401b0381111561115257611152613e06565b60405190808252806020026020018201604052801561117b578160200160208202803683370190505b5093505f895b61118b838c613f91565b81101561132d578381815181106111a4576111a4613fa4565b60200260200101518883815181106111be576111be613fa4565b60200260200101906001600160a01b031690816001600160a01b0316815250508782815181106111f0576111f0613fa4565b60200260200101516001600160a01b031663a035b1fe6040518163ffffffff1660e01b81526004016040805180830381865afa158015611232573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112569190613fc7565b5087838151811061126957611269613fa4565b60200260200101818152505087828151811061128757611287613fa4565b60209081029190910101516040516370a0823160e01b81526001600160a01b038e81166004830152909116906370a0823190602401602060405180830381865afa1580156112d7573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112fb9190613ff1565b86838151811061130d5761130d613fa4565b60209081029190910101528161132281614008565b925050600101611181565b505050505093509350935093565b5f6060806060806060806060806060611464604051806105000160405280606081526020015f81526020015f81526020015f6001600160a01b03168152602001606081526020015f8152602001606081526020015f815260200160608152602001606081526020016060815260200160608152602001606081526020015f81526020015f8152602001606081526020015f81526020016060815260200160608152602001606081526020015f81526020015f81526020015f815260200160608152602001606081526020016060815260200160608152602001606081526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016606082018190526040805163c45a015560e01b815290515f929163c45a01559160048083019260209291908290030181865afa1580156114d0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114f49190613deb565b9050806001600160a01b0316630f038dcd6040518163ffffffff1660e01b81526004015f60405180830381865afa158015611531573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261155891908101906140f2565b80835251602083018190526040805163438feb4160e11b81529051919d506001600160a01b0383169163871fd682916004808201925f929091908290030181865afa1580156115a9573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526115d09190810190614238565b608083018190525160a08301528b8e106115fd5760405163586be56960e01b815260040160405180910390fd5b6116078e8d613f78565b604083018190528d101561161d57604082018d90525b6104a082018e90525b8160400151826104a001511015611f07576040805160c08101825260608082525f6020830181905292820183905281018290526080810182905260a0810191909152816001600160a01b031663c56ebcd6845f0151856104a001518151811061169157611691613fa4565b60200260200101516040518263ffffffff1660e01b81526004016116b791815260200190565b5f60405180830381865afa1580156116d1573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526116f891908101906143c8565b9050806040015115611eef57611716836060015182602001516130cd565b61018088015261016087015261014086015261012085015261010084018190525160e08401525f6101a084018190526101c084018190525b8360e00151811015611eed57836101200151818151811061177157611771613fa4565b60200260200101516001600160401b0381111561179057611790613e06565b6040519080825280602002602001820160405280156117b9578160200160208202803683370190505b506102e08501526101408401518051829081106117d8576117d8613fa4565b60200260200101516001600160401b038111156117f7576117f7613e06565b604051908082528060200260200182016040528015611820578160200160208202803683370190505b506103008501525f5b846101200151828151811061184057611840613fa4565b60200260200101518110156118c457846101600151856101a001518151811061186b5761186b613fa4565b6020026020010151856102e00151828151811061188a5761188a613fa4565b60200260200101906001600160a01b031690816001600160a01b031681525050846101a00180516118ba90614008565b9052600101611829565b505f5b84610140015182815181106118de576118de613fa4565b602002602001015181101561194e57846101800151856101c001518151811061190957611909613fa4565b6020026020010151856103000151828151811061192857611928613fa4565b602002602001018181525050846101c001805161194490614008565b90526001016118c7565b50602082015160608501516040516305a8676560e31b81526001600160a01b039182166004820152911690632d433b28906024015f60405180830381865afa15801561199c573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526119c391908101906144ff565b6102608801526102408701526102208601526101e085018190525f61028086018190526102a086018190526102c0860181905290516104c08601919091525b80856104c001511015611ee4575f8186610220015151611a2291906145a4565b5f61038088018190526103a088018190526103c08801529050806001600160401b03811115611a5357611a53613e06565b604051908082528060200260200182016040528015611a7c578160200160208202803683370190505b506103208701525f5b81811015611b145786610220015187610280015181518110611aa957611aa9613fa4565b60200260200101518761032001518281518110611ac857611ac8613fa4565b60200260200101906001600160a01b031690816001600160a01b03168152505086610280018051611af890614008565b905261038087018051611b0a90614008565b9052600101611a85565b508186610240015151611b2791906145a4565b9050806001600160401b03811115611b4157611b41613e06565b604051908082528060200260200182016040528015611b6a578160200160208202803683370190505b506103408701525f5b81811015611bee57866102400151876102a0015181518110611b9757611b97613fa4565b60200260200101518761034001518281518110611bb657611bb6613fa4565b602002602001018181525050866102a0018051611bd290614008565b90526103a087018051611be490614008565b9052600101611b73565b508186610260015151611c0191906145a4565b9050806001600160401b03811115611c1b57611c1b613e06565b604051908082528060200260200182016040528015611c44578160200160208202803683370190505b506103608701525f5b81811015611cd057866102600151876102c0015181518110611c7157611c71613fa4565b60200260200101518761036001518281518110611c9057611c90613fa4565b602002602001019060020b908160020b81525050866102c0018051611cb490614008565b90526103c087018051611cc690614008565b9052600101611c4d565b505f856001600160a01b03166358a2ab1c8861010001518681518110611cf857611cf8613fa4565b6020026020010151875f01518a6102e001518b61030001518c61032001518d61034001518e61036001516040518863ffffffff1660e01b8152600401611d4497969594939291906145c3565b602060405180830381865afa158015611d5f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611d839190613ff1565b604051637d474fa360e01b8152600481018290529091505f906001600160a01b03881690637d474fa390602401602060405180830381865afa158015611dcb573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611def9190613deb565b6001600160a01b031603611ecb57866103e0018051611e0d90614008565b9052610120870151805185908110611e2757611e27613fa4565b60200260200101518761040001818151611e419190613f91565b905250610140870151805185908110611e5c57611e5c613fa4565b60200260200101518761042001818151611e769190613f91565b90525061038087015161044088018051611e91908390613f91565b9052506103a087015161046088018051611eac908390613f91565b9052506103c087015161048088018051611ec7908390613f91565b9052505b5050846104c0018051611edd90614008565b9052611a02565b5060010161174e565b505b50816104a0018051611f0090614008565b9052611626565b816103e001516001600160401b03811115611f2457611f24613e06565b604051908082528060200260200182016040528015611f5757816020015b6060815260200190600190039081611f425790505b509a50816103e001516001600160401b03811115611f7757611f77613e06565b604051908082528060200260200182016040528015611faa57816020015b6060815260200190600190039081611f955790505b509950816103e001516001600160401b03811115611fca57611fca613e06565b604051908082528060200260200182016040528015611ffd57816020015b6060815260200190600190039081611fe85790505b509850816103e001516001600160401b0381111561201d5761201d613e06565b60405190808252806020026020018201604052801561205657816020015b6120436139af565b81526020019060019003908161203b5790505b5097508161040001516001600160401b0381111561207657612076613e06565b60405190808252806020026020018201604052801561209f578160200160208202803683370190505b5096508161042001516001600160401b038111156120bf576120bf613e06565b6040519080825280602002602001820160405280156120e8578160200160208202803683370190505b5095508161044001516001600160401b0381111561210857612108613e06565b604051908082528060200260200182016040528015612131578160200160208202803683370190505b5094508161046001516001600160401b0381111561215157612151613e06565b60405190808252806020026020018201604052801561217a578160200160208202803683370190505b5093508161048001516001600160401b0381111561219a5761219a613e06565b6040519080825280602002602001820160405280156121c3578160200160208202803683370190505b505f6103e0840181905261040084018190526104208401819052610440840181905261046084018190526104808401526104a083018f905292505b8160400151826104a001511015610f77576040805160c08101825260608082525f6020830181905292820183905281018290526080810182905260a0810191909152816001600160a01b031663c56ebcd6845f0151856104a001518151811061226957612269613fa4565b60200260200101516040518263ffffffff1660e01b815260040161228f91815260200190565b5f60405180830381865afa1580156122a9573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526122d091908101906143c8565b90508060400151156130b5576122ee836060015182602001516130cd565b61018088015261016087015261014086015261012085015261010084018190525160e08401525f6101a084018190526101c084018190525b8360e001518110156130b357836101200151818151811061234957612349613fa4565b60200260200101516001600160401b0381111561236857612368613e06565b604051908082528060200260200182016040528015612391578160200160208202803683370190505b506102e08501526101408401518051829081106123b0576123b0613fa4565b60200260200101516001600160401b038111156123cf576123cf613e06565b6040519080825280602002602001820160405280156123f8578160200160208202803683370190505b506103008501525f5b846101200151828151811061241857612418613fa4565b602002602001015181101561249c57846101600151856101a001518151811061244357612443613fa4565b6020026020010151856102e00151828151811061246257612462613fa4565b60200260200101906001600160a01b031690816001600160a01b031681525050846101a001805161249290614008565b9052600101612401565b505f5b84610140015182815181106124b6576124b6613fa4565b602002602001015181101561252657846101800151856101c00151815181106124e1576124e1613fa4565b6020026020010151856103000151828151811061250057612500613fa4565b602002602001018181525050846101c001805161251c90614008565b905260010161249f565b50602082015160608501516040516305a8676560e31b81526001600160a01b039182166004820152911690632d433b28906024015f60405180830381865afa158015612574573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261259b91908101906144ff565b6102608801526102408701526102208601526101e085018190525f61028086018190526102a086018190526102c0860181905290516102008601526104c08501525b836102000151846104c0015110156130ab575f8461020001518561022001515161260791906145a4565b5f61038087018190526103a087018190526103c08701529050806001600160401b0381111561263857612638613e06565b604051908082528060200260200182016040528015612661578160200160208202803683370190505b506103208601525f5b818110156126f9578561022001518661028001518151811061268e5761268e613fa4565b602002602001015186610320015182815181106126ad576126ad613fa4565b60200260200101906001600160a01b031690816001600160a01b031681525050856102800180516126dd90614008565b9052610380860180516126ef90614008565b905260010161266a565b508461020001518561024001515161271191906145a4565b9050806001600160401b0381111561272b5761272b613e06565b604051908082528060200260200182016040528015612754578160200160208202803683370190505b506103408601525f5b818110156127d857856102400151866102a001518151811061278157612781613fa4565b602002602001015186610340015182815181106127a0576127a0613fa4565b602002602001018181525050856102a00180516127bc90614008565b90526103a0860180516127ce90614008565b905260010161275d565b50846102000151856102600151516127f091906145a4565b9050806001600160401b0381111561280a5761280a613e06565b604051908082528060200260200182016040528015612833578160200160208202803683370190505b506103608601525f5b818110156128bf57856102600151866102c001518151811061286057612860613fa4565b6020026020010151866103600151828151811061287f5761287f613fa4565b602002602001019060020b908160020b81525050856102c00180516128a390614008565b90526103c0860180516128b590614008565b905260010161283c565b505f846001600160a01b03166358a2ab1c87610100015185815181106128e7576128e7613fa4565b6020026020010151865f0151896102e001518a61030001518b61032001518c61034001518d61036001516040518863ffffffff1660e01b815260040161293397969594939291906145c3565b602060405180830381865afa15801561294e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906129729190613ff1565b604051637d474fa360e01b8152600481018290529091505f906001600160a01b03871690637d474fa390602401602060405180830381865afa1580156129ba573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906129de9190613deb565b6001600160a01b03160361309257856101e00151866104c0015181518110612a0857612a08613fa4565b60200260200101518f876103e0015181518110612a2757612a27613fa4565b60200260200101819052508561010001518381518110612a4957612a49613fa4565b60200260200101518e876103e0015181518110612a6857612a68613fa4565b6020026020010181905250835f01518d876103e0015181518110612a8e57612a8e613fa4565b60200260200101819052508561040001518c876103e0015181518110612ab657612ab6613fa4565b60200260200101515f600a8110612acf57612acf613fa4565b6020020152610120860151805184908110612aec57612aec613fa4565b6020026020010151866104000151612b049190613f91565b8c876103e0015181518110612b1b57612b1b613fa4565b60200260200101516001600a8110612b3557612b35613fa4565b60200201526104208601516103e08701518d518e91908110612b5957612b59613fa4565b60200260200101516002600a8110612b7357612b73613fa4565b6020020152610140860151805184908110612b9057612b90613fa4565b6020026020010151866104200151612ba89190613f91565b8c876103e0015181518110612bbf57612bbf613fa4565b60200260200101516003600a8110612bd957612bd9613fa4565b60200201526104408601516103e08701518d518e91908110612bfd57612bfd613fa4565b60200260200101516004600a8110612c1757612c17613fa4565b6020020152610380860151610440870151612c329190613f91565b8c876103e0015181518110612c4957612c49613fa4565b60200260200101516005600a8110612c6357612c63613fa4565b60200201526104608601516103e08701518d518e91908110612c8757612c87613fa4565b60200260200101516006600a8110612ca157612ca1613fa4565b60200201526103a0860151610460870151612cbc9190613f91565b8c876103e0015181518110612cd357612cd3613fa4565b60200260200101516007600a8110612ced57612ced613fa4565b60200201526104808601516103e08701518d518e91908110612d1157612d11613fa4565b60200260200101516008600a8110612d2b57612d2b613fa4565b60200201526103c0860151610480870151612d469190613f91565b8c876103e0015181518110612d5d57612d5d613fa4565b60200260200101516009600a8110612d7757612d77613fa4565b60200201525f5b8661012001518481518110612d9557612d95613fa4565b6020026020010151811015612e0557866102e001518181518110612dbb57612dbb613fa4565b60200260200101518c82896104000151612dd59190613f91565b81518110612de557612de5613fa4565b6001600160a01b0390921660209283029190910190910152600101612d7e565b505f5b8661014001518481518110612e1f57612e1f613fa4565b6020026020010151811015612e82578661030001518181518110612e4557612e45613fa4565b60200260200101518b82896104200151612e5f9190613f91565b81518110612e6f57612e6f613fa4565b6020908102919091010152600101612e08565b505f5b866103800151811015612ef3578661032001518181518110612ea957612ea9613fa4565b60200260200101518a82896104400151612ec39190613f91565b81518110612ed357612ed3613fa4565b6001600160a01b0390921660209283029190910190910152600101612e85565b505f5b866103a00151811015612f57578661034001518181518110612f1a57612f1a613fa4565b60200260200101518982896104600151612f349190613f91565b81518110612f4457612f44613fa4565b6020908102919091010152600101612ef6565b505f5b866103c00151811015612fc3578661036001518181518110612f7e57612f7e613fa4565b60200260200101518882896104800151612f989190613f91565b81518110612fa857612fa8613fa4565b60029290920b60209283029190910190910152600101612f5a565b50856103e0018051612fd490614008565b9052610120860151805184908110612fee57612fee613fa4565b602002602001015186610400018181516130089190613f91565b90525061014086015180518490811061302357613023613fa4565b6020026020010151866104200181815161303d9190613f91565b90525061038086015161044087018051613058908390613f91565b9052506103a086015161046087018051613073908390613f91565b9052506103c08601516104808701805161308e908390613f91565b9052505b5050836104c00180516130a490614008565b90526125dd565b600101612326565b505b50816104a00180516130c690614008565b90526121fe565b60608060608060606131036040518060a00160405280606081526020015f81526020015f81526020015f81526020015f81525090565b866001600160a01b031663fdff667c6040518163ffffffff1660e01b81526004015f60405180830381865afa15801561313e573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526131659190810190614659565b808252516080820152604080516360997e8560e01b815290515f916001600160a01b038b16916360997e859160048082019286929091908290030181865afa1580156131b3573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526131da919081019061468a565b5080519091505f5b836080015181101561347257734f76add676c04eca837130ceb58bc173de8799de6321a49642855f0151838151811061321d5761321d613fa4565b60200260200101516040518060400160405280600b81526020016a436f6d706f756e64696e6760a81b8152506040518363ffffffff1660e01b81526004016132669291906146e9565b602060405180830381865af4158015613281573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906132a59190614716565b156132c0578360200180516132b990614008565b905261346a565b734f76add676c04eca837130ceb58bc173de8799de6321a49642855f015183815181106132ef576132ef613fa4565b602002602001015160405180604001604052806009815260200168526577617264696e6760b81b8152506040518363ffffffff1660e01b81526004016133369291906146e9565b602060405180830381865af4158015613351573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906133759190614716565b806134385750734f76add676c04eca837130ceb58bc173de8799de6321a49642855f015183815181106133aa576133aa613fa4565b60200260200101516040518060400160405280601181526020017014995dd85c991a5b99c813585b9859d959607a1b8152506040518363ffffffff1660e01b81526004016133f99291906146e9565b602060405180830381865af4158015613414573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906134389190614716565b1561346a57818460200181815161344f9190613f91565b905250604084018051839190613466908390613f91565b9052505b6001016131e2565b5082602001516001600160401b0381111561348f5761348f613e06565b6040519080825280602002602001820160405280156134c257816020015b60608152602001906001900390816134ad5790505b50975082602001516001600160401b038111156134e1576134e1613e06565b60405190808252806020026020018201604052801561350a578160200160208202803683370190505b50965082602001516001600160401b0381111561352957613529613e06565b604051908082528060200260200182016040528015613552578160200160208202803683370190505b50955082604001516001600160401b0381111561357157613571613e06565b60405190808252806020026020018201604052801561359a578160200160208202803683370190505b50945082606001516001600160401b038111156135b9576135b9613e06565b6040519080825280602002602001820160405280156135e2578160200160208202803683370190505b5093506135ed6139ce565b5f5b84608001518110156139a057734f76add676c04eca837130ceb58bc173de8799de6321a49642865f0151838151811061362a5761362a613fa4565b60200260200101516040518060400160405280600b81526020016a436f6d706f756e64696e6760a81b8152506040518363ffffffff1660e01b81526004016136739291906146e9565b602060405180830381865af415801561368e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906136b29190614716565b1561371a5784518051829081106136cb576136cb613fa4565b60200260200101518a835f600381106136e6576136e6613fa4565b6020020151815181106136fb576136fb613fa4565b60209081029190910101528151829061371390614008565b9052613998565b734f76add676c04eca837130ceb58bc173de8799de6321a49642865f0151838151811061374957613749613fa4565b602002602001015160405180604001604052806009815260200168526577617264696e6760b81b8152506040518363ffffffff1660e01b81526004016137909291906146e9565b602060405180830381865af41580156137ab573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906137cf9190614716565b806138925750734f76add676c04eca837130ceb58bc173de8799de6321a49642865f0151838151811061380457613804613fa4565b60200260200101516040518060400160405280601181526020017014995dd85c991a5b99c813585b9859d959607a1b8152506040518363ffffffff1660e01b81526004016138539291906146e9565b602060405180830381865af415801561386e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906138929190614716565b15613998575f5b838110156139965785518051839081106138b5576138b5613fa4565b60200260200101518b845f600381106138d0576138d0613fa4565b6020020151815181106138e5576138e5613fa4565b602002602001018190525084818151811061390257613902613fa4565b6020026020010151888460016003811061391e5761391e613fa4565b60200201518151811061393357613933613fa4565b6001600160a01b03929092166020928302919091019091015282518a516001918c91811061396357613963613fa4565b60209081029190910101528251839061397b90614008565b905260208301805161398c90614008565b9052600101613899565b505b6001016135ef565b50505050509295509295909350565b604051806101400160405280600a906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b0381168114613a00575f80fd5b50565b5f805f60608486031215613a15575f80fd5b8335613a20816139ec565b95602085013595506040909401359392505050565b5f815180845260208085019450602084015f5b83811015613a6d5781516001600160a01b031687529582019590820190600101613a48565b509495945050505050565b5f815180845260208085019450602084015f5b83811015613a6d57815187529582019590820190600101613a8b565b848152608060208201525f613abf6080830186613a35565b8281036040840152613ad18186613a78565b90508281036060840152613ae58185613a78565b979650505050505050565b5f8060408385031215613b01575f80fd5b50508035926020909101359150565b5f5b83811015613b2a578181015183820152602001613b12565b50505f910152565b5f8151808452613b49816020860160208601613b10565b601f01601f19169290920160200192915050565b5f8282518085526020808601955060208260051b840101602086015f5b84811015613ba857601f19868403018952613b96838351613b32565b98840198925090830190600101613b7a565b5090979650505050505050565b5f6101408c8352806020840152613bce8184018d613a35565b90508281036040840152613be2818c613b5d565b90508281036060840152613bf6818b613b5d565b90508281036080840152613c0a818a613b5d565b905082810360a0840152613c1e8189613a78565b905082810360c0840152613c328188613a78565b905082810360e0840152613c468187613a35565b9050828103610100840152613c5b8186613b5d565b9050828103610120840152613c708185613b5d565b9d9c50505050505050505050505050565b5f815180845260208085019450602084015f5b83811015613a6d578151875f5b600a811015613cbe57825182529185019190850190600101613ca1565b505050610140969096019590820190600101613c94565b5f815180845260208085019450602084015f5b83811015613a6d57815160020b87529582019590820190600101613ce8565b5f6101408c8352806020840152613d208184018d613b5d565b90508281036040840152613d34818c613b5d565b90508281036060840152613d48818b613b5d565b90508281036080840152613d5c818a613c81565b905082810360a0840152613d708189613a35565b905082810360c0840152613d848188613a78565b905082810360e0840152613d988187613a35565b9050828103610100840152613dad8186613a78565b9050828103610120840152613c708185613cd5565b602081525f613dd46020830184613b32565b9392505050565b8051613de6816139ec565b919050565b5f60208284031215613dfb575f80fd5b8151613dd4816139ec565b634e487b7160e01b5f52604160045260245ffd5b60405160e081016001600160401b0381118282101715613e3c57613e3c613e06565b60405290565b60405160c081016001600160401b0381118282101715613e3c57613e3c613e06565b604051601f8201601f191681016001600160401b0381118282101715613e8c57613e8c613e06565b604052919050565b5f6001600160401b03821115613eac57613eac613e06565b5060051b60200190565b5f82601f830112613ec5575f80fd5b81516020613eda613ed583613e94565b613e64565b8083825260208201915060208460051b870101935086841115613efb575f80fd5b602086015b84811015613f20578051613f13816139ec565b8352918301918301613f00565b509695505050505050565b5f60208284031215613f3b575f80fd5b81516001600160401b03811115613f50575f80fd5b613f5c84828501613eb6565b949350505050565b634e487b7160e01b5f52601160045260245ffd5b81810381811115613f8b57613f8b613f64565b92915050565b80820180821115613f8b57613f8b613f64565b634e487b7160e01b5f52603260045260245ffd5b80518015158114613de6575f80fd5b5f8060408385031215613fd8575f80fd5b82519150613fe860208401613fb8565b90509250929050565b5f60208284031215614001575f80fd5b5051919050565b5f6001820161401957614019613f64565b5060010190565b5f82601f83011261402f575f80fd5b81516001600160401b0381111561404857614048613e06565b61405b601f8201601f1916602001613e64565b81815284602083860101111561406f575f80fd5b613f5c826020830160208701613b10565b5f60208284031215614090575f80fd5b81516001600160401b038111156140a5575f80fd5b613f5c84828501614020565b5f80604083850312156140c2575f80fd5b82516001600160401b038111156140d7575f80fd5b6140e385828601614020565b925050613fe860208401613fb8565b5f6020808385031215614103575f80fd5b82516001600160401b03811115614118575f80fd5b8301601f81018513614128575f80fd5b8051614136613ed582613e94565b81815260059190911b82018301908381019087831115614154575f80fd5b928401925b82841015613ae557835182529284019290840190614159565b5f82601f830112614181575f80fd5b81516020614191613ed583613e94565b8083825260208201915060208460051b8701019350868411156141b2575f80fd5b602086015b84811015613f2057805183529183019183016141b7565b5f82601f8301126141dd575f80fd5b815160206141ed613ed583613e94565b8083825260208201915060208460051b87010193508684111561420e575f80fd5b602086015b84811015613f205780518060020b811461422b575f80fd5b8352918301918301614213565b5f6020808385031215614249575f80fd5b82516001600160401b038082111561425f575f80fd5b818501915085601f830112614272575f80fd5b8151614280613ed582613e94565b81815260059190911b8301840190848101908883111561429e575f80fd5b8585015b838110156143bb578051858111156142b8575f80fd5b860160e0818c03601f190112156142cd575f80fd5b6142d5613e1a565b88820151815260406142e8818401613ddb565b8a830152606080840151898111156142fe575f80fd5b61430c8f8d83880101614020565b8385015250608091508184015189811115614325575f80fd5b6143338f8d83880101613eb6565b82850152505060a0808401518981111561434b575f80fd5b6143598f8d83880101613eb6565b838501525060c091508184015189811115614372575f80fd5b6143808f8d83880101614172565b82850152505060e083015188811115614397575f80fd5b6143a58e8c838701016141ce565b91830191909152508452509186019186016142a2565b5098975050505050505050565b5f602082840312156143d8575f80fd5b81516001600160401b03808211156143ee575f80fd5b9083019060c08286031215614401575f80fd5b614409613e42565b825182811115614417575f80fd5b61442387828601614020565b82525060208301519150614436826139ec565b81602082015261444860408401613fb8565b604082015261445960608401613fb8565b606082015261446a60808401613fb8565b608082015260a083015160a082015280935050505092915050565b5f82601f830112614494575f80fd5b815160206144a4613ed583613e94565b82815260059290921b840181019181810190868411156144c2575f80fd5b8286015b84811015613f205780516001600160401b038111156144e3575f80fd5b6144f18986838b0101614020565b8452509183019183016144c6565b5f805f8060808587031215614512575f80fd5b84516001600160401b0380821115614528575f80fd5b61453488838901614485565b95506020870151915080821115614549575f80fd5b61455588838901613eb6565b9450604087015191508082111561456a575f80fd5b61457688838901614172565b9350606087015191508082111561458b575f80fd5b50614598878288016141ce565b91505092959194509250565b5f826145be57634e487b7160e01b5f52601260045260245ffd5b500490565b60e081525f6145d560e083018a613b32565b82810360208401526145e7818a613b32565b905082810360408401526145fb8189613a35565b9050828103606084015261460f8188613a78565b905082810360808401526146238187613a35565b905082810360a08401526146378186613a78565b905082810360c084015261464b8185613cd5565b9a9950505050505050505050565b5f60208284031215614669575f80fd5b81516001600160401b0381111561467e575f80fd5b613f5c84828501614485565b5f806040838503121561469b575f80fd5b82516001600160401b03808211156146b1575f80fd5b6146bd86838701613eb6565b935060208501519150808211156146d2575f80fd5b506146df85828601614172565b9150509250929050565b604081525f6146fb6040830185613b32565b828103602084015261470d8185613b32565b95945050505050565b5f60208284031215614726575f80fd5b613dd482613fb856fea2646970667358221220b1070d55b08644f6209faf46b1d93a69ce205e18e7ae0281435dcd64fe5f4ce364736f6c634300081700330000000000000000000000004aca671a420eeb58ecafe83700686a2ad06b20d8
Deployed Bytecode
0x608060405234801561000f575f80fd5b5060043610610060575f3560e01c806302b878b4146100645780634bde38c81461009057806366a82a51146100cf578063c80729b9146100f8578063f33ddef01461010b578063ffa1ad7414610134575b5f80fd5b610077610072366004613a03565b610165565b6040516100879493929190613aa7565b60405180910390f35b6100b77f0000000000000000000000004aca671a420eeb58ecafe83700686a2ad06b20d881565b6040516001600160a01b039091168152602001610087565b6100e26100dd366004613af0565b610596565b6040516100879a99989796959493929190613bb5565b610077610106366004613a03565b610f88565b61011e610119366004613af0565b61133b565b6040516100879a99989796959493929190613d07565b610158604051806040016040528060058152602001640312e302e360dc1b81525081565b6040516100879190613dc2565b5f60608060605f7f0000000000000000000000004aca671a420eeb58ecafe83700686a2ad06b20d890505f816001600160a01b03166349b5fdb46040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101cc573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101f09190613deb565b90505f826001600160a01b0316632b3297f96040518163ffffffff1660e01b8152600401602060405180830381865afa15801561022f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102539190613deb565b6001600160a01b03166376d708d76040518163ffffffff1660e01b81526004015f60405180830381865afa15801561028d573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526102b49190810190613f2b565b9050805196508689106102da5760405163586be56960e01b815260040160405180910390fd5b5f6102e58a89613f78565b9050888111156102f25750875b806001600160401b0381111561030a5761030a613e06565b604051908082528060200260200182016040528015610333578160200160208202803683370190505b509650806001600160401b0381111561034e5761034e613e06565b604051908082528060200260200182016040528015610377578160200160208202803683370190505b509550806001600160401b0381111561039257610392613e06565b6040519080825280602002602001820160405280156103bb578160200160208202803683370190505b5094505f8a5b6103cb838d613f91565b811015610587578381815181106103e4576103e4613fa4565b60200260200101518983815181106103fe576103fe613fa4565b60200260200101906001600160a01b031690816001600160a01b031681525050846001600160a01b03166341976e098a848151811061043f5761043f613fa4565b60200260200101516040518263ffffffff1660e01b815260040161047291906001600160a01b0391909116815260200190565b6040805180830381865afa15801561048c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104b09190613fc7565b508883815181106104c3576104c3613fa4565b6020026020010181815250508882815181106104e1576104e1613fa4565b60209081029190910101516040516370a0823160e01b81526001600160a01b038f81166004830152909116906370a0823190602401602060405180830381865afa158015610531573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105559190613ff1565b87838151811061056757610567613fa4565b60209081029190910101528161057c81614008565b9250506001016103c1565b50505050505093509350935093565b5f60608060608060608060608060606105e56040518060a001604052805f6001600160a01b031681526020015f6001600160a01b03168152602001606081526020015f81526020015f81525090565b6001600160a01b037f0000000000000000000000004aca671a420eeb58ecafe83700686a2ad06b20d81680825260408051632292b7c960e21b81529051638a4adf24916004808201926020929091908290030181865afa15801561064b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061066f9190613deb565b6001600160a01b031660208201819052604080516377205b6360e01b815290516377205b63916004808201925f929091908290030181865afa1580156106b7573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526106de9190810190613f2b565b60408201819052519a508a8d106107085760405163586be56960e01b815260040160405180910390fd5b6107128d8c613f78565b606082018190528c101561072857606081018c90525b80606001516001600160401b0381111561074457610744613e06565b60405190808252806020026020018201604052801561076d578160200160208202803683370190505b50995080606001516001600160401b0381111561078c5761078c613e06565b6040519080825280602002602001820160405280156107bf57816020015b60608152602001906001900390816107aa5790505b50985080606001516001600160401b038111156107de576107de613e06565b60405190808252806020026020018201604052801561081157816020015b60608152602001906001900390816107fc5790505b50975080606001516001600160401b0381111561083057610830613e06565b60405190808252806020026020018201604052801561086357816020015b606081526020019060019003908161084e5790505b50965080606001516001600160401b0381111561088257610882613e06565b6040519080825280602002602001820160405280156108ab578160200160208202803683370190505b50945080606001516001600160401b038111156108ca576108ca613e06565b6040519080825280602002602001820160405280156108f3578160200160208202803683370190505b50955080606001516001600160401b0381111561091257610912613e06565b60405190808252806020026020018201604052801561093b578160200160208202803683370190505b50935080606001516001600160401b0381111561095a5761095a613e06565b60405190808252806020026020018201604052801561098d57816020015b60608152602001906001900390816109785790505b50925080606001516001600160401b038111156109ac576109ac613e06565b6040519080825280602002602001820160405280156109df57816020015b60608152602001906001900390816109ca5790505b5091508c5b60608201516109f3908f613f91565b811015610f775760208201516040516310c7e0f360e11b8152600481018390526001600160a01b039091169063218fc1e690602401602060405180830381865afa158015610a43573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a679190613deb565b8b836080015181518110610a7d57610a7d613fa4565b60200260200101906001600160a01b031690816001600160a01b0316815250505f8b836080015181518110610ab457610ab4613fa4565b602002602001015190508b836080015181518110610ad457610ad4613fa4565b60200260200101516001600160a01b03166306fdde036040518163ffffffff1660e01b81526004015f60405180830381865afa158015610b16573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610b3d9190810190614080565b8b846080015181518110610b5357610b53613fa4565b60200260200101819052508b836080015181518110610b7457610b74613fa4565b60200260200101516001600160a01b03166395d89b416040518163ffffffff1660e01b81526004015f60405180830381865afa158015610bb6573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610bdd9190810190614080565b8a846080015181518110610bf357610bf3613fa4565b6020026020010181905250806001600160a01b0316634ac032be6040518163ffffffff1660e01b81526004015f60405180830381865afa158015610c39573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610c609190810190614080565b89846080015181518110610c7657610c76613fa4565b6020026020010181905250806001600160a01b031663a8c62e766040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cbd573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ce19190613deb565b86846080015181518110610cf757610cf7613fa4565b60200260200101906001600160a01b031690816001600160a01b03168152505085836080015181518110610d2d57610d2d613fa4565b60200260200101516001600160a01b0316634875c9686040518163ffffffff1660e01b81526004015f60405180830381865afa158015610d6f573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610d969190810190614080565b85846080015181518110610dac57610dac613fa4565b602002602001018190525085836080015181518110610dcd57610dcd613fa4565b60200260200101516001600160a01b0316631ec71e056040518163ffffffff1660e01b81526004015f60405180830381865afa158015610e0f573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610e3691908101906140b1565b5084846080015181518110610e4d57610e4d613fa4565b6020026020010181905250806001600160a01b031663a035b1fe6040518163ffffffff1660e01b81526004016040805180830381865afa158015610e93573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610eb79190613fc7565b5088846080015181518110610ece57610ece613fa4565b602002602001018181525050806001600160a01b031663e5328e066040518163ffffffff1660e01b81526004016040805180830381865afa158015610f15573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f399190613fc7565b5087846080015181518110610f5057610f50613fa4565b602090810291909101015260808301805190610f6b82614008565b905250506001016109e4565b50509295989b9194979a5092959850565b5f60608060605f7f0000000000000000000000004aca671a420eeb58ecafe83700686a2ad06b20d890505f816001600160a01b0316638a4adf246040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fef573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110139190613deb565b6001600160a01b03166377205b636040518163ffffffff1660e01b81526004015f60405180830381865afa15801561104d573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526110749190810190613f2b565b90508051955085881061109a5760405163586be56960e01b815260040160405180910390fd5b5f6110a58988613f78565b9050878111156110b25750865b806001600160401b038111156110ca576110ca613e06565b6040519080825280602002602001820160405280156110f3578160200160208202803683370190505b509550806001600160401b0381111561110e5761110e613e06565b604051908082528060200260200182016040528015611137578160200160208202803683370190505b509450806001600160401b0381111561115257611152613e06565b60405190808252806020026020018201604052801561117b578160200160208202803683370190505b5093505f895b61118b838c613f91565b81101561132d578381815181106111a4576111a4613fa4565b60200260200101518883815181106111be576111be613fa4565b60200260200101906001600160a01b031690816001600160a01b0316815250508782815181106111f0576111f0613fa4565b60200260200101516001600160a01b031663a035b1fe6040518163ffffffff1660e01b81526004016040805180830381865afa158015611232573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112569190613fc7565b5087838151811061126957611269613fa4565b60200260200101818152505087828151811061128757611287613fa4565b60209081029190910101516040516370a0823160e01b81526001600160a01b038e81166004830152909116906370a0823190602401602060405180830381865afa1580156112d7573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112fb9190613ff1565b86838151811061130d5761130d613fa4565b60209081029190910101528161132281614008565b925050600101611181565b505050505093509350935093565b5f6060806060806060806060806060611464604051806105000160405280606081526020015f81526020015f81526020015f6001600160a01b03168152602001606081526020015f8152602001606081526020015f815260200160608152602001606081526020016060815260200160608152602001606081526020015f81526020015f8152602001606081526020015f81526020016060815260200160608152602001606081526020015f81526020015f81526020015f815260200160608152602001606081526020016060815260200160608152602001606081526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b6001600160a01b037f0000000000000000000000004aca671a420eeb58ecafe83700686a2ad06b20d816606082018190526040805163c45a015560e01b815290515f929163c45a01559160048083019260209291908290030181865afa1580156114d0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114f49190613deb565b9050806001600160a01b0316630f038dcd6040518163ffffffff1660e01b81526004015f60405180830381865afa158015611531573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261155891908101906140f2565b80835251602083018190526040805163438feb4160e11b81529051919d506001600160a01b0383169163871fd682916004808201925f929091908290030181865afa1580156115a9573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526115d09190810190614238565b608083018190525160a08301528b8e106115fd5760405163586be56960e01b815260040160405180910390fd5b6116078e8d613f78565b604083018190528d101561161d57604082018d90525b6104a082018e90525b8160400151826104a001511015611f07576040805160c08101825260608082525f6020830181905292820183905281018290526080810182905260a0810191909152816001600160a01b031663c56ebcd6845f0151856104a001518151811061169157611691613fa4565b60200260200101516040518263ffffffff1660e01b81526004016116b791815260200190565b5f60405180830381865afa1580156116d1573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526116f891908101906143c8565b9050806040015115611eef57611716836060015182602001516130cd565b61018088015261016087015261014086015261012085015261010084018190525160e08401525f6101a084018190526101c084018190525b8360e00151811015611eed57836101200151818151811061177157611771613fa4565b60200260200101516001600160401b0381111561179057611790613e06565b6040519080825280602002602001820160405280156117b9578160200160208202803683370190505b506102e08501526101408401518051829081106117d8576117d8613fa4565b60200260200101516001600160401b038111156117f7576117f7613e06565b604051908082528060200260200182016040528015611820578160200160208202803683370190505b506103008501525f5b846101200151828151811061184057611840613fa4565b60200260200101518110156118c457846101600151856101a001518151811061186b5761186b613fa4565b6020026020010151856102e00151828151811061188a5761188a613fa4565b60200260200101906001600160a01b031690816001600160a01b031681525050846101a00180516118ba90614008565b9052600101611829565b505f5b84610140015182815181106118de576118de613fa4565b602002602001015181101561194e57846101800151856101c001518151811061190957611909613fa4565b6020026020010151856103000151828151811061192857611928613fa4565b602002602001018181525050846101c001805161194490614008565b90526001016118c7565b50602082015160608501516040516305a8676560e31b81526001600160a01b039182166004820152911690632d433b28906024015f60405180830381865afa15801561199c573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526119c391908101906144ff565b6102608801526102408701526102208601526101e085018190525f61028086018190526102a086018190526102c0860181905290516104c08601919091525b80856104c001511015611ee4575f8186610220015151611a2291906145a4565b5f61038088018190526103a088018190526103c08801529050806001600160401b03811115611a5357611a53613e06565b604051908082528060200260200182016040528015611a7c578160200160208202803683370190505b506103208701525f5b81811015611b145786610220015187610280015181518110611aa957611aa9613fa4565b60200260200101518761032001518281518110611ac857611ac8613fa4565b60200260200101906001600160a01b031690816001600160a01b03168152505086610280018051611af890614008565b905261038087018051611b0a90614008565b9052600101611a85565b508186610240015151611b2791906145a4565b9050806001600160401b03811115611b4157611b41613e06565b604051908082528060200260200182016040528015611b6a578160200160208202803683370190505b506103408701525f5b81811015611bee57866102400151876102a0015181518110611b9757611b97613fa4565b60200260200101518761034001518281518110611bb657611bb6613fa4565b602002602001018181525050866102a0018051611bd290614008565b90526103a087018051611be490614008565b9052600101611b73565b508186610260015151611c0191906145a4565b9050806001600160401b03811115611c1b57611c1b613e06565b604051908082528060200260200182016040528015611c44578160200160208202803683370190505b506103608701525f5b81811015611cd057866102600151876102c0015181518110611c7157611c71613fa4565b60200260200101518761036001518281518110611c9057611c90613fa4565b602002602001019060020b908160020b81525050866102c0018051611cb490614008565b90526103c087018051611cc690614008565b9052600101611c4d565b505f856001600160a01b03166358a2ab1c8861010001518681518110611cf857611cf8613fa4565b6020026020010151875f01518a6102e001518b61030001518c61032001518d61034001518e61036001516040518863ffffffff1660e01b8152600401611d4497969594939291906145c3565b602060405180830381865afa158015611d5f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611d839190613ff1565b604051637d474fa360e01b8152600481018290529091505f906001600160a01b03881690637d474fa390602401602060405180830381865afa158015611dcb573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611def9190613deb565b6001600160a01b031603611ecb57866103e0018051611e0d90614008565b9052610120870151805185908110611e2757611e27613fa4565b60200260200101518761040001818151611e419190613f91565b905250610140870151805185908110611e5c57611e5c613fa4565b60200260200101518761042001818151611e769190613f91565b90525061038087015161044088018051611e91908390613f91565b9052506103a087015161046088018051611eac908390613f91565b9052506103c087015161048088018051611ec7908390613f91565b9052505b5050846104c0018051611edd90614008565b9052611a02565b5060010161174e565b505b50816104a0018051611f0090614008565b9052611626565b816103e001516001600160401b03811115611f2457611f24613e06565b604051908082528060200260200182016040528015611f5757816020015b6060815260200190600190039081611f425790505b509a50816103e001516001600160401b03811115611f7757611f77613e06565b604051908082528060200260200182016040528015611faa57816020015b6060815260200190600190039081611f955790505b509950816103e001516001600160401b03811115611fca57611fca613e06565b604051908082528060200260200182016040528015611ffd57816020015b6060815260200190600190039081611fe85790505b509850816103e001516001600160401b0381111561201d5761201d613e06565b60405190808252806020026020018201604052801561205657816020015b6120436139af565b81526020019060019003908161203b5790505b5097508161040001516001600160401b0381111561207657612076613e06565b60405190808252806020026020018201604052801561209f578160200160208202803683370190505b5096508161042001516001600160401b038111156120bf576120bf613e06565b6040519080825280602002602001820160405280156120e8578160200160208202803683370190505b5095508161044001516001600160401b0381111561210857612108613e06565b604051908082528060200260200182016040528015612131578160200160208202803683370190505b5094508161046001516001600160401b0381111561215157612151613e06565b60405190808252806020026020018201604052801561217a578160200160208202803683370190505b5093508161048001516001600160401b0381111561219a5761219a613e06565b6040519080825280602002602001820160405280156121c3578160200160208202803683370190505b505f6103e0840181905261040084018190526104208401819052610440840181905261046084018190526104808401526104a083018f905292505b8160400151826104a001511015610f77576040805160c08101825260608082525f6020830181905292820183905281018290526080810182905260a0810191909152816001600160a01b031663c56ebcd6845f0151856104a001518151811061226957612269613fa4565b60200260200101516040518263ffffffff1660e01b815260040161228f91815260200190565b5f60405180830381865afa1580156122a9573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526122d091908101906143c8565b90508060400151156130b5576122ee836060015182602001516130cd565b61018088015261016087015261014086015261012085015261010084018190525160e08401525f6101a084018190526101c084018190525b8360e001518110156130b357836101200151818151811061234957612349613fa4565b60200260200101516001600160401b0381111561236857612368613e06565b604051908082528060200260200182016040528015612391578160200160208202803683370190505b506102e08501526101408401518051829081106123b0576123b0613fa4565b60200260200101516001600160401b038111156123cf576123cf613e06565b6040519080825280602002602001820160405280156123f8578160200160208202803683370190505b506103008501525f5b846101200151828151811061241857612418613fa4565b602002602001015181101561249c57846101600151856101a001518151811061244357612443613fa4565b6020026020010151856102e00151828151811061246257612462613fa4565b60200260200101906001600160a01b031690816001600160a01b031681525050846101a001805161249290614008565b9052600101612401565b505f5b84610140015182815181106124b6576124b6613fa4565b602002602001015181101561252657846101800151856101c00151815181106124e1576124e1613fa4565b6020026020010151856103000151828151811061250057612500613fa4565b602002602001018181525050846101c001805161251c90614008565b905260010161249f565b50602082015160608501516040516305a8676560e31b81526001600160a01b039182166004820152911690632d433b28906024015f60405180830381865afa158015612574573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261259b91908101906144ff565b6102608801526102408701526102208601526101e085018190525f61028086018190526102a086018190526102c0860181905290516102008601526104c08501525b836102000151846104c0015110156130ab575f8461020001518561022001515161260791906145a4565b5f61038087018190526103a087018190526103c08701529050806001600160401b0381111561263857612638613e06565b604051908082528060200260200182016040528015612661578160200160208202803683370190505b506103208601525f5b818110156126f9578561022001518661028001518151811061268e5761268e613fa4565b602002602001015186610320015182815181106126ad576126ad613fa4565b60200260200101906001600160a01b031690816001600160a01b031681525050856102800180516126dd90614008565b9052610380860180516126ef90614008565b905260010161266a565b508461020001518561024001515161271191906145a4565b9050806001600160401b0381111561272b5761272b613e06565b604051908082528060200260200182016040528015612754578160200160208202803683370190505b506103408601525f5b818110156127d857856102400151866102a001518151811061278157612781613fa4565b602002602001015186610340015182815181106127a0576127a0613fa4565b602002602001018181525050856102a00180516127bc90614008565b90526103a0860180516127ce90614008565b905260010161275d565b50846102000151856102600151516127f091906145a4565b9050806001600160401b0381111561280a5761280a613e06565b604051908082528060200260200182016040528015612833578160200160208202803683370190505b506103608601525f5b818110156128bf57856102600151866102c001518151811061286057612860613fa4565b6020026020010151866103600151828151811061287f5761287f613fa4565b602002602001019060020b908160020b81525050856102c00180516128a390614008565b90526103c0860180516128b590614008565b905260010161283c565b505f846001600160a01b03166358a2ab1c87610100015185815181106128e7576128e7613fa4565b6020026020010151865f0151896102e001518a61030001518b61032001518c61034001518d61036001516040518863ffffffff1660e01b815260040161293397969594939291906145c3565b602060405180830381865afa15801561294e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906129729190613ff1565b604051637d474fa360e01b8152600481018290529091505f906001600160a01b03871690637d474fa390602401602060405180830381865afa1580156129ba573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906129de9190613deb565b6001600160a01b03160361309257856101e00151866104c0015181518110612a0857612a08613fa4565b60200260200101518f876103e0015181518110612a2757612a27613fa4565b60200260200101819052508561010001518381518110612a4957612a49613fa4565b60200260200101518e876103e0015181518110612a6857612a68613fa4565b6020026020010181905250835f01518d876103e0015181518110612a8e57612a8e613fa4565b60200260200101819052508561040001518c876103e0015181518110612ab657612ab6613fa4565b60200260200101515f600a8110612acf57612acf613fa4565b6020020152610120860151805184908110612aec57612aec613fa4565b6020026020010151866104000151612b049190613f91565b8c876103e0015181518110612b1b57612b1b613fa4565b60200260200101516001600a8110612b3557612b35613fa4565b60200201526104208601516103e08701518d518e91908110612b5957612b59613fa4565b60200260200101516002600a8110612b7357612b73613fa4565b6020020152610140860151805184908110612b9057612b90613fa4565b6020026020010151866104200151612ba89190613f91565b8c876103e0015181518110612bbf57612bbf613fa4565b60200260200101516003600a8110612bd957612bd9613fa4565b60200201526104408601516103e08701518d518e91908110612bfd57612bfd613fa4565b60200260200101516004600a8110612c1757612c17613fa4565b6020020152610380860151610440870151612c329190613f91565b8c876103e0015181518110612c4957612c49613fa4565b60200260200101516005600a8110612c6357612c63613fa4565b60200201526104608601516103e08701518d518e91908110612c8757612c87613fa4565b60200260200101516006600a8110612ca157612ca1613fa4565b60200201526103a0860151610460870151612cbc9190613f91565b8c876103e0015181518110612cd357612cd3613fa4565b60200260200101516007600a8110612ced57612ced613fa4565b60200201526104808601516103e08701518d518e91908110612d1157612d11613fa4565b60200260200101516008600a8110612d2b57612d2b613fa4565b60200201526103c0860151610480870151612d469190613f91565b8c876103e0015181518110612d5d57612d5d613fa4565b60200260200101516009600a8110612d7757612d77613fa4565b60200201525f5b8661012001518481518110612d9557612d95613fa4565b6020026020010151811015612e0557866102e001518181518110612dbb57612dbb613fa4565b60200260200101518c82896104000151612dd59190613f91565b81518110612de557612de5613fa4565b6001600160a01b0390921660209283029190910190910152600101612d7e565b505f5b8661014001518481518110612e1f57612e1f613fa4565b6020026020010151811015612e82578661030001518181518110612e4557612e45613fa4565b60200260200101518b82896104200151612e5f9190613f91565b81518110612e6f57612e6f613fa4565b6020908102919091010152600101612e08565b505f5b866103800151811015612ef3578661032001518181518110612ea957612ea9613fa4565b60200260200101518a82896104400151612ec39190613f91565b81518110612ed357612ed3613fa4565b6001600160a01b0390921660209283029190910190910152600101612e85565b505f5b866103a00151811015612f57578661034001518181518110612f1a57612f1a613fa4565b60200260200101518982896104600151612f349190613f91565b81518110612f4457612f44613fa4565b6020908102919091010152600101612ef6565b505f5b866103c00151811015612fc3578661036001518181518110612f7e57612f7e613fa4565b60200260200101518882896104800151612f989190613f91565b81518110612fa857612fa8613fa4565b60029290920b60209283029190910190910152600101612f5a565b50856103e0018051612fd490614008565b9052610120860151805184908110612fee57612fee613fa4565b602002602001015186610400018181516130089190613f91565b90525061014086015180518490811061302357613023613fa4565b6020026020010151866104200181815161303d9190613f91565b90525061038086015161044087018051613058908390613f91565b9052506103a086015161046087018051613073908390613f91565b9052506103c08601516104808701805161308e908390613f91565b9052505b5050836104c00180516130a490614008565b90526125dd565b600101612326565b505b50816104a00180516130c690614008565b90526121fe565b60608060608060606131036040518060a00160405280606081526020015f81526020015f81526020015f81526020015f81525090565b866001600160a01b031663fdff667c6040518163ffffffff1660e01b81526004015f60405180830381865afa15801561313e573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526131659190810190614659565b808252516080820152604080516360997e8560e01b815290515f916001600160a01b038b16916360997e859160048082019286929091908290030181865afa1580156131b3573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526131da919081019061468a565b5080519091505f5b836080015181101561347257734f76add676c04eca837130ceb58bc173de8799de6321a49642855f0151838151811061321d5761321d613fa4565b60200260200101516040518060400160405280600b81526020016a436f6d706f756e64696e6760a81b8152506040518363ffffffff1660e01b81526004016132669291906146e9565b602060405180830381865af4158015613281573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906132a59190614716565b156132c0578360200180516132b990614008565b905261346a565b734f76add676c04eca837130ceb58bc173de8799de6321a49642855f015183815181106132ef576132ef613fa4565b602002602001015160405180604001604052806009815260200168526577617264696e6760b81b8152506040518363ffffffff1660e01b81526004016133369291906146e9565b602060405180830381865af4158015613351573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906133759190614716565b806134385750734f76add676c04eca837130ceb58bc173de8799de6321a49642855f015183815181106133aa576133aa613fa4565b60200260200101516040518060400160405280601181526020017014995dd85c991a5b99c813585b9859d959607a1b8152506040518363ffffffff1660e01b81526004016133f99291906146e9565b602060405180830381865af4158015613414573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906134389190614716565b1561346a57818460200181815161344f9190613f91565b905250604084018051839190613466908390613f91565b9052505b6001016131e2565b5082602001516001600160401b0381111561348f5761348f613e06565b6040519080825280602002602001820160405280156134c257816020015b60608152602001906001900390816134ad5790505b50975082602001516001600160401b038111156134e1576134e1613e06565b60405190808252806020026020018201604052801561350a578160200160208202803683370190505b50965082602001516001600160401b0381111561352957613529613e06565b604051908082528060200260200182016040528015613552578160200160208202803683370190505b50955082604001516001600160401b0381111561357157613571613e06565b60405190808252806020026020018201604052801561359a578160200160208202803683370190505b50945082606001516001600160401b038111156135b9576135b9613e06565b6040519080825280602002602001820160405280156135e2578160200160208202803683370190505b5093506135ed6139ce565b5f5b84608001518110156139a057734f76add676c04eca837130ceb58bc173de8799de6321a49642865f0151838151811061362a5761362a613fa4565b60200260200101516040518060400160405280600b81526020016a436f6d706f756e64696e6760a81b8152506040518363ffffffff1660e01b81526004016136739291906146e9565b602060405180830381865af415801561368e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906136b29190614716565b1561371a5784518051829081106136cb576136cb613fa4565b60200260200101518a835f600381106136e6576136e6613fa4565b6020020151815181106136fb576136fb613fa4565b60209081029190910101528151829061371390614008565b9052613998565b734f76add676c04eca837130ceb58bc173de8799de6321a49642865f0151838151811061374957613749613fa4565b602002602001015160405180604001604052806009815260200168526577617264696e6760b81b8152506040518363ffffffff1660e01b81526004016137909291906146e9565b602060405180830381865af41580156137ab573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906137cf9190614716565b806138925750734f76add676c04eca837130ceb58bc173de8799de6321a49642865f0151838151811061380457613804613fa4565b60200260200101516040518060400160405280601181526020017014995dd85c991a5b99c813585b9859d959607a1b8152506040518363ffffffff1660e01b81526004016138539291906146e9565b602060405180830381865af415801561386e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906138929190614716565b15613998575f5b838110156139965785518051839081106138b5576138b5613fa4565b60200260200101518b845f600381106138d0576138d0613fa4565b6020020151815181106138e5576138e5613fa4565b602002602001018190525084818151811061390257613902613fa4565b6020026020010151888460016003811061391e5761391e613fa4565b60200201518151811061393357613933613fa4565b6001600160a01b03929092166020928302919091019091015282518a516001918c91811061396357613963613fa4565b60209081029190910101528251839061397b90614008565b905260208301805161398c90614008565b9052600101613899565b505b6001016135ef565b50505050509295509295909350565b604051806101400160405280600a906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b0381168114613a00575f80fd5b50565b5f805f60608486031215613a15575f80fd5b8335613a20816139ec565b95602085013595506040909401359392505050565b5f815180845260208085019450602084015f5b83811015613a6d5781516001600160a01b031687529582019590820190600101613a48565b509495945050505050565b5f815180845260208085019450602084015f5b83811015613a6d57815187529582019590820190600101613a8b565b848152608060208201525f613abf6080830186613a35565b8281036040840152613ad18186613a78565b90508281036060840152613ae58185613a78565b979650505050505050565b5f8060408385031215613b01575f80fd5b50508035926020909101359150565b5f5b83811015613b2a578181015183820152602001613b12565b50505f910152565b5f8151808452613b49816020860160208601613b10565b601f01601f19169290920160200192915050565b5f8282518085526020808601955060208260051b840101602086015f5b84811015613ba857601f19868403018952613b96838351613b32565b98840198925090830190600101613b7a565b5090979650505050505050565b5f6101408c8352806020840152613bce8184018d613a35565b90508281036040840152613be2818c613b5d565b90508281036060840152613bf6818b613b5d565b90508281036080840152613c0a818a613b5d565b905082810360a0840152613c1e8189613a78565b905082810360c0840152613c328188613a78565b905082810360e0840152613c468187613a35565b9050828103610100840152613c5b8186613b5d565b9050828103610120840152613c708185613b5d565b9d9c50505050505050505050505050565b5f815180845260208085019450602084015f5b83811015613a6d578151875f5b600a811015613cbe57825182529185019190850190600101613ca1565b505050610140969096019590820190600101613c94565b5f815180845260208085019450602084015f5b83811015613a6d57815160020b87529582019590820190600101613ce8565b5f6101408c8352806020840152613d208184018d613b5d565b90508281036040840152613d34818c613b5d565b90508281036060840152613d48818b613b5d565b90508281036080840152613d5c818a613c81565b905082810360a0840152613d708189613a35565b905082810360c0840152613d848188613a78565b905082810360e0840152613d988187613a35565b9050828103610100840152613dad8186613a78565b9050828103610120840152613c708185613cd5565b602081525f613dd46020830184613b32565b9392505050565b8051613de6816139ec565b919050565b5f60208284031215613dfb575f80fd5b8151613dd4816139ec565b634e487b7160e01b5f52604160045260245ffd5b60405160e081016001600160401b0381118282101715613e3c57613e3c613e06565b60405290565b60405160c081016001600160401b0381118282101715613e3c57613e3c613e06565b604051601f8201601f191681016001600160401b0381118282101715613e8c57613e8c613e06565b604052919050565b5f6001600160401b03821115613eac57613eac613e06565b5060051b60200190565b5f82601f830112613ec5575f80fd5b81516020613eda613ed583613e94565b613e64565b8083825260208201915060208460051b870101935086841115613efb575f80fd5b602086015b84811015613f20578051613f13816139ec565b8352918301918301613f00565b509695505050505050565b5f60208284031215613f3b575f80fd5b81516001600160401b03811115613f50575f80fd5b613f5c84828501613eb6565b949350505050565b634e487b7160e01b5f52601160045260245ffd5b81810381811115613f8b57613f8b613f64565b92915050565b80820180821115613f8b57613f8b613f64565b634e487b7160e01b5f52603260045260245ffd5b80518015158114613de6575f80fd5b5f8060408385031215613fd8575f80fd5b82519150613fe860208401613fb8565b90509250929050565b5f60208284031215614001575f80fd5b5051919050565b5f6001820161401957614019613f64565b5060010190565b5f82601f83011261402f575f80fd5b81516001600160401b0381111561404857614048613e06565b61405b601f8201601f1916602001613e64565b81815284602083860101111561406f575f80fd5b613f5c826020830160208701613b10565b5f60208284031215614090575f80fd5b81516001600160401b038111156140a5575f80fd5b613f5c84828501614020565b5f80604083850312156140c2575f80fd5b82516001600160401b038111156140d7575f80fd5b6140e385828601614020565b925050613fe860208401613fb8565b5f6020808385031215614103575f80fd5b82516001600160401b03811115614118575f80fd5b8301601f81018513614128575f80fd5b8051614136613ed582613e94565b81815260059190911b82018301908381019087831115614154575f80fd5b928401925b82841015613ae557835182529284019290840190614159565b5f82601f830112614181575f80fd5b81516020614191613ed583613e94565b8083825260208201915060208460051b8701019350868411156141b2575f80fd5b602086015b84811015613f2057805183529183019183016141b7565b5f82601f8301126141dd575f80fd5b815160206141ed613ed583613e94565b8083825260208201915060208460051b87010193508684111561420e575f80fd5b602086015b84811015613f205780518060020b811461422b575f80fd5b8352918301918301614213565b5f6020808385031215614249575f80fd5b82516001600160401b038082111561425f575f80fd5b818501915085601f830112614272575f80fd5b8151614280613ed582613e94565b81815260059190911b8301840190848101908883111561429e575f80fd5b8585015b838110156143bb578051858111156142b8575f80fd5b860160e0818c03601f190112156142cd575f80fd5b6142d5613e1a565b88820151815260406142e8818401613ddb565b8a830152606080840151898111156142fe575f80fd5b61430c8f8d83880101614020565b8385015250608091508184015189811115614325575f80fd5b6143338f8d83880101613eb6565b82850152505060a0808401518981111561434b575f80fd5b6143598f8d83880101613eb6565b838501525060c091508184015189811115614372575f80fd5b6143808f8d83880101614172565b82850152505060e083015188811115614397575f80fd5b6143a58e8c838701016141ce565b91830191909152508452509186019186016142a2565b5098975050505050505050565b5f602082840312156143d8575f80fd5b81516001600160401b03808211156143ee575f80fd5b9083019060c08286031215614401575f80fd5b614409613e42565b825182811115614417575f80fd5b61442387828601614020565b82525060208301519150614436826139ec565b81602082015261444860408401613fb8565b604082015261445960608401613fb8565b606082015261446a60808401613fb8565b608082015260a083015160a082015280935050505092915050565b5f82601f830112614494575f80fd5b815160206144a4613ed583613e94565b82815260059290921b840181019181810190868411156144c2575f80fd5b8286015b84811015613f205780516001600160401b038111156144e3575f80fd5b6144f18986838b0101614020565b8452509183019183016144c6565b5f805f8060808587031215614512575f80fd5b84516001600160401b0380821115614528575f80fd5b61453488838901614485565b95506020870151915080821115614549575f80fd5b61455588838901613eb6565b9450604087015191508082111561456a575f80fd5b61457688838901614172565b9350606087015191508082111561458b575f80fd5b50614598878288016141ce565b91505092959194509250565b5f826145be57634e487b7160e01b5f52601260045260245ffd5b500490565b60e081525f6145d560e083018a613b32565b82810360208401526145e7818a613b32565b905082810360408401526145fb8189613a35565b9050828103606084015261460f8188613a78565b905082810360808401526146238187613a35565b905082810360a08401526146378186613a78565b905082810360c084015261464b8185613cd5565b9a9950505050505050505050565b5f60208284031215614669575f80fd5b81516001600160401b0381111561467e575f80fd5b613f5c84828501614485565b5f806040838503121561469b575f80fd5b82516001600160401b03808211156146b1575f80fd5b6146bd86838701613eb6565b935060208501519150808211156146d2575f80fd5b506146df85828601614172565b9150509250929050565b604081525f6146fb6040830185613b32565b828103602084015261470d8185613b32565b95945050505050565b5f60208284031215614726575f80fd5b613dd482613fb856fea2646970667358221220b1070d55b08644f6209faf46b1d93a69ce205e18e7ae0281435dcd64fe5f4ce364736f6c63430008170033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000004aca671a420eeb58ecafe83700686a2ad06b20d8
-----Decoded View---------------
Arg [0] : platform_ (address): 0x4Aca671A420eEB58ecafE83700686a2AD06b20D8
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000004aca671a420eeb58ecafe83700686a2ad06b20d8
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.