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:
Platform
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/utils/structs/EnumerableMap.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "./base/Controllable.sol"; import "./libs/ConstantsLib.sol"; import "./libs/CommonLib.sol"; import "../interfaces/IPlatform.sol"; import "../interfaces/IFactory.sol"; import "../interfaces/IProxy.sol"; import "../interfaces/ISwapper.sol"; import "../interfaces/IPriceReader.sol"; import "../interfaces/IVaultManager.sol"; import "../interfaces/IVault.sol"; /// @notice The main contract of the platform. /// It stores core and infrastructure addresses, list of operators, fee settings, allows plaform upgrades etc. /// ┏┓┏┳┓┏┓┳┓┳┓ ┳┏┳┓┓┏ ┏┓┓ ┏┓┏┳┓┏┓┏┓┳┓┳┳┓ /// ┗┓ ┃ ┣┫┣┫┃┃ ┃ ┃ ┗┫ ┃┃┃ ┣┫ ┃ ┣ ┃┃┣┫┃┃┃ /// ┗┛ ┻ ┛┗┻┛┻┗┛┻ ┻ ┗┛ ┣┛┗┛┛┗ ┻ ┻ ┗┛┛┗┛ ┗ /// @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) contract Platform is Controllable, IPlatform { using EnumerableSet for EnumerableSet.AddressSet; using EnumerableMap for EnumerableMap.AddressToUintMap; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Version of Platform contract implementation string public constant VERSION = "1.1.0"; /// @inheritdoc IPlatform uint public constant TIME_LOCK = 16 hours; /// @dev Minimal revenue fee uint public constant MIN_FEE = 5_000; // 5% /// @dev Maximal revenue fee uint public constant MAX_FEE = 50_000; // 50% /// @dev Minimal VaultManager tokenId owner fee share uint public constant MIN_FEE_SHARE_VAULT_MANAGER = 10_000; // 10% /// @dev Minimal StrategyLogic tokenId owner fee share uint public constant MIN_FEE_SHARE_STRATEGY_LOGIC = 10_000; // 10% // keccak256(abi.encode(uint256(keccak256("erc7201:stability.Platform")) - 1)) & ~bytes32(uint256(0xff)); bytes32 private constant PLATFORM_STORAGE_LOCATION = 0x263d5089de5bb3f97c8effd51f1a153b36e97065a51e67a94885830ed03a7a00; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @custom:storage-location erc7201:stability.Platform struct PlatformStorage { /// @inheritdoc IPlatform address governance; /// @inheritdoc IPlatform address multisig; /// @inheritdoc IPlatform address buildingPermitToken; /// @inheritdoc IPlatform address buildingPayPerVaultToken; /// @inheritdoc IPlatform address ecosystemRevenueReceiver; /// @inheritdoc IPlatform address targetExchangeAsset; /// @inheritdoc IPlatform address factory; /// @inheritdoc IPlatform address vaultManager; /// @inheritdoc IPlatform address strategyLogic; /// @inheritdoc IPlatform address priceReader; /// @inheritdoc IPlatform address aprOracle; /// @inheritdoc IPlatform address swapper; /// @inheritdoc IPlatform address hardWorker; /// @inheritdoc IPlatform address rebalancer; /// @inheritdoc IPlatform address zap; /// @inheritdoc IPlatform address bridge; /// @inheritdoc IPlatform string networkName; /// @inheritdoc IPlatform bytes32 networkExtra; /// @inheritdoc IPlatform uint minInitialBoostPerDay; /// @inheritdoc IPlatform uint minInitialBoostDuration; /// @inheritdoc IPlatform PlatformUpgrade pendingPlatformUpgrade; /// @inheritdoc IPlatform uint platformUpgradeTimelock; /// @inheritdoc IPlatform string platformVersion; /// @inheritdoc IPlatform uint minTvlForFreeHardWork; /// @inheritdoc IPlatform mapping(bytes32 ammAdapterIdHash => AmmAdapter ammAdpater) ammAdapter; /// @dev Hashes of AMM adapter ID string bytes32[] ammAdapterIdHash; EnumerableSet.AddressSet operators; EnumerableMap.AddressToUintMap allowedBBTokensVaults; EnumerableSet.AddressSet allowedBoostRewardTokens; EnumerableSet.AddressSet defaultBoostRewardTokens; EnumerableSet.AddressSet dexAggregators; uint fee; uint feeShareVaultManager; uint feeShareStrategyLogic; uint feeShareEcosystem; mapping(address vault => uint platformFee) customVaultFee; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INITIALIZATION */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ function initialize(address multisig_, string memory version) public initializer { PlatformStorage storage $ = _getStorage(); //slither-disable-next-line missing-zero-check $.multisig = multisig_; __Controllable_init(address(this)); //slither-disable-next-line unused-return $.operators.add(msg.sender); //slither-disable-next-line unused-return $.operators.add(multisig_); $.platformVersion = version; emit PlatformVersion(version); } function setup( IPlatform.SetupAddresses memory addresses, IPlatform.PlatformSettings memory settings ) external onlyOperator { PlatformStorage storage $ = _getStorage(); if ($.factory != address(0)) { revert AlreadyExist(); } $.factory = addresses.factory; $.priceReader = addresses.priceReader; $.swapper = addresses.swapper; $.buildingPermitToken = addresses.buildingPermitToken; $.buildingPayPerVaultToken = addresses.buildingPayPerVaultToken; $.vaultManager = addresses.vaultManager; $.strategyLogic = addresses.strategyLogic; $.aprOracle = addresses.aprOracle; $.targetExchangeAsset = addresses.targetExchangeAsset; $.hardWorker = addresses.hardWorker; $.rebalancer = addresses.rebalancer; $.zap = addresses.zap; $.bridge = addresses.bridge; $.minTvlForFreeHardWork = 100e18; emit Addresses( $.multisig, addresses.factory, addresses.priceReader, addresses.swapper, addresses.buildingPermitToken, addresses.vaultManager, addresses.strategyLogic, addresses.aprOracle, addresses.hardWorker, addresses.rebalancer, addresses.zap, addresses.bridge ); $.networkName = settings.networkName; $.networkExtra = settings.networkExtra; _setFees( settings.fee, settings.feeShareVaultManager, settings.feeShareStrategyLogic, settings.feeShareEcosystem ); _setInitialBoost(settings.minInitialBoostPerDay, settings.minInitialBoostDuration); emit MinTvlForFreeHardWorkChanged(0, $.minTvlForFreeHardWork); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* RESTRICTED ACTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ function setEcosystemRevenueReceiver(address receiver) external onlyGovernanceOrMultisig { if (receiver == address(0)) { revert IControllable.IncorrectZeroArgument(); } PlatformStorage storage $ = _getStorage(); $.ecosystemRevenueReceiver = receiver; emit EcosystemRevenueReceiver(receiver); } /// @inheritdoc IPlatform function addOperator(address operator) external onlyGovernanceOrMultisig { PlatformStorage storage $ = _getStorage(); if (!$.operators.add(operator)) { revert AlreadyExist(); } emit OperatorAdded(operator); } /// @inheritdoc IPlatform function removeOperator(address operator) external onlyGovernanceOrMultisig { PlatformStorage storage $ = _getStorage(); if (!$.operators.remove(operator)) { revert NotExist(); } emit OperatorRemoved(operator); } /// @inheritdoc IPlatform function announcePlatformUpgrade( string memory newVersion, address[] memory proxies, address[] memory newImplementations ) external onlyGovernanceOrMultisig { PlatformStorage storage $ = _getStorage(); if ($.pendingPlatformUpgrade.proxies.length != 0) { revert AlreadyAnnounced(); } uint len = proxies.length; if (len != newImplementations.length) { revert IncorrectArrayLength(); } // nosemgrep for (uint i; i < len; ++i) { if (proxies[i] == address(0)) { revert IControllable.IncorrectZeroArgument(); } if (newImplementations[i] == address(0)) { revert IControllable.IncorrectZeroArgument(); } //slither-disable-next-line calls-loop if (CommonLib.eq(IControllable(proxies[i]).VERSION(), IControllable(newImplementations[i]).VERSION())) { revert SameVersion(); } } string memory oldVersion = $.platformVersion; if (CommonLib.eq(oldVersion, newVersion)) { revert SameVersion(); } $.pendingPlatformUpgrade.newVersion = newVersion; $.pendingPlatformUpgrade.proxies = proxies; $.pendingPlatformUpgrade.newImplementations = newImplementations; uint tl = block.timestamp + TIME_LOCK; $.platformUpgradeTimelock = tl; emit UpgradeAnnounce(oldVersion, newVersion, proxies, newImplementations, tl); } /// @inheritdoc IPlatform //slither-disable-next-line reentrancy-benign reentrancy-no-eth calls-loop function upgrade() external onlyOperator { PlatformStorage storage $ = _getStorage(); uint ts = $.platformUpgradeTimelock; if (ts == 0) { revert NoNewVersion(); } //slither-disable-next-line timestamp if (ts > block.timestamp) { revert UpgradeTimerIsNotOver(ts); } PlatformUpgrade memory platformUpgrade = $.pendingPlatformUpgrade; uint len = platformUpgrade.proxies.length; // nosemgrep for (uint i; i < len; ++i) { //slither-disable-next-line calls-loop string memory oldContractVersion = IControllable(platformUpgrade.proxies[i]).VERSION(); //slither-disable-next-line calls-loop IProxy(platformUpgrade.proxies[i]).upgrade(platformUpgrade.newImplementations[i]); //slither-disable-next-line calls-loop reentrancy-events emit ProxyUpgraded( platformUpgrade.proxies[i], platformUpgrade.newImplementations[i], oldContractVersion, IControllable(platformUpgrade.proxies[i]).VERSION() ); } $.platformVersion = platformUpgrade.newVersion; $.pendingPlatformUpgrade.newVersion = ""; $.pendingPlatformUpgrade.proxies = new address[](0); $.pendingPlatformUpgrade.newImplementations = new address[](0); $.platformUpgradeTimelock = 0; //slither-disable-next-line reentrancy-events emit PlatformVersion(platformUpgrade.newVersion); } /// @inheritdoc IPlatform function cancelUpgrade() external onlyOperator { PlatformStorage storage $ = _getStorage(); if ($.platformUpgradeTimelock == 0) { revert NoNewVersion(); } emit CancelUpgrade(VERSION, $.pendingPlatformUpgrade.newVersion); $.pendingPlatformUpgrade.newVersion = ""; $.pendingPlatformUpgrade.proxies = new address[](0); $.pendingPlatformUpgrade.newImplementations = new address[](0); $.platformUpgradeTimelock = 0; } function setFees( uint fee, uint feeShareVaultManager, uint feeShareStrategyLogic, uint feeShareEcosystem ) external onlyGovernance { _setFees(fee, feeShareVaultManager, feeShareStrategyLogic, feeShareEcosystem); } /// @inheritdoc IPlatform function addAmmAdapter(string memory id, address proxy) external onlyOperator { PlatformStorage storage $ = _getStorage(); bytes32 hash = keccak256(bytes(id)); if ($.ammAdapter[hash].proxy != address(0)) { revert AlreadyExist(); } $.ammAdapter[hash].id = id; $.ammAdapter[hash].proxy = proxy; $.ammAdapterIdHash.push(hash); emit NewAmmAdapter(id, proxy); } /// @inheritdoc IPlatform function addDexAggregators(address[] memory dexAggRouter) external onlyOperator { PlatformStorage storage $ = _getStorage(); uint len = dexAggRouter.length; // nosemgrep for (uint i; i < len; ++i) { if (dexAggRouter[i] == address(0)) { revert IControllable.IncorrectZeroArgument(); } // nosemgrep if (!$.dexAggregators.add(dexAggRouter[i])) { continue; } emit AddDexAggregator(dexAggRouter[i]); } } /// @inheritdoc IPlatform function removeDexAggregator(address dexAggRouter) external onlyOperator { PlatformStorage storage $ = _getStorage(); if (!$.dexAggregators.remove(dexAggRouter)) { revert AggregatorNotExists(dexAggRouter); } emit RemoveDexAggregator(dexAggRouter); } /// @inheritdoc IPlatform function setAllowedBBTokenVaults(address bbToken, uint vaultsToBuild) external onlyOperator { PlatformStorage storage $ = _getStorage(); bool firstSet = $.allowedBBTokensVaults.set(bbToken, vaultsToBuild); emit SetAllowedBBTokenVaults(bbToken, vaultsToBuild, firstSet); } /// @inheritdoc IPlatform function useAllowedBBTokenVault(address bbToken) external onlyFactory { PlatformStorage storage $ = _getStorage(); uint allowedVaults = $.allowedBBTokensVaults.get(bbToken); if (allowedVaults <= 0) { revert NotEnoughAllowedBBToken(); } //slither-disable-next-line unused-return $.allowedBBTokensVaults.set(bbToken, allowedVaults - 1); emit AllowedBBTokenVaultUsed(bbToken, allowedVaults - 1); } function removeAllowedBBToken(address bbToken) external onlyOperator { PlatformStorage storage $ = _getStorage(); if (!$.allowedBBTokensVaults.remove(bbToken)) { revert NotExist(); } emit RemoveAllowedBBToken(bbToken); } /// @inheritdoc IPlatform function addAllowedBoostRewardToken(address token) external onlyOperator { PlatformStorage storage $ = _getStorage(); if (!$.allowedBoostRewardTokens.add(token)) { revert AlreadyExist(); } emit AddAllowedBoostRewardToken(token); } /// @inheritdoc IPlatform function removeAllowedBoostRewardToken(address token) external onlyOperator { PlatformStorage storage $ = _getStorage(); if (!$.allowedBoostRewardTokens.remove(token)) { revert NotExist(); } emit RemoveAllowedBoostRewardToken(token); } /// @inheritdoc IPlatform function addDefaultBoostRewardToken(address token) external onlyOperator { PlatformStorage storage $ = _getStorage(); if (!$.defaultBoostRewardTokens.add(token)) { revert AlreadyExist(); } emit AddDefaultBoostRewardToken(token); } /// @inheritdoc IPlatform function removeDefaultBoostRewardToken(address token) external onlyOperator { PlatformStorage storage $ = _getStorage(); if (!$.defaultBoostRewardTokens.remove(token)) { revert NotExist(); } emit RemoveDefaultBoostRewardToken(token); } /// @inheritdoc IPlatform function addBoostTokens( address[] memory allowedBoostRewardToken, address[] memory defaultBoostRewardToken ) external onlyOperator { PlatformStorage storage $ = _getStorage(); _addTokens($.allowedBoostRewardTokens, allowedBoostRewardToken); _addTokens($.defaultBoostRewardTokens, defaultBoostRewardToken); emit AddBoostTokens(allowedBoostRewardToken, defaultBoostRewardToken); } /// @inheritdoc IPlatform function setInitialBoost(uint minInitialBoostPerDay_, uint minInitialBoostDuration_) external onlyOperator { _setInitialBoost(minInitialBoostPerDay_, minInitialBoostDuration_); } /// @inheritdoc IPlatform function setMinTvlForFreeHardWork(uint value) external onlyGovernanceOrMultisig { PlatformStorage storage $ = _getStorage(); emit MinTvlForFreeHardWorkChanged($.minTvlForFreeHardWork, value); $.minTvlForFreeHardWork = value; } /// @inheritdoc IPlatform function setCustomVaultFee(address vault, uint platformFee) external onlyGovernanceOrMultisig { PlatformStorage storage $ = _getStorage(); emit CustomVaultFee(vault, platformFee); $.customVaultFee[vault] = platformFee; } /// @inheritdoc IPlatform function setupRebalancer(address rebalancer_) external onlyGovernanceOrMultisig { PlatformStorage storage $ = _getStorage(); emit Rebalancer(rebalancer_); $.rebalancer = rebalancer_; } /// @inheritdoc IPlatform function setupBridge(address bridge_) external onlyGovernanceOrMultisig { PlatformStorage storage $ = _getStorage(); emit Bridge(bridge_); $.bridge = bridge_; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* VIEW FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @inheritdoc IPlatform function pendingPlatformUpgrade() external view returns (PlatformUpgrade memory) { PlatformStorage storage $ = _getStorage(); return $.pendingPlatformUpgrade; } /// @inheritdoc IPlatform function isOperator(address operator) external view returns (bool) { PlatformStorage storage $ = _getStorage(); return $.operators.contains(operator); } function operatorsList() external view returns (address[] memory) { PlatformStorage storage $ = _getStorage(); return $.operators.values(); } /// @inheritdoc IPlatform function getFees() public view returns (uint fee, uint feeShareVaultManager, uint feeShareStrategyLogic, uint feeShareEcosystem) { PlatformStorage storage $ = _getStorage(); return ($.fee, $.feeShareVaultManager, $.feeShareStrategyLogic, $.feeShareEcosystem); } /// @inheritdoc IPlatform function getCustomVaultFee(address vault) external view returns (uint fee) { PlatformStorage storage $ = _getStorage(); return $.customVaultFee[vault]; } /// @inheritdoc IPlatform function getPlatformSettings() external view returns (PlatformSettings memory) { PlatformStorage storage $ = _getStorage(); //slither-disable-next-line uninitialized-local PlatformSettings memory platformSettings; ( platformSettings.fee, platformSettings.feeShareVaultManager, platformSettings.feeShareStrategyLogic, platformSettings.feeShareEcosystem ) = getFees(); platformSettings.networkName = $.networkName; platformSettings.networkExtra = $.networkExtra; platformSettings.minInitialBoostPerDay = $.minInitialBoostPerDay; platformSettings.minInitialBoostDuration = $.minInitialBoostDuration; return platformSettings; } /// @inheritdoc IPlatform function getAmmAdapters() external view returns (string[] memory ids, address[] memory proxies) { PlatformStorage storage $ = _getStorage(); uint len = $.ammAdapterIdHash.length; ids = new string[](len); proxies = new address[](len); bytes32[] memory _ammAdapterIdHash = $.ammAdapterIdHash; // nosemgrep for (uint i; i < len; ++i) { bytes32 hash = _ammAdapterIdHash[i]; AmmAdapter memory __ammAdapter = $.ammAdapter[hash]; ids[i] = __ammAdapter.id; proxies[i] = __ammAdapter.proxy; } } /// @inheritdoc IPlatform function ammAdapter(bytes32 ammAdapterIdHash) external view returns (AmmAdapter memory) { PlatformStorage storage $ = _getStorage(); return $.ammAdapter[ammAdapterIdHash]; } /// @inheritdoc IPlatform function allowedBBTokens() external view returns (address[] memory) { PlatformStorage storage $ = _getStorage(); return $.allowedBBTokensVaults.keys(); } /// @inheritdoc IPlatform //slither-disable-next-line unused-return function allowedBBTokenVaults(address token) external view returns (uint vaultsLimit) { PlatformStorage storage $ = _getStorage(); //slither-disable-next-line unused-return (, vaultsLimit) = $.allowedBBTokensVaults.tryGet(token); } /// @inheritdoc IPlatform function allowedBBTokenVaults() external view returns (address[] memory bbToken, uint[] memory vaultsLimit) { PlatformStorage storage $ = _getStorage(); bbToken = $.allowedBBTokensVaults.keys(); uint len = bbToken.length; vaultsLimit = new uint[](len); // nosemgrep for (uint i; i < len; ++i) { //slither-disable-next-line unused-return (, vaultsLimit[i]) = $.allowedBBTokensVaults.tryGet(bbToken[i]); } } /// @inheritdoc IPlatform function allowedBBTokenVaultsFiltered() external view returns (address[] memory bbToken, uint[] memory vaultsLimit) { PlatformStorage storage $ = _getStorage(); address[] memory allBbTokens = $.allowedBBTokensVaults.keys(); uint len = allBbTokens.length; uint[] memory limit = new uint[](len); //slither-disable-next-line uninitialized-local uint k; // nosemgrep for (uint i; i < len; ++i) { // nosemgrep limit[i] = $.allowedBBTokensVaults.get(allBbTokens[i]); if (limit[i] > 0) ++k; } bbToken = new address[](k); vaultsLimit = new uint[](k); //slither-disable-next-line uninitialized-local uint y; // nosemgrep for (uint i; i < len; ++i) { if (limit[i] == 0) { continue; } bbToken[y] = allBbTokens[i]; vaultsLimit[y] = limit[i]; ++y; } } /// @inheritdoc IPlatform function allowedBoostRewardTokens() external view returns (address[] memory) { PlatformStorage storage $ = _getStorage(); return $.allowedBoostRewardTokens.values(); } /// @inheritdoc IPlatform function defaultBoostRewardTokens() external view returns (address[] memory) { PlatformStorage storage $ = _getStorage(); return $.defaultBoostRewardTokens.values(); } /// @inheritdoc IPlatform function defaultBoostRewardTokensFiltered(address addressToRemove) external view returns (address[] memory) { PlatformStorage storage $ = _getStorage(); return CommonLib.filterAddresses($.defaultBoostRewardTokens.values(), addressToRemove); } /// @inheritdoc IPlatform function dexAggregators() external view returns (address[] memory) { PlatformStorage storage $ = _getStorage(); return $.dexAggregators.values(); } /// @inheritdoc IPlatform function isAllowedDexAggregatorRouter(address dexAggRouter) external view returns (bool) { PlatformStorage storage $ = _getStorage(); return $.dexAggregators.contains(dexAggRouter); } /// @inheritdoc IPlatform //slither-disable-next-line unused-return function getData() external view returns ( address[] memory platformAddresses, address[] memory bcAssets, address[] memory dexAggregators_, string[] memory vaultType, bytes32[] memory vaultExtra, //slither-disable-next-line similar-names uint[] memory vaultBuildingPrice, string[] memory strategyId, bool[] memory isFarmingStrategy, string[] memory strategyTokenURI, bytes32[] memory strategyExtra ) { PlatformStorage storage $ = _getStorage(); address factory_ = $.factory; if (factory_ == address(0)) { revert NotExist(); } platformAddresses = new address[](9); 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; ISwapper _swapper = ISwapper($.swapper); bcAssets = _swapper.bcAssets(); dexAggregators_ = $.dexAggregators.values(); IFactory _factory = IFactory(factory_); (vaultType,,,, vaultBuildingPrice, vaultExtra) = _factory.vaultTypes(); (strategyId,,, isFarmingStrategy,, strategyTokenURI, strategyExtra) = _factory.strategies(); } /// @inheritdoc IPlatform //slither-disable-next-line unused-return 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 ) { PlatformStorage storage $ = _getStorage(); token = ISwapper($.swapper).allAssets(); IPriceReader _priceReader = IPriceReader($.priceReader); uint len = token.length; tokenPrice = new uint[](len); tokenUserBalance = new uint[](len); // nosemgrep for (uint i; i < len; ++i) { //slither-disable-next-line calls-loop (tokenPrice[i],) = _priceReader.getPrice(token[i]); //slither-disable-next-line calls-loop tokenUserBalance[i] = IERC20(token[i]).balanceOf(yourAccount); } vault = IVaultManager($.vaultManager).vaultAddresses(); len = vault.length; vaultSharePrice = new uint[](len); vaultUserBalance = new uint[](len); // nosemgrep for (uint i; i < len; ++i) { //slither-disable-next-line calls-loop unused-return (vaultSharePrice[i],) = IVault(vault[i]).price(); //slither-disable-next-line calls-loop vaultUserBalance[i] = IERC20(vault[i]).balanceOf(yourAccount); } len = 3; nft = new address[](len); nft[0] = $.buildingPermitToken; nft[1] = $.vaultManager; nft[2] = $.strategyLogic; nftUserBalance = new uint[](len); // nosemgrep for (uint i; i < len; ++i) { //slither-disable-next-line calls-loop if (nft[i] != address(0)) { nftUserBalance[i] = IERC721(nft[i]).balanceOf(yourAccount); } } buildingPayPerVaultTokenBalance = IERC20($.buildingPayPerVaultToken).balanceOf(yourAccount); } /// @inheritdoc IPlatform function platformVersion() external view returns (string memory) { PlatformStorage storage $ = _getStorage(); return $.platformVersion; } /// @inheritdoc IPlatform function governance() external view returns (address) { PlatformStorage storage $ = _getStorage(); return $.governance; } /// @inheritdoc IPlatform function multisig() external view returns (address) { PlatformStorage storage $ = _getStorage(); return $.multisig; } /// @inheritdoc IPlatform function buildingPayPerVaultToken() external view returns (address) { PlatformStorage storage $ = _getStorage(); return $.buildingPayPerVaultToken; } /// @inheritdoc IPlatform function buildingPermitToken() external view returns (address) { PlatformStorage storage $ = _getStorage(); return $.buildingPermitToken; } /// @inheritdoc IPlatform function ecosystemRevenueReceiver() external view returns (address) { PlatformStorage storage $ = _getStorage(); return $.ecosystemRevenueReceiver; } /// @inheritdoc IPlatform function targetExchangeAsset() external view returns (address) { PlatformStorage storage $ = _getStorage(); return $.targetExchangeAsset; } /// @inheritdoc IPlatform function factory() external view returns (address) { PlatformStorage storage $ = _getStorage(); return $.factory; } /// @inheritdoc IPlatform function vaultManager() external view returns (address) { PlatformStorage storage $ = _getStorage(); return $.vaultManager; } /// @inheritdoc IPlatform function strategyLogic() external view returns (address) { PlatformStorage storage $ = _getStorage(); return $.strategyLogic; } /// @inheritdoc IPlatform function priceReader() external view returns (address) { PlatformStorage storage $ = _getStorage(); return $.priceReader; } /// @inheritdoc IPlatform function aprOracle() external view returns (address) { PlatformStorage storage $ = _getStorage(); return $.aprOracle; } /// @inheritdoc IPlatform function swapper() external view returns (address) { PlatformStorage storage $ = _getStorage(); return $.swapper; } /// @inheritdoc IPlatform function hardWorker() external view returns (address) { PlatformStorage storage $ = _getStorage(); return $.hardWorker; } /// @inheritdoc IPlatform function rebalancer() external view returns (address) { PlatformStorage storage $ = _getStorage(); return $.rebalancer; } /// @inheritdoc IPlatform function zap() external view returns (address) { PlatformStorage storage $ = _getStorage(); return $.zap; } /// @inheritdoc IPlatform function bridge() external view returns (address) { PlatformStorage storage $ = _getStorage(); return $.bridge; } /// @inheritdoc IPlatform function minInitialBoostDuration() external view returns (uint) { PlatformStorage storage $ = _getStorage(); return $.minInitialBoostDuration; } /// @inheritdoc IPlatform function minInitialBoostPerDay() external view returns (uint) { PlatformStorage storage $ = _getStorage(); return $.minInitialBoostPerDay; } /// @inheritdoc IPlatform function networkExtra() external view returns (bytes32) { PlatformStorage storage $ = _getStorage(); return $.networkExtra; } /// @inheritdoc IPlatform function networkName() external view returns (string memory) { PlatformStorage storage $ = _getStorage(); return $.networkName; } /// @inheritdoc IPlatform function platformUpgradeTimelock() external view returns (uint) { PlatformStorage storage $ = _getStorage(); return $.platformUpgradeTimelock; } /// @inheritdoc IPlatform function minTvlForFreeHardWork() external view returns (uint) { PlatformStorage storage $ = _getStorage(); return $.minTvlForFreeHardWork; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL LOGIC */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ function _setFees( uint fee, uint feeShareVaultManager, uint feeShareStrategyLogic, uint feeShareEcosystem ) internal { PlatformStorage storage $ = _getStorage(); address ecosystemRevenueReceiver_ = $.ecosystemRevenueReceiver; // nosemgrep if (feeShareEcosystem != 0 && ecosystemRevenueReceiver_ == address(0)) { revert IControllable.IncorrectZeroArgument(); // revert IncorrectFee(0,0); } if (fee < MIN_FEE || fee > MAX_FEE) { revert IncorrectFee(MIN_FEE, MAX_FEE); } if (feeShareVaultManager < MIN_FEE_SHARE_VAULT_MANAGER) { revert IncorrectFee(MIN_FEE_SHARE_VAULT_MANAGER, 0); } if (feeShareStrategyLogic < MIN_FEE_SHARE_STRATEGY_LOGIC) { revert IncorrectFee(MIN_FEE_SHARE_STRATEGY_LOGIC, 0); } if (feeShareVaultManager + feeShareStrategyLogic + feeShareEcosystem > ConstantsLib.DENOMINATOR) { revert IncorrectFee(0, ConstantsLib.DENOMINATOR); } $.fee = fee; $.feeShareVaultManager = feeShareVaultManager; $.feeShareStrategyLogic = feeShareStrategyLogic; $.feeShareEcosystem = feeShareEcosystem; emit FeesChanged(fee, feeShareVaultManager, feeShareStrategyLogic, feeShareEcosystem); } function _setInitialBoost(uint minInitialBoostPerDay_, uint minInitialBoostDuration_) internal { PlatformStorage storage $ = _getStorage(); $.minInitialBoostPerDay = minInitialBoostPerDay_; $.minInitialBoostDuration = minInitialBoostDuration_; emit MinInitialBoostChanged(minInitialBoostPerDay_, minInitialBoostDuration_); } /** * @dev Adds tokens to a specified token set. * @param tokenSet The target token set. * @param tokens Array of tokens to be added. */ function _addTokens(EnumerableSet.AddressSet storage tokenSet, address[] memory tokens) internal { uint len = tokens.length; // nosemgrep for (uint i = 0; i < len; ++i) { if (!tokenSet.add(tokens[i])) { revert TokenAlreadyExistsInSet({token: tokens[i]}); } } } function _getStorage() private pure returns (PlatformStorage storage $) { //slither-disable-next-line assembly assembly { $.slot := PLATFORM_STORAGE_LOCATION } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableMap.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableMap.js. pragma solidity ^0.8.20; import {EnumerableSet} from "./EnumerableSet.sol"; /** * @dev Library for managing an enumerable variant of Solidity's * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] * type. * * Maps have the following properties: * * - Entries are added, removed, and checked for existence in constant time * (O(1)). * - Entries are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableMap for EnumerableMap.UintToAddressMap; * * // Declare a set state variable * EnumerableMap.UintToAddressMap private myMap; * } * ``` * * The following map types are supported: * * - `uint256 -> address` (`UintToAddressMap`) since v3.0.0 * - `address -> uint256` (`AddressToUintMap`) since v4.6.0 * - `bytes32 -> bytes32` (`Bytes32ToBytes32Map`) since v4.6.0 * - `uint256 -> uint256` (`UintToUintMap`) since v4.7.0 * - `bytes32 -> uint256` (`Bytes32ToUintMap`) since v4.7.0 * * [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 EnumerableMap, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableMap. * ==== */ library EnumerableMap { using EnumerableSet for EnumerableSet.Bytes32Set; // To implement this library for multiple types with as little code repetition as possible, we write it in // terms of a generic Map type with bytes32 keys and values. The Map implementation uses private functions, // and user-facing implementations such as `UintToAddressMap` are just wrappers around the underlying Map. // This means that we can only create new EnumerableMaps for types that fit in bytes32. /** * @dev Query for a nonexistent map key. */ error EnumerableMapNonexistentKey(bytes32 key); struct Bytes32ToBytes32Map { // Storage of keys EnumerableSet.Bytes32Set _keys; mapping(bytes32 key => bytes32) _values; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(Bytes32ToBytes32Map storage map, bytes32 key, bytes32 value) internal returns (bool) { map._values[key] = value; return map._keys.add(key); } /** * @dev Removes a key-value pair from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(Bytes32ToBytes32Map storage map, bytes32 key) internal returns (bool) { delete map._values[key]; return map._keys.remove(key); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool) { return map._keys.contains(key); } /** * @dev Returns the number of key-value pairs in the map. O(1). */ function length(Bytes32ToBytes32Map storage map) internal view returns (uint256) { return map._keys.length(); } /** * @dev Returns the key-value pair stored at position `index` in the map. O(1). * * Note that there are no guarantees on the ordering of entries inside the * array, and it may change when more entries are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32ToBytes32Map storage map, uint256 index) internal view returns (bytes32, bytes32) { bytes32 key = map._keys.at(index); return (key, map._values[key]); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool, bytes32) { bytes32 value = map._values[key]; if (value == bytes32(0)) { return (contains(map, key), bytes32(0)); } else { return (true, value); } } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bytes32) { bytes32 value = map._values[key]; if (value == 0 && !contains(map, key)) { revert EnumerableMapNonexistentKey(key); } return value; } /** * @dev Return the an array containing all the keys * * 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 map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(Bytes32ToBytes32Map storage map) internal view returns (bytes32[] memory) { return map._keys.values(); } // UintToUintMap struct UintToUintMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(UintToUintMap storage map, uint256 key, uint256 value) internal returns (bool) { return set(map._inner, bytes32(key), bytes32(value)); } /** * @dev Removes a value from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToUintMap storage map, uint256 key) internal returns (bool) { return remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToUintMap storage map, uint256 key) internal view returns (bool) { return contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToUintMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the map. 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(UintToUintMap storage map, uint256 index) internal view returns (uint256, uint256) { (bytes32 key, bytes32 value) = at(map._inner, index); return (uint256(key), uint256(value)); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(UintToUintMap storage map, uint256 key) internal view returns (bool, uint256) { (bool success, bytes32 value) = tryGet(map._inner, bytes32(key)); return (success, uint256(value)); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToUintMap storage map, uint256 key) internal view returns (uint256) { return uint256(get(map._inner, bytes32(key))); } /** * @dev Return the an array containing all the keys * * 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 map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(UintToUintMap storage map) internal view returns (uint256[] memory) { bytes32[] memory store = keys(map._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintToAddressMap struct UintToAddressMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) { return set(map._inner, bytes32(key), bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) { return contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToAddressMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the map. 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(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = at(map._inner, index); return (uint256(key), address(uint160(uint256(value)))); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) { (bool success, bytes32 value) = tryGet(map._inner, bytes32(key)); return (success, address(uint160(uint256(value)))); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToAddressMap storage map, uint256 key) internal view returns (address) { return address(uint160(uint256(get(map._inner, bytes32(key))))); } /** * @dev Return the an array containing all the keys * * 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 map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(UintToAddressMap storage map) internal view returns (uint256[] memory) { bytes32[] memory store = keys(map._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressToUintMap struct AddressToUintMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(AddressToUintMap storage map, address key, uint256 value) internal returns (bool) { return set(map._inner, bytes32(uint256(uint160(key))), bytes32(value)); } /** * @dev Removes a value from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(AddressToUintMap storage map, address key) internal returns (bool) { return remove(map._inner, bytes32(uint256(uint160(key)))); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(AddressToUintMap storage map, address key) internal view returns (bool) { return contains(map._inner, bytes32(uint256(uint160(key)))); } /** * @dev Returns the number of elements in the map. O(1). */ function length(AddressToUintMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the map. 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(AddressToUintMap storage map, uint256 index) internal view returns (address, uint256) { (bytes32 key, bytes32 value) = at(map._inner, index); return (address(uint160(uint256(key))), uint256(value)); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(AddressToUintMap storage map, address key) internal view returns (bool, uint256) { (bool success, bytes32 value) = tryGet(map._inner, bytes32(uint256(uint160(key)))); return (success, uint256(value)); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(AddressToUintMap storage map, address key) internal view returns (uint256) { return uint256(get(map._inner, bytes32(uint256(uint160(key))))); } /** * @dev Return the an array containing all the keys * * 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 map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(AddressToUintMap storage map) internal view returns (address[] memory) { bytes32[] memory store = keys(map._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // Bytes32ToUintMap struct Bytes32ToUintMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(Bytes32ToUintMap storage map, bytes32 key, uint256 value) internal returns (bool) { return set(map._inner, key, bytes32(value)); } /** * @dev Removes a value from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(Bytes32ToUintMap storage map, bytes32 key) internal returns (bool) { return remove(map._inner, key); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool) { return contains(map._inner, key); } /** * @dev Returns the number of elements in the map. O(1). */ function length(Bytes32ToUintMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the map. 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(Bytes32ToUintMap storage map, uint256 index) internal view returns (bytes32, uint256) { (bytes32 key, bytes32 value) = at(map._inner, index); return (key, uint256(value)); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool, uint256) { (bool success, bytes32 value) = tryGet(map._inner, key); return (success, uint256(value)); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(Bytes32ToUintMap storage map, bytes32 key) internal view returns (uint256) { return uint256(get(map._inner, key)); } /** * @dev Return the an array containing all the keys * * 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 map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(Bytes32ToUintMap storage map) internal view returns (bytes32[] memory) { bytes32[] memory store = keys(map._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// 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/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 pragma solidity ^0.8.23; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; import "../libs/SlotsLib.sol"; import "../../interfaces/IControllable.sol"; import "../../interfaces/IPlatform.sol"; /// @dev Base core contract. /// It store an immutable platform proxy address in the storage and provides access control to inherited contracts. /// @author Alien Deployer (https://github.com/a17) /// @author 0xhokugava (https://github.com/0xhokugava) abstract contract Controllable is Initializable, IControllable, ERC165 { using SlotsLib for bytes32; string public constant CONTROLLABLE_VERSION = "1.0.0"; bytes32 internal constant _PLATFORM_SLOT = bytes32(uint(keccak256("eip1967.controllable.platform")) - 1); bytes32 internal constant _CREATED_BLOCK_SLOT = bytes32(uint(keccak256("eip1967.controllable.created_block")) - 1); /// @dev Prevent implementation init constructor() { _disableInitializers(); } /// @notice Initialize contract after setup it as proxy implementation /// Save block.timestamp in the "created" variable /// @dev Use it only once after first logic setup /// @param platform_ Platform address //slither-disable-next-line naming-convention function __Controllable_init(address platform_) internal onlyInitializing { if (platform_ == address(0) || IPlatform(platform_).multisig() == address(0)) { revert IncorrectZeroArgument(); } SlotsLib.set(_PLATFORM_SLOT, platform_); // syntax for forge coverage _CREATED_BLOCK_SLOT.set(block.number); emit ContractInitialized(platform_, block.timestamp, block.number); } modifier onlyGovernance() { _requireGovernance(); _; } modifier onlyMultisig() { _requireMultisig(); _; } modifier onlyGovernanceOrMultisig() { _requireGovernanceOrMultisig(); _; } modifier onlyOperator() { _requireOperator(); _; } modifier onlyFactory() { _requireFactory(); _; } // ************* SETTERS/GETTERS ******************* /// @inheritdoc IControllable function platform() public view override returns (address) { return _PLATFORM_SLOT.getAddress(); } /// @inheritdoc IControllable function createdBlock() external view override returns (uint) { return _CREATED_BLOCK_SLOT.getUint(); } /// @inheritdoc IERC165 function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IControllable).interfaceId || super.supportsInterface(interfaceId); } function _requireGovernance() internal view { if (IPlatform(platform()).governance() != msg.sender) { revert NotGovernance(); } } function _requireMultisig() internal view { if (!IPlatform(platform()).isOperator(msg.sender)) { revert NotMultisig(); } } function _requireGovernanceOrMultisig() internal view { IPlatform _platform = IPlatform(platform()); // nosemgrep if (_platform.governance() != msg.sender && _platform.multisig() != msg.sender) { revert NotGovernanceAndNotMultisig(); } } function _requireOperator() internal view { if (!IPlatform(platform()).isOperator(msg.sender)) { revert NotOperator(); } } function _requireFactory() internal view { if (IPlatform(platform()).factory() != msg.sender) { revert NotFactory(); } } }
// 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 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; /// @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 ); // todo add vaultSymbol, vaultName /// @notice Front-end balances, prices and vault list viewer /// @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/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 initizlization addresses for deployVaultAndStrategy method /// @param vaultInitNums Vault initizlization uint numbers for deployVaultAndStrategy method /// @param strategyInitAddresses Strategy initizlization addresses for deployVaultAndStrategy method /// @param strategyInitNums Strategy initizlization uint numbers for deployVaultAndStrategy method /// @param strategyInitTicks Strategy initizlization 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 returns (bytes32); /// @notice Available variants of new vault for creating. /// 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 initizlization addresses for deployVaultAndStrategy method for all building variants. /// @return vaultInitNums Vault initizlization uint numbers for deployVaultAndStrategy method for all building variants. /// @return strategyInitAddresses Strategy initizlization addresses for deployVaultAndStrategy method for all building variants. /// @return strategyInitNums Strategy initizlization uint numbers for deployVaultAndStrategy method for all building variants. /// @return strategyInitTicks Strategy initizlization 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; /// @dev Proxy of core contract implementation interface IProxy { /// @dev Initialize proxy logic. Need to call after deploy new proxy. /// @param logic Address of core contract implementation function initProxy(address logic) external; /// @notice Upgrade proxy implementation (contract logic). /// @dev Upgrade execution allowed only for Platform contract. /// An upgrade of any core contract proxy is always part of a platform time locked upgrade, /// with a change in the platform version. /// @param newImplementation New implementation address function upgrade(address newImplementation) external; /// @notice Return current logic implementation /// @return Address of implementation contract function implementation() external view returns (address); }
// 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/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. /// 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 */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @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 // 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/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) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._initialized = 1; if (isTopLevelCall) { $._initializing = true; } _; if (isTopLevelCall) { $._initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._initialized = version; $._initializing = true; _; $._initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; /// @title Minimal library for setting / getting slot variables (used in upgradable proxy contracts) library SlotsLib { /// @dev Gets a slot as an address function getAddress(bytes32 slot) internal view returns (address result) { assembly { result := sload(slot) } } /// @dev Gets a slot as uint256 function getUint(bytes32 slot) internal view returns (uint result) { assembly { result := sload(slot) } } /// @dev Sets a slot with address /// @notice Check address for 0 at the setter function set(bytes32 slot, address value) internal { assembly { sstore(slot, value) } } /// @dev Sets a slot with uint function set(bytes32 slot, uint value) internal { assembly { sstore(slot, value) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; /// @dev Base core interface implemented by most platform contracts. /// Inherited contracts store an immutable Platform proxy address in the storage, /// which provides authorization capabilities and infrastructure contract addresses. /// @author Alien Deployer (https://github.com/a17) /// @author JodsMigel (https://github.com/JodsMigel) interface IControllable { //region ----- Custom Errors ----- error IncorrectZeroArgument(); error IncorrectMsgSender(); error NotGovernance(); error NotMultisig(); error NotGovernanceAndNotMultisig(); error NotOperator(); error NotFactory(); error NotPlatform(); error NotVault(); error IncorrectArrayLength(); error AlreadyExist(); error NotExist(); error NotTheOwner(); error ETHTransferFailed(); error IncorrectInitParams(); //endregion -- Custom Errors ----- event ContractInitialized(address platform, uint ts, uint block); /// @notice Stability Platform main contract address function platform() external view returns (address); /// @notice Version of contract implementation /// @dev SemVer scheme MAJOR.MINOR.PATCH //slither-disable-next-line naming-convention function VERSION() external view returns (string memory); /// @notice Block number when contract was initialized function createdBlock() external view returns (uint); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { uint256 localValue = value; bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = HEX_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal * representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/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 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 // 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" }, "src/core/libs/DeployerLib.sol": { "DeployerLib": "0x29613385F8808A04E593163a2867f3F3D4a1BD8B" }, "src/core/libs/FactoryLib.sol": { "FactoryLib": "0x06e0912b4f2E36cfcF9556478352AFC2d991919F" }, "src/core/libs/FactoryNamingLib.sol": { "FactoryNamingLib": "0x3110a397362465b6Ad45703DE9DEa2CC2Ae6C3B3" }, "src/core/libs/StrategyLogicLib.sol": { "StrategyLogicLib": "0xCA26bF5d5B610EB3E48041Dd7eb5Ce57475fB878" }, "src/core/libs/VaultBaseLib.sol": { "VaultBaseLib": "0xD728c9C834985f583B1d0C29f84D80d1EF75A609" }, "src/core/libs/VaultManagerLib.sol": { "VaultManagerLib": "0xE080ED61824494De0b191597e907Ee458F47c64b" }, "src/strategies/libs/LPStrategyLib.sol": { "LPStrategyLib": "0xda05a4EC440C6E3A253d37652F1907118c06079a" }, "src/strategies/libs/StrategyLib.sol": { "StrategyLib": "0xc2dE381a066FD7282aF33378664161a8fc180796" }, "src/strategies/libs/UniswapV3MathLib.sol": { "UniswapV3MathLib": "0xbbc63ee4a06bf1F2432ccC4d70103e3D465fcA39" } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"dexAggRouter","type":"address"}],"name":"AggregatorNotExists","type":"error"},{"inputs":[],"name":"AlreadyAnnounced","type":"error"},{"inputs":[],"name":"AlreadyExist","type":"error"},{"inputs":[],"name":"ETHTransferFailed","type":"error"},{"inputs":[{"internalType":"bytes32","name":"key","type":"bytes32"}],"name":"EnumerableMapNonexistentKey","type":"error"},{"inputs":[],"name":"IncorrectArrayLength","type":"error"},{"inputs":[{"internalType":"uint256","name":"minFee","type":"uint256"},{"internalType":"uint256","name":"maxFee","type":"uint256"}],"name":"IncorrectFee","type":"error"},{"inputs":[],"name":"IncorrectInitParams","type":"error"},{"inputs":[],"name":"IncorrectMsgSender","type":"error"},{"inputs":[],"name":"IncorrectZeroArgument","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NoNewVersion","type":"error"},{"inputs":[],"name":"NotEnoughAllowedBBToken","type":"error"},{"inputs":[],"name":"NotExist","type":"error"},{"inputs":[],"name":"NotFactory","type":"error"},{"inputs":[],"name":"NotGovernance","type":"error"},{"inputs":[],"name":"NotGovernanceAndNotMultisig","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"NotMultisig","type":"error"},{"inputs":[],"name":"NotOperator","type":"error"},{"inputs":[],"name":"NotPlatform","type":"error"},{"inputs":[],"name":"NotTheOwner","type":"error"},{"inputs":[],"name":"NotVault","type":"error"},{"inputs":[],"name":"SameVersion","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"TokenAlreadyExistsInSet","type":"error"},{"inputs":[{"internalType":"uint256","name":"TimerTimestamp","type":"uint256"}],"name":"UpgradeTimerIsNotOver","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"AddAllowedBoostRewardToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"allowedBoostRewardToken","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"defaultBoostRewardToken","type":"address[]"}],"name":"AddBoostTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"AddDefaultBoostRewardToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"router","type":"address"}],"name":"AddDexAggregator","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"multisig_","type":"address"},{"indexed":false,"internalType":"address","name":"factory_","type":"address"},{"indexed":false,"internalType":"address","name":"priceReader_","type":"address"},{"indexed":false,"internalType":"address","name":"swapper_","type":"address"},{"indexed":false,"internalType":"address","name":"buildingPermitToken_","type":"address"},{"indexed":false,"internalType":"address","name":"vaultManager_","type":"address"},{"indexed":false,"internalType":"address","name":"strategyLogic_","type":"address"},{"indexed":false,"internalType":"address","name":"aprOracle_","type":"address"},{"indexed":false,"internalType":"address","name":"hardWorker","type":"address"},{"indexed":false,"internalType":"address","name":"rebalancer","type":"address"},{"indexed":false,"internalType":"address","name":"zap","type":"address"},{"indexed":false,"internalType":"address","name":"bridge","type":"address"}],"name":"Addresses","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"bbToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"vaultToUse","type":"uint256"}],"name":"AllowedBBTokenVaultUsed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"bridge_","type":"address"}],"name":"Bridge","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"oldVersion","type":"string"},{"indexed":false,"internalType":"string","name":"newVersion","type":"string"}],"name":"CancelUpgrade","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"platform","type":"address"},{"indexed":false,"internalType":"uint256","name":"ts","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"block","type":"uint256"}],"name":"ContractInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"vault","type":"address"},{"indexed":false,"internalType":"uint256","name":"platformFee","type":"uint256"}],"name":"CustomVaultFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"receiver","type":"address"}],"name":"EcosystemRevenueReceiver","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feeShareVaultManager","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feeShareStrategyLogic","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feeShareEcosystem","type":"uint256"}],"name":"FeesChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"minInitialBoostPerDay","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minInitialBoostDuration","type":"uint256"}],"name":"MinInitialBoostChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"MinTvlForFreeHardWorkChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"id","type":"string"},{"indexed":false,"internalType":"address","name":"proxy","type":"address"}],"name":"NewAmmAdapter","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"operator","type":"address"}],"name":"OperatorAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"operator","type":"address"}],"name":"OperatorRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"version","type":"string"}],"name":"PlatformVersion","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"proxy","type":"address"},{"indexed":false,"internalType":"address","name":"implementation","type":"address"},{"indexed":false,"internalType":"string","name":"oldContractVersion","type":"string"},{"indexed":false,"internalType":"string","name":"newContractVersion","type":"string"}],"name":"ProxyUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"rebalancer_","type":"address"}],"name":"Rebalancer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"bbToken","type":"address"}],"name":"RemoveAllowedBBToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"RemoveAllowedBoostRewardToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"RemoveDefaultBoostRewardToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"router","type":"address"}],"name":"RemoveDexAggregator","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"bbToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"vaultsToBuild","type":"uint256"},{"indexed":false,"internalType":"bool","name":"firstSet","type":"bool"}],"name":"SetAllowedBBTokenVaults","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"oldVersion","type":"string"},{"indexed":false,"internalType":"string","name":"newVersion","type":"string"},{"indexed":false,"internalType":"address[]","name":"proxies","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"newImplementations","type":"address[]"},{"indexed":false,"internalType":"uint256","name":"timelock","type":"uint256"}],"name":"UpgradeAnnounce","type":"event"},{"inputs":[],"name":"CONTROLLABLE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_FEE_SHARE_STRATEGY_LOGIC","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_FEE_SHARE_VAULT_MANAGER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TIME_LOCK","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"addAllowedBoostRewardToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"id","type":"string"},{"internalType":"address","name":"proxy","type":"address"}],"name":"addAmmAdapter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"allowedBoostRewardToken","type":"address[]"},{"internalType":"address[]","name":"defaultBoostRewardToken","type":"address[]"}],"name":"addBoostTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"addDefaultBoostRewardToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"dexAggRouter","type":"address[]"}],"name":"addDexAggregators","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"addOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"allowedBBTokenVaults","outputs":[{"internalType":"uint256","name":"vaultsLimit","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allowedBBTokenVaults","outputs":[{"internalType":"address[]","name":"bbToken","type":"address[]"},{"internalType":"uint256[]","name":"vaultsLimit","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allowedBBTokenVaultsFiltered","outputs":[{"internalType":"address[]","name":"bbToken","type":"address[]"},{"internalType":"uint256[]","name":"vaultsLimit","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allowedBBTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allowedBoostRewardTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"ammAdapterIdHash","type":"bytes32"}],"name":"ammAdapter","outputs":[{"components":[{"internalType":"string","name":"id","type":"string"},{"internalType":"address","name":"proxy","type":"address"}],"internalType":"struct IPlatform.AmmAdapter","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"newVersion","type":"string"},{"internalType":"address[]","name":"proxies","type":"address[]"},{"internalType":"address[]","name":"newImplementations","type":"address[]"}],"name":"announcePlatformUpgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"aprOracle","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bridge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buildingPayPerVaultToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buildingPermitToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cancelUpgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"createdBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultBoostRewardTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addressToRemove","type":"address"}],"name":"defaultBoostRewardTokensFiltered","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dexAggregators","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ecosystemRevenueReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAmmAdapters","outputs":[{"internalType":"string[]","name":"ids","type":"string[]"},{"internalType":"address[]","name":"proxies","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"yourAccount","type":"address"}],"name":"getBalance","outputs":[{"internalType":"address[]","name":"token","type":"address[]"},{"internalType":"uint256[]","name":"tokenPrice","type":"uint256[]"},{"internalType":"uint256[]","name":"tokenUserBalance","type":"uint256[]"},{"internalType":"address[]","name":"vault","type":"address[]"},{"internalType":"uint256[]","name":"vaultSharePrice","type":"uint256[]"},{"internalType":"uint256[]","name":"vaultUserBalance","type":"uint256[]"},{"internalType":"address[]","name":"nft","type":"address[]"},{"internalType":"uint256[]","name":"nftUserBalance","type":"uint256[]"},{"internalType":"uint256","name":"buildingPayPerVaultTokenBalance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"}],"name":"getCustomVaultFee","outputs":[{"internalType":"uint256","name":"fee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getData","outputs":[{"internalType":"address[]","name":"platformAddresses","type":"address[]"},{"internalType":"address[]","name":"bcAssets","type":"address[]"},{"internalType":"address[]","name":"dexAggregators_","type":"address[]"},{"internalType":"string[]","name":"vaultType","type":"string[]"},{"internalType":"bytes32[]","name":"vaultExtra","type":"bytes32[]"},{"internalType":"uint256[]","name":"vaultBuildingPrice","type":"uint256[]"},{"internalType":"string[]","name":"strategyId","type":"string[]"},{"internalType":"bool[]","name":"isFarmingStrategy","type":"bool[]"},{"internalType":"string[]","name":"strategyTokenURI","type":"string[]"},{"internalType":"bytes32[]","name":"strategyExtra","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFees","outputs":[{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"feeShareVaultManager","type":"uint256"},{"internalType":"uint256","name":"feeShareStrategyLogic","type":"uint256"},{"internalType":"uint256","name":"feeShareEcosystem","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPlatformSettings","outputs":[{"components":[{"internalType":"string","name":"networkName","type":"string"},{"internalType":"bytes32","name":"networkExtra","type":"bytes32"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"feeShareVaultManager","type":"uint256"},{"internalType":"uint256","name":"feeShareStrategyLogic","type":"uint256"},{"internalType":"uint256","name":"feeShareEcosystem","type":"uint256"},{"internalType":"uint256","name":"minInitialBoostPerDay","type":"uint256"},{"internalType":"uint256","name":"minInitialBoostDuration","type":"uint256"}],"internalType":"struct IPlatform.PlatformSettings","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hardWorker","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"multisig_","type":"address"},{"internalType":"string","name":"version","type":"string"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"dexAggRouter","type":"address"}],"name":"isAllowedDexAggregatorRouter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"isOperator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minInitialBoostDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minInitialBoostPerDay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minTvlForFreeHardWork","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"multisig","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"networkExtra","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"networkName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operatorsList","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingPlatformUpgrade","outputs":[{"components":[{"internalType":"string","name":"newVersion","type":"string"},{"internalType":"address[]","name":"proxies","type":"address[]"},{"internalType":"address[]","name":"newImplementations","type":"address[]"}],"internalType":"struct IPlatform.PlatformUpgrade","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"platform","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"platformUpgradeTimelock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"platformVersion","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceReader","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rebalancer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"bbToken","type":"address"}],"name":"removeAllowedBBToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"removeAllowedBoostRewardToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"removeDefaultBoostRewardToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"dexAggRouter","type":"address"}],"name":"removeDexAggregator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"removeOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"bbToken","type":"address"},{"internalType":"uint256","name":"vaultsToBuild","type":"uint256"}],"name":"setAllowedBBTokenVaults","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"uint256","name":"platformFee","type":"uint256"}],"name":"setCustomVaultFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"setEcosystemRevenueReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"feeShareVaultManager","type":"uint256"},{"internalType":"uint256","name":"feeShareStrategyLogic","type":"uint256"},{"internalType":"uint256","name":"feeShareEcosystem","type":"uint256"}],"name":"setFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"minInitialBoostPerDay_","type":"uint256"},{"internalType":"uint256","name":"minInitialBoostDuration_","type":"uint256"}],"name":"setInitialBoost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"setMinTvlForFreeHardWork","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"factory","type":"address"},{"internalType":"address","name":"priceReader","type":"address"},{"internalType":"address","name":"swapper","type":"address"},{"internalType":"address","name":"buildingPermitToken","type":"address"},{"internalType":"address","name":"buildingPayPerVaultToken","type":"address"},{"internalType":"address","name":"vaultManager","type":"address"},{"internalType":"address","name":"strategyLogic","type":"address"},{"internalType":"address","name":"aprOracle","type":"address"},{"internalType":"address","name":"targetExchangeAsset","type":"address"},{"internalType":"address","name":"hardWorker","type":"address"},{"internalType":"address","name":"zap","type":"address"},{"internalType":"address","name":"bridge","type":"address"},{"internalType":"address","name":"rebalancer","type":"address"}],"internalType":"struct IPlatform.SetupAddresses","name":"addresses","type":"tuple"},{"components":[{"internalType":"string","name":"networkName","type":"string"},{"internalType":"bytes32","name":"networkExtra","type":"bytes32"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"feeShareVaultManager","type":"uint256"},{"internalType":"uint256","name":"feeShareStrategyLogic","type":"uint256"},{"internalType":"uint256","name":"feeShareEcosystem","type":"uint256"},{"internalType":"uint256","name":"minInitialBoostPerDay","type":"uint256"},{"internalType":"uint256","name":"minInitialBoostDuration","type":"uint256"}],"internalType":"struct IPlatform.PlatformSettings","name":"settings","type":"tuple"}],"name":"setup","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"bridge_","type":"address"}],"name":"setupBridge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"rebalancer_","type":"address"}],"name":"setupRebalancer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"strategyLogic","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swapper","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"targetExchangeAsset","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"upgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"bbToken","type":"address"}],"name":"useAllowedBBTokenVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vaultManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"zap","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801562000010575f80fd5b506200001b62000021565b620000d5565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff1615620000725760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b0390811614620000d25780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b6159ac80620000e35f395ff3fe608060405234801561000f575f80fd5b506004361061044d575f3560e01c80637396195011610242578063bb1afe6811610140578063dd391baf116100bf578063ec1600b211610084578063ec1600b2146108a2578063f399e22e146108b5578063f8b2cb4f146108c8578063ff2f4c73146108f0578063ffa1ad7414610903575f80fd5b8063dd391baf14610858578063de15991b1461086b578063df6617f81461087e578063e0a09c6814610891578063e78cea921461089a575f80fd5b8063cbee570711610105578063cbee570714610805578063cc1fb4e014610818578063d515be5614610820578063d55ec69714610828578063db8d55f114610830575f80fd5b8063bb1afe68146107ce578063bc063e1a146107d6578063c314840f146107df578063c45a0155146107f5578063c5419106146107fd575f80fd5b806394990bd8116101cc578063a91b0e3811610191578063a91b0e3814610798578063ac8a584a146107a0578063aea00d1d146107b3578063b3cf0cfb146107c6578063b5da564814610774575f80fd5b806394990bd8146107595780639870d7fe146107615780639fee2cfa14610774578063a345d0cd1461077d578063a8f43c6714610790575f80fd5b80638006267c116102125780638006267c146106ff578063878571d7146107125780638a4adf241461071a578063922b711b14610722578063936725ec14610735575f80fd5b806373961950146106bd57806373a869bc146106d057806376c7a3c7146106e35780637a547dad146106ec575f80fd5b80633bc5de301161034f57806354aa3d08116102d957806362988af41161029e57806362988af41461067f57806364e20cbd146106875780636d70f7ae1461068f5780636f460dc8146106a25780636fcba377146106aa575f80fd5b806354aa3d081461064a57806355e868de1461065257806355f29166146106675780635aa6e6751461066f57806360997e8514610677575f80fd5b80634783c35b1161031f5780634783c35b1461060c57806349b5fdb4146106145780634bde38c81461061c5780634dba649e14610624578063532d9fbd14610637575f80fd5b80633bc5de30146105b35780634254af1c146105d15780634593144c146105f157806345ade4ad146105f9575f80fd5b806312e0832a116103db578063334cc491116103a0578063334cc4911461056857806335157a581461057057806339597ab51461058557806339665640146105985780633aab685c146105a0575f80fd5b806312e0832a14610535578063262d61521461053d5780632a976e94146105455780632b3297f9146105585780632ce8f10414610560575f80fd5b80630b57f995116104215780630b57f995146104cf5780630d9981e0146104e25780630e6c7cf4146104f55780630f8a634d1461050a578063107bf28c14610520575f80fd5b8062a14d441461045157806301d22ccd1461046657806301ffc9a71461048b578063054e7333146104ae575b5f80fd5b61046461045f36600461480a565b610927565b005b61046e610d7a565b6040516001600160a01b0390911681526020015b60405180910390f35b61049e61049936600461488b565b610d97565b6040519015158152602001610482565b6104c16104bc3660046148b2565b610dcd565b604051908152602001610482565b6104646104dd3660046148b2565b610dee565b61049e6104f03660046148b2565b610e61565b6104fd610e92565b6040516104829190614910565b610512610eb1565b604051610482929190614951565b610528610f7b565b60405161048291906149cb565b6104c1611019565b61046e61102d565b6104646105533660046148b2565b61104a565b61046e6110c8565b61046e6110e5565b6104fd611102565b61057861111b565b60405161048291906149dd565b6104646105933660046148b2565b611204565b61046e61127a565b6104c16105ae3660046148b2565b611297565b6105bb6112c2565b6040516104829a99989796959493929190614ad6565b6105e46105df366004614bb0565b611673565b6040516104829190614bc7565b6104c161175b565b6104646106073660046148b2565b611793565b61046e611809565b61046e611826565b61046e611843565b6104646106323660046148b2565b611872565b610464610645366004614c03565b6118e8565b61046e61195c565b61065a611979565b6040516104829190614c2d565b610464611b0c565b61046e611bfd565b610512611c17565b6104fd611e60565b6104c1611e79565b61049e61069d3660046148b2565b611e8d565b61046e611ebb565b6104646106b8366004614c84565b611ed8565b6104646106cb3660046148b2565b611ef2565b6104646106de366004614cb3565b611f7d565b6104c161138881565b6104646106fa366004614ce4565b612084565b61046461070d366004614d43565b6120ef565b61046e6121e7565b61046e612204565b610464610730366004614d91565b612221565b610528604051806040016040528060058152602001640312e302e360dc1b81525081565b61046e612237565b61046461076f3660046148b2565b612254565b6104c161271081565b61046461078b3660046148b2565b6122ca565b610528612340565b6104c161235c565b6104646107ae3660046148b2565b612370565b6104fd6107c13660046148b2565b6123e6565b6104fd612478565b6104c1612491565b6104c161c35081565b6107e76124a5565b604051610482929190614db1565b61046e6126ef565b6104fd61270c565b6104646108133660046148b2565b612725565b61046e612798565b6104c16127b5565b6104646127c9565b610838612c6e565b604080519485526020850193909352918301526060820152608001610482565b610464610866366004614bb0565b612c9f565b610464610879366004614c03565b612cf7565b61046461088c3660046148b2565b612d67565b6104c161e10081565b61046e612e11565b6104646108b03660046148b2565b612e2e565b6104646108c3366004614dd5565b612eaf565b6108db6108d63660046148b2565b613043565b60405161048299989796959493929190614e17565b6104646108fe366004614f59565b6137c7565b610528604051806040016040528060058152602001640312e312e360dc1b81525081565b61092f613b74565b5f610938613c92565b60158101549091501561095e5760405163a6751d6160e01b815260040160405180910390fd5b82518251811461098157604051630ef9926760e21b815260040160405180910390fd5b5f5b81811015610bb6575f6001600160a01b03168582815181106109a7576109a7615086565b60200260200101516001600160a01b0316036109d6576040516371c42ac360e01b815260040160405180910390fd5b5f6001600160a01b03168482815181106109f2576109f2615086565b60200260200101516001600160a01b031603610a21576040516371c42ac360e01b815260040160405180910390fd5b734f76add676c04eca837130ceb58bc173de8799de6321a49642868381518110610a4d57610a4d615086565b60200260200101516001600160a01b031663ffa1ad746040518163ffffffff1660e01b81526004015f60405180830381865afa158015610a8f573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610ab691908101906150dc565b868481518110610ac857610ac8615086565b60200260200101516001600160a01b031663ffa1ad746040518163ffffffff1660e01b81526004015f60405180830381865afa158015610b0a573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610b3191908101906150dc565b6040518363ffffffff1660e01b8152600401610b4e92919061510d565b602060405180830381865af4158015610b69573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b8d9190615140565b15610bae5760405160016221c56960e11b0319815260040160405180910390fd5b600101610983565b505f826018018054610bc790615159565b80601f0160208091040260200160405190810160405280929190818152602001828054610bf390615159565b8015610c3e5780601f10610c1557610100808354040283529160200191610c3e565b820191905f5260205f20905b815481529060010190602001808311610c2157829003601f168201915b50506040516310d24b2160e11b8152939450734f76add676c04eca837130ceb58bc173de8799de936321a496429350610c7f92508591508a9060040161510d565b602060405180830381865af4158015610c9a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cbe9190615140565b15610cdf5760405160016221c56960e11b0319815260040160405180910390fd5b60148301610ced87826151dd565b508451610d039060158501906020880190614594565b508351610d199060168501906020870190614594565b505f610d2761e100426152b0565b90508084601701819055507f14693df2ca79e2e824b9e873800e5d630e7ef6b241799952899e49f5c3d61e348288888885604051610d699594939291906152c3565b60405180910390a150505050505050565b5f80610d84613c92565b600d01546001600160a01b031692915050565b5f6001600160e01b03198216630f1ec81f60e41b1480610dc757506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f80610dd7613c92565b9050610de6601e820184613cb6565b949350505050565b610df6613b74565b5f610dff613c92565b6040516001600160a01b03841681529091507fb15ef10f9355ef19a10a9cca0b2fe16693884655f12f1b274b9de11bd01842f69060200160405180910390a1600f0180546001600160a01b0319166001600160a01b0392909216919091179055565b5f80610e6b613c92565b6001600160a01b0384165f90815260268201602052604090205490915015155b9392505050565b60605f610e9d613c92565b9050610eab81602301613cdc565b91505090565b6060805f610ebd613c92565b9050610ecb81601e01613ce8565b8051909350806001600160401b03811115610ee857610ee861464c565b604051908082528060200260200182016040528015610f11578160200160208202803683370190505b5092505f5b81811015610f7457610f4d858281518110610f3357610f33615086565b602002602001015184601e01613cb690919063ffffffff16565b9050848281518110610f6157610f61615086565b6020908102919091010152600101610f16565b5050509091565b60605f610f86613c92565b9050806010018054610f9790615159565b80601f0160208091040260200160405190810160405280929190818152602001828054610fc390615159565b801561100e5780601f10610fe55761010080835404028352916020019161100e565b820191905f5260205f20905b815481529060010190602001808311610ff157829003601f168201915b505050505091505090565b5f80611023613c92565b6013015492915050565b5f80611037613c92565b600e01546001600160a01b031692915050565b611052613cf4565b5f61105b613c92565b905061106a6021820183613d83565b611087576040516333e9449d60e21b815260040160405180910390fd5b6040516001600160a01b03831681527fc7605a8c2a587f745fd716ef9e058f894f313f21fe66a475d431e365faa27c3f906020015b60405180910390a15050565b5f806110d2613c92565b600b01546001600160a01b031692915050565b5f806110ef613c92565b600201546001600160a01b031692915050565b60605f61110d613c92565b9050610eab81602101613cdc565b6111236145f7565b5f61112c613c92565b90506111366145f7565b61113e612c6e565b60a085015260808401526060830152604082015260108201805461116190615159565b80601f016020809104026020016040519081016040528092919081815260200182805461118d90615159565b80156111d85780601f106111af576101008083540402835291602001916111d8565b820191905f5260205f20905b8154815290600101906020018083116111bb57829003601f168201915b505050918352505060118201546020820152601282015460c082015260139091015460e0820152919050565b61120c613cf4565b5f611215613c92565b90506112246023820183613d97565b6112415760405163ad5679e160e01b815260040160405180910390fd5b6040516001600160a01b03831681527f913d0cceb9442b7c02b8eae856a0f26a6245df340df8db1ff0a11bb58fd452f4906020016110bc565b5f80611284613c92565b600c01546001600160a01b031692915050565b5f806112a1613c92565b6001600160a01b039093165f908152602b9093016020525050604090205490565b6060806060806060806060806060805f6112da613c92565b60068101549091506001600160a01b0316806113095760405163ad5679e160e01b815260040160405180910390fd5b6040805160098082526101408201909252906020820161012080368337019050509b50808c5f8151811061133f5761133f615086565b6001600160a01b03928316602091820292909201015260078301548d519116908d90600190811061137257611372615086565b6001600160a01b03928316602091820292909201015260088301548d519116908d9060029081106113a5576113a5615086565b6001600160a01b03928316602091820292909201015260028301548d519116908d9060039081106113d8576113d8615086565b6001600160a01b03928316602091820292909201015260038301548d519116908d90600490811061140b5761140b615086565b6001600160a01b03928316602091820292909201015282548d519116908d90600590811061143b5761143b615086565b6001600160a01b03928316602091820292909201015260018301548d519116908d90600690811061146e5761146e615086565b6001600160a01b039283166020918202929092010152600e8301548d519116908d9060079081106114a1576114a1615086565b6001600160a01b039283166020918202929092010152600f8301548d519116908d9060089081106114d4576114d4615086565b6001600160a01b039283166020918202929092010152600b830154604080516331aa6cf560e21b815290519190921691829163c6a9b3d4916004808201925f929091908290030181865afa15801561152e573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526115559190810190615387565b9b5061156383602501613cdc565b9a505f829050806001600160a01b03166336abf3dc6040518163ffffffff1660e01b81526004015f60405180830381865afa1580156115a4573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526115cb91908101906154f1565b909192935090919250909150809c50819b50829d50505050806001600160a01b031663d9f9027f6040518163ffffffff1660e01b81526004015f60405180830381865afa15801561161e573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261164591908101906155db565b9091929394509091929350909150809850819950829a50839b50505050505050505090919293949596979899565b60408051808201909152606081525f60208201525f611690613c92565b905080601a015f8481526020019081526020015f206040518060400160405290815f820180546116bf90615159565b80601f01602080910402602001604051908101604052809291908181526020018280546116eb90615159565b80156117365780601f1061170d57610100808354040283529160200191611736565b820191905f5260205f20905b81548152906001019060200180831161171957829003601f168201915b5050509183525050600191909101546001600160a01b03166020909101529392505050565b5f61178e61178a60017f812a673dfca07956350df10f8a654925f561d7a0da09bdbe79e653939a14d9f16156e9565b5490565b905090565b61179b613cf4565b5f6117a4613c92565b90506117b3601e820183613dab565b6117d05760405163ad5679e160e01b815260040160405180910390fd5b6040516001600160a01b03831681527f164327620fc0e8228e649bc4a379147b84dc96ab396dd4ec9c23903c204fae1f906020016110bc565b5f80611813613c92565b600101546001600160a01b031692915050565b5f80611830613c92565b600901546001600160a01b031692915050565b5f61178e61178a60017faa116a42804728f23983458454b6eb9c6ddf3011db9f9addaf3cd7508d85b0d66156e9565b61187a613cf4565b5f611883613c92565b90506118926021820183613d97565b6118af5760405163ad5679e160e01b815260040160405180910390fd5b6040516001600160a01b03831681527f01022458cedbd7bde667e12d184e4a49ee3341b737a8cf215229e3ae06a0ce8d906020016110bc565b6118f0613b74565b5f6118f9613c92565b604080516001600160a01b0386168152602081018590529192507e04b958f81f06965a6634f3b58554a07646eb77ce1b500fac6fb67fb21c5d01910160405180910390a16001600160a01b039092165f908152602b909201602052604090912055565b5f80611966613c92565b600501546001600160a01b031692915050565b61199d60405180606001604052806060815260200160608152602001606081525090565b5f6119a6613c92565b9050806014016040518060600160405290815f820180546119c690615159565b80601f01602080910402602001604051908101604052809291908181526020018280546119f290615159565b8015611a3d5780601f10611a1457610100808354040283529160200191611a3d565b820191905f5260205f20905b815481529060010190602001808311611a2057829003601f168201915b5050505050815260200160018201805480602002602001604051908101604052809291908181526020018280548015611a9d57602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311611a7f575b5050505050815260200160028201805480602002602001604051908101604052809291908181526020018280548015611afd57602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311611adf575b50505050508152505091505090565b611b14613cf4565b5f611b1d613c92565b905080601701545f03611b435760405163de2d2a5760e01b815260040160405180910390fd5b60408051808201825260058152640312e312e360dc1b602082015290517f027629ebccc4ab0f98063cf8ccd405d331aaceb2f61f023fe7b10b3ae0d0d2e991611b909160148501906156fc565b60405180910390a160408051602081019091525f81526014820190611bb590826151dd565b50604080515f8152602081019182905251611bd4916015840191614594565b50604080515f8152602081019182905251611bf3916016840191614594565b505f601790910155565b5f80611c07613c92565b546001600160a01b031692915050565b6060805f611c23613c92565b90505f611c3282601e01613ce8565b80519091505f816001600160401b03811115611c5057611c5061464c565b604051908082528060200260200182016040528015611c79578160200160208202803683370190505b5090505f805b83811015611d0957611cb6858281518110611c9c57611c9c615086565b602002602001015187601e01613dbf90919063ffffffff16565b838281518110611cc857611cc8615086565b6020026020010181815250505f838281518110611ce757611ce7615086565b60200260200101511115611d0157611cfe82615792565b91505b600101611c7f565b50806001600160401b03811115611d2257611d2261464c565b604051908082528060200260200182016040528015611d4b578160200160208202803683370190505b509650806001600160401b03811115611d6657611d6661464c565b604051908082528060200260200182016040528015611d8f578160200160208202803683370190505b5095505f805b84811015611e5557838181518110611daf57611daf615086565b60200260200101515f0315611e4d57858181518110611dd057611dd0615086565b6020026020010151898381518110611dea57611dea615086565b60200260200101906001600160a01b031690816001600160a01b031681525050838181518110611e1c57611e1c615086565b6020026020010151888381518110611e3657611e36615086565b6020908102919091010152611e4a82615792565b91505b600101611d95565b505050505050509091565b60605f611e6b613c92565b9050610eab81601e01613ce8565b5f80611e83613c92565b6011015492915050565b5f80611e97613c92565b6001600160a01b0384165f908152601d820160205260409020549091501515610e8b565b5f80611ec5613c92565b600301546001600160a01b031692915050565b611ee0613dd3565b611eec84848484613e62565b50505050565b611efa613b74565b6001600160a01b038116611f21576040516371c42ac360e01b815260040160405180910390fd5b5f611f2a613c92565b6004810180546001600160a01b0319166001600160a01b0385169081179091556040519081529091507f7c676a9ea57f4a0e6a379581c6a39f9b4ae37ada549eb00328ebe0f67ce9889b906020016110bc565b611f85613cf4565b5f611f8e613c92565b82519091505f5b81811015611eec575f6001600160a01b0316848281518110611fb957611fb9615086565b60200260200101516001600160a01b031603611fe8576040516371c42ac360e01b815260040160405180910390fd5b612017848281518110611ffd57611ffd615086565b602002602001015184602501613d8390919063ffffffff16565b1561207c577f39df6cfdb2af553b6c1c48f35b52e5ad0c41048656d17a53e86dba2b1d56fcb584828151811061204f5761204f615086565b602002602001015160405161207391906001600160a01b0391909116815260200190565b60405180910390a15b600101611f95565b61208c613cf4565b5f612095613c92565b90506120a48160210184613ff4565b6120b18160230183613ff4565b7f91b5c4ce7115d4e6dc7fb1d7751facb1c981bf008604a17367dcc9c8200d9e9e83836040516120e29291906157aa565b60405180910390a1505050565b6120f7613cf4565b5f612100613c92565b83516020808601919091205f818152601a8401909252604090912060010154919250906001600160a01b03161561214a576040516333e9449d60e21b815260040160405180910390fd5b5f818152601a83016020526040902061216385826151dd565b505f818152601a830160209081526040808320600190810180546001600160a01b0319166001600160a01b038916179055601b86018054918201815584529190922001829055517f3fbba6c5c03e01d729b07cdaad69928911d1d4776a3b730981a3bbb9271c06c1906121d990869086906157bc565b60405180910390a150505050565b5f806121f1613c92565b600801546001600160a01b031692915050565b5f8061220e613c92565b600701546001600160a01b031692915050565b612229613cf4565b612233828261407b565b5050565b5f80612241613c92565b600a01546001600160a01b031692915050565b61225c613b74565b5f612265613c92565b9050612274601c820183613d83565b612291576040516333e9449d60e21b815260040160405180910390fd5b6040516001600160a01b03831681527fac6fa858e9350a46cec16539926e0fde25b7629f84b5a72bffaae4df888ae86d906020016110bc565b6122d2613cf4565b5f6122db613c92565b90506122ea6023820183613d83565b612307576040516333e9449d60e21b815260040160405180910390fd5b6040516001600160a01b03831681527f70510c0f553be5541883456497528db520af63f62da85ce11327e141d7e9eada906020016110bc565b60605f61234b613c92565b9050806018018054610f9790615159565b5f80612366613c92565b6017015492915050565b612378613b74565b5f612381613c92565b9050612390601c820183613d97565b6123ad5760405163ad5679e160e01b815260040160405180910390fd5b6040516001600160a01b03831681527f80c0b871b97b595b16a7741c1b06fed0c6f6f558639f18ccbce50724325dc40d906020016110bc565b60605f6123f1613c92565b9050734f76add676c04eca837130ceb58bc173de8799de63505bb4fa61241983602301613cdc565b856040518363ffffffff1660e01b81526004016124379291906157e5565b5f60405180830381865af4158015612451573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610e8b9190810190615387565b60605f612483613c92565b9050610eab81602501613cdc565b5f8061249b613c92565b6019015492915050565b6060805f6124b1613c92565b601b810154909150806001600160401b038111156124d1576124d161464c565b60405190808252806020026020018201604052801561250457816020015b60608152602001906001900390816124ef5790505b509350806001600160401b0381111561251f5761251f61464c565b604051908082528060200260200182016040528015612548578160200160208202803683370190505b5092505f82601b0180548060200260200160405190810160405280929190818152602001828054801561259857602002820191905f5260205f20905b815481526020019060010190808311612584575b505050505090505f5b828110156126e7575f8282815181106125bc576125bc615086565b602002602001015190505f85601a015f8381526020019081526020015f206040518060400160405290815f820180546125f490615159565b80601f016020809104026020016040519081016040528092919081815260200182805461262090615159565b801561266b5780601f106126425761010080835404028352916020019161266b565b820191905f5260205f20905b81548152906001019060200180831161264e57829003601f168201915b5050509183525050600191909101546001600160a01b031660209091015280518951919250908990859081106126a3576126a3615086565b602002602001018190525080602001518784815181106126c5576126c5615086565b6001600160a01b039092166020928302919091019091015250506001016125a1565b505050509091565b5f806126f9613c92565b600601546001600160a01b031692915050565b60605f612717613c92565b9050610eab81601c01613cdc565b61272d613b74565b5f612736613c92565b6040516001600160a01b03841681529091507fbe16f9da73e1f71a56cb2bba7f4a7c31a28c9745a0d39211ee5b1455b7b4ffe09060200160405180910390a1600d0180546001600160a01b0319166001600160a01b0392909216919091179055565b5f806127a2613c92565b600401546001600160a01b031692915050565b5f806127bf613c92565b6012015492915050565b6127d1613cf4565b5f6127da613c92565b60178101549091505f8190036128035760405163de2d2a5760e01b815260040160405180910390fd5b4281111561282c576040516321ffc5d560e11b8152600481018290526024015b60405180910390fd5b5f826014016040518060600160405290815f8201805461284b90615159565b80601f016020809104026020016040519081016040528092919081815260200182805461287790615159565b80156128c25780601f10612899576101008083540402835291602001916128c2565b820191905f5260205f20905b8154815290600101906020018083116128a557829003601f168201915b505050505081526020016001820180548060200260200160405190810160405280929190818152602001828054801561292257602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311612904575b505050505081526020016002820180548060200260200160405190810160405280929190818152602001828054801561298257602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311612964575b505050919092525050506020810151519091505f5b81811015612bc9575f836020015182815181106129b6576129b6615086565b60200260200101516001600160a01b031663ffa1ad746040518163ffffffff1660e01b81526004015f60405180830381865afa1580156129f8573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052612a1f91908101906150dc565b905083602001518281518110612a3757612a37615086565b60200260200101516001600160a01b0316630900f01085604001518481518110612a6357612a63615086565b60200260200101516040518263ffffffff1660e01b8152600401612a9691906001600160a01b0391909116815260200190565b5f604051808303815f87803b158015612aad575f80fd5b505af1158015612abf573d5f803e3d5ffd5b5050505083602001518281518110612ad957612ad9615086565b60200260200101516001600160a01b03167fb79e887de86d38ec54dda618ce1b439ec0c3514c58d9a1b79f571b6762bfe87385604001518481518110612b2157612b21615086565b60200260200101518387602001518681518110612b4057612b40615086565b60200260200101516001600160a01b031663ffa1ad746040518163ffffffff1660e01b81526004015f60405180830381865afa158015612b82573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052612ba991908101906150dc565b604051612bb893929190615847565b60405180910390a250600101612997565b5081516018850190612bdb90826151dd565b5060408051602081019091525f81526014850190612bf990826151dd565b50604080515f8152602081019182905251612c18916015870191614594565b50604080515f8152602081019182905251612c37916016870191614594565b505f601785015581516040517faedc33a750c6b68c8b2c1de7376e9e4a69f8e5d8cabc6757105a6b3fa1d75701916121d9916149cb565b5f805f805f612c7b613c92565b602781015460288201546029830154602a9093015491989097509195509350915050565b612ca7613b74565b5f612cb0613c92565b601981015460408051918252602082018590529192507f36542355c4238243e42f18a2aea69f0c94db23a46c0f751ae8a74124d6511398910160405180910390a160190155565b612cff613cf4565b5f612d08613c92565b90505f612d19601e830185856140cb565b604080516001600160a01b038716815260208101869052821515918101919091529091507fa2df1b9ad1068670235c77f8bdf05aa68b9bfeafc7a7124f9f5b916b73e7ec16906060016121d9565b612d6f6140e0565b5f612d78613c92565b90505f612d88601e830184613dbf565b90505f8111612daa5760405163d43e2e2760e01b815260040160405180910390fd5b612dc483612db96001846156e9565b601e850191906140cb565b507fd3af71f3b90f30dc8a11b6e5a552bd73ebf945f132aadb051e2291076d5192ae83612df26001846156e9565b604080516001600160a01b0390931683526020830191909152016120e2565b5f80612e1b613c92565b600f01546001600160a01b031692915050565b612e36613cf4565b5f612e3f613c92565b9050612e4e6025820183613d97565b612e7657604051633ccd059360e01b81526001600160a01b0383166004820152602401612823565b6040516001600160a01b03831681527f1894a5125f24cd2598e595dceb1030c5937681a8088af2a60710ea73399573ed906020016110bc565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03165f81158015612ef35750825b90505f826001600160401b03166001148015612f0e5750303b155b905081158015612f1c575080155b15612f3a5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315612f6457845460ff60401b1916600160401b1785555b5f612f6d613c92565b6001810180546001600160a01b0319166001600160a01b038b161790559050612f953061416f565b612fa2601c820133613d83565b50612fb0601c820189613d83565b5060188101612fbf88826151dd565b507faedc33a750c6b68c8b2c1de7376e9e4a69f8e5d8cabc6757105a6b3fa1d7570187604051612fef91906149cb565b60405180910390a150831561303a57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602001610d69565b50505050505050565b6060806060806060806060805f80613059613c92565b905080600b015f9054906101000a90046001600160a01b03166001600160a01b03166376d708d76040518163ffffffff1660e01b81526004015f60405180830381865afa1580156130ac573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526130d39190810190615387565b60098201548151919b506001600160a01b031690806001600160401b038111156130ff576130ff61464c565b604051908082528060200260200182016040528015613128578160200160208202803683370190505b509a50806001600160401b038111156131435761314361464c565b60405190808252806020026020018201604052801561316c578160200160208202803683370190505b5099505f5b818110156132e257826001600160a01b03166341976e098e838151811061319a5761319a615086565b60200260200101516040518263ffffffff1660e01b81526004016131cd91906001600160a01b0391909116815260200190565b6040805180830381865afa1580156131e7573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061320b9190615886565b508c828151811061321e5761321e615086565b6020026020010181815250508c818151811061323c5761323c615086565b60200260200101516001600160a01b03166370a082318f6040518263ffffffff1660e01b815260040161327e91906001600160a01b0391909116815260200190565b602060405180830381865afa158015613299573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906132bd91906158b0565b8b82815181106132cf576132cf615086565b6020908102919091010152600101613171565b50826007015f9054906101000a90046001600160a01b03166001600160a01b03166377205b636040518163ffffffff1660e01b81526004015f60405180830381865afa158015613334573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261335b9190810190615387565b985088519050806001600160401b038111156133795761337961464c565b6040519080825280602002602001820160405280156133a2578160200160208202803683370190505b509750806001600160401b038111156133bd576133bd61464c565b6040519080825280602002602001820160405280156133e6578160200160208202803683370190505b5096505f5b818110156135425789818151811061340557613405615086565b60200260200101516001600160a01b031663a035b1fe6040518163ffffffff1660e01b81526004016040805180830381865afa158015613447573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061346b9190615886565b5089828151811061347e5761347e615086565b60200260200101818152505089818151811061349c5761349c615086565b60200260200101516001600160a01b03166370a082318f6040518263ffffffff1660e01b81526004016134de91906001600160a01b0391909116815260200190565b602060405180830381865afa1580156134f9573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061351d91906158b0565b88828151811061352f5761352f615086565b60209081029190910101526001016133eb565b5050604080516003808252608082019092528160208201606080368337505050600284015481519197506001600160a01b03169087905f9061358657613586615086565b6001600160a01b03928316602091820292909201015260078401548751911690879060019081106135b9576135b9615086565b6001600160a01b03928316602091820292909201015260088401548751911690879060029081106135ec576135ec615086565b60200260200101906001600160a01b031690816001600160a01b031681525050806001600160401b038111156136245761362461464c565b60405190808252806020026020018201604052801561364d578160200160208202803683370190505b5094505f5b81811015613746575f6001600160a01b031687828151811061367657613676615086565b60200260200101516001600160a01b03161461373e5786818151811061369e5761369e615086565b60200260200101516001600160a01b03166370a082318f6040518263ffffffff1660e01b81526004016136e091906001600160a01b0391909116815260200190565b602060405180830381865afa1580156136fb573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061371f91906158b0565b86828151811061373157613731615086565b6020026020010181815250505b600101613652565b5060038301546040516370a0823160e01b81526001600160a01b038f81166004830152909116906370a0823190602401602060405180830381865afa158015613791573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906137b591906158b0565b93505050509193959799909294969850565b6137cf613cf4565b5f6137d8613c92565b60068101549091506001600160a01b031615613807576040516333e9449d60e21b815260040160405180910390fd5b825f0151816006015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055508260200151816009015f6101000a8154816001600160a01b0302191690836001600160a01b03160217905550826040015181600b015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055508260600151816002015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055508260800151816003015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055508260a00151816007015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055508260c00151816008015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055508260e0015181600a015f6101000a8154816001600160a01b0302191690836001600160a01b03160217905550826101000151816005015f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555082610120015181600c015f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555082610180015181600d015f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555082610140015181600e015f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555082610160015181600f015f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555068056bc75e2d6310000081601901819055507fcdf4971b2af8b35e2501a87bd3740a3d0b3e42403f2d09e8c217786b65fe965d816001015f9054906101000a90046001600160a01b0316845f01518560200151866040015187606001518860a001518960c001518a60e001518b61012001518c61018001518d61014001518e6101600151604051613ae39c9b9a999897969594939291906158c7565b60405180910390a181516010820190613afc90826151dd565b5081602001518160110181905550613b268260400151836060015184608001518560a00151613e62565b613b388260c001518360e0015161407b565b6019810154604080515f815260208101929092527f36542355c4238243e42f18a2aea69f0c94db23a46c0f751ae8a74124d651139891016120e2565b5f613b7d611843565b9050336001600160a01b0316816001600160a01b0316635aa6e6756040518163ffffffff1660e01b8152600401602060405180830381865afa158015613bc5573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613be99190615947565b6001600160a01b031614158015613c715750336001600160a01b0316816001600160a01b0316634783c35b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613c41573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613c659190615947565b6001600160a01b031614155b15613c8f576040516354299b6f60e01b815260040160405180910390fd5b50565b7f263d5089de5bb3f97c8effd51f1a153b36e97065a51e67a94885830ed03a7a0090565b5f808080613ccd866001600160a01b0387166142ca565b909450925050505b9250929050565b60605f610e8b83614302565b60605f610e8b8361435b565b613cfc611843565b6040516336b87bd760e11b81523360048201526001600160a01b039190911690636d70f7ae90602401602060405180830381865afa158015613d40573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613d649190615140565b613d8157604051631f0853c160e21b815260040160405180910390fd5b565b5f610e8b836001600160a01b038416614366565b5f610e8b836001600160a01b0384166143b2565b5f610e8b836001600160a01b038416614495565b5f610e8b836001600160a01b0384166144b1565b33613ddc611843565b6001600160a01b0316635aa6e6756040518163ffffffff1660e01b8152600401602060405180830381865afa158015613e17573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613e3b9190615947565b6001600160a01b031614613d8157604051632d5be4cb60e21b815260040160405180910390fd5b5f613e6b613c92565b60048101549091506001600160a01b03168215801590613e9257506001600160a01b038116155b15613eb0576040516371c42ac360e01b815260040160405180910390fd5b611388861080613ec1575061c35086115b15613eeb5760405163dcf6afcb60e01b8152611388600482015261c3506024820152604401612823565b612710851015613f185760405163dcf6afcb60e01b815261271060048201525f6024820152604401612823565b612710841015613f455760405163dcf6afcb60e01b815261271060048201525f6024820152604401612823565b620186a083613f5486886152b0565b613f5e91906152b0565b1115613f885760405163dcf6afcb60e01b81525f6004820152620186a06024820152604401612823565b602782018690556028820185905560298201849055602a82018390556040805187815260208101879052908101859052606081018490527f7027e29faa2460f22e800d92db38d4795b668c7104da6b87afaeaf502a269ca59060800160405180910390a1505050505050565b80515f5b81811015611eec5761402c83828151811061401557614015615086565b602002602001015185613d8390919063ffffffff16565b6140735782818151811061404257614042615086565b602002602001015160405163e88e458960e01b815260040161282391906001600160a01b0391909116815260200190565b600101613ff8565b5f614084613c92565b601281018490556013810183905560408051858152602081018590529192507f9b30f86f0857913d2337c63fb4eb1eb65997a6587dcd80de1f6de3aee357c7c191016120e2565b5f610de6846001600160a01b038516846144f7565b336140e9611843565b6001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015614124573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906141489190615947565b6001600160a01b031614613d8157604051631966391b60e11b815260040160405180910390fd5b614177614513565b6001600160a01b03811615806141fd57505f6001600160a01b0316816001600160a01b0316634783c35b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156141ce573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906141f29190615947565b6001600160a01b0316145b1561421b576040516371c42ac360e01b815260040160405180910390fd5b61424e61424960017faa116a42804728f23983458454b6eb9c6ddf3011db9f9addaf3cd7508d85b0d66156e9565b829055565b6142804361427d60017f812a673dfca07956350df10f8a654925f561d7a0da09bdbe79e653939a14d9f16156e9565b55565b604080516001600160a01b0383168152426020820152438183015290517f1a2dd071001ebf6e03174e3df5b305795a4ad5d41d8fdb9ba41dbbe2367134269181900360600190a150565b5f8181526002830160205260408120548190806142f7576142eb858561455c565b92505f9150613cd59050565b600192509050613cd5565b6060815f0180548060200260200160405190810160405280929190818152602001828054801561434f57602002820191905f5260205f20905b81548152602001906001019080831161433b575b50505050509050919050565b6060610dc782613cdc565b5f8181526001830160205260408120546143ab57508154600181810184555f848152602080822090930184905584548482528286019093526040902091909155610dc7565b505f610dc7565b5f818152600183016020526040812054801561448c575f6143d46001836156e9565b85549091505f906143e7906001906156e9565b9050808214614446575f865f01828154811061440557614405615086565b905f5260205f200154905080875f01848154811061442557614425615086565b5f918252602080832090910192909255918252600188019052604090208390555b855486908061445757614457615962565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f905560019350505050610dc7565b5f915050610dc7565b5f8181526002830160205260408120819055610e8b8383614567565b5f818152600283016020526040812054801580156144d657506144d4848461455c565b155b15610e8b5760405163015ab34360e11b815260048101849052602401612823565b5f8281526002840160205260408120829055610de68484614572565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff16613d8157604051631afcd79f60e31b815260040160405180910390fd5b5f610e8b838361457d565b5f610e8b83836143b2565b5f610e8b8383614366565b5f8181526001830160205260408120541515610e8b565b828054828255905f5260205f209081019282156145e7579160200282015b828111156145e757825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906145b2565b506145f3929150614638565b5090565b604051806101000160405280606081526020015f80191681526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b5b808211156145f3575f8155600101614639565b634e487b7160e01b5f52604160045260245ffd5b60405161010081016001600160401b03811182821017156146835761468361464c565b60405290565b6040516101a081016001600160401b03811182821017156146835761468361464c565b604051601f8201601f191681016001600160401b03811182821017156146d4576146d461464c565b604052919050565b5f6001600160401b038211156146f4576146f461464c565b50601f01601f191660200190565b5f82601f830112614711575f80fd5b813561472461471f826146dc565b6146ac565b818152846020838601011115614738575f80fd5b816020850160208301375f918101602001919091529392505050565b5f6001600160401b0382111561476c5761476c61464c565b5060051b60200190565b6001600160a01b0381168114613c8f575f80fd5b803561479581614776565b919050565b5f82601f8301126147a9575f80fd5b813560206147b961471f83614754565b8083825260208201915060208460051b8701019350868411156147da575f80fd5b602086015b848110156147ff5780356147f281614776565b83529183019183016147df565b509695505050505050565b5f805f6060848603121561481c575f80fd5b83356001600160401b0380821115614832575f80fd5b61483e87838801614702565b94506020860135915080821115614853575f80fd5b61485f8783880161479a565b93506040860135915080821115614874575f80fd5b506148818682870161479a565b9150509250925092565b5f6020828403121561489b575f80fd5b81356001600160e01b031981168114610e8b575f80fd5b5f602082840312156148c2575f80fd5b8135610e8b81614776565b5f815180845260208085019450602084015f5b838110156149055781516001600160a01b0316875295820195908201906001016148e0565b509495945050505050565b602081525f610e8b60208301846148cd565b5f815180845260208085019450602084015f5b8381101561490557815187529582019590820190600101614935565b604081525f61496360408301856148cd565b82810360208401526149758185614922565b95945050505050565b5f5b83811015614998578181015183820152602001614980565b50505f910152565b5f81518084526149b781602086016020860161497e565b601f01601f19169290920160200192915050565b602081525f610e8b60208301846149a0565b602081525f82516101008060208501526149fb6101208501836149a0565b9150602085015160408501526040850151606085015260608501516080850152608085015160a085015260a085015160c085015260c085015160e085015260e085015181850152508091505092915050565b5f8282518085526020808601955060208260051b840101602086015f5b84811015614a9857601f19868403018952614a868383516149a0565b98840198925090830190600101614a6a565b5090979650505050505050565b5f815180845260208085019450602084015f5b83811015614905578151151587529582019590820190600101614ab8565b5f610140808352614ae98184018e6148cd565b90508281036020840152614afd818d6148cd565b90508281036040840152614b11818c6148cd565b90508281036060840152614b25818b614a4d565b90508281036080840152614b39818a614922565b905082810360a0840152614b4d8189614922565b905082810360c0840152614b618188614a4d565b905082810360e0840152614b758187614aa5565b9050828103610100840152614b8a8186614a4d565b9050828103610120840152614b9f8185614922565b9d9c50505050505050505050505050565b5f60208284031215614bc0575f80fd5b5035919050565b602081525f825160406020840152614be260608401826149a0565b602094909401516001600160a01b0316604093909301929092525090919050565b5f8060408385031215614c14575f80fd5b8235614c1f81614776565b946020939093013593505050565b602081525f825160606020840152614c4860808401826149a0565b90506020840151601f1980858403016040860152614c6683836148cd565b925060408601519150808584030160608601525061497582826148cd565b5f805f8060808587031215614c97575f80fd5b5050823594602084013594506040840135936060013592509050565b5f60208284031215614cc3575f80fd5b81356001600160401b03811115614cd8575f80fd5b610de68482850161479a565b5f8060408385031215614cf5575f80fd5b82356001600160401b0380821115614d0b575f80fd5b614d178683870161479a565b93506020850135915080821115614d2c575f80fd5b50614d398582860161479a565b9150509250929050565b5f8060408385031215614d54575f80fd5b82356001600160401b03811115614d69575f80fd5b614d7585828601614702565b9250506020830135614d8681614776565b809150509250929050565b5f8060408385031215614da2575f80fd5b50508035926020909101359150565b604081525f614dc36040830185614a4d565b828103602084015261497581856148cd565b5f8060408385031215614de6575f80fd5b8235614df181614776565b915060208301356001600160401b03811115614e0b575f80fd5b614d3985828601614702565b5f610120808352614e2a8184018d6148cd565b90508281036020840152614e3e818c614922565b90508281036040840152614e52818b614922565b90508281036060840152614e66818a6148cd565b90508281036080840152614e7a8189614922565b905082810360a0840152614e8e8188614922565b905082810360c0840152614ea281876148cd565b905082810360e0840152614eb68186614922565b915050826101008301529a9950505050505050505050565b5f6101008284031215614edf575f80fd5b614ee7614660565b905081356001600160401b03811115614efe575f80fd5b614f0a84828501614702565b8252506020820135602082015260408201356040820152606082013560608201526080820135608082015260a082013560a082015260c082013560c082015260e082013560e082015292915050565b5f808284036101c0811215614f6c575f80fd5b6101a080821215614f7b575f80fd5b614f83614689565b9150614f8e8561478a565b8252614f9c6020860161478a565b6020830152614fad6040860161478a565b6040830152614fbe6060860161478a565b6060830152614fcf6080860161478a565b6080830152614fe060a0860161478a565b60a0830152614ff160c0860161478a565b60c083015261500260e0860161478a565b60e083015261010061501581870161478a565b9083015261012061502786820161478a565b9083015261014061503986820161478a565b9083015261016061504b86820161478a565b9083015261018061505d86820161478a565b908301529092508301356001600160401b0381111561507a575f80fd5b614d3985828601614ece565b634e487b7160e01b5f52603260045260245ffd5b5f82601f8301126150a9575f80fd5b81516150b761471f826146dc565b8181528460208386010111156150cb575f80fd5b610de682602083016020870161497e565b5f602082840312156150ec575f80fd5b81516001600160401b03811115615101575f80fd5b610de68482850161509a565b604081525f61511f60408301856149a0565b828103602084015261497581856149a0565b80518015158114614795575f80fd5b5f60208284031215615150575f80fd5b610e8b82615131565b600181811c9082168061516d57607f821691505b60208210810361518b57634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156151d857805f5260205f20601f840160051c810160208510156151b65750805b601f840160051c820191505b818110156151d5575f81556001016151c2565b50505b505050565b81516001600160401b038111156151f6576151f661464c565b61520a816152048454615159565b84615191565b602080601f83116001811461523d575f84156152265750858301515b5f19600386901b1c1916600185901b178555615294565b5f85815260208120601f198616915b8281101561526b5788860151825594840194600190910190840161524c565b508582101561528857878501515f19600388901b60f8161c191681555b505060018460011b0185555b505050505050565b634e487b7160e01b5f52601160045260245ffd5b80820180821115610dc757610dc761529c565b60a081525f6152d560a08301886149a0565b82810360208401526152e781886149a0565b905082810360408401526152fb81876148cd565b9050828103606084015261530f81866148cd565b9150508260808301529695505050505050565b5f82601f830112615331575f80fd5b8151602061534161471f83614754565b8083825260208201915060208460051b870101935086841115615362575f80fd5b602086015b848110156147ff57805161537a81614776565b8352918301918301615367565b5f60208284031215615397575f80fd5b81516001600160401b038111156153ac575f80fd5b610de684828501615322565b5f82601f8301126153c7575f80fd5b815160206153d761471f83614754565b82815260059290921b840181019181810190868411156153f5575f80fd5b8286015b848110156147ff5780516001600160401b03811115615416575f80fd5b6154248986838b010161509a565b8452509183019183016153f9565b5f82601f830112615441575f80fd5b8151602061545161471f83614754565b8083825260208201915060208460051b870101935086841115615472575f80fd5b602086015b848110156147ff5761548881615131565b8352918301918301615477565b5f82601f8301126154a4575f80fd5b815160206154b461471f83614754565b8083825260208201915060208460051b8701019350868411156154d5575f80fd5b602086015b848110156147ff57805183529183019183016154da565b5f805f805f8060c08789031215615506575f80fd5b86516001600160401b038082111561551c575f80fd5b6155288a838b016153b8565b9750602089015191508082111561553d575f80fd5b6155498a838b01615322565b9650604089015191508082111561555e575f80fd5b61556a8a838b01615432565b9550606089015191508082111561557f575f80fd5b61558b8a838b01615432565b945060808901519150808211156155a0575f80fd5b6155ac8a838b01615495565b935060a08901519150808211156155c1575f80fd5b506155ce89828a01615495565b9150509295509295509295565b5f805f805f805f60e0888a0312156155f1575f80fd5b87516001600160401b0380821115615607575f80fd5b6156138b838c016153b8565b985060208a0151915080821115615628575f80fd5b6156348b838c01615432565b975060408a0151915080821115615649575f80fd5b6156558b838c01615432565b965060608a015191508082111561566a575f80fd5b6156768b838c01615432565b955060808a015191508082111561568b575f80fd5b6156978b838c01615495565b945060a08a01519150808211156156ac575f80fd5b6156b88b838c016153b8565b935060c08a01519150808211156156cd575f80fd5b506156da8a828b01615495565b91505092959891949750929550565b81810381811115610dc757610dc761529c565b604081525f61570e60408301856149a0565b6020838203818501525f855461572381615159565b8085526001828116801561573e576001811461575857615783565b60ff1984168787015282151560051b870186019450615783565b895f52855f205f5b8481101561577b578154898201890152908301908701615760565b880187019550505b50929998505050505050505050565b5f600182016157a3576157a361529c565b5060010190565b604081525f614dc360408301856148cd565b604081525f6157ce60408301856149a0565b905060018060a01b03831660208301529392505050565b604080825283519082018190525f906020906060840190828701845b828110156158265781516001600160a01b031684529284019290840190600101615801565b5050506001600160a01b039490941660209390930192909252509092915050565b6001600160a01b03841681526060602082018190525f9061586a908301856149a0565b828103604084015261587c81856149a0565b9695505050505050565b5f8060408385031215615897575f80fd5b825191506158a760208401615131565b90509250929050565b5f602082840312156158c0575f80fd5b5051919050565b6001600160a01b038d811682528c811660208301528b811660408301528a81166060830152898116608083015288811660a083015287811660c083015286811660e0830152858116610100830152841661012082015261018081016001600160a01b0384166101408301526001600160a01b038316610160830152614b9f565b5f60208284031215615957575f80fd5b8151610e8b81614776565b634e487b7160e01b5f52603160045260245ffdfea26469706673582212208c85e4a8299405182a06d08437f0a7695f1110ad33995fddd12885cf3d3c786964736f6c63430008170033
Deployed Bytecode
0x608060405234801561000f575f80fd5b506004361061044d575f3560e01c80637396195011610242578063bb1afe6811610140578063dd391baf116100bf578063ec1600b211610084578063ec1600b2146108a2578063f399e22e146108b5578063f8b2cb4f146108c8578063ff2f4c73146108f0578063ffa1ad7414610903575f80fd5b8063dd391baf14610858578063de15991b1461086b578063df6617f81461087e578063e0a09c6814610891578063e78cea921461089a575f80fd5b8063cbee570711610105578063cbee570714610805578063cc1fb4e014610818578063d515be5614610820578063d55ec69714610828578063db8d55f114610830575f80fd5b8063bb1afe68146107ce578063bc063e1a146107d6578063c314840f146107df578063c45a0155146107f5578063c5419106146107fd575f80fd5b806394990bd8116101cc578063a91b0e3811610191578063a91b0e3814610798578063ac8a584a146107a0578063aea00d1d146107b3578063b3cf0cfb146107c6578063b5da564814610774575f80fd5b806394990bd8146107595780639870d7fe146107615780639fee2cfa14610774578063a345d0cd1461077d578063a8f43c6714610790575f80fd5b80638006267c116102125780638006267c146106ff578063878571d7146107125780638a4adf241461071a578063922b711b14610722578063936725ec14610735575f80fd5b806373961950146106bd57806373a869bc146106d057806376c7a3c7146106e35780637a547dad146106ec575f80fd5b80633bc5de301161034f57806354aa3d08116102d957806362988af41161029e57806362988af41461067f57806364e20cbd146106875780636d70f7ae1461068f5780636f460dc8146106a25780636fcba377146106aa575f80fd5b806354aa3d081461064a57806355e868de1461065257806355f29166146106675780635aa6e6751461066f57806360997e8514610677575f80fd5b80634783c35b1161031f5780634783c35b1461060c57806349b5fdb4146106145780634bde38c81461061c5780634dba649e14610624578063532d9fbd14610637575f80fd5b80633bc5de30146105b35780634254af1c146105d15780634593144c146105f157806345ade4ad146105f9575f80fd5b806312e0832a116103db578063334cc491116103a0578063334cc4911461056857806335157a581461057057806339597ab51461058557806339665640146105985780633aab685c146105a0575f80fd5b806312e0832a14610535578063262d61521461053d5780632a976e94146105455780632b3297f9146105585780632ce8f10414610560575f80fd5b80630b57f995116104215780630b57f995146104cf5780630d9981e0146104e25780630e6c7cf4146104f55780630f8a634d1461050a578063107bf28c14610520575f80fd5b8062a14d441461045157806301d22ccd1461046657806301ffc9a71461048b578063054e7333146104ae575b5f80fd5b61046461045f36600461480a565b610927565b005b61046e610d7a565b6040516001600160a01b0390911681526020015b60405180910390f35b61049e61049936600461488b565b610d97565b6040519015158152602001610482565b6104c16104bc3660046148b2565b610dcd565b604051908152602001610482565b6104646104dd3660046148b2565b610dee565b61049e6104f03660046148b2565b610e61565b6104fd610e92565b6040516104829190614910565b610512610eb1565b604051610482929190614951565b610528610f7b565b60405161048291906149cb565b6104c1611019565b61046e61102d565b6104646105533660046148b2565b61104a565b61046e6110c8565b61046e6110e5565b6104fd611102565b61057861111b565b60405161048291906149dd565b6104646105933660046148b2565b611204565b61046e61127a565b6104c16105ae3660046148b2565b611297565b6105bb6112c2565b6040516104829a99989796959493929190614ad6565b6105e46105df366004614bb0565b611673565b6040516104829190614bc7565b6104c161175b565b6104646106073660046148b2565b611793565b61046e611809565b61046e611826565b61046e611843565b6104646106323660046148b2565b611872565b610464610645366004614c03565b6118e8565b61046e61195c565b61065a611979565b6040516104829190614c2d565b610464611b0c565b61046e611bfd565b610512611c17565b6104fd611e60565b6104c1611e79565b61049e61069d3660046148b2565b611e8d565b61046e611ebb565b6104646106b8366004614c84565b611ed8565b6104646106cb3660046148b2565b611ef2565b6104646106de366004614cb3565b611f7d565b6104c161138881565b6104646106fa366004614ce4565b612084565b61046461070d366004614d43565b6120ef565b61046e6121e7565b61046e612204565b610464610730366004614d91565b612221565b610528604051806040016040528060058152602001640312e302e360dc1b81525081565b61046e612237565b61046461076f3660046148b2565b612254565b6104c161271081565b61046461078b3660046148b2565b6122ca565b610528612340565b6104c161235c565b6104646107ae3660046148b2565b612370565b6104fd6107c13660046148b2565b6123e6565b6104fd612478565b6104c1612491565b6104c161c35081565b6107e76124a5565b604051610482929190614db1565b61046e6126ef565b6104fd61270c565b6104646108133660046148b2565b612725565b61046e612798565b6104c16127b5565b6104646127c9565b610838612c6e565b604080519485526020850193909352918301526060820152608001610482565b610464610866366004614bb0565b612c9f565b610464610879366004614c03565b612cf7565b61046461088c3660046148b2565b612d67565b6104c161e10081565b61046e612e11565b6104646108b03660046148b2565b612e2e565b6104646108c3366004614dd5565b612eaf565b6108db6108d63660046148b2565b613043565b60405161048299989796959493929190614e17565b6104646108fe366004614f59565b6137c7565b610528604051806040016040528060058152602001640312e312e360dc1b81525081565b61092f613b74565b5f610938613c92565b60158101549091501561095e5760405163a6751d6160e01b815260040160405180910390fd5b82518251811461098157604051630ef9926760e21b815260040160405180910390fd5b5f5b81811015610bb6575f6001600160a01b03168582815181106109a7576109a7615086565b60200260200101516001600160a01b0316036109d6576040516371c42ac360e01b815260040160405180910390fd5b5f6001600160a01b03168482815181106109f2576109f2615086565b60200260200101516001600160a01b031603610a21576040516371c42ac360e01b815260040160405180910390fd5b734f76add676c04eca837130ceb58bc173de8799de6321a49642868381518110610a4d57610a4d615086565b60200260200101516001600160a01b031663ffa1ad746040518163ffffffff1660e01b81526004015f60405180830381865afa158015610a8f573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610ab691908101906150dc565b868481518110610ac857610ac8615086565b60200260200101516001600160a01b031663ffa1ad746040518163ffffffff1660e01b81526004015f60405180830381865afa158015610b0a573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610b3191908101906150dc565b6040518363ffffffff1660e01b8152600401610b4e92919061510d565b602060405180830381865af4158015610b69573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b8d9190615140565b15610bae5760405160016221c56960e11b0319815260040160405180910390fd5b600101610983565b505f826018018054610bc790615159565b80601f0160208091040260200160405190810160405280929190818152602001828054610bf390615159565b8015610c3e5780601f10610c1557610100808354040283529160200191610c3e565b820191905f5260205f20905b815481529060010190602001808311610c2157829003601f168201915b50506040516310d24b2160e11b8152939450734f76add676c04eca837130ceb58bc173de8799de936321a496429350610c7f92508591508a9060040161510d565b602060405180830381865af4158015610c9a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cbe9190615140565b15610cdf5760405160016221c56960e11b0319815260040160405180910390fd5b60148301610ced87826151dd565b508451610d039060158501906020880190614594565b508351610d199060168501906020870190614594565b505f610d2761e100426152b0565b90508084601701819055507f14693df2ca79e2e824b9e873800e5d630e7ef6b241799952899e49f5c3d61e348288888885604051610d699594939291906152c3565b60405180910390a150505050505050565b5f80610d84613c92565b600d01546001600160a01b031692915050565b5f6001600160e01b03198216630f1ec81f60e41b1480610dc757506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f80610dd7613c92565b9050610de6601e820184613cb6565b949350505050565b610df6613b74565b5f610dff613c92565b6040516001600160a01b03841681529091507fb15ef10f9355ef19a10a9cca0b2fe16693884655f12f1b274b9de11bd01842f69060200160405180910390a1600f0180546001600160a01b0319166001600160a01b0392909216919091179055565b5f80610e6b613c92565b6001600160a01b0384165f90815260268201602052604090205490915015155b9392505050565b60605f610e9d613c92565b9050610eab81602301613cdc565b91505090565b6060805f610ebd613c92565b9050610ecb81601e01613ce8565b8051909350806001600160401b03811115610ee857610ee861464c565b604051908082528060200260200182016040528015610f11578160200160208202803683370190505b5092505f5b81811015610f7457610f4d858281518110610f3357610f33615086565b602002602001015184601e01613cb690919063ffffffff16565b9050848281518110610f6157610f61615086565b6020908102919091010152600101610f16565b5050509091565b60605f610f86613c92565b9050806010018054610f9790615159565b80601f0160208091040260200160405190810160405280929190818152602001828054610fc390615159565b801561100e5780601f10610fe55761010080835404028352916020019161100e565b820191905f5260205f20905b815481529060010190602001808311610ff157829003601f168201915b505050505091505090565b5f80611023613c92565b6013015492915050565b5f80611037613c92565b600e01546001600160a01b031692915050565b611052613cf4565b5f61105b613c92565b905061106a6021820183613d83565b611087576040516333e9449d60e21b815260040160405180910390fd5b6040516001600160a01b03831681527fc7605a8c2a587f745fd716ef9e058f894f313f21fe66a475d431e365faa27c3f906020015b60405180910390a15050565b5f806110d2613c92565b600b01546001600160a01b031692915050565b5f806110ef613c92565b600201546001600160a01b031692915050565b60605f61110d613c92565b9050610eab81602101613cdc565b6111236145f7565b5f61112c613c92565b90506111366145f7565b61113e612c6e565b60a085015260808401526060830152604082015260108201805461116190615159565b80601f016020809104026020016040519081016040528092919081815260200182805461118d90615159565b80156111d85780601f106111af576101008083540402835291602001916111d8565b820191905f5260205f20905b8154815290600101906020018083116111bb57829003601f168201915b505050918352505060118201546020820152601282015460c082015260139091015460e0820152919050565b61120c613cf4565b5f611215613c92565b90506112246023820183613d97565b6112415760405163ad5679e160e01b815260040160405180910390fd5b6040516001600160a01b03831681527f913d0cceb9442b7c02b8eae856a0f26a6245df340df8db1ff0a11bb58fd452f4906020016110bc565b5f80611284613c92565b600c01546001600160a01b031692915050565b5f806112a1613c92565b6001600160a01b039093165f908152602b9093016020525050604090205490565b6060806060806060806060806060805f6112da613c92565b60068101549091506001600160a01b0316806113095760405163ad5679e160e01b815260040160405180910390fd5b6040805160098082526101408201909252906020820161012080368337019050509b50808c5f8151811061133f5761133f615086565b6001600160a01b03928316602091820292909201015260078301548d519116908d90600190811061137257611372615086565b6001600160a01b03928316602091820292909201015260088301548d519116908d9060029081106113a5576113a5615086565b6001600160a01b03928316602091820292909201015260028301548d519116908d9060039081106113d8576113d8615086565b6001600160a01b03928316602091820292909201015260038301548d519116908d90600490811061140b5761140b615086565b6001600160a01b03928316602091820292909201015282548d519116908d90600590811061143b5761143b615086565b6001600160a01b03928316602091820292909201015260018301548d519116908d90600690811061146e5761146e615086565b6001600160a01b039283166020918202929092010152600e8301548d519116908d9060079081106114a1576114a1615086565b6001600160a01b039283166020918202929092010152600f8301548d519116908d9060089081106114d4576114d4615086565b6001600160a01b039283166020918202929092010152600b830154604080516331aa6cf560e21b815290519190921691829163c6a9b3d4916004808201925f929091908290030181865afa15801561152e573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526115559190810190615387565b9b5061156383602501613cdc565b9a505f829050806001600160a01b03166336abf3dc6040518163ffffffff1660e01b81526004015f60405180830381865afa1580156115a4573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526115cb91908101906154f1565b909192935090919250909150809c50819b50829d50505050806001600160a01b031663d9f9027f6040518163ffffffff1660e01b81526004015f60405180830381865afa15801561161e573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261164591908101906155db565b9091929394509091929350909150809850819950829a50839b50505050505050505090919293949596979899565b60408051808201909152606081525f60208201525f611690613c92565b905080601a015f8481526020019081526020015f206040518060400160405290815f820180546116bf90615159565b80601f01602080910402602001604051908101604052809291908181526020018280546116eb90615159565b80156117365780601f1061170d57610100808354040283529160200191611736565b820191905f5260205f20905b81548152906001019060200180831161171957829003601f168201915b5050509183525050600191909101546001600160a01b03166020909101529392505050565b5f61178e61178a60017f812a673dfca07956350df10f8a654925f561d7a0da09bdbe79e653939a14d9f16156e9565b5490565b905090565b61179b613cf4565b5f6117a4613c92565b90506117b3601e820183613dab565b6117d05760405163ad5679e160e01b815260040160405180910390fd5b6040516001600160a01b03831681527f164327620fc0e8228e649bc4a379147b84dc96ab396dd4ec9c23903c204fae1f906020016110bc565b5f80611813613c92565b600101546001600160a01b031692915050565b5f80611830613c92565b600901546001600160a01b031692915050565b5f61178e61178a60017faa116a42804728f23983458454b6eb9c6ddf3011db9f9addaf3cd7508d85b0d66156e9565b61187a613cf4565b5f611883613c92565b90506118926021820183613d97565b6118af5760405163ad5679e160e01b815260040160405180910390fd5b6040516001600160a01b03831681527f01022458cedbd7bde667e12d184e4a49ee3341b737a8cf215229e3ae06a0ce8d906020016110bc565b6118f0613b74565b5f6118f9613c92565b604080516001600160a01b0386168152602081018590529192507e04b958f81f06965a6634f3b58554a07646eb77ce1b500fac6fb67fb21c5d01910160405180910390a16001600160a01b039092165f908152602b909201602052604090912055565b5f80611966613c92565b600501546001600160a01b031692915050565b61199d60405180606001604052806060815260200160608152602001606081525090565b5f6119a6613c92565b9050806014016040518060600160405290815f820180546119c690615159565b80601f01602080910402602001604051908101604052809291908181526020018280546119f290615159565b8015611a3d5780601f10611a1457610100808354040283529160200191611a3d565b820191905f5260205f20905b815481529060010190602001808311611a2057829003601f168201915b5050505050815260200160018201805480602002602001604051908101604052809291908181526020018280548015611a9d57602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311611a7f575b5050505050815260200160028201805480602002602001604051908101604052809291908181526020018280548015611afd57602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311611adf575b50505050508152505091505090565b611b14613cf4565b5f611b1d613c92565b905080601701545f03611b435760405163de2d2a5760e01b815260040160405180910390fd5b60408051808201825260058152640312e312e360dc1b602082015290517f027629ebccc4ab0f98063cf8ccd405d331aaceb2f61f023fe7b10b3ae0d0d2e991611b909160148501906156fc565b60405180910390a160408051602081019091525f81526014820190611bb590826151dd565b50604080515f8152602081019182905251611bd4916015840191614594565b50604080515f8152602081019182905251611bf3916016840191614594565b505f601790910155565b5f80611c07613c92565b546001600160a01b031692915050565b6060805f611c23613c92565b90505f611c3282601e01613ce8565b80519091505f816001600160401b03811115611c5057611c5061464c565b604051908082528060200260200182016040528015611c79578160200160208202803683370190505b5090505f805b83811015611d0957611cb6858281518110611c9c57611c9c615086565b602002602001015187601e01613dbf90919063ffffffff16565b838281518110611cc857611cc8615086565b6020026020010181815250505f838281518110611ce757611ce7615086565b60200260200101511115611d0157611cfe82615792565b91505b600101611c7f565b50806001600160401b03811115611d2257611d2261464c565b604051908082528060200260200182016040528015611d4b578160200160208202803683370190505b509650806001600160401b03811115611d6657611d6661464c565b604051908082528060200260200182016040528015611d8f578160200160208202803683370190505b5095505f805b84811015611e5557838181518110611daf57611daf615086565b60200260200101515f0315611e4d57858181518110611dd057611dd0615086565b6020026020010151898381518110611dea57611dea615086565b60200260200101906001600160a01b031690816001600160a01b031681525050838181518110611e1c57611e1c615086565b6020026020010151888381518110611e3657611e36615086565b6020908102919091010152611e4a82615792565b91505b600101611d95565b505050505050509091565b60605f611e6b613c92565b9050610eab81601e01613ce8565b5f80611e83613c92565b6011015492915050565b5f80611e97613c92565b6001600160a01b0384165f908152601d820160205260409020549091501515610e8b565b5f80611ec5613c92565b600301546001600160a01b031692915050565b611ee0613dd3565b611eec84848484613e62565b50505050565b611efa613b74565b6001600160a01b038116611f21576040516371c42ac360e01b815260040160405180910390fd5b5f611f2a613c92565b6004810180546001600160a01b0319166001600160a01b0385169081179091556040519081529091507f7c676a9ea57f4a0e6a379581c6a39f9b4ae37ada549eb00328ebe0f67ce9889b906020016110bc565b611f85613cf4565b5f611f8e613c92565b82519091505f5b81811015611eec575f6001600160a01b0316848281518110611fb957611fb9615086565b60200260200101516001600160a01b031603611fe8576040516371c42ac360e01b815260040160405180910390fd5b612017848281518110611ffd57611ffd615086565b602002602001015184602501613d8390919063ffffffff16565b1561207c577f39df6cfdb2af553b6c1c48f35b52e5ad0c41048656d17a53e86dba2b1d56fcb584828151811061204f5761204f615086565b602002602001015160405161207391906001600160a01b0391909116815260200190565b60405180910390a15b600101611f95565b61208c613cf4565b5f612095613c92565b90506120a48160210184613ff4565b6120b18160230183613ff4565b7f91b5c4ce7115d4e6dc7fb1d7751facb1c981bf008604a17367dcc9c8200d9e9e83836040516120e29291906157aa565b60405180910390a1505050565b6120f7613cf4565b5f612100613c92565b83516020808601919091205f818152601a8401909252604090912060010154919250906001600160a01b03161561214a576040516333e9449d60e21b815260040160405180910390fd5b5f818152601a83016020526040902061216385826151dd565b505f818152601a830160209081526040808320600190810180546001600160a01b0319166001600160a01b038916179055601b86018054918201815584529190922001829055517f3fbba6c5c03e01d729b07cdaad69928911d1d4776a3b730981a3bbb9271c06c1906121d990869086906157bc565b60405180910390a150505050565b5f806121f1613c92565b600801546001600160a01b031692915050565b5f8061220e613c92565b600701546001600160a01b031692915050565b612229613cf4565b612233828261407b565b5050565b5f80612241613c92565b600a01546001600160a01b031692915050565b61225c613b74565b5f612265613c92565b9050612274601c820183613d83565b612291576040516333e9449d60e21b815260040160405180910390fd5b6040516001600160a01b03831681527fac6fa858e9350a46cec16539926e0fde25b7629f84b5a72bffaae4df888ae86d906020016110bc565b6122d2613cf4565b5f6122db613c92565b90506122ea6023820183613d83565b612307576040516333e9449d60e21b815260040160405180910390fd5b6040516001600160a01b03831681527f70510c0f553be5541883456497528db520af63f62da85ce11327e141d7e9eada906020016110bc565b60605f61234b613c92565b9050806018018054610f9790615159565b5f80612366613c92565b6017015492915050565b612378613b74565b5f612381613c92565b9050612390601c820183613d97565b6123ad5760405163ad5679e160e01b815260040160405180910390fd5b6040516001600160a01b03831681527f80c0b871b97b595b16a7741c1b06fed0c6f6f558639f18ccbce50724325dc40d906020016110bc565b60605f6123f1613c92565b9050734f76add676c04eca837130ceb58bc173de8799de63505bb4fa61241983602301613cdc565b856040518363ffffffff1660e01b81526004016124379291906157e5565b5f60405180830381865af4158015612451573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610e8b9190810190615387565b60605f612483613c92565b9050610eab81602501613cdc565b5f8061249b613c92565b6019015492915050565b6060805f6124b1613c92565b601b810154909150806001600160401b038111156124d1576124d161464c565b60405190808252806020026020018201604052801561250457816020015b60608152602001906001900390816124ef5790505b509350806001600160401b0381111561251f5761251f61464c565b604051908082528060200260200182016040528015612548578160200160208202803683370190505b5092505f82601b0180548060200260200160405190810160405280929190818152602001828054801561259857602002820191905f5260205f20905b815481526020019060010190808311612584575b505050505090505f5b828110156126e7575f8282815181106125bc576125bc615086565b602002602001015190505f85601a015f8381526020019081526020015f206040518060400160405290815f820180546125f490615159565b80601f016020809104026020016040519081016040528092919081815260200182805461262090615159565b801561266b5780601f106126425761010080835404028352916020019161266b565b820191905f5260205f20905b81548152906001019060200180831161264e57829003601f168201915b5050509183525050600191909101546001600160a01b031660209091015280518951919250908990859081106126a3576126a3615086565b602002602001018190525080602001518784815181106126c5576126c5615086565b6001600160a01b039092166020928302919091019091015250506001016125a1565b505050509091565b5f806126f9613c92565b600601546001600160a01b031692915050565b60605f612717613c92565b9050610eab81601c01613cdc565b61272d613b74565b5f612736613c92565b6040516001600160a01b03841681529091507fbe16f9da73e1f71a56cb2bba7f4a7c31a28c9745a0d39211ee5b1455b7b4ffe09060200160405180910390a1600d0180546001600160a01b0319166001600160a01b0392909216919091179055565b5f806127a2613c92565b600401546001600160a01b031692915050565b5f806127bf613c92565b6012015492915050565b6127d1613cf4565b5f6127da613c92565b60178101549091505f8190036128035760405163de2d2a5760e01b815260040160405180910390fd5b4281111561282c576040516321ffc5d560e11b8152600481018290526024015b60405180910390fd5b5f826014016040518060600160405290815f8201805461284b90615159565b80601f016020809104026020016040519081016040528092919081815260200182805461287790615159565b80156128c25780601f10612899576101008083540402835291602001916128c2565b820191905f5260205f20905b8154815290600101906020018083116128a557829003601f168201915b505050505081526020016001820180548060200260200160405190810160405280929190818152602001828054801561292257602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311612904575b505050505081526020016002820180548060200260200160405190810160405280929190818152602001828054801561298257602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311612964575b505050919092525050506020810151519091505f5b81811015612bc9575f836020015182815181106129b6576129b6615086565b60200260200101516001600160a01b031663ffa1ad746040518163ffffffff1660e01b81526004015f60405180830381865afa1580156129f8573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052612a1f91908101906150dc565b905083602001518281518110612a3757612a37615086565b60200260200101516001600160a01b0316630900f01085604001518481518110612a6357612a63615086565b60200260200101516040518263ffffffff1660e01b8152600401612a9691906001600160a01b0391909116815260200190565b5f604051808303815f87803b158015612aad575f80fd5b505af1158015612abf573d5f803e3d5ffd5b5050505083602001518281518110612ad957612ad9615086565b60200260200101516001600160a01b03167fb79e887de86d38ec54dda618ce1b439ec0c3514c58d9a1b79f571b6762bfe87385604001518481518110612b2157612b21615086565b60200260200101518387602001518681518110612b4057612b40615086565b60200260200101516001600160a01b031663ffa1ad746040518163ffffffff1660e01b81526004015f60405180830381865afa158015612b82573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052612ba991908101906150dc565b604051612bb893929190615847565b60405180910390a250600101612997565b5081516018850190612bdb90826151dd565b5060408051602081019091525f81526014850190612bf990826151dd565b50604080515f8152602081019182905251612c18916015870191614594565b50604080515f8152602081019182905251612c37916016870191614594565b505f601785015581516040517faedc33a750c6b68c8b2c1de7376e9e4a69f8e5d8cabc6757105a6b3fa1d75701916121d9916149cb565b5f805f805f612c7b613c92565b602781015460288201546029830154602a9093015491989097509195509350915050565b612ca7613b74565b5f612cb0613c92565b601981015460408051918252602082018590529192507f36542355c4238243e42f18a2aea69f0c94db23a46c0f751ae8a74124d6511398910160405180910390a160190155565b612cff613cf4565b5f612d08613c92565b90505f612d19601e830185856140cb565b604080516001600160a01b038716815260208101869052821515918101919091529091507fa2df1b9ad1068670235c77f8bdf05aa68b9bfeafc7a7124f9f5b916b73e7ec16906060016121d9565b612d6f6140e0565b5f612d78613c92565b90505f612d88601e830184613dbf565b90505f8111612daa5760405163d43e2e2760e01b815260040160405180910390fd5b612dc483612db96001846156e9565b601e850191906140cb565b507fd3af71f3b90f30dc8a11b6e5a552bd73ebf945f132aadb051e2291076d5192ae83612df26001846156e9565b604080516001600160a01b0390931683526020830191909152016120e2565b5f80612e1b613c92565b600f01546001600160a01b031692915050565b612e36613cf4565b5f612e3f613c92565b9050612e4e6025820183613d97565b612e7657604051633ccd059360e01b81526001600160a01b0383166004820152602401612823565b6040516001600160a01b03831681527f1894a5125f24cd2598e595dceb1030c5937681a8088af2a60710ea73399573ed906020016110bc565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03165f81158015612ef35750825b90505f826001600160401b03166001148015612f0e5750303b155b905081158015612f1c575080155b15612f3a5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315612f6457845460ff60401b1916600160401b1785555b5f612f6d613c92565b6001810180546001600160a01b0319166001600160a01b038b161790559050612f953061416f565b612fa2601c820133613d83565b50612fb0601c820189613d83565b5060188101612fbf88826151dd565b507faedc33a750c6b68c8b2c1de7376e9e4a69f8e5d8cabc6757105a6b3fa1d7570187604051612fef91906149cb565b60405180910390a150831561303a57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602001610d69565b50505050505050565b6060806060806060806060805f80613059613c92565b905080600b015f9054906101000a90046001600160a01b03166001600160a01b03166376d708d76040518163ffffffff1660e01b81526004015f60405180830381865afa1580156130ac573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526130d39190810190615387565b60098201548151919b506001600160a01b031690806001600160401b038111156130ff576130ff61464c565b604051908082528060200260200182016040528015613128578160200160208202803683370190505b509a50806001600160401b038111156131435761314361464c565b60405190808252806020026020018201604052801561316c578160200160208202803683370190505b5099505f5b818110156132e257826001600160a01b03166341976e098e838151811061319a5761319a615086565b60200260200101516040518263ffffffff1660e01b81526004016131cd91906001600160a01b0391909116815260200190565b6040805180830381865afa1580156131e7573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061320b9190615886565b508c828151811061321e5761321e615086565b6020026020010181815250508c818151811061323c5761323c615086565b60200260200101516001600160a01b03166370a082318f6040518263ffffffff1660e01b815260040161327e91906001600160a01b0391909116815260200190565b602060405180830381865afa158015613299573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906132bd91906158b0565b8b82815181106132cf576132cf615086565b6020908102919091010152600101613171565b50826007015f9054906101000a90046001600160a01b03166001600160a01b03166377205b636040518163ffffffff1660e01b81526004015f60405180830381865afa158015613334573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261335b9190810190615387565b985088519050806001600160401b038111156133795761337961464c565b6040519080825280602002602001820160405280156133a2578160200160208202803683370190505b509750806001600160401b038111156133bd576133bd61464c565b6040519080825280602002602001820160405280156133e6578160200160208202803683370190505b5096505f5b818110156135425789818151811061340557613405615086565b60200260200101516001600160a01b031663a035b1fe6040518163ffffffff1660e01b81526004016040805180830381865afa158015613447573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061346b9190615886565b5089828151811061347e5761347e615086565b60200260200101818152505089818151811061349c5761349c615086565b60200260200101516001600160a01b03166370a082318f6040518263ffffffff1660e01b81526004016134de91906001600160a01b0391909116815260200190565b602060405180830381865afa1580156134f9573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061351d91906158b0565b88828151811061352f5761352f615086565b60209081029190910101526001016133eb565b5050604080516003808252608082019092528160208201606080368337505050600284015481519197506001600160a01b03169087905f9061358657613586615086565b6001600160a01b03928316602091820292909201015260078401548751911690879060019081106135b9576135b9615086565b6001600160a01b03928316602091820292909201015260088401548751911690879060029081106135ec576135ec615086565b60200260200101906001600160a01b031690816001600160a01b031681525050806001600160401b038111156136245761362461464c565b60405190808252806020026020018201604052801561364d578160200160208202803683370190505b5094505f5b81811015613746575f6001600160a01b031687828151811061367657613676615086565b60200260200101516001600160a01b03161461373e5786818151811061369e5761369e615086565b60200260200101516001600160a01b03166370a082318f6040518263ffffffff1660e01b81526004016136e091906001600160a01b0391909116815260200190565b602060405180830381865afa1580156136fb573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061371f91906158b0565b86828151811061373157613731615086565b6020026020010181815250505b600101613652565b5060038301546040516370a0823160e01b81526001600160a01b038f81166004830152909116906370a0823190602401602060405180830381865afa158015613791573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906137b591906158b0565b93505050509193959799909294969850565b6137cf613cf4565b5f6137d8613c92565b60068101549091506001600160a01b031615613807576040516333e9449d60e21b815260040160405180910390fd5b825f0151816006015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055508260200151816009015f6101000a8154816001600160a01b0302191690836001600160a01b03160217905550826040015181600b015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055508260600151816002015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055508260800151816003015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055508260a00151816007015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055508260c00151816008015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055508260e0015181600a015f6101000a8154816001600160a01b0302191690836001600160a01b03160217905550826101000151816005015f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555082610120015181600c015f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555082610180015181600d015f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555082610140015181600e015f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555082610160015181600f015f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555068056bc75e2d6310000081601901819055507fcdf4971b2af8b35e2501a87bd3740a3d0b3e42403f2d09e8c217786b65fe965d816001015f9054906101000a90046001600160a01b0316845f01518560200151866040015187606001518860a001518960c001518a60e001518b61012001518c61018001518d61014001518e6101600151604051613ae39c9b9a999897969594939291906158c7565b60405180910390a181516010820190613afc90826151dd565b5081602001518160110181905550613b268260400151836060015184608001518560a00151613e62565b613b388260c001518360e0015161407b565b6019810154604080515f815260208101929092527f36542355c4238243e42f18a2aea69f0c94db23a46c0f751ae8a74124d651139891016120e2565b5f613b7d611843565b9050336001600160a01b0316816001600160a01b0316635aa6e6756040518163ffffffff1660e01b8152600401602060405180830381865afa158015613bc5573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613be99190615947565b6001600160a01b031614158015613c715750336001600160a01b0316816001600160a01b0316634783c35b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613c41573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613c659190615947565b6001600160a01b031614155b15613c8f576040516354299b6f60e01b815260040160405180910390fd5b50565b7f263d5089de5bb3f97c8effd51f1a153b36e97065a51e67a94885830ed03a7a0090565b5f808080613ccd866001600160a01b0387166142ca565b909450925050505b9250929050565b60605f610e8b83614302565b60605f610e8b8361435b565b613cfc611843565b6040516336b87bd760e11b81523360048201526001600160a01b039190911690636d70f7ae90602401602060405180830381865afa158015613d40573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613d649190615140565b613d8157604051631f0853c160e21b815260040160405180910390fd5b565b5f610e8b836001600160a01b038416614366565b5f610e8b836001600160a01b0384166143b2565b5f610e8b836001600160a01b038416614495565b5f610e8b836001600160a01b0384166144b1565b33613ddc611843565b6001600160a01b0316635aa6e6756040518163ffffffff1660e01b8152600401602060405180830381865afa158015613e17573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613e3b9190615947565b6001600160a01b031614613d8157604051632d5be4cb60e21b815260040160405180910390fd5b5f613e6b613c92565b60048101549091506001600160a01b03168215801590613e9257506001600160a01b038116155b15613eb0576040516371c42ac360e01b815260040160405180910390fd5b611388861080613ec1575061c35086115b15613eeb5760405163dcf6afcb60e01b8152611388600482015261c3506024820152604401612823565b612710851015613f185760405163dcf6afcb60e01b815261271060048201525f6024820152604401612823565b612710841015613f455760405163dcf6afcb60e01b815261271060048201525f6024820152604401612823565b620186a083613f5486886152b0565b613f5e91906152b0565b1115613f885760405163dcf6afcb60e01b81525f6004820152620186a06024820152604401612823565b602782018690556028820185905560298201849055602a82018390556040805187815260208101879052908101859052606081018490527f7027e29faa2460f22e800d92db38d4795b668c7104da6b87afaeaf502a269ca59060800160405180910390a1505050505050565b80515f5b81811015611eec5761402c83828151811061401557614015615086565b602002602001015185613d8390919063ffffffff16565b6140735782818151811061404257614042615086565b602002602001015160405163e88e458960e01b815260040161282391906001600160a01b0391909116815260200190565b600101613ff8565b5f614084613c92565b601281018490556013810183905560408051858152602081018590529192507f9b30f86f0857913d2337c63fb4eb1eb65997a6587dcd80de1f6de3aee357c7c191016120e2565b5f610de6846001600160a01b038516846144f7565b336140e9611843565b6001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015614124573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906141489190615947565b6001600160a01b031614613d8157604051631966391b60e11b815260040160405180910390fd5b614177614513565b6001600160a01b03811615806141fd57505f6001600160a01b0316816001600160a01b0316634783c35b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156141ce573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906141f29190615947565b6001600160a01b0316145b1561421b576040516371c42ac360e01b815260040160405180910390fd5b61424e61424960017faa116a42804728f23983458454b6eb9c6ddf3011db9f9addaf3cd7508d85b0d66156e9565b829055565b6142804361427d60017f812a673dfca07956350df10f8a654925f561d7a0da09bdbe79e653939a14d9f16156e9565b55565b604080516001600160a01b0383168152426020820152438183015290517f1a2dd071001ebf6e03174e3df5b305795a4ad5d41d8fdb9ba41dbbe2367134269181900360600190a150565b5f8181526002830160205260408120548190806142f7576142eb858561455c565b92505f9150613cd59050565b600192509050613cd5565b6060815f0180548060200260200160405190810160405280929190818152602001828054801561434f57602002820191905f5260205f20905b81548152602001906001019080831161433b575b50505050509050919050565b6060610dc782613cdc565b5f8181526001830160205260408120546143ab57508154600181810184555f848152602080822090930184905584548482528286019093526040902091909155610dc7565b505f610dc7565b5f818152600183016020526040812054801561448c575f6143d46001836156e9565b85549091505f906143e7906001906156e9565b9050808214614446575f865f01828154811061440557614405615086565b905f5260205f200154905080875f01848154811061442557614425615086565b5f918252602080832090910192909255918252600188019052604090208390555b855486908061445757614457615962565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f905560019350505050610dc7565b5f915050610dc7565b5f8181526002830160205260408120819055610e8b8383614567565b5f818152600283016020526040812054801580156144d657506144d4848461455c565b155b15610e8b5760405163015ab34360e11b815260048101849052602401612823565b5f8281526002840160205260408120829055610de68484614572565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff16613d8157604051631afcd79f60e31b815260040160405180910390fd5b5f610e8b838361457d565b5f610e8b83836143b2565b5f610e8b8383614366565b5f8181526001830160205260408120541515610e8b565b828054828255905f5260205f209081019282156145e7579160200282015b828111156145e757825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906145b2565b506145f3929150614638565b5090565b604051806101000160405280606081526020015f80191681526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b5b808211156145f3575f8155600101614639565b634e487b7160e01b5f52604160045260245ffd5b60405161010081016001600160401b03811182821017156146835761468361464c565b60405290565b6040516101a081016001600160401b03811182821017156146835761468361464c565b604051601f8201601f191681016001600160401b03811182821017156146d4576146d461464c565b604052919050565b5f6001600160401b038211156146f4576146f461464c565b50601f01601f191660200190565b5f82601f830112614711575f80fd5b813561472461471f826146dc565b6146ac565b818152846020838601011115614738575f80fd5b816020850160208301375f918101602001919091529392505050565b5f6001600160401b0382111561476c5761476c61464c565b5060051b60200190565b6001600160a01b0381168114613c8f575f80fd5b803561479581614776565b919050565b5f82601f8301126147a9575f80fd5b813560206147b961471f83614754565b8083825260208201915060208460051b8701019350868411156147da575f80fd5b602086015b848110156147ff5780356147f281614776565b83529183019183016147df565b509695505050505050565b5f805f6060848603121561481c575f80fd5b83356001600160401b0380821115614832575f80fd5b61483e87838801614702565b94506020860135915080821115614853575f80fd5b61485f8783880161479a565b93506040860135915080821115614874575f80fd5b506148818682870161479a565b9150509250925092565b5f6020828403121561489b575f80fd5b81356001600160e01b031981168114610e8b575f80fd5b5f602082840312156148c2575f80fd5b8135610e8b81614776565b5f815180845260208085019450602084015f5b838110156149055781516001600160a01b0316875295820195908201906001016148e0565b509495945050505050565b602081525f610e8b60208301846148cd565b5f815180845260208085019450602084015f5b8381101561490557815187529582019590820190600101614935565b604081525f61496360408301856148cd565b82810360208401526149758185614922565b95945050505050565b5f5b83811015614998578181015183820152602001614980565b50505f910152565b5f81518084526149b781602086016020860161497e565b601f01601f19169290920160200192915050565b602081525f610e8b60208301846149a0565b602081525f82516101008060208501526149fb6101208501836149a0565b9150602085015160408501526040850151606085015260608501516080850152608085015160a085015260a085015160c085015260c085015160e085015260e085015181850152508091505092915050565b5f8282518085526020808601955060208260051b840101602086015f5b84811015614a9857601f19868403018952614a868383516149a0565b98840198925090830190600101614a6a565b5090979650505050505050565b5f815180845260208085019450602084015f5b83811015614905578151151587529582019590820190600101614ab8565b5f610140808352614ae98184018e6148cd565b90508281036020840152614afd818d6148cd565b90508281036040840152614b11818c6148cd565b90508281036060840152614b25818b614a4d565b90508281036080840152614b39818a614922565b905082810360a0840152614b4d8189614922565b905082810360c0840152614b618188614a4d565b905082810360e0840152614b758187614aa5565b9050828103610100840152614b8a8186614a4d565b9050828103610120840152614b9f8185614922565b9d9c50505050505050505050505050565b5f60208284031215614bc0575f80fd5b5035919050565b602081525f825160406020840152614be260608401826149a0565b602094909401516001600160a01b0316604093909301929092525090919050565b5f8060408385031215614c14575f80fd5b8235614c1f81614776565b946020939093013593505050565b602081525f825160606020840152614c4860808401826149a0565b90506020840151601f1980858403016040860152614c6683836148cd565b925060408601519150808584030160608601525061497582826148cd565b5f805f8060808587031215614c97575f80fd5b5050823594602084013594506040840135936060013592509050565b5f60208284031215614cc3575f80fd5b81356001600160401b03811115614cd8575f80fd5b610de68482850161479a565b5f8060408385031215614cf5575f80fd5b82356001600160401b0380821115614d0b575f80fd5b614d178683870161479a565b93506020850135915080821115614d2c575f80fd5b50614d398582860161479a565b9150509250929050565b5f8060408385031215614d54575f80fd5b82356001600160401b03811115614d69575f80fd5b614d7585828601614702565b9250506020830135614d8681614776565b809150509250929050565b5f8060408385031215614da2575f80fd5b50508035926020909101359150565b604081525f614dc36040830185614a4d565b828103602084015261497581856148cd565b5f8060408385031215614de6575f80fd5b8235614df181614776565b915060208301356001600160401b03811115614e0b575f80fd5b614d3985828601614702565b5f610120808352614e2a8184018d6148cd565b90508281036020840152614e3e818c614922565b90508281036040840152614e52818b614922565b90508281036060840152614e66818a6148cd565b90508281036080840152614e7a8189614922565b905082810360a0840152614e8e8188614922565b905082810360c0840152614ea281876148cd565b905082810360e0840152614eb68186614922565b915050826101008301529a9950505050505050505050565b5f6101008284031215614edf575f80fd5b614ee7614660565b905081356001600160401b03811115614efe575f80fd5b614f0a84828501614702565b8252506020820135602082015260408201356040820152606082013560608201526080820135608082015260a082013560a082015260c082013560c082015260e082013560e082015292915050565b5f808284036101c0811215614f6c575f80fd5b6101a080821215614f7b575f80fd5b614f83614689565b9150614f8e8561478a565b8252614f9c6020860161478a565b6020830152614fad6040860161478a565b6040830152614fbe6060860161478a565b6060830152614fcf6080860161478a565b6080830152614fe060a0860161478a565b60a0830152614ff160c0860161478a565b60c083015261500260e0860161478a565b60e083015261010061501581870161478a565b9083015261012061502786820161478a565b9083015261014061503986820161478a565b9083015261016061504b86820161478a565b9083015261018061505d86820161478a565b908301529092508301356001600160401b0381111561507a575f80fd5b614d3985828601614ece565b634e487b7160e01b5f52603260045260245ffd5b5f82601f8301126150a9575f80fd5b81516150b761471f826146dc565b8181528460208386010111156150cb575f80fd5b610de682602083016020870161497e565b5f602082840312156150ec575f80fd5b81516001600160401b03811115615101575f80fd5b610de68482850161509a565b604081525f61511f60408301856149a0565b828103602084015261497581856149a0565b80518015158114614795575f80fd5b5f60208284031215615150575f80fd5b610e8b82615131565b600181811c9082168061516d57607f821691505b60208210810361518b57634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156151d857805f5260205f20601f840160051c810160208510156151b65750805b601f840160051c820191505b818110156151d5575f81556001016151c2565b50505b505050565b81516001600160401b038111156151f6576151f661464c565b61520a816152048454615159565b84615191565b602080601f83116001811461523d575f84156152265750858301515b5f19600386901b1c1916600185901b178555615294565b5f85815260208120601f198616915b8281101561526b5788860151825594840194600190910190840161524c565b508582101561528857878501515f19600388901b60f8161c191681555b505060018460011b0185555b505050505050565b634e487b7160e01b5f52601160045260245ffd5b80820180821115610dc757610dc761529c565b60a081525f6152d560a08301886149a0565b82810360208401526152e781886149a0565b905082810360408401526152fb81876148cd565b9050828103606084015261530f81866148cd565b9150508260808301529695505050505050565b5f82601f830112615331575f80fd5b8151602061534161471f83614754565b8083825260208201915060208460051b870101935086841115615362575f80fd5b602086015b848110156147ff57805161537a81614776565b8352918301918301615367565b5f60208284031215615397575f80fd5b81516001600160401b038111156153ac575f80fd5b610de684828501615322565b5f82601f8301126153c7575f80fd5b815160206153d761471f83614754565b82815260059290921b840181019181810190868411156153f5575f80fd5b8286015b848110156147ff5780516001600160401b03811115615416575f80fd5b6154248986838b010161509a565b8452509183019183016153f9565b5f82601f830112615441575f80fd5b8151602061545161471f83614754565b8083825260208201915060208460051b870101935086841115615472575f80fd5b602086015b848110156147ff5761548881615131565b8352918301918301615477565b5f82601f8301126154a4575f80fd5b815160206154b461471f83614754565b8083825260208201915060208460051b8701019350868411156154d5575f80fd5b602086015b848110156147ff57805183529183019183016154da565b5f805f805f8060c08789031215615506575f80fd5b86516001600160401b038082111561551c575f80fd5b6155288a838b016153b8565b9750602089015191508082111561553d575f80fd5b6155498a838b01615322565b9650604089015191508082111561555e575f80fd5b61556a8a838b01615432565b9550606089015191508082111561557f575f80fd5b61558b8a838b01615432565b945060808901519150808211156155a0575f80fd5b6155ac8a838b01615495565b935060a08901519150808211156155c1575f80fd5b506155ce89828a01615495565b9150509295509295509295565b5f805f805f805f60e0888a0312156155f1575f80fd5b87516001600160401b0380821115615607575f80fd5b6156138b838c016153b8565b985060208a0151915080821115615628575f80fd5b6156348b838c01615432565b975060408a0151915080821115615649575f80fd5b6156558b838c01615432565b965060608a015191508082111561566a575f80fd5b6156768b838c01615432565b955060808a015191508082111561568b575f80fd5b6156978b838c01615495565b945060a08a01519150808211156156ac575f80fd5b6156b88b838c016153b8565b935060c08a01519150808211156156cd575f80fd5b506156da8a828b01615495565b91505092959891949750929550565b81810381811115610dc757610dc761529c565b604081525f61570e60408301856149a0565b6020838203818501525f855461572381615159565b8085526001828116801561573e576001811461575857615783565b60ff1984168787015282151560051b870186019450615783565b895f52855f205f5b8481101561577b578154898201890152908301908701615760565b880187019550505b50929998505050505050505050565b5f600182016157a3576157a361529c565b5060010190565b604081525f614dc360408301856148cd565b604081525f6157ce60408301856149a0565b905060018060a01b03831660208301529392505050565b604080825283519082018190525f906020906060840190828701845b828110156158265781516001600160a01b031684529284019290840190600101615801565b5050506001600160a01b039490941660209390930192909252509092915050565b6001600160a01b03841681526060602082018190525f9061586a908301856149a0565b828103604084015261587c81856149a0565b9695505050505050565b5f8060408385031215615897575f80fd5b825191506158a760208401615131565b90509250929050565b5f602082840312156158c0575f80fd5b5051919050565b6001600160a01b038d811682528c811660208301528b811660408301528a81166060830152898116608083015288811660a083015287811660c083015286811660e0830152858116610100830152841661012082015261018081016001600160a01b0384166101408301526001600160a01b038316610160830152614b9f565b5f60208284031215615957575f80fd5b8151610e8b81614776565b634e487b7160e01b5f52603160045260245ffdfea26469706673582212208c85e4a8299405182a06d08437f0a7695f1110ad33995fddd12885cf3d3c786964736f6c63430008170033
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.