Contract

0xd4D6ad656f64E8644AFa18e7CCc9372E0Cd256f0

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

-

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
VaultManager

Compiler Version
v0.8.23+commit.f704f362

Optimization Enabled:
Yes with 200 runs

Other Settings:
shanghai EvmVersion
File 1 of 34 : VaultManager.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";
import "./base/Controllable.sol";
import "./libs/VaultManagerLib.sol";
import "./libs/VaultTypeLib.sol";
import "../interfaces/IVaultManager.sol";
import "../interfaces/IVault.sol";
import "../interfaces/IFactory.sol";
import "../interfaces/IRVault.sol";
import "../interfaces/IManagedVault.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)
contract VaultManager is Controllable, ERC721EnumerableUpgradeable, IVaultManager {
    //region ----- Constants -----

    /// @inheritdoc IControllable
    string public constant VERSION = "1.0.0";

    // keccak256(abi.encode(uint256(keccak256("erc7201:stability.VaultManager")) - 1)) & ~bytes32(uint256(0xff));
    bytes32 private constant VAULTMANAGER_STORAGE_LOCATION =
        0xdc91b926f64ceb646f47da4c796e445221faf197fcaee29e875daf63dcf64e00;

    //endregion ----- Constants -----

    //region ----- Storage -----

    /// @custom:storage-location erc7201:stability.VaultManager
    struct VaultManagerStorage {
        /// @inheritdoc IVaultManager
        mapping(uint tokenId => address vault) tokenVault;
        mapping(uint tokenId => address account) _revenueReceiver;
    }

    //endregion -- Storage -----

    function init(address platform_) external initializer {
        __Controllable_init(platform_);
        __ERC721_init("Stability Vault", "VAULT");
    }

    /// @inheritdoc IVaultManager
    //slither-disable-next-line reentrancy-events
    function changeVaultParams(uint tokenId, address[] memory addresses, uint[] memory nums) external {
        VaultManagerStorage storage $ = _getStorage();
        _requireOwner(tokenId);
        address vault = $.tokenVault[tokenId];
        IManagedVault(vault).changeParams(addresses, nums);
        emit ChangeVaultParams(tokenId, addresses, nums);
    }

    /// @inheritdoc IVaultManager
    function mint(address to, address vault) external onlyFactory returns (uint tokenId) {
        VaultManagerStorage storage $ = _getStorage();
        tokenId = totalSupply();
        $.tokenVault[tokenId] = vault;
        _mint(to, tokenId);
    }

    /// @inheritdoc IVaultManager
    function setRevenueReceiver(uint tokenId, address receiver) external {
        VaultManagerStorage storage $ = _getStorage();
        _requireOwner(tokenId);
        $._revenueReceiver[tokenId] = receiver;
        emit SetRevenueReceiver(tokenId, receiver);
    }

    /// @dev Returns current token URI metadata
    /// @param tokenId Token ID to fetch URI for.
    function tokenURI(uint tokenId) public view override(ERC721Upgradeable, IERC721Metadata) returns (string memory) {
        if (_ownerOf(tokenId) == address(0)) {
            revert NotExist();
        }
        VaultManagerStorage storage $ = _getStorage();
        //slither-disable-next-line uninitialized-local
        VaultData memory vaultData;
        IPlatform _platform = IPlatform(platform());
        IFactory factory = IFactory(_platform.factory());
        vaultData.vault = $.tokenVault[tokenId];
        IVault vault = IVault(vaultData.vault);
        IStrategy strategy = vault.strategy();
        // slither-disable-next-line unused-return
        (vaultData.sharePrice,) = vault.price();
        // slither-disable-next-line unused-return
        (vaultData.tvl,) = vault.tvl();
        // slither-disable-next-line unused-return
        (vaultData.totalApr, vaultData.strategyApr,,) = vault.getApr();
        vaultData.vaultType = vault.vaultType();
        vaultData.name = IERC20Metadata(vaultData.vault).name();
        vaultData.vaultExtra = vault.extra();
        vaultData.strategyExtra = strategy.extra();

        address bbAsset = address(0);
        if (keccak256(bytes(vaultData.vaultType)) == keccak256(bytes(VaultTypeLib.REWARDING))) {
            address[] memory rts = IRVault(vaultData.vault).rewardTokens();
            vaultData.rewardAssetsSymbols = CommonLib.getSymbols(rts);
            bbAsset = rts[0];
        }

        // slither-disable-next-line unused-return
        (vaultData.strategyId,, vaultData.assetsSymbols, vaultData.strategySpecific, vaultData.symbol) =
            factory.getStrategyData(vaultData.vaultType, address(strategy), bbAsset);

        vaultData.strategyTokenId = factory.strategyLogicConfig(keccak256(bytes(vaultData.strategyId))).tokenId;

        return VaultManagerLib.tokenURI(vaultData, _platform.platformVersion(), _platform.getPlatformSettings());
    }

    /// @inheritdoc IVaultManager
    //slither-disable-next-line calls-loop
    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
        )
    {
        VaultManagerStorage storage $ = _getStorage();
        uint len = totalSupply();
        vaultAddress = new address[](len);
        name = new string[](len);
        symbol = new string[](len);
        vaultType = new string[](len);
        strategyId = new string[](len);
        sharePrice = new uint[](len);
        totalApr = new uint[](len);
        strategyApr = new uint[](len);
        strategySpecific = new string[](len);
        tvl = new uint[](len);
        // nosemgrep
        for (uint i; i < len; ++i) {
            vaultAddress[i] = $.tokenVault[i];
            IVault vault = IVault(vaultAddress[i]);
            name[i] = IERC20Metadata(vaultAddress[i]).name();
            symbol[i] = IERC20Metadata(vaultAddress[i]).symbol();
            vaultType[i] = vault.vaultType();
            IStrategy strategy = vault.strategy();
            strategyId[i] = strategy.strategyLogicId();
            //slither-disable-next-line unused-return
            (strategySpecific[i],) = strategy.getSpecificName();
            //slither-disable-next-line unused-return
            (totalApr[i], strategyApr[i],,) = vault.getApr();
            //slither-disable-next-line unused-return
            (sharePrice[i],) = vault.price();
            //slither-disable-next-line unused-return
            (tvl[i],) = vault.tvl();
        }
    }

    /// @inheritdoc IVaultManager
    function vaultAddresses() external view returns (address[] memory vaultAddress) {
        VaultManagerStorage storage $ = _getStorage();
        uint len = totalSupply();
        vaultAddress = new address[](len);
        // nosemgrep
        for (uint i; i < len; ++i) {
            vaultAddress[i] = $.tokenVault[i];
        }
    }

    /// @inheritdoc IVaultManager
    function vaultInfo(address vault)
        external
        view
        returns (
            address strategy,
            address[] memory strategyAssets,
            address underlying,
            address[] memory assetsWithApr,
            uint[] memory assetsAprs,
            uint lastHardWork
        )
    {
        IVault v = IVault(vault);
        IStrategy s = v.strategy();
        strategy = address(s);
        strategyAssets = s.assets();
        underlying = s.underlying();
        //slither-disable-next-line unused-return
        (,, assetsWithApr, assetsAprs) = v.getApr();
        lastHardWork = s.lastHardWork();
    }

    /// @inheritdoc IVaultManager
    function getRevenueReceiver(uint tokenId) external view returns (address receiver) {
        VaultManagerStorage storage $ = _getStorage();
        receiver = $._revenueReceiver[tokenId];
        if (receiver == address(0)) {
            receiver = _ownerOf(tokenId);
        }
    }

    /// @inheritdoc IVaultManager
    function tokenVault(uint tokenId) external view returns (address vault) {
        VaultManagerStorage storage $ = _getStorage();
        vault = $.tokenVault[tokenId];
    }

    /// @inheritdoc IERC165
    function supportsInterface(bytes4 interfaceId)
        public
        view
        override(ERC721EnumerableUpgradeable, IERC165, Controllable)
        returns (bool)
    {
        return interfaceId == type(IVaultManager).interfaceId || interfaceId == type(IControllable).interfaceId
            || super.supportsInterface(interfaceId);
    }

    function _requireOwner(uint tokenId) internal view {
        if (_ownerOf(tokenId) != msg.sender) {
            revert NotTheOwner();
        }
    }

    //region ----- Internal logic -----

    function _getStorage() private pure returns (VaultManagerStorage storage $) {
        //slither-disable-next-line assembly
        assembly {
            $.slot := VAULTMANAGER_STORAGE_LOCATION
        }
    }

    //endregion ----- Internal logic -----
}

File 2 of 34 : IERC20Metadata.sol
// 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);
}

File 3 of 34 : ERC721EnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/ERC721Enumerable.sol)

pragma solidity ^0.8.20;

import {ERC721Upgradeable} from "../ERC721Upgradeable.sol";
import {IERC721Enumerable} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {Initializable} from "../../../proxy/utils/Initializable.sol";

/**
 * @dev This implements an optional extension of {ERC721} defined in the EIP that adds enumerability
 * of all the token ids in the contract as well as all token ids owned by each account.
 *
 * CAUTION: `ERC721` extensions that implement custom `balanceOf` logic, such as `ERC721Consecutive`,
 * interfere with enumerability and should not be used together with `ERC721Enumerable`.
 */
abstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721Enumerable {
    /// @custom:storage-location erc7201:openzeppelin.storage.ERC721Enumerable
    struct ERC721EnumerableStorage {
        mapping(address owner => mapping(uint256 index => uint256)) _ownedTokens;
        mapping(uint256 tokenId => uint256) _ownedTokensIndex;

        uint256[] _allTokens;
        mapping(uint256 tokenId => uint256) _allTokensIndex;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC721Enumerable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant ERC721EnumerableStorageLocation = 0x645e039705490088daad89bae25049a34f4a9072d398537b1ab2425f24cbed00;

    function _getERC721EnumerableStorage() private pure returns (ERC721EnumerableStorage storage $) {
        assembly {
            $.slot := ERC721EnumerableStorageLocation
        }
    }

    /**
     * @dev An `owner`'s token query was out of bounds for `index`.
     *
     * NOTE: The owner being `address(0)` indicates a global out of bounds index.
     */
    error ERC721OutOfBoundsIndex(address owner, uint256 index);

    /**
     * @dev Batch mint is not allowed.
     */
    error ERC721EnumerableForbiddenBatchMint();

    function __ERC721Enumerable_init() internal onlyInitializing {
    }

    function __ERC721Enumerable_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721Upgradeable) returns (bool) {
        return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual returns (uint256) {
        ERC721EnumerableStorage storage $ = _getERC721EnumerableStorage();
        if (index >= balanceOf(owner)) {
            revert ERC721OutOfBoundsIndex(owner, index);
        }
        return $._ownedTokens[owner][index];
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual returns (uint256) {
        ERC721EnumerableStorage storage $ = _getERC721EnumerableStorage();
        return $._allTokens.length;
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual returns (uint256) {
        ERC721EnumerableStorage storage $ = _getERC721EnumerableStorage();
        if (index >= totalSupply()) {
            revert ERC721OutOfBoundsIndex(address(0), index);
        }
        return $._allTokens[index];
    }

    /**
     * @dev See {ERC721-_update}.
     */
    function _update(address to, uint256 tokenId, address auth) internal virtual override returns (address) {
        address previousOwner = super._update(to, tokenId, auth);

        if (previousOwner == address(0)) {
            _addTokenToAllTokensEnumeration(tokenId);
        } else if (previousOwner != to) {
            _removeTokenFromOwnerEnumeration(previousOwner, tokenId);
        }
        if (to == address(0)) {
            _removeTokenFromAllTokensEnumeration(tokenId);
        } else if (previousOwner != to) {
            _addTokenToOwnerEnumeration(to, tokenId);
        }

        return previousOwner;
    }

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @param to address representing the new owner of the given token ID
     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
     */
    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        ERC721EnumerableStorage storage $ = _getERC721EnumerableStorage();
        uint256 length = balanceOf(to) - 1;
        $._ownedTokens[to][length] = tokenId;
        $._ownedTokensIndex[tokenId] = length;
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        ERC721EnumerableStorage storage $ = _getERC721EnumerableStorage();
        $._allTokensIndex[tokenId] = $._allTokens.length;
        $._allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @param from address representing the previous owner of the given token ID
     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
     */
    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        ERC721EnumerableStorage storage $ = _getERC721EnumerableStorage();
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = balanceOf(from);
        uint256 tokenIndex = $._ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = $._ownedTokens[from][lastTokenIndex];

            $._ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            $._ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete $._ownedTokensIndex[tokenId];
        delete $._ownedTokens[from][lastTokenIndex];
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        ERC721EnumerableStorage storage $ = _getERC721EnumerableStorage();
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = $._allTokens.length - 1;
        uint256 tokenIndex = $._allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = $._allTokens[lastTokenIndex];

        $._allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        $._allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete $._allTokensIndex[tokenId];
        $._allTokens.pop();
    }

    /**
     * See {ERC721-_increaseBalance}. We need that to account tokens that were minted in batch
     */
    function _increaseBalance(address account, uint128 amount) internal virtual override {
        if (amount > 0) {
            revert ERC721EnumerableForbiddenBatchMint();
        }
        super._increaseBalance(account, amount);
    }
}

File 4 of 34 : Controllable.sol
// 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();
        }
    }
}

File 5 of 34 : VaultManagerLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

import {Base64} from "@openzeppelin/contracts/utils/Base64.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "./CommonLib.sol";
import "../../interfaces/IVaultManager.sol";
import "../../interfaces/IPlatform.sol";

/// @dev Library for VaultManager's tokenURI generation with SVG image and other metadata
library VaultManagerLib {
    struct TokenURIVars {
        uint h;
        uint vaultBlockHeight;
        uint platformBlockHeight;
        uint step;
        string vaultColor;
        string vaultBgColor;
        string strategyColor;
        string strategyBgColor;
        string networkColor;
        string networkBgColor;
    }

    /// @dev Return SVG logo, name and description of VaultManager tokenId
    function tokenURI(
        IVaultManager.VaultData memory vaultData,
        string memory platformVersion,
        IPlatform.PlatformSettings memory platformData
    ) external pure returns (string memory output) {
        //region ----- Setup vars -----
        TokenURIVars memory vars;
        vars.h = 40;
        vars.vaultBlockHeight = 470;
        vars.platformBlockHeight = 170;
        vars.step = 40;
        vars.vaultColor = CommonLib.bToHex(abi.encodePacked(bytes3(vaultData.vaultExtra)));
        vars.vaultBgColor = CommonLib.bToHex(abi.encodePacked(bytes3(vaultData.vaultExtra << 8 * 3)));
        vars.strategyColor = CommonLib.bToHex(abi.encodePacked(bytes3(vaultData.strategyExtra)));
        vars.strategyBgColor = CommonLib.bToHex(abi.encodePacked(bytes3(vaultData.strategyExtra << 8 * 3)));
        vars.networkColor = CommonLib.bToHex(abi.encodePacked(bytes3(platformData.networkExtra)));
        vars.networkBgColor = CommonLib.bToHex(abi.encodePacked(bytes3(platformData.networkExtra << 8 * 3)));
        output = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 900">';
        //endregion -- Setup vars -----

        //region ----- SVG logo -----
        //endregion -- SVG logo -----

        //region ----- Styles -----
        output = string.concat(output, "<style>");
        output = string.concat(output, ".base{font-weight: bold;font-family: sans-serif;}");
        output = string.concat(output, ".title{font-size:46px;}");
        output = string.concat(output, ".symbol{font-size:30px;}");
        output = string.concat(output, ".address{font-size:20px;}");
        output = string.concat(output, ".strategyTitle{font-size:34px;}");
        output = string.concat(output, ".strategy{font-size:30px;}");
        output = string.concat(output, ".param{font-size:26px;}");
        output = string.concat(output, ".value{font-size:26px;font-weight: bold;}");
        output = string.concat(output, ".platform{font-size:26px;}");
        output = string.concat(output, ".platform-param{font-size:20px;}");
        output = string.concat(output, ".platform-value{font-size:20px;font-weight: bold;}");
        output = string.concat(output, "</style>");
        //endregion -- Styles -----

        //region ----- Vault -----
        vars.h += vars.step;
        output = string.concat(
            output, '<rect fill="#', vars.vaultBgColor, '" width="600" height="', _str(vars.vaultBlockHeight), '"/>'
        );
        output = string.concat(
            output,
            '<text transform="matrix(1 0 0 1 50 ',
            _str(vars.h),
            ')" fill="#',
            vars.vaultColor,
            '" class="title base">Vault #',
            _str(vaultData.tokenId),
            "</text>"
        );
        vars.h += vars.step + 6;
        output = string.concat(
            output,
            '<text transform="matrix(1 0 0 1 50 ',
            _str(vars.h),
            ')" fill="#',
            vars.vaultColor,
            '" class="symbol base">',
            vaultData.symbol,
            "</text>"
        );
        vars.h += vars.step - 4;
        output = string.concat(
            output,
            '<text transform="matrix(1 0 0 1 50 ',
            _str(vars.h),
            ')" fill="#',
            vars.vaultColor,
            '" class="address base">',
            Strings.toHexString(vaultData.vault),
            "</text>"
        );
        vars.h += vars.step;
        output = string.concat(
            output,
            '<text transform="matrix(1 0 0 1 50 ',
            _str(vars.h),
            ')" fill="#',
            vars.vaultColor,
            '" class="param base">Type</text><text transform="matrix(1 0 0 1 300 ',
            _str(vars.h),
            ')" fill="#',
            vars.vaultColor,
            '" class="value base">',
            vaultData.vaultType,
            "</text>"
        );
        vars.h += vars.step;
        output = string.concat(
            output,
            '<text transform="matrix(1 0 0 1 50 ',
            _str(vars.h),
            ')" fill="#',
            vars.vaultColor,
            '" class="param base">Assets</text><text transform="matrix(1 0 0 1 300 ',
            _str(vars.h),
            ')" fill="#',
            vars.vaultColor,
            '" class="value base">',
            CommonLib.implode(vaultData.assetsSymbols, ", "),
            "</text>"
        );
        if (vaultData.rewardAssetsSymbols.length > 0) {
            vars.h += vars.step;
            output = string.concat(
                output,
                '<text transform="matrix(1 0 0 1 50 ',
                _str(vars.h),
                ')" fill="#',
                vars.vaultColor,
                '" class="param base">Buy-back</text><text transform="matrix(1 0 0 1 300 ',
                _str(vars.h),
                ')" fill="#',
                vars.vaultColor,
                '" class="value base">',
                vaultData.rewardAssetsSymbols[0],
                "</text>"
            );
            vars.h += vars.step;
            output = string.concat(
                output,
                '<text transform="matrix(1 0 0 1 50 ',
                _str(vars.h),
                ')" fill="#',
                vars.vaultColor,
                '" class="param base">Boost</text><text transform="matrix(1 0 0 1 300 ',
                _str(vars.h),
                ')" fill="#',
                vars.vaultColor,
                '" class="value base">',
                CommonLib.implode(vaultData.rewardAssetsSymbols, ", "),
                "</text>"
            );
        }
        vars.h += vars.step;
        output = string.concat(
            output,
            '<text transform="matrix(1 0 0 1 50 ',
            _str(vars.h),
            ')" fill="#',
            vars.vaultColor,
            '" class="param base">APR</text><text transform="matrix(1 0 0 1 300 ',
            _str(vars.h),
            ')" fill="#',
            vars.vaultColor,
            '" class="value base">',
            CommonLib.formatApr(vaultData.totalApr),
            "</text>"
        );
        vars.h += vars.step;
        output = string.concat(
            output,
            '<text transform="matrix(1 0 0 1 50 ',
            _str(vars.h),
            ')" fill="#',
            vars.vaultColor,
            '" class="param base">Share price</text><text transform="matrix(1 0 0 1 300 ',
            _str(vars.h),
            ')" fill="#',
            vars.vaultColor,
            '" class="value base">',
            CommonLib.formatUsdAmount(vaultData.sharePrice),
            "</text>"
        );
        vars.h += vars.step;
        output = string.concat(
            output,
            '<text transform="matrix(1 0 0 1 50 ',
            _str(vars.h),
            ')" fill="#',
            vars.vaultColor,
            '" class="param base">TVL</text><text transform="matrix(1 0 0 1 300 ',
            _str(vars.h),
            ')" fill="#',
            vars.vaultColor,
            '" class="value base">',
            CommonLib.formatUsdAmount(vaultData.tvl),
            "</text>"
        );
        //endregion -- Vault -----

        //region ----- Strategy -----
        uint strategyBlockHeight = 900 - vars.vaultBlockHeight - vars.platformBlockHeight;
        vars.h = vars.vaultBlockHeight + 15;
        output = string.concat(
            output,
            '<rect y="',
            _str(vars.vaultBlockHeight),
            '" fill="#',
            vars.strategyBgColor,
            '" width="600" height="',
            _str(strategyBlockHeight),
            '"/>'
        );
        vars.h += vars.step;
        output = string.concat(
            output,
            '<text transform="matrix(1 0 0 1 50 ',
            _str(vars.h),
            ')" fill="#',
            vars.strategyColor,
            '" class="strategyTitle base">Strategy #',
            _str(vaultData.strategyTokenId),
            "</text>"
        );
        vars.h += vars.step + 4;
        output = string.concat(
            output,
            '<text transform="matrix(1 0 0 1 50 ',
            _str(vars.h),
            ')" fill="#',
            vars.strategyColor,
            '" class="strategy base">',
            vaultData.strategyId,
            "</text>"
        );
        if (bytes(vaultData.strategySpecific).length > 0) {
            vars.h += vars.step;
            output = string.concat(
                output,
                '<text transform="matrix(1 0 0 1 50 ',
                _str(vars.h),
                ')" fill="#',
                vars.strategyColor,
                '" class="param base">Specific</text><text transform="matrix(1 0 0 1 300 ',
                _str(vars.h),
                ')" fill="#',
                vars.strategyColor,
                '" class="value base">',
                vaultData.strategySpecific,
                "</text>"
            );
        }
        vars.h += vars.step;
        output = string.concat(
            output,
            '<text transform="matrix(1 0 0 1 50 ',
            _str(vars.h),
            ')" fill="#',
            vars.strategyColor,
            '" class="param base">Strategy APR</text><text transform="matrix(1 0 0 1 300 ',
            _str(vars.h),
            ')" fill="#',
            vars.strategyColor,
            '" class="value base">',
            CommonLib.formatApr(vaultData.strategyApr),
            "</text>"
        );
        //endregion -- Strategy -----

        //region ----- Platform -----
        vars.step = 30;
        output = string.concat(
            output,
            '<rect y="',
            _str(vars.vaultBlockHeight + strategyBlockHeight),
            '" fill="#',
            vars.networkBgColor,
            '" width="600" height="',
            _str(vars.platformBlockHeight),
            '"/>'
        );
        vars.h = vars.vaultBlockHeight + strategyBlockHeight + 20;
        output = string.concat(output, '<g transform="translate(50,', _str(vars.h + 8), ')">');
        output = string.concat(
            output, '<polygon style="fill:#6466e9;" points="24,5.6 12.8,0 1.6,5.6 1.6,20 12.8,25.6 24,20 "/>'
        );
        output = string.concat(
            output, '<polygon style="fill:#36309d;" points="12.8,11.2 1.6,5.6 1.6,20 12.8,25.6 24,20 24,5.6 "/>'
        );
        output = string.concat(output, '<polygon style="fill:#201c62;" points="12.8,11.2 12.8,25.6 24,20 24,5.6 "/>');
        output = string.concat(output, "</g>");

        vars.h += vars.step;

        output = string.concat(
            output,
            '<text transform="matrix(1 0 0 1 80 ',
            _str(vars.h),
            ')" fill="#',
            vars.networkColor,
            '" class="platform base">Stability Platform ',
            platformVersion,
            "</text>"
        );
        vars.h += vars.step;
        output = string.concat(
            output,
            '<text transform="matrix(1 0 0 1 50 ',
            _str(vars.h),
            ')" fill="#',
            vars.networkColor,
            '" class="platform-param base">Network</text><text transform="matrix(1 0 0 1 300 ',
            _str(vars.h),
            ')" fill="#',
            vars.networkColor,
            '" class="platform-value base">',
            platformData.networkName,
            "</text>"
        );
        vars.h += vars.step;
        output = string.concat(
            output,
            '<text transform="matrix(1 0 0 1 50 ',
            _str(vars.h),
            ')" fill="#',
            vars.networkColor,
            '" class="platform-param base">Revenue fee</text><text transform="matrix(1 0 0 1 300 ',
            _str(vars.h),
            ')" fill="#',
            vars.networkColor,
            '" class="platform-value base">',
            CommonLib.formatApr(platformData.fee),
            "</text>"
        );
        vars.h += vars.step;
        output = string.concat(
            output,
            '<text transform="matrix(1 0 0 1 50 ',
            _str(vars.h),
            ')" fill="#',
            vars.networkColor,
            '" class="platform-param base">Manager share</text><text transform="matrix(1 0 0 1 300 ',
            _str(vars.h),
            ')" fill="#',
            vars.networkColor,
            '" class="platform-value base">',
            CommonLib.formatApr(platformData.feeShareVaultManager),
            "</text>"
        );
        //endregion -- Platform -----

        //region ----- Name, description -----
        string memory name = string.concat("Vault #", _str(vaultData.tokenId));
        string memory description = string.concat("Vault ", vaultData.name);
        //endregion -- Name, description -----

        //region ----- Encoding -----
        output = string.concat(output, "</svg>");
        string memory json = Base64.encode(
            bytes(
                string.concat(
                    '{"name": "',
                    name,
                    '", "description": "',
                    description,
                    '", "image": "data:image/svg+xml;base64,',
                    Base64.encode(bytes(output)),
                    '"}'
                )
            )
        );
        output = string.concat("data:application/json;base64,", json);
        //endregion -- Encoding -----
    }

    function _str(uint num) internal pure returns (string memory) {
        return Strings.toString(num);
    }
}

File 6 of 34 : VaultTypeLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

library VaultTypeLib {
    string internal constant COMPOUNDING = "Compounding";
    string internal constant REWARDING = "Rewarding";
    string internal constant REWARDING_MANAGED = "Rewarding Managed";
    string internal constant SPLITTER_MANAGED = "Splitter Managed";
    string internal constant SPLITTER_AUTO = "Splitter Automatic";
}

File 7 of 34 : IVaultManager.sol
// 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 -----
}

File 8 of 34 : IVault.sol
// 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;
}

File 9 of 34 : IFactory.sol
// 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 -----
}

File 10 of 34 : IRVault.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

import "./IVault.sol";

/// @notice Interface of Rewarding Vault
/// @author Alien Deployer (https://github.com/a17)
/// @author JodsMigel (https://github.com/JodsMigel)
/// @author 0xhokugava (https://github.com/0xhokugava)
interface IRVault is IVault {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       CUSTOM ERRORS                        */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    error NotAllowed();
    error Overflow(uint maxAmount);
    error RTNotFound();
    error NoBBToken();
    error NotAllowedBBToken();
    error IncorrectNums();
    error ZeroToken();
    error ZeroVestingDuration();
    error TooHighCompoundRation();
    error RewardIsTooSmall();
    // error RewardIsTooBig();

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                           EVENTS                           */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    event RewardAdded(address rewardToken, uint reward);
    event RewardPaid(address indexed user, address rewardToken, uint reward);
    event SetRewardsRedirect(address owner, address receiver);
    event AddedRewardToken(address indexed token, uint indexed tokenIndex);
    event CompoundRatio(uint compoundRatio_);

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                         DATA TYPES                         */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @custom:storage-location erc7201:stability.RVaultBase
    struct RVaultBaseStorage {
        /// @inheritdoc IRVault
        mapping(uint tokenIndex => address rewardToken) rewardToken;
        /// @inheritdoc IRVault
        mapping(uint tokenIndex => uint durationSeconds) duration;
        /// @inheritdoc IRVault
        mapping(address owner => address receiver) rewardsRedirect;
        /// @dev Timestamp value when current period of rewards will be ended
        mapping(uint tokenIndex => uint finishTimestamp) periodFinishForToken;
        /// @dev Reward rate in normal circumstances is distributed rewards divided on duration
        mapping(uint tokenIndex => uint rewardRate) rewardRateForToken;
        /// @dev Last rewards snapshot time. Updated on each share movements
        mapping(uint tokenIndex => uint lastUpdateTimestamp) lastUpdateTimeForToken;
        /// @dev Rewards snapshot calculated from rewardPerToken(rt). Updated on each share movements
        mapping(uint tokenIndex => uint rewardPerTokenStored) rewardPerTokenStoredForToken;
        /// @dev User personal reward rate snapshot. Updated on each share movements
        mapping(uint tokenIndex => mapping(address user => uint rewardPerTokenPaid)) userRewardPerTokenPaidForToken;
        /// @dev User personal earned reward snapshot. Updated on each share movements
        mapping(uint tokenIndex => mapping(address user => uint earned)) rewardsForToken;
        /// @inheritdoc IRVault
        uint rewardTokensTotal;
        /// @inheritdoc IRVault
        uint compoundRatio;
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       VIEW FUNCTIONS                       */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @notice All vault rewarding tokens
    /// @return Reward token addresses
    function rewardTokens() external view returns (address[] memory);

    /// @return Total of bbToken + boost reward tokens
    function rewardTokensTotal() external view returns (uint);

    /// @notice Immutable reward buy-back token with tokenIndex 0
    function bbToken() external view returns (address);

    /// @dev A mapping of reward tokens that able to be distributed to this contract.
    /// Token with index 0 always is bbToken.
    function rewardToken(uint tokenIndex) external view returns (address rewardToken_);

    /// @notice Re-investing ratio
    /// @dev Changeable ratio of revenue part for re-investing. Other part goes to rewarding by bbToken.
    /// @return Ratio of re-investing part of revenue. Denominator is 100_000.
    function compoundRatio() external view returns (uint);

    /// @notice Vesting period for distribution reward
    /// @param tokenIndex Index of rewarding token
    /// @return durationSeconds Duration for distributing of notified reward
    function duration(uint tokenIndex) external view returns (uint durationSeconds);

    /// @notice Return earned rewards for specific token and account
    ///         Accurate value returns only after updateRewards call
    ///         ((balanceOf(account)
    ///           * (rewardPerToken - userRewardPerTokenPaidForToken)) / 10**18) + rewardsForToken
    function earned(uint rewardTokenIndex, address account) external view returns (uint);

    /// @notice Return reward per token ratio by reward token address
    ///                rewardPerTokenStoredForToken + (
    ///                (lastTimeRewardApplicable - lastUpdateTimeForToken)
    ///                 * rewardRateForToken * 10**18 / totalSupply)
    /// @param rewardTokenIndex Index of reward token
    /// @return Return reward per token ratio by reward token address
    function rewardPerToken(uint rewardTokenIndex) external view returns (uint);

    /// @dev Receiver of rewards can be set by multisig when owner cant claim rewards himself
    /// @param owner Token owner address
    /// @return receiver Return reward's receiver
    function rewardsRedirect(address owner) external view returns (address receiver);

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                      WRITE FUNCTIONS                       */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @notice Filling vault with rewards
    /// @dev Update rewardRateForToken
    /// If period ended: reward / duration
    /// else add leftover to the reward amount and refresh the period
    /// (reward + ((periodFinishForToken - block.timestamp) * rewardRateForToken)) / duration
    /// @param tokenIndex Index of rewarding token
    /// @param amount Amount for rewarding
    function notifyTargetRewardAmount(uint tokenIndex, uint amount) external;

    /// @notice Update and Claim all rewards for caller
    function getAllRewards() external;

    /// @notice Update and Claim rewards for specific token
    /// @param rt Index of reward token
    function getReward(uint rt) external;

    /// @dev All rewards for given owner could be claimed for receiver address.
    /// @param owner Token owner address
    /// @param receiver New reward's receiver
    function setRewardsRedirect(address owner, address receiver) external;

    /// @notice Update and Claim all rewards for given owner address. Send them to predefined receiver.
    /// @param owner Token owner address
    function getAllRewardsAndRedirect(address owner) external;

    /// @notice Update and Claim all rewards for the given owner.
    ///         Sender should have allowance for push rewards for the owner.
    /// @param owner Token owner address
    function getAllRewardsFor(address owner) external;
}

File 11 of 34 : IManagedVault.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

/// @dev Managed vaults allow the owner of the VaultManager token to change their parameters.
/// @author JodsMigel (https://github.com/JodsMigel)
interface IManagedVault {
    //region ----- Custom Errors -----
    error CantRemoveRewardToken();
    error NotVaultManager();
    error IncorrectRewardToken(address token);
    error CantChangeDuration(uint incorrectDuration);
    //endregion -- Custom Errors -----

    /// @notice VaultManager contract can change managed vault parameters by this method
    /// @param vaultInitAddresses All vault init addresses. Not changeable init addresses must be provided correctly.
    /// @param vaultInitNums All vault init numbers. Not changeable init numbers must be provided correctly.
    function changeParams(address[] memory vaultInitAddresses, uint[] memory vaultInitNums) external;
}

File 12 of 34 : IERC20.sol
// 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);
}

File 13 of 34 : ERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.20;

import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import {IERC721Metadata} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import {ContextUpgradeable} from "../../utils/ContextUpgradeable.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {ERC165Upgradeable} from "../../utils/introspection/ERC165Upgradeable.sol";
import {IERC721Errors} from "@openzeppelin/contracts/interfaces/draft-IERC6093.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
abstract contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721, IERC721Metadata, IERC721Errors {
    using Strings for uint256;

    /// @custom:storage-location erc7201:openzeppelin.storage.ERC721
    struct ERC721Storage {
        // Token name
        string _name;

        // Token symbol
        string _symbol;

        mapping(uint256 tokenId => address) _owners;

        mapping(address owner => uint256) _balances;

        mapping(uint256 tokenId => address) _tokenApprovals;

        mapping(address owner => mapping(address operator => bool)) _operatorApprovals;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC721")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant ERC721StorageLocation = 0x80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079300;

    function _getERC721Storage() private pure returns (ERC721Storage storage $) {
        assembly {
            $.slot := ERC721StorageLocation
        }
    }

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {
        __ERC721_init_unchained(name_, symbol_);
    }

    function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
        ERC721Storage storage $ = _getERC721Storage();
        $._name = name_;
        $._symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165) returns (bool) {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual returns (uint256) {
        ERC721Storage storage $ = _getERC721Storage();
        if (owner == address(0)) {
            revert ERC721InvalidOwner(address(0));
        }
        return $._balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual returns (address) {
        return _requireOwned(tokenId);
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual returns (string memory) {
        ERC721Storage storage $ = _getERC721Storage();
        return $._name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual returns (string memory) {
        ERC721Storage storage $ = _getERC721Storage();
        return $._symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual returns (string memory) {
        _requireOwned(tokenId);

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string.concat(baseURI, tokenId.toString()) : "";
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual {
        _approve(to, tokenId, _msgSender());
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual returns (address) {
        _requireOwned(tokenId);

        return _getApproved(tokenId);
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual returns (bool) {
        ERC721Storage storage $ = _getERC721Storage();
        return $._operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(address from, address to, uint256 tokenId) public virtual {
        if (to == address(0)) {
            revert ERC721InvalidReceiver(address(0));
        }
        // Setting an "auth" arguments enables the `_isAuthorized` check which verifies that the token exists
        // (from != 0). Therefore, it is not needed to verify that the return value is not 0 here.
        address previousOwner = _update(to, tokenId, _msgSender());
        if (previousOwner != from) {
            revert ERC721IncorrectOwner(from, tokenId, previousOwner);
        }
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) public {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual {
        transferFrom(from, to, tokenId);
        _checkOnERC721Received(from, to, tokenId, data);
    }

    /**
     * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
     *
     * IMPORTANT: Any overrides to this function that add ownership of tokens not tracked by the
     * core ERC721 logic MUST be matched with the use of {_increaseBalance} to keep balances
     * consistent with ownership. The invariant to preserve is that for any address `a` the value returned by
     * `balanceOf(a)` must be equal to the number of tokens such that `_ownerOf(tokenId)` is `a`.
     */
    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
        ERC721Storage storage $ = _getERC721Storage();
        return $._owners[tokenId];
    }

    /**
     * @dev Returns the approved address for `tokenId`. Returns 0 if `tokenId` is not minted.
     */
    function _getApproved(uint256 tokenId) internal view virtual returns (address) {
        ERC721Storage storage $ = _getERC721Storage();
        return $._tokenApprovals[tokenId];
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `owner`'s tokens, or `tokenId` in
     * particular (ignoring whether it is owned by `owner`).
     *
     * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
     * assumption.
     */
    function _isAuthorized(address owner, address spender, uint256 tokenId) internal view virtual returns (bool) {
        return
            spender != address(0) &&
            (owner == spender || isApprovedForAll(owner, spender) || _getApproved(tokenId) == spender);
    }

    /**
     * @dev Checks if `spender` can operate on `tokenId`, assuming the provided `owner` is the actual owner.
     * Reverts if `spender` does not have approval from the provided `owner` for the given token or for all its assets
     * the `spender` for the specific `tokenId`.
     *
     * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
     * assumption.
     */
    function _checkAuthorized(address owner, address spender, uint256 tokenId) internal view virtual {
        if (!_isAuthorized(owner, spender, tokenId)) {
            if (owner == address(0)) {
                revert ERC721NonexistentToken(tokenId);
            } else {
                revert ERC721InsufficientApproval(spender, tokenId);
            }
        }
    }

    /**
     * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
     *
     * NOTE: the value is limited to type(uint128).max. This protect against _balance overflow. It is unrealistic that
     * a uint256 would ever overflow from increments when these increments are bounded to uint128 values.
     *
     * WARNING: Increasing an account's balance using this function tends to be paired with an override of the
     * {_ownerOf} function to resolve the ownership of the corresponding tokens so that balances and ownership
     * remain consistent with one another.
     */
    function _increaseBalance(address account, uint128 value) internal virtual {
        ERC721Storage storage $ = _getERC721Storage();
        unchecked {
            $._balances[account] += value;
        }
    }

    /**
     * @dev Transfers `tokenId` from its current owner to `to`, or alternatively mints (or burns) if the current owner
     * (or `to`) is the zero address. Returns the owner of the `tokenId` before the update.
     *
     * The `auth` argument is optional. If the value passed is non 0, then this function will check that
     * `auth` is either the owner of the token, or approved to operate on the token (by the owner).
     *
     * Emits a {Transfer} event.
     *
     * NOTE: If overriding this function in a way that tracks balances, see also {_increaseBalance}.
     */
    function _update(address to, uint256 tokenId, address auth) internal virtual returns (address) {
        ERC721Storage storage $ = _getERC721Storage();
        address from = _ownerOf(tokenId);

        // Perform (optional) operator check
        if (auth != address(0)) {
            _checkAuthorized(from, auth, tokenId);
        }

        // Execute the update
        if (from != address(0)) {
            // Clear approval. No need to re-authorize or emit the Approval event
            _approve(address(0), tokenId, address(0), false);

            unchecked {
                $._balances[from] -= 1;
            }
        }

        if (to != address(0)) {
            unchecked {
                $._balances[to] += 1;
            }
        }

        $._owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        return from;
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal {
        if (to == address(0)) {
            revert ERC721InvalidReceiver(address(0));
        }
        address previousOwner = _update(to, tokenId, address(0));
        if (previousOwner != address(0)) {
            revert ERC721InvalidSender(address(0));
        }
    }

    /**
     * @dev Mints `tokenId`, transfers it to `to` and checks for `to` acceptance.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {
        _mint(to, tokenId);
        _checkOnERC721Received(address(0), to, tokenId, data);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     * This is an internal function that does not check if the sender is authorized to operate on the token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal {
        address previousOwner = _update(address(0), tokenId, address(0));
        if (previousOwner == address(0)) {
            revert ERC721NonexistentToken(tokenId);
        }
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(address from, address to, uint256 tokenId) internal {
        if (to == address(0)) {
            revert ERC721InvalidReceiver(address(0));
        }
        address previousOwner = _update(to, tokenId, address(0));
        if (previousOwner == address(0)) {
            revert ERC721NonexistentToken(tokenId);
        } else if (previousOwner != from) {
            revert ERC721IncorrectOwner(from, tokenId, previousOwner);
        }
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking that contract recipients
     * are aware of the ERC721 standard to prevent tokens from being forever locked.
     *
     * `data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is like {safeTransferFrom} in the sense that it invokes
     * {IERC721Receiver-onERC721Received} on the receiver, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `tokenId` token must exist and be owned by `from`.
     * - `to` cannot be the zero address.
     * - `from` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(address from, address to, uint256 tokenId) internal {
        _safeTransfer(from, to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeTransfer-address-address-uint256-}[`_safeTransfer`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {
        _transfer(from, to, tokenId);
        _checkOnERC721Received(from, to, tokenId, data);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * The `auth` argument is optional. If the value passed is non 0, then this function will check that `auth` is
     * either the owner of the token, or approved to operate on all tokens held by this owner.
     *
     * Emits an {Approval} event.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address to, uint256 tokenId, address auth) internal {
        _approve(to, tokenId, auth, true);
    }

    /**
     * @dev Variant of `_approve` with an optional flag to enable or disable the {Approval} event. The event is not
     * emitted in the context of transfers.
     */
    function _approve(address to, uint256 tokenId, address auth, bool emitEvent) internal virtual {
        ERC721Storage storage $ = _getERC721Storage();
        // Avoid reading the owner unless necessary
        if (emitEvent || auth != address(0)) {
            address owner = _requireOwned(tokenId);

            // We do not use _isAuthorized because single-token approvals should not be able to call approve
            if (auth != address(0) && owner != auth && !isApprovedForAll(owner, auth)) {
                revert ERC721InvalidApprover(auth);
            }

            if (emitEvent) {
                emit Approval(owner, to, tokenId);
            }
        }

        $._tokenApprovals[tokenId] = to;
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Requirements:
     * - operator can't be the address zero.
     *
     * Emits an {ApprovalForAll} event.
     */
    function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
        ERC721Storage storage $ = _getERC721Storage();
        if (operator == address(0)) {
            revert ERC721InvalidOperator(operator);
        }
        $._operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Reverts if the `tokenId` doesn't have a current owner (it hasn't been minted, or it has been burned).
     * Returns the owner.
     *
     * Overrides to ownership logic should be done to {_ownerOf}.
     */
    function _requireOwned(uint256 tokenId) internal view returns (address) {
        address owner = _ownerOf(tokenId);
        if (owner == address(0)) {
            revert ERC721NonexistentToken(tokenId);
        }
        return owner;
    }

    /**
     * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target address. This will revert if the
     * recipient doesn't accept the token transfer. The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param data bytes optional data to send along with the call
     */
    function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory data) private {
        if (to.code.length > 0) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
                if (retval != IERC721Receiver.onERC721Received.selector) {
                    revert ERC721InvalidReceiver(to);
                }
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert ERC721InvalidReceiver(to);
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        }
    }
}

File 14 of 34 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.20;

import {IERC721} from "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

File 15 of 34 : IERC165.sol
// 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);
}

File 16 of 34 : Initializable.sol
// 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
        }
    }
}

File 17 of 34 : ERC165.sol
// 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;
    }
}

File 18 of 34 : SlotsLib.sol
// 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)
        }
    }
}

File 19 of 34 : IControllable.sol
// 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);
}

File 20 of 34 : IPlatform.sol
// 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;
}

File 21 of 34 : Base64.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Base64.sol)

pragma solidity ^0.8.20;

/**
 * @dev Provides a set of functions to operate with Base64 strings.
 */
library Base64 {
    /**
     * @dev Base64 Encoding/Decoding Table
     */
    string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

    /**
     * @dev Converts a `bytes` to its Bytes64 `string` representation.
     */
    function encode(bytes memory data) internal pure returns (string memory) {
        /**
         * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence
         * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol
         */
        if (data.length == 0) return "";

        // Loads the table into memory
        string memory table = _TABLE;

        // Encoding takes 3 bytes chunks of binary data from `bytes` data parameter
        // and split into 4 numbers of 6 bits.
        // The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up
        // - `data.length + 2`  -> Round up
        // - `/ 3`              -> Number of 3-bytes chunks
        // - `4 *`              -> 4 characters for each chunk
        string memory result = new string(4 * ((data.length + 2) / 3));

        /// @solidity memory-safe-assembly
        assembly {
            // Prepare the lookup table (skip the first "length" byte)
            let tablePtr := add(table, 1)

            // Prepare result pointer, jump over length
            let resultPtr := add(result, 32)

            // Run over the input, 3 bytes at a time
            for {
                let dataPtr := data
                let endPtr := add(data, mload(data))
            } lt(dataPtr, endPtr) {

            } {
                // Advance 3 bytes
                dataPtr := add(dataPtr, 3)
                let input := mload(dataPtr)

                // To write each character, shift the 3 bytes (18 bits) chunk
                // 4 times in blocks of 6 bits for each character (18, 12, 6, 0)
                // and apply logical AND with 0x3F which is the number of
                // the previous character in the ASCII table prior to the Base64 Table
                // The result is then added to the table to get the character to write,
                // and finally write it in the result pointer but with a left shift
                // of 256 (1 byte) - 8 (1 ASCII char) = 248 bits

                mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance
            }

            // When data `bytes` is not exactly 3 bytes long
            // it is padded with `=` characters at the end
            switch mod(mload(data), 3)
            case 1 {
                mstore8(sub(resultPtr, 1), 0x3d)
                mstore8(sub(resultPtr, 2), 0x3d)
            }
            case 2 {
                mstore8(sub(resultPtr, 1), 0x3d)
            }
        }

        return result;
    }
}

File 22 of 34 : Strings.sol
// 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));
    }
}

File 23 of 34 : CommonLib.sol
// 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));
    }
}

File 24 of 34 : IERC721Metadata.sol
// 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);
}

File 25 of 34 : IStrategy.sol
// 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;
}

File 26 of 34 : EnumerableSet.sol
// 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;
    }
}

File 27 of 34 : IERC721.sol
// 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);
}

File 28 of 34 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.20;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be
     * reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 29 of 34 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Context.sol)

pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 30 of 34 : ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 */
abstract contract ERC165Upgradeable is Initializable, IERC165 {
    function __ERC165_init() internal onlyInitializing {
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 31 of 34 : draft-IERC6093.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;

/**
 * @dev Standard ERC20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     * @param tokenId Identifier number of a token.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155MissingApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}

File 32 of 34 : Math.sol
// 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;
    }
}

File 33 of 34 : SignedMath.sol
// 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);
        }
    }
}

File 34 of 34 : ConstantsLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

library ConstantsLib {
    uint internal constant DENOMINATOR = 100_000;
    address internal constant DEAD_ADDRESS = 0xdEad000000000000000000000000000000000000;
}

Settings
{
  "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

Contract ABI

[{"inputs":[],"name":"AlreadyExist","type":"error"},{"inputs":[],"name":"ERC721EnumerableForbiddenBatchMint","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721IncorrectOwner","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721InsufficientApproval","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC721InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC721InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721InvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC721InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC721InvalidSender","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721NonexistentToken","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"ERC721OutOfBoundsIndex","type":"error"},{"inputs":[],"name":"ETHTransferFailed","type":"error"},{"inputs":[],"name":"IncorrectArrayLength","type":"error"},{"inputs":[],"name":"IncorrectInitParams","type":"error"},{"inputs":[],"name":"IncorrectMsgSender","type":"error"},{"inputs":[],"name":"IncorrectZeroArgument","type":"error"},{"inputs":[],"name":"InvalidInitialization","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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address[]","name":"addresses","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"nums","type":"uint256[]"}],"name":"ChangeVaultParams","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":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"}],"name":"SetRevenueReceiver","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"CONTROLLABLE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address[]","name":"addresses","type":"address[]"},{"internalType":"uint256[]","name":"nums","type":"uint256[]"}],"name":"changeVaultParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"createdBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getRevenueReceiver","outputs":[{"internalType":"address","name":"receiver","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"platform_","type":"address"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"vault","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"platform","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"setRevenueReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenVault","outputs":[{"internalType":"address","name":"vault","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vaultAddresses","outputs":[{"internalType":"address[]","name":"vaultAddress","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"}],"name":"vaultInfo","outputs":[{"internalType":"address","name":"strategy","type":"address"},{"internalType":"address[]","name":"strategyAssets","type":"address[]"},{"internalType":"address","name":"underlying","type":"address"},{"internalType":"address[]","name":"assetsWithApr","type":"address[]"},{"internalType":"uint256[]","name":"assetsAprs","type":"uint256[]"},{"internalType":"uint256","name":"lastHardWork","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vaults","outputs":[{"internalType":"address[]","name":"vaultAddress","type":"address[]"},{"internalType":"string[]","name":"name","type":"string[]"},{"internalType":"string[]","name":"symbol","type":"string[]"},{"internalType":"string[]","name":"vaultType","type":"string[]"},{"internalType":"string[]","name":"strategyId","type":"string[]"},{"internalType":"uint256[]","name":"sharePrice","type":"uint256[]"},{"internalType":"uint256[]","name":"tvl","type":"uint256[]"},{"internalType":"uint256[]","name":"totalApr","type":"uint256[]"},{"internalType":"uint256[]","name":"strategyApr","type":"uint256[]"},{"internalType":"string[]","name":"strategySpecific","type":"string[]"}],"stateMutability":"view","type":"function"}]

608060405234801562000010575f80fd5b506200001b62000021565b620000d5565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff1615620000725760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b0390811614620000d25780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b613c1880620000e35f395ff3fe608060405234801561000f575f80fd5b50600436106101c6575f3560e01c80634f6ccce7116100fe57806395d89b411161009e578063c87b56dd1161006e578063c87b56dd14610411578063e985e9c514610424578063ee1fe2ad14610437578063ffa1ad74146103ac575f80fd5b806395d89b41146103d0578063a22cb465146103d8578063b5802f73146103eb578063b88d4fde146103fe575f80fd5b806377205b63116100d957806377205b63146103545780638220ef5b146103695780639164359a14610387578063936725ec146103ac575f80fd5b80634f6ccce71461031b5780636352211e1461032e57806370a0823114610341575f80fd5b806323b872dd116101695780633ccf45f4116101445780633ccf45f4146102e557806342842e0e146102f85780634593144c1461030b5780634bde38c814610313575f80fd5b806323b872dd146102ac5780632f745c59146102bf5780633cae9646146102d2575f80fd5b8063095ea7b3116101a4578063095ea7b31461023257806318160ddd1461024757806319ab453c14610265578063218fc1e614610278575f80fd5b806301ffc9a7146101ca57806306fdde03146101f2578063081812fc14610207575b5f80fd5b6101dd6101d8366004612aee565b61044a565b60405190151581526020015b60405180910390f35b6101fa61048f565b6040516101e99190612b5d565b61021a610215366004612b6f565b610530565b6040516001600160a01b0390911681526020016101e9565b610245610240366004612b9a565b610544565b005b5f80516020613ba3833981519152545b6040519081526020016101e9565b610245610273366004612bc4565b610553565b61021a610286366004612b6f565b5f9081525f80516020613bc383398151915260205260409020546001600160a01b031690565b6102456102ba366004612bdf565b6106ad565b6102576102cd366004612b9a565b61073b565b6102456102e0366004612d3a565b6107ac565b61021a6102f3366004612b6f565b610872565b610245610306366004612bdf565b6108cd565b6102576108ec565b61021a610924565b610257610329366004612b6f565b610953565b61021a61033c366004612b6f565b6109c5565b61025761034f366004612bc4565b6109cf565b61035c610a27565b6040516101e99190612e42565b610371610af1565b6040516101e99a99989796959493929190612edb565b61039a610395366004612bc4565b611337565b6040516101e996959493929190612fb5565b6101fa604051806040016040528060058152602001640312e302e360dc1b81525081565b6101fa61154d565b6102456103e6366004613026565b61158b565b6102456103f936600461305d565b611596565b61024561040c3660046130a6565b611615565b6101fa61041f366004612b6f565b61162c565b6101dd610432366004613148565b611e7f565b610257610445366004613148565b611ecb565b5f6001600160e01b031982166303c2abc560e31b148061047a57506001600160e01b03198216630f1ec81f60e41b145b80610489575061048982611f30565b92915050565b5f80516020613b8383398151915280546060919081906104ae90613174565b80601f01602080910402602001604051908101604052809291908181526020018280546104da90613174565b80156105255780601f106104fc57610100808354040283529160200191610525565b820191905f5260205f20905b81548152906001019060200180831161050857829003601f168201915b505050505091505090565b5f61053a82611f54565b5061048982611f8b565b61054f828233611fc4565b5050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03165f811580156105975750825b90505f826001600160401b031660011480156105b25750303b155b9050811580156105c0575080155b156105de5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561060857845460ff60401b1916600160401b1785555b61061186611fd1565b61065f6040518060400160405280600f81526020016e14dd18589a5b1a5d1e4815985d5b1d608a1b81525060405180604001604052806005815260200164159055531560da1b81525061212c565b83156106a557845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050565b6001600160a01b0382166106db57604051633250574960e11b81525f60048201526024015b60405180910390fd5b5f6106e783833361213e565b9050836001600160a01b0316816001600160a01b031614610735576040516364283d7b60e01b81526001600160a01b03808616600483015260248201849052821660448201526064016106d2565b50505050565b5f5f80516020613b63833981519152610753846109cf565b83106107845760405163295f44f760e21b81526001600160a01b0385166004820152602481018490526044016106d2565b6001600160a01b0384165f908152602091825260408082208583529092522054905092915050565b5f80516020613bc38339815191526107c38461223c565b5f8481526020829052604090819020549051633e6d4a2f60e11b81526001600160a01b03909116908190637cda945e9061080390879087906004016131a6565b5f604051808303815f87803b15801561081a575f80fd5b505af115801561082c573d5f803e3d5ffd5b505050507f8a3f3ae961f929de67317ea56703e16267eb8de197efed8c2395939fac4dd747858585604051610863939291906131d3565b60405180910390a15050505050565b5f8181527fdc91b926f64ceb646f47da4c796e445221faf197fcaee29e875daf63dcf64e0160205260409020546001600160a01b03165f80516020613bc3833981519152816108c7576108c483612270565b91505b50919050565b6108e783838360405180602001604052805f815250611615565b505050565b5f61091f61091b60017f812a673dfca07956350df10f8a654925f561d7a0da09bdbe79e653939a14d9f1613207565b5490565b905090565b5f61091f61091b60017faa116a42804728f23983458454b6eb9c6ddf3011db9f9addaf3cd7508d85b0d6613207565b5f5f80516020613b638339815191526109775f80516020613ba38339815191525490565b831061099f5760405163295f44f760e21b81525f6004820152602481018490526044016106d2565b8060020183815481106109b4576109b4613226565b905f5260205f200154915050919050565b5f61048982611f54565b5f5f80516020613b838339815191526001600160a01b038316610a07576040516322718ad960e21b81525f60048201526024016106d2565b6001600160a01b039092165f908152600390920160205250604090205490565b60605f80516020613bc38339815191525f610a4d5f80516020613ba38339815191525490565b9050806001600160401b03811115610a6757610a67612c1d565b604051908082528060200260200182016040528015610a90578160200160208202803683370190505b5092505f5b81811015610aeb575f8181526020849052604090205484516001600160a01b0390911690859083908110610acb57610acb613226565b6001600160a01b0390921660209283029190910190910152600101610a95565b50505090565b60608080808080808080805f80516020613bc38339815191525f610b205f80516020613ba38339815191525490565b9050806001600160401b03811115610b3a57610b3a612c1d565b604051908082528060200260200182016040528015610b63578160200160208202803683370190505b509b50806001600160401b03811115610b7e57610b7e612c1d565b604051908082528060200260200182016040528015610bb157816020015b6060815260200190600190039081610b9c5790505b509a50806001600160401b03811115610bcc57610bcc612c1d565b604051908082528060200260200182016040528015610bff57816020015b6060815260200190600190039081610bea5790505b509950806001600160401b03811115610c1a57610c1a612c1d565b604051908082528060200260200182016040528015610c4d57816020015b6060815260200190600190039081610c385790505b509850806001600160401b03811115610c6857610c68612c1d565b604051908082528060200260200182016040528015610c9b57816020015b6060815260200190600190039081610c865790505b509750806001600160401b03811115610cb657610cb6612c1d565b604051908082528060200260200182016040528015610cdf578160200160208202803683370190505b509650806001600160401b03811115610cfa57610cfa612c1d565b604051908082528060200260200182016040528015610d23578160200160208202803683370190505b509450806001600160401b03811115610d3e57610d3e612c1d565b604051908082528060200260200182016040528015610d67578160200160208202803683370190505b509350806001600160401b03811115610d8257610d82612c1d565b604051908082528060200260200182016040528015610db557816020015b6060815260200190600190039081610da05790505b509250806001600160401b03811115610dd057610dd0612c1d565b604051908082528060200260200182016040528015610df9578160200160208202803683370190505b5095505f5b81811015611328575f818152602084905260409020548d516001600160a01b03909116908e9083908110610e3457610e34613226565b60200260200101906001600160a01b031690816001600160a01b0316815250505f8d8281518110610e6757610e67613226565b602002602001015190508d8281518110610e8357610e83613226565b60200260200101516001600160a01b03166306fdde036040518163ffffffff1660e01b81526004015f60405180830381865afa158015610ec5573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610eec919081019061327c565b8d8381518110610efe57610efe613226565b60200260200101819052508d8281518110610f1b57610f1b613226565b60200260200101516001600160a01b03166395d89b416040518163ffffffff1660e01b81526004015f60405180830381865afa158015610f5d573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610f84919081019061327c565b8c8381518110610f9657610f96613226565b6020026020010181905250806001600160a01b0316634ac032be6040518163ffffffff1660e01b81526004015f60405180830381865afa158015610fdc573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611003919081019061327c565b8b838151811061101557611015613226565b60200260200101819052505f816001600160a01b031663a8c62e766040518163ffffffff1660e01b8152600401602060405180830381865afa15801561105d573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061108191906132ad565b9050806001600160a01b0316634875c9686040518163ffffffff1660e01b81526004015f60405180830381865afa1580156110be573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526110e5919081019061327c565b8b84815181106110f7576110f7613226565b6020026020010181905250806001600160a01b0316631ec71e056040518163ffffffff1660e01b81526004015f60405180830381865afa15801561113d573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261116491908101906132d8565b5086848151811061117757611177613226565b6020026020010181905250816001600160a01b031663845bc8046040518163ffffffff1660e01b81526004015f60405180830381865afa1580156111bd573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526111e49190810190613380565b9050508985815181106111f9576111f9613226565b6020026020010189868151811061121257611212613226565b6020026020010182815250828152505050816001600160a01b031663a035b1fe6040518163ffffffff1660e01b81526004016040805180830381865afa15801561125e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112829190613443565b508a848151811061129557611295613226565b602002602001018181525050816001600160a01b031663e5328e066040518163ffffffff1660e01b81526004016040805180830381865afa1580156112dc573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113009190613443565b5089848151811061131357611313613226565b60209081029190910101525050600101610dfe565b50505090919293949596979899565b5f60605f6060805f808790505f816001600160a01b031663a8c62e766040518163ffffffff1660e01b8152600401602060405180830381865afa158015611380573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113a491906132ad565b9050809750806001600160a01b03166371a973056040518163ffffffff1660e01b81526004015f60405180830381865afa1580156113e4573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261140b9190810190613466565b9650806001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015611449573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061146d91906132ad565b9550816001600160a01b031663845bc8046040518163ffffffff1660e01b81526004015f60405180830381865afa1580156114aa573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526114d19190810190613380565b909192509091508095508196505050806001600160a01b03166313e631806040518163ffffffff1660e01b8152600401602060405180830381865afa15801561151c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115409190613497565b9250505091939550919395565b7f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930180546060915f80516020613b83833981519152916104ae90613174565b61054f3383836122a9565b5f80516020613bc38339815191526115ad8361223c565b5f83815260018201602090815260409182902080546001600160a01b0319166001600160a01b0386169081179091558251868152918201527fa83e8967b7ce26c82b43a0fc5e46f1a242fd5341151c6f7c098efe8d485b4e56910160405180910390a1505050565b6116208484846106ad565b61073584848484612358565b60605f61163883612270565b6001600160a01b03160361165f5760405163ad5679e160e01b815260040160405180910390fd5b5f5f80516020613bc383398151915290506116f66040518061020001604052805f81526020015f6001600160a01b0316815260200160608152602001606081526020016060815260200160608152602001606081526020015f81526020015f81526020015f81526020015f80191681526020015f815260200160608152602001606081526020015f81526020015f80191681525090565b5f6116ff610924565b90505f816001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561173e573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061176291906132ad565b5f87815260208681526040808320546001600160a01b03168783018190528151635463173b60e11b8152915194955093849263a8c62e7692600480820193918290030181865afa1580156117b8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906117dc91906132ad565b9050816001600160a01b031663a035b1fe6040518163ffffffff1660e01b81526004016040805180830381865afa158015611819573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061183d9190613443565b5060e086015260408051637299470360e11b815281516001600160a01b0385169263e5328e0692600480820193918290030181865afa158015611882573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906118a69190613443565b5085610100018181525050816001600160a01b031663845bc8046040518163ffffffff1660e01b81526004015f60405180830381865afa1580156118ec573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526119139190810190613380565b50506101c087015261012086015260408051632560195f60e11b815290516001600160a01b03841691634ac032be916004808301925f9291908290030181865afa158015611963573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261198a919081019061327c565b856040018190525084602001516001600160a01b03166306fdde036040518163ffffffff1660e01b81526004015f60405180830381865afa1580156119d1573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526119f8919081019061327c565b8560600181905250816001600160a01b031663190024e06040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a3c573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a609190613497565b85610140018181525050806001600160a01b031663190024e06040518163ffffffff1660e01b8152600401602060405180830381865afa158015611aa6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611aca9190613497565b6101e08601526040805180820182526009815268526577617264696e6760b81b6020918201529086015180519101205f907f9ebab07909aaa4cdae2d5e985d99720616df0dc6818db31d46ea1437e7afe57f01611c26575f86602001516001600160a01b031663c2b18aa06040518163ffffffff1660e01b81526004015f60405180830381865afa158015611b61573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611b889190810190613466565b60405163fbcadbe960e01b8152909150734f76add676c04eca837130ceb58bc173de8799de9063fbcadbe990611bc29084906004016134ae565b5f60405180830381865af4158015611bdc573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611c039190810190613574565b60c0880152805181905f90611c1a57611c1a613226565b60200260200101519150505b6040808701519051637ac1b9a760e11b81526001600160a01b0386169163f583734e91611c5a9190869086906004016135a5565b5f60405180830381865afa158015611c74573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611c9b91908101906135d7565b60808b01526101a08a015260a089015250610180870181905280516020909101206040516362b75e6b60e11b815260048101919091526001600160a01b0385169063c56ebcd6906024015f60405180830381865afa158015611cff573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611d26919081019061369f565b60a001518661016001818152505073e080ed61824494de0b191597e907ee458f47c64b638aecdced87876001600160a01b031663a8f43c676040518163ffffffff1660e01b81526004015f60405180830381865afa158015611d8a573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611db1919081019061327c565b886001600160a01b03166335157a586040518163ffffffff1660e01b81526004015f60405180830381865afa158015611dec573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611e139190810190613766565b6040518463ffffffff1660e01b8152600401611e319392919061387f565b5f60405180830381865af4158015611e4b573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611e72919081019061327c565b9998505050505050505050565b6001600160a01b039182165f9081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab00793056020908152604080832093909416825291909152205460ff1690565b5f611ed461247e565b5f80516020613bc3833981519152611ef75f80516020613ba38339815191525490565b5f81815260208390526040902080546001600160a01b0319166001600160a01b0386161790559150611f29848361250f565b5092915050565b5f6001600160e01b0319821663780e9d6360e01b1480610489575061048982612570565b5f80611f5f83612270565b90506001600160a01b03811661048957604051637e27328960e01b8152600481018490526024016106d2565b5f9081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930460205260409020546001600160a01b031690565b6108e783838360016125bf565b611fd96126d2565b6001600160a01b038116158061205f57505f6001600160a01b0316816001600160a01b0316634783c35b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612030573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061205491906132ad565b6001600160a01b0316145b1561207d576040516371c42ac360e01b815260040160405180910390fd5b6120b06120ab60017faa116a42804728f23983458454b6eb9c6ddf3011db9f9addaf3cd7508d85b0d6613207565b829055565b6120e2436120df60017f812a673dfca07956350df10f8a654925f561d7a0da09bdbe79e653939a14d9f1613207565b55565b604080516001600160a01b0383168152426020820152438183015290517f1a2dd071001ebf6e03174e3df5b305795a4ad5d41d8fdb9ba41dbbe2367134269181900360600190a150565b6121346126d2565b61054f828261271b565b5f8061214b85858561274b565b90506001600160a01b0381166121d2576121cd845f80516020613ba383398151915280545f8381527f645e039705490088daad89bae25049a34f4a9072d398537b1ab2425f24cbed0360205260408120829055600182018355919091527fa42f15e5d656f8155fd7419d740a6073999f19cd6e061449ce4a257150545bf20155565b6121f5565b846001600160a01b0316816001600160a01b0316146121f5576121f5818561284d565b6001600160a01b0385166122115761220c846128ec565b612234565b846001600160a01b0316816001600160a01b0316146122345761223485856129b9565b949350505050565b3361224682612270565b6001600160a01b03161461226d576040516336b6b89560e01b815260040160405180910390fd5b50565b5f9081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930260205260409020546001600160a01b031690565b5f80516020613b838339815191526001600160a01b0383166122e957604051630b61174360e31b81526001600160a01b03841660048201526024016106d2565b6001600160a01b038481165f818152600584016020908152604080832094881680845294825291829020805460ff191687151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a350505050565b6001600160a01b0383163b1561073557604051630a85bd0160e11b81526001600160a01b0384169063150b7a029061239a903390889087908790600401613a02565b6020604051808303815f875af19250505080156123d4575060408051601f3d908101601f191682019092526123d191810190613a34565b60015b61243b573d808015612401576040519150601f19603f3d011682016040523d82523d5f602084013e612406565b606091505b5080515f0361243357604051633250574960e11b81526001600160a01b03851660048201526024016106d2565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b1461247757604051633250574960e11b81526001600160a01b03851660048201526024016106d2565b5050505050565b33612487610924565b6001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156124c2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906124e691906132ad565b6001600160a01b03161461250d57604051631966391b60e11b815260040160405180910390fd5b565b6001600160a01b03821661253857604051633250574960e11b81525f60048201526024016106d2565b5f61254483835f61213e565b90506001600160a01b038116156108e7576040516339e3563760e11b81525f60048201526024016106d2565b5f6001600160e01b031982166380ac58cd60e01b14806125a057506001600160e01b03198216635b5e139f60e01b145b8061048957506301ffc9a760e01b6001600160e01b0319831614610489565b5f80516020613b8383398151915281806125e157506001600160a01b03831615155b156126a2575f6125f085611f54565b90506001600160a01b0384161580159061261c5750836001600160a01b0316816001600160a01b031614155b801561262f575061262d8185611e7f565b155b156126585760405163a9fbf51f60e01b81526001600160a01b03851660048201526024016106d2565b82156126a05784866001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b5f93845260040160205250506040902080546001600160a01b0319166001600160a01b0392909216919091179055565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661250d57604051631afcd79f60e31b815260040160405180910390fd5b6127236126d2565b5f80516020613b838339815191528061273c8482613a93565b50600181016107358382613a93565b5f5f80516020613b838339815191528161276485612270565b90506001600160a01b0384161561278057612780818587612a11565b6001600160a01b038116156127bc5761279b5f865f806125bf565b6001600160a01b0381165f908152600383016020526040902080545f190190555b6001600160a01b038616156127ec576001600160a01b0386165f9081526003830160205260409020805460010190555b5f85815260028301602052604080822080546001600160a01b0319166001600160a01b038a811691821790925591518893918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a495945050505050565b5f80516020613b638339815191525f612865846109cf565b5f8481526001840160205260409020549091508082146128b8576001600160a01b0385165f9081526020848152604080832085845282528083205484845281842081905583526001860190915290208190555b505f92835260018201602090815260408085208590556001600160a01b039095168452918252838320908352905290812055565b5f80516020613ba3833981519152545f80516020613b63833981519152905f9061291890600190613207565b5f84815260038401602052604081205460028501805493945090928490811061294357612943613226565b905f5260205f20015490508084600201838154811061296457612964613226565b5f9182526020808320909101929092558281526003860190915260408082208490558682528120556002840180548061299f5761299f613b4e565b600190038181905f5260205f20015f905590555050505050565b5f80516020613b638339815191525f60016129d3856109cf565b6129dd9190613207565b6001600160a01b039094165f9081526020838152604080832087845282528083208690559482526001909301909252502055565b612a1c838383612a75565b6108e7576001600160a01b038316612a4a57604051637e27328960e01b8152600481018290526024016106d2565b60405163177e802f60e01b81526001600160a01b0383166004820152602481018290526044016106d2565b5f6001600160a01b038316158015906122345750826001600160a01b0316846001600160a01b03161480612aae5750612aae8484611e7f565b806122345750826001600160a01b0316612ac783611f8b565b6001600160a01b031614949350505050565b6001600160e01b03198116811461226d575f80fd5b5f60208284031215612afe575f80fd5b8135612b0981612ad9565b9392505050565b5f5b83811015612b2a578181015183820152602001612b12565b50505f910152565b5f8151808452612b49816020860160208601612b10565b601f01601f19169290920160200192915050565b602081525f612b096020830184612b32565b5f60208284031215612b7f575f80fd5b5035919050565b6001600160a01b038116811461226d575f80fd5b5f8060408385031215612bab575f80fd5b8235612bb681612b86565b946020939093013593505050565b5f60208284031215612bd4575f80fd5b8135612b0981612b86565b5f805f60608486031215612bf1575f80fd5b8335612bfc81612b86565b92506020840135612c0c81612b86565b929592945050506040919091013590565b634e487b7160e01b5f52604160045260245ffd5b60405160c081016001600160401b0381118282101715612c5357612c53612c1d565b60405290565b60405161010081016001600160401b0381118282101715612c5357612c53612c1d565b604051601f8201601f191681016001600160401b0381118282101715612ca457612ca4612c1d565b604052919050565b5f6001600160401b03821115612cc457612cc4612c1d565b5060051b60200190565b5f82601f830112612cdd575f80fd5b81356020612cf2612ced83612cac565b612c7c565b8083825260208201915060208460051b870101935086841115612d13575f80fd5b602086015b84811015612d2f5780358352918301918301612d18565b509695505050505050565b5f805f60608486031215612d4c575f80fd5b833592506020808501356001600160401b0380821115612d6a575f80fd5b818701915087601f830112612d7d575f80fd5b8135612d8b612ced82612cac565b81815260059190911b8301840190848101908a831115612da9575f80fd5b938501935b82851015612dd0578435612dc181612b86565b82529385019390850190612dae565b965050506040870135925080831115612de7575f80fd5b5050612df586828701612cce565b9150509250925092565b5f815180845260208085019450602084015f5b83811015612e375781516001600160a01b031687529582019590820190600101612e12565b509495945050505050565b602081525f612b096020830184612dff565b5f8282518085526020808601955060208260051b840101602086015f5b84811015612e9f57601f19868403018952612e8d838351612b32565b98840198925090830190600101612e71565b5090979650505050505050565b5f815180845260208085019450602084015f5b83811015612e3757815187529582019590820190600101612ebf565b5f610140808352612eee8184018e612dff565b90508281036020840152612f02818d612e54565b90508281036040840152612f16818c612e54565b90508281036060840152612f2a818b612e54565b90508281036080840152612f3e818a612e54565b905082810360a0840152612f528189612eac565b905082810360c0840152612f668188612eac565b905082810360e0840152612f7a8187612eac565b9050828103610100840152612f8f8186612eac565b9050828103610120840152612fa48185612e54565b9d9c50505050505050505050505050565b5f60018060a01b03808916835260c06020840152612fd660c0840189612dff565b81881660408501528381036060850152612ff08188612dff565b91505082810360808401526130058186612eac565b9150508260a0830152979650505050505050565b801515811461226d575f80fd5b5f8060408385031215613037575f80fd5b823561304281612b86565b9150602083013561305281613019565b809150509250929050565b5f806040838503121561306e575f80fd5b82359150602083013561305281612b86565b5f6001600160401b0382111561309857613098612c1d565b50601f01601f191660200190565b5f805f80608085870312156130b9575f80fd5b84356130c481612b86565b935060208501356130d481612b86565b92506040850135915060608501356001600160401b038111156130f5575f80fd5b8501601f81018713613105575f80fd5b8035613113612ced82613080565b818152886020838501011115613127575f80fd5b816020840160208301375f6020838301015280935050505092959194509250565b5f8060408385031215613159575f80fd5b823561316481612b86565b9150602083013561305281612b86565b600181811c9082168061318857607f821691505b6020821081036108c757634e487b7160e01b5f52602260045260245ffd5b604081525f6131b86040830185612dff565b82810360208401526131ca8185612eac565b95945050505050565b838152606060208201525f6131eb6060830185612dff565b82810360408401526131fd8185612eac565b9695505050505050565b8181038181111561048957634e487b7160e01b5f52601160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b5f82601f830112613249575f80fd5b8151613257612ced82613080565b81815284602083860101111561326b575f80fd5b612234826020830160208701612b10565b5f6020828403121561328c575f80fd5b81516001600160401b038111156132a1575f80fd5b6122348482850161323a565b5f602082840312156132bd575f80fd5b8151612b0981612b86565b80516132d381613019565b919050565b5f80604083850312156132e9575f80fd5b82516001600160401b038111156132fe575f80fd5b61330a8582860161323a565b925050602083015161305281613019565b5f82601f83011261332a575f80fd5b8151602061333a612ced83612cac565b8083825260208201915060208460051b87010193508684111561335b575f80fd5b602086015b84811015612d2f57805161337381612b86565b8352918301918301613360565b5f805f8060808587031215613393575f80fd5b84519350602080860151935060408601516001600160401b03808211156133b8575f80fd5b6133c489838a0161331b565b945060608801519150808211156133d9575f80fd5b508601601f810188136133ea575f80fd5b80516133f8612ced82612cac565b81815260059190911b8201830190838101908a831115613416575f80fd5b928401925b828410156134345783518252928401929084019061341b565b979a9699509497505050505050565b5f8060408385031215613454575f80fd5b82519150602083015161305281613019565b5f60208284031215613476575f80fd5b81516001600160401b0381111561348b575f80fd5b6122348482850161331b565b5f602082840312156134a7575f80fd5b5051919050565b602080825282518282018190525f9190848201906040850190845b818110156134ee5783516001600160a01b0316835292840192918401916001016134c9565b50909695505050505050565b5f82601f830112613509575f80fd5b81516020613519612ced83612cac565b82815260059290921b84018101918181019086841115613537575f80fd5b8286015b84811015612d2f5780516001600160401b03811115613558575f80fd5b6135668986838b010161323a565b84525091830191830161353b565b5f60208284031215613584575f80fd5b81516001600160401b03811115613599575f80fd5b612234848285016134fa565b606081525f6135b76060830186612b32565b6001600160a01b0394851660208401529290931660409091015292915050565b5f805f805f60a086880312156135eb575f80fd5b85516001600160401b0380821115613601575f80fd5b61360d89838a0161323a565b96506020880151915080821115613622575f80fd5b61362e89838a0161331b565b95506040880151915080821115613643575f80fd5b61364f89838a016134fa565b94506060880151915080821115613664575f80fd5b61367089838a0161323a565b93506080880151915080821115613685575f80fd5b506136928882890161323a565b9150509295509295909350565b5f602082840312156136af575f80fd5b81516001600160401b03808211156136c5575f80fd5b9083019060c082860312156136d8575f80fd5b6136e0612c31565b8251828111156136ee575f80fd5b6136fa8782860161323a565b8252506020830151915061370d82612b86565b8160208201526040830151915061372382613019565b8160408201526060830151915061373982613019565b81606082015261374b608084016132c8565b608082015260a083015160a082015280935050505092915050565b5f60208284031215613776575f80fd5b81516001600160401b038082111561378c575f80fd5b9083019061010082860312156137a0575f80fd5b6137a8612c59565b8251828111156137b6575f80fd5b6137c28782860161323a565b8252506020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c082015260e083015160e082015280935050505092915050565b5f610100825181855261382c82860182612b32565b9150506020830151602085015260408301516040850152606083015160608501526080830151608085015260a083015160a085015260c083015160c085015260e083015160e08501528091505092915050565b60608152835160608201525f60208501516138a560808401826001600160a01b03169052565b5060408501516102008060a08501526138c2610260850183612b32565b91506060870151605f19808685030160c08701526138e08483612b32565b935060808901519150808685030160e08701526138fd8483612b32565b935060a0890151915061010081878603018188015261391c8584612e54565b945060c08a0151925061012082888703018189015261393b8685612e54565b60e08c01516101408a810191909152928c0151610160808b0191909152918c0151610180808b0191909152928c01516101a0808b0191909152918c01516101c0808b0191909152928c015189820385016101e0808c01919091529197509450906139a58786612b32565b9650808c01519450508288870301858901526139c18685612b32565b9550818b0151610220890152808b0151610240890152505050505082810360208401526139ee8186612b32565b905082810360408401526131fd8185613817565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f906131fd90830184612b32565b5f60208284031215613a44575f80fd5b8151612b0981612ad9565b601f8211156108e757805f5260205f20601f840160051c81016020851015613a745750805b601f840160051c820191505b81811015612477575f8155600101613a80565b81516001600160401b03811115613aac57613aac612c1d565b613ac081613aba8454613174565b84613a4f565b602080601f831160018114613af3575f8415613adc5750858301515b5f19600386901b1c1916600185901b1785556106a5565b5f85815260208120601f198616915b82811015613b2157888601518255948401946001909101908401613b02565b5085821015613b3e57878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b5f52603160045260245ffdfe645e039705490088daad89bae25049a34f4a9072d398537b1ab2425f24cbed0080bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079300645e039705490088daad89bae25049a34f4a9072d398537b1ab2425f24cbed02dc91b926f64ceb646f47da4c796e445221faf197fcaee29e875daf63dcf64e00a2646970667358221220d4a85501d95ccb86f2ca3a5b5186d4f79316bd0eac61939a5cb644eb6f7635ba64736f6c63430008170033

Deployed Bytecode

0x608060405234801561000f575f80fd5b50600436106101c6575f3560e01c80634f6ccce7116100fe57806395d89b411161009e578063c87b56dd1161006e578063c87b56dd14610411578063e985e9c514610424578063ee1fe2ad14610437578063ffa1ad74146103ac575f80fd5b806395d89b41146103d0578063a22cb465146103d8578063b5802f73146103eb578063b88d4fde146103fe575f80fd5b806377205b63116100d957806377205b63146103545780638220ef5b146103695780639164359a14610387578063936725ec146103ac575f80fd5b80634f6ccce71461031b5780636352211e1461032e57806370a0823114610341575f80fd5b806323b872dd116101695780633ccf45f4116101445780633ccf45f4146102e557806342842e0e146102f85780634593144c1461030b5780634bde38c814610313575f80fd5b806323b872dd146102ac5780632f745c59146102bf5780633cae9646146102d2575f80fd5b8063095ea7b3116101a4578063095ea7b31461023257806318160ddd1461024757806319ab453c14610265578063218fc1e614610278575f80fd5b806301ffc9a7146101ca57806306fdde03146101f2578063081812fc14610207575b5f80fd5b6101dd6101d8366004612aee565b61044a565b60405190151581526020015b60405180910390f35b6101fa61048f565b6040516101e99190612b5d565b61021a610215366004612b6f565b610530565b6040516001600160a01b0390911681526020016101e9565b610245610240366004612b9a565b610544565b005b5f80516020613ba3833981519152545b6040519081526020016101e9565b610245610273366004612bc4565b610553565b61021a610286366004612b6f565b5f9081525f80516020613bc383398151915260205260409020546001600160a01b031690565b6102456102ba366004612bdf565b6106ad565b6102576102cd366004612b9a565b61073b565b6102456102e0366004612d3a565b6107ac565b61021a6102f3366004612b6f565b610872565b610245610306366004612bdf565b6108cd565b6102576108ec565b61021a610924565b610257610329366004612b6f565b610953565b61021a61033c366004612b6f565b6109c5565b61025761034f366004612bc4565b6109cf565b61035c610a27565b6040516101e99190612e42565b610371610af1565b6040516101e99a99989796959493929190612edb565b61039a610395366004612bc4565b611337565b6040516101e996959493929190612fb5565b6101fa604051806040016040528060058152602001640312e302e360dc1b81525081565b6101fa61154d565b6102456103e6366004613026565b61158b565b6102456103f936600461305d565b611596565b61024561040c3660046130a6565b611615565b6101fa61041f366004612b6f565b61162c565b6101dd610432366004613148565b611e7f565b610257610445366004613148565b611ecb565b5f6001600160e01b031982166303c2abc560e31b148061047a57506001600160e01b03198216630f1ec81f60e41b145b80610489575061048982611f30565b92915050565b5f80516020613b8383398151915280546060919081906104ae90613174565b80601f01602080910402602001604051908101604052809291908181526020018280546104da90613174565b80156105255780601f106104fc57610100808354040283529160200191610525565b820191905f5260205f20905b81548152906001019060200180831161050857829003601f168201915b505050505091505090565b5f61053a82611f54565b5061048982611f8b565b61054f828233611fc4565b5050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03165f811580156105975750825b90505f826001600160401b031660011480156105b25750303b155b9050811580156105c0575080155b156105de5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561060857845460ff60401b1916600160401b1785555b61061186611fd1565b61065f6040518060400160405280600f81526020016e14dd18589a5b1a5d1e4815985d5b1d608a1b81525060405180604001604052806005815260200164159055531560da1b81525061212c565b83156106a557845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050565b6001600160a01b0382166106db57604051633250574960e11b81525f60048201526024015b60405180910390fd5b5f6106e783833361213e565b9050836001600160a01b0316816001600160a01b031614610735576040516364283d7b60e01b81526001600160a01b03808616600483015260248201849052821660448201526064016106d2565b50505050565b5f5f80516020613b63833981519152610753846109cf565b83106107845760405163295f44f760e21b81526001600160a01b0385166004820152602481018490526044016106d2565b6001600160a01b0384165f908152602091825260408082208583529092522054905092915050565b5f80516020613bc38339815191526107c38461223c565b5f8481526020829052604090819020549051633e6d4a2f60e11b81526001600160a01b03909116908190637cda945e9061080390879087906004016131a6565b5f604051808303815f87803b15801561081a575f80fd5b505af115801561082c573d5f803e3d5ffd5b505050507f8a3f3ae961f929de67317ea56703e16267eb8de197efed8c2395939fac4dd747858585604051610863939291906131d3565b60405180910390a15050505050565b5f8181527fdc91b926f64ceb646f47da4c796e445221faf197fcaee29e875daf63dcf64e0160205260409020546001600160a01b03165f80516020613bc3833981519152816108c7576108c483612270565b91505b50919050565b6108e783838360405180602001604052805f815250611615565b505050565b5f61091f61091b60017f812a673dfca07956350df10f8a654925f561d7a0da09bdbe79e653939a14d9f1613207565b5490565b905090565b5f61091f61091b60017faa116a42804728f23983458454b6eb9c6ddf3011db9f9addaf3cd7508d85b0d6613207565b5f5f80516020613b638339815191526109775f80516020613ba38339815191525490565b831061099f5760405163295f44f760e21b81525f6004820152602481018490526044016106d2565b8060020183815481106109b4576109b4613226565b905f5260205f200154915050919050565b5f61048982611f54565b5f5f80516020613b838339815191526001600160a01b038316610a07576040516322718ad960e21b81525f60048201526024016106d2565b6001600160a01b039092165f908152600390920160205250604090205490565b60605f80516020613bc38339815191525f610a4d5f80516020613ba38339815191525490565b9050806001600160401b03811115610a6757610a67612c1d565b604051908082528060200260200182016040528015610a90578160200160208202803683370190505b5092505f5b81811015610aeb575f8181526020849052604090205484516001600160a01b0390911690859083908110610acb57610acb613226565b6001600160a01b0390921660209283029190910190910152600101610a95565b50505090565b60608080808080808080805f80516020613bc38339815191525f610b205f80516020613ba38339815191525490565b9050806001600160401b03811115610b3a57610b3a612c1d565b604051908082528060200260200182016040528015610b63578160200160208202803683370190505b509b50806001600160401b03811115610b7e57610b7e612c1d565b604051908082528060200260200182016040528015610bb157816020015b6060815260200190600190039081610b9c5790505b509a50806001600160401b03811115610bcc57610bcc612c1d565b604051908082528060200260200182016040528015610bff57816020015b6060815260200190600190039081610bea5790505b509950806001600160401b03811115610c1a57610c1a612c1d565b604051908082528060200260200182016040528015610c4d57816020015b6060815260200190600190039081610c385790505b509850806001600160401b03811115610c6857610c68612c1d565b604051908082528060200260200182016040528015610c9b57816020015b6060815260200190600190039081610c865790505b509750806001600160401b03811115610cb657610cb6612c1d565b604051908082528060200260200182016040528015610cdf578160200160208202803683370190505b509650806001600160401b03811115610cfa57610cfa612c1d565b604051908082528060200260200182016040528015610d23578160200160208202803683370190505b509450806001600160401b03811115610d3e57610d3e612c1d565b604051908082528060200260200182016040528015610d67578160200160208202803683370190505b509350806001600160401b03811115610d8257610d82612c1d565b604051908082528060200260200182016040528015610db557816020015b6060815260200190600190039081610da05790505b509250806001600160401b03811115610dd057610dd0612c1d565b604051908082528060200260200182016040528015610df9578160200160208202803683370190505b5095505f5b81811015611328575f818152602084905260409020548d516001600160a01b03909116908e9083908110610e3457610e34613226565b60200260200101906001600160a01b031690816001600160a01b0316815250505f8d8281518110610e6757610e67613226565b602002602001015190508d8281518110610e8357610e83613226565b60200260200101516001600160a01b03166306fdde036040518163ffffffff1660e01b81526004015f60405180830381865afa158015610ec5573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610eec919081019061327c565b8d8381518110610efe57610efe613226565b60200260200101819052508d8281518110610f1b57610f1b613226565b60200260200101516001600160a01b03166395d89b416040518163ffffffff1660e01b81526004015f60405180830381865afa158015610f5d573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610f84919081019061327c565b8c8381518110610f9657610f96613226565b6020026020010181905250806001600160a01b0316634ac032be6040518163ffffffff1660e01b81526004015f60405180830381865afa158015610fdc573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611003919081019061327c565b8b838151811061101557611015613226565b60200260200101819052505f816001600160a01b031663a8c62e766040518163ffffffff1660e01b8152600401602060405180830381865afa15801561105d573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061108191906132ad565b9050806001600160a01b0316634875c9686040518163ffffffff1660e01b81526004015f60405180830381865afa1580156110be573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526110e5919081019061327c565b8b84815181106110f7576110f7613226565b6020026020010181905250806001600160a01b0316631ec71e056040518163ffffffff1660e01b81526004015f60405180830381865afa15801561113d573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261116491908101906132d8565b5086848151811061117757611177613226565b6020026020010181905250816001600160a01b031663845bc8046040518163ffffffff1660e01b81526004015f60405180830381865afa1580156111bd573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526111e49190810190613380565b9050508985815181106111f9576111f9613226565b6020026020010189868151811061121257611212613226565b6020026020010182815250828152505050816001600160a01b031663a035b1fe6040518163ffffffff1660e01b81526004016040805180830381865afa15801561125e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112829190613443565b508a848151811061129557611295613226565b602002602001018181525050816001600160a01b031663e5328e066040518163ffffffff1660e01b81526004016040805180830381865afa1580156112dc573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113009190613443565b5089848151811061131357611313613226565b60209081029190910101525050600101610dfe565b50505090919293949596979899565b5f60605f6060805f808790505f816001600160a01b031663a8c62e766040518163ffffffff1660e01b8152600401602060405180830381865afa158015611380573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113a491906132ad565b9050809750806001600160a01b03166371a973056040518163ffffffff1660e01b81526004015f60405180830381865afa1580156113e4573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261140b9190810190613466565b9650806001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015611449573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061146d91906132ad565b9550816001600160a01b031663845bc8046040518163ffffffff1660e01b81526004015f60405180830381865afa1580156114aa573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526114d19190810190613380565b909192509091508095508196505050806001600160a01b03166313e631806040518163ffffffff1660e01b8152600401602060405180830381865afa15801561151c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115409190613497565b9250505091939550919395565b7f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930180546060915f80516020613b83833981519152916104ae90613174565b61054f3383836122a9565b5f80516020613bc38339815191526115ad8361223c565b5f83815260018201602090815260409182902080546001600160a01b0319166001600160a01b0386169081179091558251868152918201527fa83e8967b7ce26c82b43a0fc5e46f1a242fd5341151c6f7c098efe8d485b4e56910160405180910390a1505050565b6116208484846106ad565b61073584848484612358565b60605f61163883612270565b6001600160a01b03160361165f5760405163ad5679e160e01b815260040160405180910390fd5b5f5f80516020613bc383398151915290506116f66040518061020001604052805f81526020015f6001600160a01b0316815260200160608152602001606081526020016060815260200160608152602001606081526020015f81526020015f81526020015f81526020015f80191681526020015f815260200160608152602001606081526020015f81526020015f80191681525090565b5f6116ff610924565b90505f816001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561173e573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061176291906132ad565b5f87815260208681526040808320546001600160a01b03168783018190528151635463173b60e11b8152915194955093849263a8c62e7692600480820193918290030181865afa1580156117b8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906117dc91906132ad565b9050816001600160a01b031663a035b1fe6040518163ffffffff1660e01b81526004016040805180830381865afa158015611819573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061183d9190613443565b5060e086015260408051637299470360e11b815281516001600160a01b0385169263e5328e0692600480820193918290030181865afa158015611882573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906118a69190613443565b5085610100018181525050816001600160a01b031663845bc8046040518163ffffffff1660e01b81526004015f60405180830381865afa1580156118ec573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526119139190810190613380565b50506101c087015261012086015260408051632560195f60e11b815290516001600160a01b03841691634ac032be916004808301925f9291908290030181865afa158015611963573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261198a919081019061327c565b856040018190525084602001516001600160a01b03166306fdde036040518163ffffffff1660e01b81526004015f60405180830381865afa1580156119d1573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526119f8919081019061327c565b8560600181905250816001600160a01b031663190024e06040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a3c573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a609190613497565b85610140018181525050806001600160a01b031663190024e06040518163ffffffff1660e01b8152600401602060405180830381865afa158015611aa6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611aca9190613497565b6101e08601526040805180820182526009815268526577617264696e6760b81b6020918201529086015180519101205f907f9ebab07909aaa4cdae2d5e985d99720616df0dc6818db31d46ea1437e7afe57f01611c26575f86602001516001600160a01b031663c2b18aa06040518163ffffffff1660e01b81526004015f60405180830381865afa158015611b61573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611b889190810190613466565b60405163fbcadbe960e01b8152909150734f76add676c04eca837130ceb58bc173de8799de9063fbcadbe990611bc29084906004016134ae565b5f60405180830381865af4158015611bdc573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611c039190810190613574565b60c0880152805181905f90611c1a57611c1a613226565b60200260200101519150505b6040808701519051637ac1b9a760e11b81526001600160a01b0386169163f583734e91611c5a9190869086906004016135a5565b5f60405180830381865afa158015611c74573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611c9b91908101906135d7565b60808b01526101a08a015260a089015250610180870181905280516020909101206040516362b75e6b60e11b815260048101919091526001600160a01b0385169063c56ebcd6906024015f60405180830381865afa158015611cff573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611d26919081019061369f565b60a001518661016001818152505073e080ed61824494de0b191597e907ee458f47c64b638aecdced87876001600160a01b031663a8f43c676040518163ffffffff1660e01b81526004015f60405180830381865afa158015611d8a573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611db1919081019061327c565b886001600160a01b03166335157a586040518163ffffffff1660e01b81526004015f60405180830381865afa158015611dec573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611e139190810190613766565b6040518463ffffffff1660e01b8152600401611e319392919061387f565b5f60405180830381865af4158015611e4b573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611e72919081019061327c565b9998505050505050505050565b6001600160a01b039182165f9081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab00793056020908152604080832093909416825291909152205460ff1690565b5f611ed461247e565b5f80516020613bc3833981519152611ef75f80516020613ba38339815191525490565b5f81815260208390526040902080546001600160a01b0319166001600160a01b0386161790559150611f29848361250f565b5092915050565b5f6001600160e01b0319821663780e9d6360e01b1480610489575061048982612570565b5f80611f5f83612270565b90506001600160a01b03811661048957604051637e27328960e01b8152600481018490526024016106d2565b5f9081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930460205260409020546001600160a01b031690565b6108e783838360016125bf565b611fd96126d2565b6001600160a01b038116158061205f57505f6001600160a01b0316816001600160a01b0316634783c35b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612030573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061205491906132ad565b6001600160a01b0316145b1561207d576040516371c42ac360e01b815260040160405180910390fd5b6120b06120ab60017faa116a42804728f23983458454b6eb9c6ddf3011db9f9addaf3cd7508d85b0d6613207565b829055565b6120e2436120df60017f812a673dfca07956350df10f8a654925f561d7a0da09bdbe79e653939a14d9f1613207565b55565b604080516001600160a01b0383168152426020820152438183015290517f1a2dd071001ebf6e03174e3df5b305795a4ad5d41d8fdb9ba41dbbe2367134269181900360600190a150565b6121346126d2565b61054f828261271b565b5f8061214b85858561274b565b90506001600160a01b0381166121d2576121cd845f80516020613ba383398151915280545f8381527f645e039705490088daad89bae25049a34f4a9072d398537b1ab2425f24cbed0360205260408120829055600182018355919091527fa42f15e5d656f8155fd7419d740a6073999f19cd6e061449ce4a257150545bf20155565b6121f5565b846001600160a01b0316816001600160a01b0316146121f5576121f5818561284d565b6001600160a01b0385166122115761220c846128ec565b612234565b846001600160a01b0316816001600160a01b0316146122345761223485856129b9565b949350505050565b3361224682612270565b6001600160a01b03161461226d576040516336b6b89560e01b815260040160405180910390fd5b50565b5f9081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930260205260409020546001600160a01b031690565b5f80516020613b838339815191526001600160a01b0383166122e957604051630b61174360e31b81526001600160a01b03841660048201526024016106d2565b6001600160a01b038481165f818152600584016020908152604080832094881680845294825291829020805460ff191687151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a350505050565b6001600160a01b0383163b1561073557604051630a85bd0160e11b81526001600160a01b0384169063150b7a029061239a903390889087908790600401613a02565b6020604051808303815f875af19250505080156123d4575060408051601f3d908101601f191682019092526123d191810190613a34565b60015b61243b573d808015612401576040519150601f19603f3d011682016040523d82523d5f602084013e612406565b606091505b5080515f0361243357604051633250574960e11b81526001600160a01b03851660048201526024016106d2565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b1461247757604051633250574960e11b81526001600160a01b03851660048201526024016106d2565b5050505050565b33612487610924565b6001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156124c2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906124e691906132ad565b6001600160a01b03161461250d57604051631966391b60e11b815260040160405180910390fd5b565b6001600160a01b03821661253857604051633250574960e11b81525f60048201526024016106d2565b5f61254483835f61213e565b90506001600160a01b038116156108e7576040516339e3563760e11b81525f60048201526024016106d2565b5f6001600160e01b031982166380ac58cd60e01b14806125a057506001600160e01b03198216635b5e139f60e01b145b8061048957506301ffc9a760e01b6001600160e01b0319831614610489565b5f80516020613b8383398151915281806125e157506001600160a01b03831615155b156126a2575f6125f085611f54565b90506001600160a01b0384161580159061261c5750836001600160a01b0316816001600160a01b031614155b801561262f575061262d8185611e7f565b155b156126585760405163a9fbf51f60e01b81526001600160a01b03851660048201526024016106d2565b82156126a05784866001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b5f93845260040160205250506040902080546001600160a01b0319166001600160a01b0392909216919091179055565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661250d57604051631afcd79f60e31b815260040160405180910390fd5b6127236126d2565b5f80516020613b838339815191528061273c8482613a93565b50600181016107358382613a93565b5f5f80516020613b838339815191528161276485612270565b90506001600160a01b0384161561278057612780818587612a11565b6001600160a01b038116156127bc5761279b5f865f806125bf565b6001600160a01b0381165f908152600383016020526040902080545f190190555b6001600160a01b038616156127ec576001600160a01b0386165f9081526003830160205260409020805460010190555b5f85815260028301602052604080822080546001600160a01b0319166001600160a01b038a811691821790925591518893918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a495945050505050565b5f80516020613b638339815191525f612865846109cf565b5f8481526001840160205260409020549091508082146128b8576001600160a01b0385165f9081526020848152604080832085845282528083205484845281842081905583526001860190915290208190555b505f92835260018201602090815260408085208590556001600160a01b039095168452918252838320908352905290812055565b5f80516020613ba3833981519152545f80516020613b63833981519152905f9061291890600190613207565b5f84815260038401602052604081205460028501805493945090928490811061294357612943613226565b905f5260205f20015490508084600201838154811061296457612964613226565b5f9182526020808320909101929092558281526003860190915260408082208490558682528120556002840180548061299f5761299f613b4e565b600190038181905f5260205f20015f905590555050505050565b5f80516020613b638339815191525f60016129d3856109cf565b6129dd9190613207565b6001600160a01b039094165f9081526020838152604080832087845282528083208690559482526001909301909252502055565b612a1c838383612a75565b6108e7576001600160a01b038316612a4a57604051637e27328960e01b8152600481018290526024016106d2565b60405163177e802f60e01b81526001600160a01b0383166004820152602481018290526044016106d2565b5f6001600160a01b038316158015906122345750826001600160a01b0316846001600160a01b03161480612aae5750612aae8484611e7f565b806122345750826001600160a01b0316612ac783611f8b565b6001600160a01b031614949350505050565b6001600160e01b03198116811461226d575f80fd5b5f60208284031215612afe575f80fd5b8135612b0981612ad9565b9392505050565b5f5b83811015612b2a578181015183820152602001612b12565b50505f910152565b5f8151808452612b49816020860160208601612b10565b601f01601f19169290920160200192915050565b602081525f612b096020830184612b32565b5f60208284031215612b7f575f80fd5b5035919050565b6001600160a01b038116811461226d575f80fd5b5f8060408385031215612bab575f80fd5b8235612bb681612b86565b946020939093013593505050565b5f60208284031215612bd4575f80fd5b8135612b0981612b86565b5f805f60608486031215612bf1575f80fd5b8335612bfc81612b86565b92506020840135612c0c81612b86565b929592945050506040919091013590565b634e487b7160e01b5f52604160045260245ffd5b60405160c081016001600160401b0381118282101715612c5357612c53612c1d565b60405290565b60405161010081016001600160401b0381118282101715612c5357612c53612c1d565b604051601f8201601f191681016001600160401b0381118282101715612ca457612ca4612c1d565b604052919050565b5f6001600160401b03821115612cc457612cc4612c1d565b5060051b60200190565b5f82601f830112612cdd575f80fd5b81356020612cf2612ced83612cac565b612c7c565b8083825260208201915060208460051b870101935086841115612d13575f80fd5b602086015b84811015612d2f5780358352918301918301612d18565b509695505050505050565b5f805f60608486031215612d4c575f80fd5b833592506020808501356001600160401b0380821115612d6a575f80fd5b818701915087601f830112612d7d575f80fd5b8135612d8b612ced82612cac565b81815260059190911b8301840190848101908a831115612da9575f80fd5b938501935b82851015612dd0578435612dc181612b86565b82529385019390850190612dae565b965050506040870135925080831115612de7575f80fd5b5050612df586828701612cce565b9150509250925092565b5f815180845260208085019450602084015f5b83811015612e375781516001600160a01b031687529582019590820190600101612e12565b509495945050505050565b602081525f612b096020830184612dff565b5f8282518085526020808601955060208260051b840101602086015f5b84811015612e9f57601f19868403018952612e8d838351612b32565b98840198925090830190600101612e71565b5090979650505050505050565b5f815180845260208085019450602084015f5b83811015612e3757815187529582019590820190600101612ebf565b5f610140808352612eee8184018e612dff565b90508281036020840152612f02818d612e54565b90508281036040840152612f16818c612e54565b90508281036060840152612f2a818b612e54565b90508281036080840152612f3e818a612e54565b905082810360a0840152612f528189612eac565b905082810360c0840152612f668188612eac565b905082810360e0840152612f7a8187612eac565b9050828103610100840152612f8f8186612eac565b9050828103610120840152612fa48185612e54565b9d9c50505050505050505050505050565b5f60018060a01b03808916835260c06020840152612fd660c0840189612dff565b81881660408501528381036060850152612ff08188612dff565b91505082810360808401526130058186612eac565b9150508260a0830152979650505050505050565b801515811461226d575f80fd5b5f8060408385031215613037575f80fd5b823561304281612b86565b9150602083013561305281613019565b809150509250929050565b5f806040838503121561306e575f80fd5b82359150602083013561305281612b86565b5f6001600160401b0382111561309857613098612c1d565b50601f01601f191660200190565b5f805f80608085870312156130b9575f80fd5b84356130c481612b86565b935060208501356130d481612b86565b92506040850135915060608501356001600160401b038111156130f5575f80fd5b8501601f81018713613105575f80fd5b8035613113612ced82613080565b818152886020838501011115613127575f80fd5b816020840160208301375f6020838301015280935050505092959194509250565b5f8060408385031215613159575f80fd5b823561316481612b86565b9150602083013561305281612b86565b600181811c9082168061318857607f821691505b6020821081036108c757634e487b7160e01b5f52602260045260245ffd5b604081525f6131b86040830185612dff565b82810360208401526131ca8185612eac565b95945050505050565b838152606060208201525f6131eb6060830185612dff565b82810360408401526131fd8185612eac565b9695505050505050565b8181038181111561048957634e487b7160e01b5f52601160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b5f82601f830112613249575f80fd5b8151613257612ced82613080565b81815284602083860101111561326b575f80fd5b612234826020830160208701612b10565b5f6020828403121561328c575f80fd5b81516001600160401b038111156132a1575f80fd5b6122348482850161323a565b5f602082840312156132bd575f80fd5b8151612b0981612b86565b80516132d381613019565b919050565b5f80604083850312156132e9575f80fd5b82516001600160401b038111156132fe575f80fd5b61330a8582860161323a565b925050602083015161305281613019565b5f82601f83011261332a575f80fd5b8151602061333a612ced83612cac565b8083825260208201915060208460051b87010193508684111561335b575f80fd5b602086015b84811015612d2f57805161337381612b86565b8352918301918301613360565b5f805f8060808587031215613393575f80fd5b84519350602080860151935060408601516001600160401b03808211156133b8575f80fd5b6133c489838a0161331b565b945060608801519150808211156133d9575f80fd5b508601601f810188136133ea575f80fd5b80516133f8612ced82612cac565b81815260059190911b8201830190838101908a831115613416575f80fd5b928401925b828410156134345783518252928401929084019061341b565b979a9699509497505050505050565b5f8060408385031215613454575f80fd5b82519150602083015161305281613019565b5f60208284031215613476575f80fd5b81516001600160401b0381111561348b575f80fd5b6122348482850161331b565b5f602082840312156134a7575f80fd5b5051919050565b602080825282518282018190525f9190848201906040850190845b818110156134ee5783516001600160a01b0316835292840192918401916001016134c9565b50909695505050505050565b5f82601f830112613509575f80fd5b81516020613519612ced83612cac565b82815260059290921b84018101918181019086841115613537575f80fd5b8286015b84811015612d2f5780516001600160401b03811115613558575f80fd5b6135668986838b010161323a565b84525091830191830161353b565b5f60208284031215613584575f80fd5b81516001600160401b03811115613599575f80fd5b612234848285016134fa565b606081525f6135b76060830186612b32565b6001600160a01b0394851660208401529290931660409091015292915050565b5f805f805f60a086880312156135eb575f80fd5b85516001600160401b0380821115613601575f80fd5b61360d89838a0161323a565b96506020880151915080821115613622575f80fd5b61362e89838a0161331b565b95506040880151915080821115613643575f80fd5b61364f89838a016134fa565b94506060880151915080821115613664575f80fd5b61367089838a0161323a565b93506080880151915080821115613685575f80fd5b506136928882890161323a565b9150509295509295909350565b5f602082840312156136af575f80fd5b81516001600160401b03808211156136c5575f80fd5b9083019060c082860312156136d8575f80fd5b6136e0612c31565b8251828111156136ee575f80fd5b6136fa8782860161323a565b8252506020830151915061370d82612b86565b8160208201526040830151915061372382613019565b8160408201526060830151915061373982613019565b81606082015261374b608084016132c8565b608082015260a083015160a082015280935050505092915050565b5f60208284031215613776575f80fd5b81516001600160401b038082111561378c575f80fd5b9083019061010082860312156137a0575f80fd5b6137a8612c59565b8251828111156137b6575f80fd5b6137c28782860161323a565b8252506020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c082015260e083015160e082015280935050505092915050565b5f610100825181855261382c82860182612b32565b9150506020830151602085015260408301516040850152606083015160608501526080830151608085015260a083015160a085015260c083015160c085015260e083015160e08501528091505092915050565b60608152835160608201525f60208501516138a560808401826001600160a01b03169052565b5060408501516102008060a08501526138c2610260850183612b32565b91506060870151605f19808685030160c08701526138e08483612b32565b935060808901519150808685030160e08701526138fd8483612b32565b935060a0890151915061010081878603018188015261391c8584612e54565b945060c08a0151925061012082888703018189015261393b8685612e54565b60e08c01516101408a810191909152928c0151610160808b0191909152918c0151610180808b0191909152928c01516101a0808b0191909152918c01516101c0808b0191909152928c015189820385016101e0808c01919091529197509450906139a58786612b32565b9650808c01519450508288870301858901526139c18685612b32565b9550818b0151610220890152808b0151610240890152505050505082810360208401526139ee8186612b32565b905082810360408401526131fd8185613817565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f906131fd90830184612b32565b5f60208284031215613a44575f80fd5b8151612b0981612ad9565b601f8211156108e757805f5260205f20601f840160051c81016020851015613a745750805b601f840160051c820191505b81811015612477575f8155600101613a80565b81516001600160401b03811115613aac57613aac612c1d565b613ac081613aba8454613174565b84613a4f565b602080601f831160018114613af3575f8415613adc5750858301515b5f19600386901b1c1916600185901b1785556106a5565b5f85815260208120601f198616915b82811015613b2157888601518255948401946001909101908401613b02565b5085821015613b3e57878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b5f52603160045260245ffdfe645e039705490088daad89bae25049a34f4a9072d398537b1ab2425f24cbed0080bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079300645e039705490088daad89bae25049a34f4a9072d398537b1ab2425f24cbed02dc91b926f64ceb646f47da4c796e445221faf197fcaee29e875daf63dcf64e00a2646970667358221220d4a85501d95ccb86f2ca3a5b5186d4f79316bd0eac61939a5cb644eb6f7635ba64736f6c63430008170033

Block Transaction Gas Used Reward
view all blocks produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits

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.