{"constructor_args":"0x000000000000000000000000ec306e46549a7e8f4fce823d3058f2d134133b170000000000000000000000003aa0670e24cb122e1d5307ed74b0c44d619aff9b0000000000000000000000009485711f11b17f73f2ccc8561bcae05bdc7e9ad900000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000004000000000000000000000000363d200e54fe86985790f4e210df9bfb142342020000000000000000000000009221fbe66be06f43dcbda3fc17cdd66ef1b236f9000000000000000000000000a66723d951f15423ef2c9c11edcb821e38301836000000000000000000000000856edf1b835ea02bf11b16f041df5a13ef1ec3d10000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000c35000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000061a800000000000000000000000000000000000000000000000000000000000086470","is_partially_verified":true,"is_changed_bytecode":false,"abi":[{"inputs":[{"internalType":"address","name":"_minter","type":"address"},{"internalType":"address","name":"_proposal","type":"address"},{"internalType":"address payable","name":"_assetsVault","type":"address"},{"internalType":"address[]","name":"_strategies","type":"address[]"},{"internalType":"uint256[]","name":"_ratios","type":"uint256[]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"round","type":"uint256"}],"name":"CancelWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mint","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"round","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FeeCharged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"round","type":"uint256"}],"name":"InitiateWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"strategies","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"ratios","type":"uint256[]"}],"name":"PortfolioConfigUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"round","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"vaultIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"vaultOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sharePrice","type":"uint256"}],"name":"RollToNextRound","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldAddr","type":"address"},{"indexed":false,"internalType":"address","name":"newAddr","type":"address"}],"name":"SetFeeRecipient","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"interval","type":"uint256"}],"name":"SetRebaseInterval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newRate","type":"uint256"}],"name":"SetWithdrawFeeRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"strategy","type":"address"}],"name":"StragetyAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"strategy","type":"address"}],"name":"StragetyCleared","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"strategy","type":"address"}],"name":"StragetyDestroyed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"round","type":"uint256"}],"name":"Withdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"actualAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"round","type":"uint256"}],"name":"WithdrawnFromStrategy","type":"event"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_strategy","type":"address"}],"name":"addStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"assetsVault","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"cancelWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_strategy","type":"address"}],"name":"clearStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentSharePrice","outputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"deposit","outputs":[{"internalType":"uint256","name":"mintAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"depositFor","outputs":[{"internalType":"uint256","name":"mintAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_strategy","type":"address"}],"name":"destroyStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVaultAvailableAmount","outputs":[{"internalType":"uint256","name":"idleAmount","type":"uint256"},{"internalType":"uint256","name":"investedAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"instantWithdraw","outputs":[{"internalType":"uint256","name":"actualWithdrawn","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"latestRoundID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"}],"name":"migrateVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"minter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proposal","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rebaseTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rebaseTimeInterval","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"requestWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rollToNextRound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"roundPricePerShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_feeRecipient","type":"address"}],"name":"setFeeRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_interval","type":"uint256"}],"name":"setRebaseInterval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_withdrawFeeRate","type":"uint256"}],"name":"setWithdrawFeeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"settlementTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stone","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"strategyController","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_strategies","type":"address[]"},{"internalType":"uint256[]","name":"_ratios","type":"uint256[]"}],"name":"updatePortfolioConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_proposal","type":"address"}],"name":"updateProposal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userReceipts","outputs":[{"internalType":"uint256","name":"withdrawRound","type":"uint256"},{"internalType":"uint256","name":"withdrawShares","type":"uint256"},{"internalType":"uint256","name":"withdrawableAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawFeeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawableAmountInPast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawingSharesInPast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawingSharesInRound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}],"conflicting_implementations":null,"certified":false,"additional_sources":[{"file_path":"/contracts/AssetsVault.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\nimport {TransferHelper} from \"@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol\";\n\ncontract AssetsVault {\n    address public stoneVault;\n    address public strategyController;\n\n    modifier onlyPermit() {\n        require(\n            stoneVault == msg.sender || strategyController == msg.sender,\n            \"not permit\"\n        );\n        _;\n    }\n\n    constructor(address _stoneVault, address _strategyController) {\n        require(\n            _stoneVault != address(0) && _strategyController != address(0),\n            \"ZERO ADDRESS\"\n        );\n        stoneVault = _stoneVault;\n        strategyController = _strategyController;\n    }\n\n    function deposit() external payable {\n        require(msg.value != 0, \"too small\");\n    }\n\n    function withdraw(address _to, uint256 _amount) external onlyPermit {\n        TransferHelper.safeTransferETH(_to, _amount);\n    }\n\n    function setNewVault(address _vault) external onlyPermit {\n        stoneVault = _vault;\n    }\n\n    function getBalance() external view returns (uint256 amount) {\n        amount = address(this).balance;\n    }\n\n    receive() external payable {}\n}\n"},{"file_path":"/contracts/libraries/VaultMath.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\nlibrary VaultMath {\n    uint256 internal constant DECIMALS = 18;\n\n    function assetToShares(\n        uint256 _assetAmount,\n        uint256 _assetPerShare\n    ) internal pure returns (uint256) {\n        require(_assetPerShare > 1, \"Vault Lib: invalid assetPerShare\");\n        return (_assetAmount * (10 ** DECIMALS)) / _assetPerShare;\n    }\n\n    function sharesToAsset(\n        uint256 _shares,\n        uint256 _assetPerShare\n    ) internal pure returns (uint256) {\n        require(_assetPerShare > 1, \"Vault Lib: invalid assetPerShare\");\n        return (_shares * _assetPerShare) / (10 ** DECIMALS);\n    }\n}\n"},{"file_path":"/contracts/strategies/Strategy.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\nimport {StrategyController} from \"../strategies/StrategyController.sol\";\n\nabstract contract Strategy {\n    address payable public immutable controller;\n\n    address public governance;\n\n    string public name;\n\n    modifier onlyGovernance() {\n        require(governance == msg.sender, \"not governace\");\n        _;\n    }\n\n    event TransferGovernance(address oldOwner, address newOwner);\n\n    constructor(address payable _controller, string memory _name) {\n        require(_controller != address(0), \"ZERO ADDRESS\");\n\n        governance = msg.sender;\n        controller = _controller;\n        name = _name;\n    }\n\n    modifier onlyController() {\n        require(controller == msg.sender, \"not controller\");\n        _;\n    }\n\n    function deposit() public payable virtual onlyController {}\n\n    function withdraw(\n        uint256 _amount\n    ) public virtual onlyController returns (uint256 actualAmount) {}\n\n    function instantWithdraw(\n        uint256 _amount\n    ) public virtual onlyController returns (uint256 actualAmount) {}\n\n    function clear() public virtual onlyController returns (uint256 amount) {}\n\n    function execPendingRequest(\n        uint256 _amount\n    ) public virtual returns (uint256 amount) {}\n\n    function getAllValue() public virtual returns (uint256 value) {}\n\n    function getPendingValue() public virtual returns (uint256 value) {}\n\n    function getInvestedValue() public virtual returns (uint256 value) {}\n\n    function checkPendingStatus()\n        public\n        virtual\n        returns (uint256 pending, uint256 executable)\n    {}\n\n    function setGovernance(address governance_) external onlyGovernance {\n        emit TransferGovernance(governance, governance_);\n        governance = governance_;\n    }\n}\n"},{"file_path":"/contracts/strategies/StrategyController.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\nimport {EnumerableSet} from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport {TransferHelper} from \"@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol\";\n\nimport {Strategy} from \"./Strategy.sol\";\nimport {AssetsVault} from \"../AssetsVault.sol\";\n\ncontract StrategyController {\n    using EnumerableSet for EnumerableSet.AddressSet;\n\n    uint256 internal constant ONE_HUNDRED_PERCENT = 1e6;\n\n    address public stoneVault;\n    address payable public immutable assetsVault;\n\n    EnumerableSet.AddressSet private strategies;\n\n    mapping(address => uint256) public ratios;\n\n    struct StrategyDiff {\n        address strategy;\n        bool isDeposit;\n        uint256 amount;\n    }\n\n    modifier onlyVault() {\n        require(stoneVault == msg.sender, \"not vault\");\n        _;\n    }\n\n    constructor(\n        address payable _assetsVault,\n        address[] memory _strategies,\n        uint256[] memory _ratios\n    ) {\n        require(_assetsVault != address(0), \"ZERO ADDRESS\");\n\n        uint256 length = _strategies.length;\n        for (uint256 i; i < length; i++) {\n            require(_strategies[i] != address(0), \"ZERO ADDRESS\");\n        }\n\n        stoneVault = msg.sender;\n        assetsVault = _assetsVault;\n\n        _initStrategies(_strategies, _ratios);\n    }\n\n    function onlyRebaseStrategies() external {\n        _rebase(0, 0);\n    }\n\n    function forceWithdraw(\n        uint256 _amount\n    ) external onlyVault returns (uint256 actualAmount) {\n        uint256 balanceBeforeRepay = address(this).balance;\n\n        if (balanceBeforeRepay >= _amount) {\n            _repayToVault();\n\n            actualAmount = balanceBeforeRepay;\n        } else {\n            actualAmount =\n                _forceWithdraw(_amount - balanceBeforeRepay) +\n                balanceBeforeRepay;\n        }\n    }\n\n    function setStrategies(\n        address[] memory _strategies,\n        uint256[] memory _ratios\n    ) external onlyVault {\n        _setStrategies(_strategies, _ratios);\n    }\n\n    function addStrategy(address _strategy) external onlyVault {\n        require(!strategies.contains(_strategy), \"already exist\");\n\n        strategies.add(_strategy);\n    }\n\n    function rebaseStrategies(\n        uint256 _in,\n        uint256 _out\n    ) external payable onlyVault {\n        _rebase(_in, _out);\n    }\n\n    function destroyStrategy(address _strategy) external onlyVault {\n        _destoryStrategy(_strategy);\n    }\n\n    function _rebase(uint256 _in, uint256 _out) internal {\n        require(_in == 0 || _out == 0, \"only deposit or withdraw\");\n\n        if (_in != 0) {\n            AssetsVault(assetsVault).withdraw(address(this), _in);\n        }\n        uint256 total = getAllStrategyValidValue();\n        if (total < _out) {\n            total = 0;\n        } else {\n            total = total + _in - _out;\n        }\n\n        uint256 length = strategies.length();\n        StrategyDiff[] memory diffs = new StrategyDiff[](length);\n        uint256 head;\n        uint256 tail = length - 1;\n        for (uint i; i < length; i++) {\n            address strategy = strategies.at(i);\n            if (ratios[strategy] == 0) {\n                _clearStrategy(strategy, true);\n                continue;\n            }\n            uint256 newPosition = (total * ratios[strategy]) /\n                ONE_HUNDRED_PERCENT;\n            uint256 position = getStrategyValidValue(strategy);\n\n            if (newPosition < position) {\n                diffs[head] = StrategyDiff(\n                    strategy,\n                    false,\n                    position - newPosition\n                );\n                head++;\n            } else if (newPosition > position) {\n                diffs[tail] = StrategyDiff(\n                    strategy,\n                    true,\n                    newPosition - position\n                );\n                if (tail != 0) {\n                    tail--;\n                }\n            }\n        }\n\n        length = diffs.length;\n        for (uint256 i; i < length; i++) {\n            StrategyDiff memory diff = diffs[i];\n\n            if (diff.amount == 0) {\n                continue;\n            }\n\n            if (diff.isDeposit) {\n                if (address(this).balance < diff.amount) {\n                    diff.amount = address(this).balance;\n                }\n                _depositToStrategy(diff.strategy, diff.amount);\n            } else {\n                _withdrawFromStrategy(diff.strategy, diff.amount);\n            }\n        }\n\n        _repayToVault();\n    }\n\n    function _repayToVault() internal {\n        if (address(this).balance != 0) {\n            TransferHelper.safeTransferETH(assetsVault, address(this).balance);\n        }\n    }\n\n    function _depositToStrategy(address _strategy, uint256 _amount) internal {\n        Strategy(_strategy).deposit{value: _amount}();\n    }\n\n    function _withdrawFromStrategy(\n        address _strategy,\n        uint256 _amount\n    ) internal {\n        Strategy(_strategy).withdraw(_amount);\n    }\n\n    function _forceWithdraw(\n        uint256 _amount\n    ) internal returns (uint256 actualAmount) {\n        uint256 length = strategies.length();\n        for (uint i; i < length; i++) {\n            address strategy = strategies.at(i);\n\n            uint256 withAmount = (_amount * ratios[strategy]) /\n                ONE_HUNDRED_PERCENT;\n\n            if (withAmount != 0) {\n                actualAmount =\n                    Strategy(strategy).instantWithdraw(withAmount) +\n                    actualAmount;\n            }\n        }\n\n        _repayToVault();\n    }\n\n    function getStrategyValue(\n        address _strategy\n    ) public returns (uint256 _value) {\n        return Strategy(_strategy).getAllValue();\n    }\n\n    function getStrategyValidValue(\n        address _strategy\n    ) public returns (uint256 _value) {\n        return Strategy(_strategy).getInvestedValue();\n    }\n\n    function getStrategyPendingValue(\n        address _strategy\n    ) public returns (uint256 _value) {\n        return Strategy(_strategy).getPendingValue();\n    }\n\n    function getAllStrategiesValue() public returns (uint256 _value) {\n        uint256 length = strategies.length();\n        for (uint i; i < length; i++) {\n            _value = _value + getStrategyValue(strategies.at(i));\n        }\n    }\n\n    function getAllStrategyValidValue() public returns (uint256 _value) {\n        uint256 length = strategies.length();\n        for (uint i; i < length; i++) {\n            _value = _value + getStrategyValidValue(strategies.at(i));\n        }\n    }\n\n    function getAllStrategyPendingValue() public returns (uint256 _value) {\n        uint256 length = strategies.length();\n        for (uint i; i < length; i++) {\n            _value = _value + getStrategyPendingValue(strategies.at(i));\n        }\n    }\n\n    function getStrategies()\n        public\n        view\n        returns (address[] memory addrs, uint256[] memory portions)\n    {\n        uint256 length = strategies.length();\n\n        addrs = new address[](length);\n        portions = new uint256[](length);\n\n        for (uint256 i; i < length; i++) {\n            address addr = strategies.at(i);\n            addrs[i] = addr;\n            portions[i] = ratios[addr];\n        }\n    }\n\n    function _initStrategies(\n        address[] memory _strategies,\n        uint256[] memory _ratios\n    ) internal {\n        require(_strategies.length == _ratios.length, \"invalid length\");\n\n        uint256 totalRatio;\n        uint256 length = _strategies.length;\n        for (uint i; i < length; i++) {\n            strategies.add(_strategies[i]);\n            ratios[_strategies[i]] = _ratios[i];\n            totalRatio = totalRatio + _ratios[i];\n        }\n        require(totalRatio <= ONE_HUNDRED_PERCENT, \"exceed 100%\");\n    }\n\n    function _setStrategies(\n        address[] memory _strategies,\n        uint256[] memory _ratios\n    ) internal {\n        uint256 length = _strategies.length;\n        require(length == _ratios.length, \"invalid length\");\n\n        uint256 oldLength = strategies.length();\n        for (uint i; i < oldLength; i++) {\n            ratios[strategies.at(i)] = 0;\n        }\n        uint256 totalRatio;\n        for (uint i; i < length; i++) {\n            require(\n                Strategy(_strategies[i]).controller() == address(this),\n                \"controller mismatch\"\n            );\n            strategies.add(_strategies[i]);\n            ratios[_strategies[i]] = _ratios[i];\n            totalRatio = totalRatio + _ratios[i];\n        }\n        require(totalRatio <= ONE_HUNDRED_PERCENT, \"exceed 100%\");\n    }\n\n    function clearStrategy(address _strategy) public onlyVault {\n        _clearStrategy(_strategy, false);\n    }\n\n    function _clearStrategy(address _strategy, bool _isRebase) internal {\n        Strategy(_strategy).clear();\n\n        if (!_isRebase) {\n            _repayToVault();\n        }\n    }\n\n    function _destoryStrategy(address _strategy) internal {\n        require(_couldDestroyStrategy(_strategy), \"still active\");\n\n        strategies.remove(_strategy);\n\n        _repayToVault();\n    }\n\n    function _couldDestroyStrategy(\n        address _strategy\n    ) internal returns (bool status) {\n        return\n            ratios[_strategy] == 0 && Strategy(_strategy).getAllValue() < 1e4;\n    }\n\n    function setNewVault(address _vault) external onlyVault {\n        stoneVault = _vault;\n    }\n\n    receive() external payable {}\n}\n"},{"file_path":"/contracts/token/Minter.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\nimport {Stone} from \"./Stone.sol\";\nimport {StoneVault} from \"../StoneVault.sol\";\n\ncontract Minter {\n    // TODO: governable upgrade\n    address public stone;\n    address payable public vault;\n\n    modifier onlyVault() {\n        require(msg.sender == vault, \"not vault\");\n        _;\n    }\n\n    constructor(address _stone, address payable _vault) {\n        stone = _stone;\n        vault = _vault;\n    }\n\n    function mint(address _to, uint256 _amount) external onlyVault {\n        Stone(stone).mint(_to, _amount);\n    }\n\n    function burn(address _from, uint256 _amount) external onlyVault {\n        Stone(stone).burn(_from, _amount);\n    }\n\n    function setNewVault(address _vault) external onlyVault {\n        vault = payable(_vault);\n    }\n\n    function getTokenPrice() public returns (uint256 price) {\n        price = StoneVault(vault).currentSharePrice();\n    }\n}\n"},{"file_path":"/contracts/token/Stone.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\nimport \"@layerzerolabs/solidity-examples/contracts/token/oft/extension/BasedOFT.sol\";\n\nimport {Minter} from \"./Minter.sol\";\n\ncontract Stone is BasedOFT {\n    uint256 public constant DAY_INTERVAL = 24 * 60 * 60;\n\n    address public minter;\n\n    uint16 public constant PT_FEED = 1;\n    uint16 public constant PT_SET_ENABLE = 2;\n    uint16 public constant PT_SET_CAP = 3;\n\n    uint256 public cap;\n    bool public enable = true;\n\n    mapping(uint256 => uint256) public quota;\n\n    event FeedToChain(\n        uint16 indexed dstChainId,\n        address indexed from,\n        bytes toAddress,\n        uint price\n    );\n    event SetCapFor(uint16 indexed dstChainId, bytes toAddress, uint cap);\n    event SetEnableFor(uint16 indexed dstChainId, bytes toAddress, bool flag);\n\n    constructor(\n        address _minter,\n        address _layerZeroEndpoint,\n        uint256 _cap\n    ) BasedOFT(\"StakeStone Ether\", \"STONE\", _layerZeroEndpoint) {\n        minter = _minter;\n        cap = _cap;\n    }\n\n    modifier onlyMinter() {\n        require(msg.sender == minter, \"NM\");\n        _;\n    }\n\n    function mint(address _to, uint256 _amount) external onlyMinter {\n        _mint(_to, _amount);\n    }\n\n    function burn(address _from, uint256 _amount) external onlyMinter {\n        _burn(_from, _amount);\n    }\n\n    function sendFrom(\n        address _from,\n        uint16 _dstChainId,\n        bytes calldata _toAddress,\n        uint _amount,\n        address payable _refundAddress,\n        address _zroPaymentAddress,\n        bytes calldata _adapterParams\n    ) public payable override(IOFTCore, OFTCore) {\n        require(enable, \"invalid\");\n\n        uint256 id;\n        assembly {\n            id := chainid()\n        }\n        require(id != _dstChainId, \"same chain\");\n\n        uint256 day = block.timestamp / DAY_INTERVAL;\n        require(_amount + quota[day] <= cap, \"Exceed cap\");\n\n        quota[day] = quota[day] + _amount;\n\n        super.sendFrom(\n            _from,\n            _dstChainId,\n            _toAddress,\n            _amount,\n            _refundAddress,\n            _zroPaymentAddress,\n            _adapterParams\n        );\n    }\n\n    function updatePrice(\n        uint16 _dstChainId,\n        bytes memory _toAddress\n    ) external payable returns (uint256 price) {\n        require(enable, \"invalid\");\n\n        uint256 id;\n        assembly {\n            id := chainid()\n        }\n        require(id != _dstChainId, \"same chain\");\n\n        price = tokenPrice();\n\n        bytes memory lzPayload = abi.encode(\n            PT_FEED,\n            _toAddress,\n            price,\n            block.timestamp\n        );\n\n        _lzSend(\n            _dstChainId,\n            lzPayload,\n            payable(msg.sender),\n            address(0),\n            bytes(\"\"),\n            msg.value\n        );\n\n        emit FeedToChain(_dstChainId, msg.sender, _toAddress, price);\n    }\n\n    function setEnableFor(\n        uint16 _dstChainId,\n        bool _flag,\n        bytes memory _toAddress\n    ) external payable onlyOwner {\n        uint256 id;\n        assembly {\n            id := chainid()\n        }\n\n        if (_dstChainId == id) {\n            enable = _flag;\n\n            emit SetEnableFor(\n                _dstChainId,\n                abi.encodePacked(address(this)),\n                enable\n            );\n            return;\n        }\n\n        bytes memory lzPayload = abi.encode(PT_SET_ENABLE, _toAddress, _flag);\n        _lzSend(\n            _dstChainId,\n            lzPayload,\n            payable(msg.sender),\n            address(0),\n            bytes(\"\"),\n            msg.value\n        );\n\n        emit SetEnableFor(_dstChainId, _toAddress, _flag);\n    }\n\n    function setCapFor(\n        uint16 _dstChainId,\n        uint256 _cap,\n        bytes memory _toAddress\n    ) external payable onlyOwner {\n        uint256 id;\n        assembly {\n            id := chainid()\n        }\n\n        if (_dstChainId == id) {\n            cap = _cap;\n\n            emit SetCapFor(_dstChainId, abi.encodePacked(address(this)), cap);\n            return;\n        }\n\n        bytes memory lzPayload = abi.encode(PT_SET_CAP, _toAddress, _cap);\n        _lzSend(\n            _dstChainId,\n            lzPayload,\n            payable(msg.sender),\n            address(0),\n            bytes(\"\"),\n            msg.value\n        );\n\n        emit SetCapFor(_dstChainId, _toAddress, _cap);\n    }\n\n    function tokenPrice() public returns (uint256 price) {\n        price = Minter(minter).getTokenPrice();\n    }\n\n    function getQuota() external view returns (uint256) {\n        uint256 amount = quota[block.timestamp / DAY_INTERVAL];\n        if (cap > amount && enable) {\n            return cap - amount;\n        }\n    }\n}\n"},{"file_path":"@layerzerolabs/solidity-examples/contracts/interfaces/ILayerZeroEndpoint.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"./ILayerZeroUserApplicationConfig.sol\";\n\ninterface ILayerZeroEndpoint is ILayerZeroUserApplicationConfig {\n    // @notice send a LayerZero message to the specified address at a LayerZero endpoint.\n    // @param _dstChainId - the destination chain identifier\n    // @param _destination - the address on destination chain (in bytes). address length/format may vary by chains\n    // @param _payload - a custom bytes payload to send to the destination contract\n    // @param _refundAddress - if the source transaction is cheaper than the amount of value passed, refund the additional amount to this address\n    // @param _zroPaymentAddress - the address of the ZRO token holder who would pay for the transaction\n    // @param _adapterParams - parameters for custom functionality. e.g. receive airdropped native gas from the relayer on destination\n    function send(uint16 _dstChainId, bytes calldata _destination, bytes calldata _payload, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable;\n\n    // @notice used by the messaging library to publish verified payload\n    // @param _srcChainId - the source chain identifier\n    // @param _srcAddress - the source contract (as bytes) at the source chain\n    // @param _dstAddress - the address on destination chain\n    // @param _nonce - the unbound message ordering nonce\n    // @param _gasLimit - the gas limit for external contract execution\n    // @param _payload - verified payload to send to the destination contract\n    function receivePayload(uint16 _srcChainId, bytes calldata _srcAddress, address _dstAddress, uint64 _nonce, uint _gasLimit, bytes calldata _payload) external;\n\n    // @notice get the inboundNonce of a lzApp from a source chain which could be EVM or non-EVM chain\n    // @param _srcChainId - the source chain identifier\n    // @param _srcAddress - the source chain contract address\n    function getInboundNonce(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (uint64);\n\n    // @notice get the outboundNonce from this source chain which, consequently, is always an EVM\n    // @param _srcAddress - the source chain contract address\n    function getOutboundNonce(uint16 _dstChainId, address _srcAddress) external view returns (uint64);\n\n    // @notice gets a quote in source native gas, for the amount that send() requires to pay for message delivery\n    // @param _dstChainId - the destination chain identifier\n    // @param _userApplication - the user app address on this EVM chain\n    // @param _payload - the custom message to send over LayerZero\n    // @param _payInZRO - if false, user app pays the protocol fee in native token\n    // @param _adapterParam - parameters for the adapter service, e.g. send some dust native token to dstChain\n    function estimateFees(uint16 _dstChainId, address _userApplication, bytes calldata _payload, bool _payInZRO, bytes calldata _adapterParam) external view returns (uint nativeFee, uint zroFee);\n\n    // @notice get this Endpoint's immutable source identifier\n    function getChainId() external view returns (uint16);\n\n    // @notice the interface to retry failed message on this Endpoint destination\n    // @param _srcChainId - the source chain identifier\n    // @param _srcAddress - the source chain contract address\n    // @param _payload - the payload to be retried\n    function retryPayload(uint16 _srcChainId, bytes calldata _srcAddress, bytes calldata _payload) external;\n\n    // @notice query if any STORED payload (message blocking) at the endpoint.\n    // @param _srcChainId - the source chain identifier\n    // @param _srcAddress - the source chain contract address\n    function hasStoredPayload(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool);\n\n    // @notice query if the _libraryAddress is valid for sending msgs.\n    // @param _userApplication - the user app address on this EVM chain\n    function getSendLibraryAddress(address _userApplication) external view returns (address);\n\n    // @notice query if the _libraryAddress is valid for receiving msgs.\n    // @param _userApplication - the user app address on this EVM chain\n    function getReceiveLibraryAddress(address _userApplication) external view returns (address);\n\n    // @notice query if the non-reentrancy guard for send() is on\n    // @return true if the guard is on. false otherwise\n    function isSendingPayload() external view returns (bool);\n\n    // @notice query if the non-reentrancy guard for receive() is on\n    // @return true if the guard is on. false otherwise\n    function isReceivingPayload() external view returns (bool);\n\n    // @notice get the configuration of the LayerZero messaging library of the specified version\n    // @param _version - messaging library version\n    // @param _chainId - the chainId for the pending config change\n    // @param _userApplication - the contract address of the user application\n    // @param _configType - type of configuration. every messaging library has its own convention.\n    function getConfig(uint16 _version, uint16 _chainId, address _userApplication, uint _configType) external view returns (bytes memory);\n\n    // @notice get the send() LayerZero messaging library version\n    // @param _userApplication - the contract address of the user application\n    function getSendVersion(address _userApplication) external view returns (uint16);\n\n    // @notice get the lzReceive() LayerZero messaging library version\n    // @param _userApplication - the contract address of the user application\n    function getReceiveVersion(address _userApplication) external view returns (uint16);\n}\n"},{"file_path":"@layerzerolabs/solidity-examples/contracts/interfaces/ILayerZeroReceiver.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\ninterface ILayerZeroReceiver {\n    // @notice LayerZero endpoint will invoke this function to deliver the message on the destination\n    // @param _srcChainId - the source endpoint identifier\n    // @param _srcAddress - the source sending contract address from the source chain\n    // @param _nonce - the ordered message nonce\n    // @param _payload - the signed payload is the UA bytes has encoded to be sent\n    function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) external;\n}\n"},{"file_path":"@layerzerolabs/solidity-examples/contracts/interfaces/ILayerZeroUserApplicationConfig.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\ninterface ILayerZeroUserApplicationConfig {\n    // @notice set the configuration of the LayerZero messaging library of the specified version\n    // @param _version - messaging library version\n    // @param _chainId - the chainId for the pending config change\n    // @param _configType - type of configuration. every messaging library has its own convention.\n    // @param _config - configuration in the bytes. can encode arbitrary content.\n    function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external;\n\n    // @notice set the send() LayerZero messaging library version to _version\n    // @param _version - new messaging library version\n    function setSendVersion(uint16 _version) external;\n\n    // @notice set the lzReceive() LayerZero messaging library version to _version\n    // @param _version - new messaging library version\n    function setReceiveVersion(uint16 _version) external;\n\n    // @notice Only when the UA needs to resume the message flow in blocking mode and clear the stored payload\n    // @param _srcChainId - the chainId of the source chain\n    // @param _srcAddress - the contract address of the source contract at the source chain\n    function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external;\n}\n"},{"file_path":"@layerzerolabs/solidity-examples/contracts/lzApp/LzApp.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../interfaces/ILayerZeroReceiver.sol\";\nimport \"../interfaces/ILayerZeroUserApplicationConfig.sol\";\nimport \"../interfaces/ILayerZeroEndpoint.sol\";\nimport \"../util/BytesLib.sol\";\n\n/*\n * a generic LzReceiver implementation\n */\nabstract contract LzApp is Ownable, ILayerZeroReceiver, ILayerZeroUserApplicationConfig {\n    using BytesLib for bytes;\n\n    // ua can not send payload larger than this by default, but it can be changed by the ua owner\n    uint constant public DEFAULT_PAYLOAD_SIZE_LIMIT = 10000;\n\n    ILayerZeroEndpoint public immutable lzEndpoint;\n    mapping(uint16 => bytes) public trustedRemoteLookup;\n    mapping(uint16 => mapping(uint16 => uint)) public minDstGasLookup;\n    mapping(uint16 => uint) public payloadSizeLimitLookup;\n    address public precrime;\n\n    event SetPrecrime(address precrime);\n    event SetTrustedRemote(uint16 _remoteChainId, bytes _path);\n    event SetTrustedRemoteAddress(uint16 _remoteChainId, bytes _remoteAddress);\n    event SetMinDstGas(uint16 _dstChainId, uint16 _type, uint _minDstGas);\n\n    constructor(address _endpoint) {\n        lzEndpoint = ILayerZeroEndpoint(_endpoint);\n    }\n\n    function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual override {\n        // lzReceive must be called by the endpoint for security\n        require(_msgSender() == address(lzEndpoint), \"LzApp: invalid endpoint caller\");\n\n        bytes memory trustedRemote = trustedRemoteLookup[_srcChainId];\n        // if will still block the message pathway from (srcChainId, srcAddress). should not receive message from untrusted remote.\n        require(_srcAddress.length == trustedRemote.length && trustedRemote.length > 0 && keccak256(_srcAddress) == keccak256(trustedRemote), \"LzApp: invalid source sending contract\");\n\n        _blockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);\n    }\n\n    // abstract function - the default behaviour of LayerZero is blocking. See: NonblockingLzApp if you dont need to enforce ordered messaging\n    function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual;\n\n    function _lzSend(uint16 _dstChainId, bytes memory _payload, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams, uint _nativeFee) internal virtual {\n        bytes memory trustedRemote = trustedRemoteLookup[_dstChainId];\n        require(trustedRemote.length != 0, \"LzApp: destination chain is not a trusted source\");\n        _checkPayloadSize(_dstChainId, _payload.length);\n        lzEndpoint.send{value: _nativeFee}(_dstChainId, trustedRemote, _payload, _refundAddress, _zroPaymentAddress, _adapterParams);\n    }\n\n    function _checkGasLimit(uint16 _dstChainId, uint16 _type, bytes memory _adapterParams, uint _extraGas) internal view virtual {\n        uint providedGasLimit = _getGasLimit(_adapterParams);\n        uint minGasLimit = minDstGasLookup[_dstChainId][_type] + _extraGas;\n        require(minGasLimit > 0, \"LzApp: minGasLimit not set\");\n        require(providedGasLimit >= minGasLimit, \"LzApp: gas limit is too low\");\n    }\n\n    function _getGasLimit(bytes memory _adapterParams) internal pure virtual returns (uint gasLimit) {\n        require(_adapterParams.length >= 34, \"LzApp: invalid adapterParams\");\n        assembly {\n            gasLimit := mload(add(_adapterParams, 34))\n        }\n    }\n\n    function _checkPayloadSize(uint16 _dstChainId, uint _payloadSize) internal view virtual {\n        uint payloadSizeLimit = payloadSizeLimitLookup[_dstChainId];\n        if (payloadSizeLimit == 0) { // use default if not set\n            payloadSizeLimit = DEFAULT_PAYLOAD_SIZE_LIMIT;\n        }\n        require(_payloadSize <= payloadSizeLimit, \"LzApp: payload size is too large\");\n    }\n\n    //---------------------------UserApplication config----------------------------------------\n    function getConfig(uint16 _version, uint16 _chainId, address, uint _configType) external view returns (bytes memory) {\n        return lzEndpoint.getConfig(_version, _chainId, address(this), _configType);\n    }\n\n    // generic config for LayerZero user Application\n    function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external override onlyOwner {\n        lzEndpoint.setConfig(_version, _chainId, _configType, _config);\n    }\n\n    function setSendVersion(uint16 _version) external override onlyOwner {\n        lzEndpoint.setSendVersion(_version);\n    }\n\n    function setReceiveVersion(uint16 _version) external override onlyOwner {\n        lzEndpoint.setReceiveVersion(_version);\n    }\n\n    function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external override onlyOwner {\n        lzEndpoint.forceResumeReceive(_srcChainId, _srcAddress);\n    }\n\n    // _path = abi.encodePacked(remoteAddress, localAddress)\n    // this function set the trusted path for the cross-chain communication\n    function setTrustedRemote(uint16 _remoteChainId, bytes calldata _path) external onlyOwner {\n        trustedRemoteLookup[_remoteChainId] = _path;\n        emit SetTrustedRemote(_remoteChainId, _path);\n    }\n\n    function setTrustedRemoteAddress(uint16 _remoteChainId, bytes calldata _remoteAddress) external onlyOwner {\n        trustedRemoteLookup[_remoteChainId] = abi.encodePacked(_remoteAddress, address(this));\n        emit SetTrustedRemoteAddress(_remoteChainId, _remoteAddress);\n    }\n\n    function getTrustedRemoteAddress(uint16 _remoteChainId) external view returns (bytes memory) {\n        bytes memory path = trustedRemoteLookup[_remoteChainId];\n        require(path.length != 0, \"LzApp: no trusted path record\");\n        return path.slice(0, path.length - 20); // the last 20 bytes should be address(this)\n    }\n\n    function setPrecrime(address _precrime) external onlyOwner {\n        precrime = _precrime;\n        emit SetPrecrime(_precrime);\n    }\n\n    function setMinDstGas(uint16 _dstChainId, uint16 _packetType, uint _minGas) external onlyOwner {\n        require(_minGas > 0, \"LzApp: invalid minGas\");\n        minDstGasLookup[_dstChainId][_packetType] = _minGas;\n        emit SetMinDstGas(_dstChainId, _packetType, _minGas);\n    }\n\n    // if the size is 0, it means default size limit\n    function setPayloadSizeLimit(uint16 _dstChainId, uint _size) external onlyOwner {\n        payloadSizeLimitLookup[_dstChainId] = _size;\n    }\n\n    //--------------------------- VIEW FUNCTION ----------------------------------------\n    function isTrustedRemote(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool) {\n        bytes memory trustedSource = trustedRemoteLookup[_srcChainId];\n        return keccak256(trustedSource) == keccak256(_srcAddress);\n    }\n}\n"},{"file_path":"@layerzerolabs/solidity-examples/contracts/lzApp/NonblockingLzApp.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./LzApp.sol\";\nimport \"../util/ExcessivelySafeCall.sol\";\n\n/*\n * the default LayerZero messaging behaviour is blocking, i.e. any failed message will block the channel\n * this abstract class try-catch all fail messages and store locally for future retry. hence, non-blocking\n * NOTE: if the srcAddress is not configured properly, it will still block the message pathway from (srcChainId, srcAddress)\n */\nabstract contract NonblockingLzApp is LzApp {\n    using ExcessivelySafeCall for address;\n\n    constructor(address _endpoint) LzApp(_endpoint) {}\n\n    mapping(uint16 => mapping(bytes => mapping(uint64 => bytes32))) public failedMessages;\n\n    event MessageFailed(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes _payload, bytes _reason);\n    event RetryMessageSuccess(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _payloadHash);\n\n    // overriding the virtual function in LzReceiver\n    function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override {\n        (bool success, bytes memory reason) = address(this).excessivelySafeCall(gasleft(), 150, abi.encodeWithSelector(this.nonblockingLzReceive.selector, _srcChainId, _srcAddress, _nonce, _payload));\n        // try-catch all errors/exceptions\n        if (!success) {\n            _storeFailedMessage(_srcChainId, _srcAddress, _nonce, _payload, reason);\n        }\n    }\n\n    function _storeFailedMessage(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload, bytes memory _reason) internal virtual {\n        failedMessages[_srcChainId][_srcAddress][_nonce] = keccak256(_payload);\n        emit MessageFailed(_srcChainId, _srcAddress, _nonce, _payload, _reason);\n    }\n\n    function nonblockingLzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual {\n        // only internal transaction\n        require(_msgSender() == address(this), \"NonblockingLzApp: caller must be LzApp\");\n        _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);\n    }\n\n    //@notice override this function\n    function _nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual;\n\n    function retryMessage(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public payable virtual {\n        // assert there is message to retry\n        bytes32 payloadHash = failedMessages[_srcChainId][_srcAddress][_nonce];\n        require(payloadHash != bytes32(0), \"NonblockingLzApp: no stored message\");\n        require(keccak256(_payload) == payloadHash, \"NonblockingLzApp: invalid payload\");\n        // clear the stored message\n        failedMessages[_srcChainId][_srcAddress][_nonce] = bytes32(0);\n        // execute the message. revert if it fails again\n        _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);\n        emit RetryMessageSuccess(_srcChainId, _srcAddress, _nonce, payloadHash);\n    }\n}\n"},{"file_path":"@layerzerolabs/solidity-examples/contracts/token/oft/IOFT.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"./IOFTCore.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @dev Interface of the OFT standard\n */\ninterface IOFT is IOFTCore, IERC20 {\n\n}\n"},{"file_path":"@layerzerolabs/solidity-examples/contracts/token/oft/IOFTCore.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @dev Interface of the IOFT core standard\n */\ninterface IOFTCore is IERC165 {\n    /**\n     * @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`)\n     * _dstChainId - L0 defined chain id to send tokens too\n     * _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain\n     * _amount - amount of the tokens to transfer\n     * _useZro - indicates to use zro to pay L0 fees\n     * _adapterParam - flexible bytes array to indicate messaging adapter services in L0\n     */\n    function estimateSendFee(uint16 _dstChainId, bytes calldata _toAddress, uint _amount, bool _useZro, bytes calldata _adapterParams) external view returns (uint nativeFee, uint zroFee);\n\n    /**\n     * @dev send `_amount` amount of token to (`_dstChainId`, `_toAddress`) from `_from`\n     * `_from` the owner of token\n     * `_dstChainId` the destination chain identifier\n     * `_toAddress` can be any size depending on the `dstChainId`.\n     * `_amount` the quantity of tokens in wei\n     * `_refundAddress` the address LayerZero refunds if too much message fee is sent\n     * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token)\n     * `_adapterParams` is a flexible bytes array to indicate messaging adapter services\n     */\n    function sendFrom(address _from, uint16 _dstChainId, bytes calldata _toAddress, uint _amount, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable;\n\n    /**\n     * @dev returns the circulating amount of tokens on current chain\n     */\n    function circulatingSupply() external view returns (uint);\n\n    /**\n     * @dev returns the address of the ERC20 token\n     */\n    function token() external view returns (address);\n\n    /**\n     * @dev Emitted when `_amount` tokens are moved from the `_sender` to (`_dstChainId`, `_toAddress`)\n     * `_nonce` is the outbound nonce\n     */\n    event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes _toAddress, uint _amount);\n\n    /**\n     * @dev Emitted when `_amount` tokens are received from `_srcChainId` into the `_toAddress` on the local chain.\n     * `_nonce` is the inbound nonce.\n     */\n    event ReceiveFromChain(uint16 indexed _srcChainId, address indexed _to, uint _amount);\n\n    event SetUseCustomAdapterParams(bool _useCustomAdapterParams);\n}\n"},{"file_path":"@layerzerolabs/solidity-examples/contracts/token/oft/OFT.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./IOFT.sol\";\nimport \"./OFTCore.sol\";\n\n// override decimal() function is needed\ncontract OFT is OFTCore, ERC20, IOFT {\n    constructor(string memory _name, string memory _symbol, address _lzEndpoint) ERC20(_name, _symbol) OFTCore(_lzEndpoint) {}\n\n    function supportsInterface(bytes4 interfaceId) public view virtual override(OFTCore, IERC165) returns (bool) {\n        return interfaceId == type(IOFT).interfaceId || interfaceId == type(IERC20).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    function token() public view virtual override returns (address) {\n        return address(this);\n    }\n\n    function circulatingSupply() public view virtual override returns (uint) {\n        return totalSupply();\n    }\n\n    function _debitFrom(address _from, uint16, bytes memory, uint _amount) internal virtual override returns(uint) {\n        address spender = _msgSender();\n        if (_from != spender) _spendAllowance(_from, spender, _amount);\n        _burn(_from, _amount);\n        return _amount;\n    }\n\n    function _creditTo(uint16, address _toAddress, uint _amount) internal virtual override returns(uint) {\n        _mint(_toAddress, _amount);\n        return _amount;\n    }\n}\n"},{"file_path":"@layerzerolabs/solidity-examples/contracts/token/oft/OFTCore.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../../lzApp/NonblockingLzApp.sol\";\nimport \"./IOFTCore.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract OFTCore is NonblockingLzApp, ERC165, IOFTCore {\n    using BytesLib for bytes;\n\n    uint public constant NO_EXTRA_GAS = 0;\n\n    // packet type\n    uint16 public constant PT_SEND = 0;\n\n    bool public useCustomAdapterParams;\n\n    constructor(address _lzEndpoint) NonblockingLzApp(_lzEndpoint) {}\n\n    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n        return interfaceId == type(IOFTCore).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    function estimateSendFee(uint16 _dstChainId, bytes calldata _toAddress, uint _amount, bool _useZro, bytes calldata _adapterParams) public view virtual override returns (uint nativeFee, uint zroFee) {\n        // mock the payload for sendFrom()\n        bytes memory payload = abi.encode(PT_SEND, _toAddress, _amount);\n        return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams);\n    }\n\n    function sendFrom(address _from, uint16 _dstChainId, bytes calldata _toAddress, uint _amount, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) public payable virtual override {\n        _send(_from, _dstChainId, _toAddress, _amount, _refundAddress, _zroPaymentAddress, _adapterParams);\n    }\n\n    function setUseCustomAdapterParams(bool _useCustomAdapterParams) public virtual onlyOwner {\n        useCustomAdapterParams = _useCustomAdapterParams;\n        emit SetUseCustomAdapterParams(_useCustomAdapterParams);\n    }\n\n    function _nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override {\n        uint16 packetType;\n        assembly {\n            packetType := mload(add(_payload, 32))\n        }\n\n        if (packetType == PT_SEND) {\n            _sendAck(_srcChainId, _srcAddress, _nonce, _payload);\n        } else {\n            revert(\"OFTCore: unknown packet type\");\n        }\n    }\n\n    function _send(address _from, uint16 _dstChainId, bytes memory _toAddress, uint _amount, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams) internal virtual {\n        _checkAdapterParams(_dstChainId, PT_SEND, _adapterParams, NO_EXTRA_GAS);\n\n        uint amount = _debitFrom(_from, _dstChainId, _toAddress, _amount);\n\n        bytes memory lzPayload = abi.encode(PT_SEND, _toAddress, amount);\n        _lzSend(_dstChainId, lzPayload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value);\n\n        emit SendToChain(_dstChainId, _from, _toAddress, amount);\n    }\n\n    function _sendAck(uint16 _srcChainId, bytes memory, uint64, bytes memory _payload) internal virtual {\n        (, bytes memory toAddressBytes, uint amount) = abi.decode(_payload, (uint16, bytes, uint));\n\n        address to = toAddressBytes.toAddress(0);\n\n        amount = _creditTo(_srcChainId, to, amount);\n        emit ReceiveFromChain(_srcChainId, to, amount);\n    }\n\n    function _checkAdapterParams(uint16 _dstChainId, uint16 _pkType, bytes memory _adapterParams, uint _extraGas) internal virtual {\n        if (useCustomAdapterParams) {\n            _checkGasLimit(_dstChainId, _pkType, _adapterParams, _extraGas);\n        } else {\n            require(_adapterParams.length == 0, \"OFTCore: _adapterParams must be empty.\");\n        }\n    }\n\n    function _debitFrom(address _from, uint16 _dstChainId, bytes memory _toAddress, uint _amount) internal virtual returns(uint);\n\n    function _creditTo(uint16 _srcChainId, address _toAddress, uint _amount) internal virtual returns(uint);\n}\n"},{"file_path":"@layerzerolabs/solidity-examples/contracts/token/oft/extension/BasedOFT.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../OFT.sol\";\n\ncontract BasedOFT is OFT {\n    constructor(string memory _name, string memory _symbol, address _lzEndpoint) OFT(_name, _symbol, _lzEndpoint) {}\n\n    function circulatingSupply() public view virtual override returns (uint) {\n        unchecked {\n            return totalSupply() - balanceOf(address(this));\n        }\n    }\n\n    function _debitFrom(address _from, uint16, bytes memory, uint _amount) internal virtual override returns(uint) {\n        address spender = _msgSender();\n        if (_from != spender) _spendAllowance(_from, spender, _amount);\n        _transfer(_from, address(this), _amount);\n        return _amount;\n    }\n\n    function _creditTo(uint16, address _toAddress, uint _amount) internal virtual override returns(uint) {\n        _transfer(address(this), _toAddress, _amount);\n        return _amount;\n    }\n}\n"},{"file_path":"@layerzerolabs/solidity-examples/contracts/util/BytesLib.sol","source_code":"// SPDX-License-Identifier: Unlicense\n/*\n * @title Solidity Bytes Arrays Utils\n * @author Gonçalo Sá <goncalo.sa@consensys.net>\n *\n * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity.\n *      The library lets you concatenate, slice and type cast bytes arrays both in memory and storage.\n */\npragma solidity >=0.8.0 <0.9.0;\n\n\nlibrary BytesLib {\n    function concat(\n        bytes memory _preBytes,\n        bytes memory _postBytes\n    )\n    internal\n    pure\n    returns (bytes memory)\n    {\n        bytes memory tempBytes;\n\n        assembly {\n        // Get a location of some free memory and store it in tempBytes as\n        // Solidity does for memory variables.\n            tempBytes := mload(0x40)\n\n        // Store the length of the first bytes array at the beginning of\n        // the memory for tempBytes.\n            let length := mload(_preBytes)\n            mstore(tempBytes, length)\n\n        // Maintain a memory counter for the current write location in the\n        // temp bytes array by adding the 32 bytes for the array length to\n        // the starting location.\n            let mc := add(tempBytes, 0x20)\n        // Stop copying when the memory counter reaches the length of the\n        // first bytes array.\n            let end := add(mc, length)\n\n            for {\n            // Initialize a copy counter to the start of the _preBytes data,\n            // 32 bytes into its memory.\n                let cc := add(_preBytes, 0x20)\n            } lt(mc, end) {\n            // Increase both counters by 32 bytes each iteration.\n                mc := add(mc, 0x20)\n                cc := add(cc, 0x20)\n            } {\n            // Write the _preBytes data into the tempBytes memory 32 bytes\n            // at a time.\n                mstore(mc, mload(cc))\n            }\n\n        // Add the length of _postBytes to the current length of tempBytes\n        // and store it as the new length in the first 32 bytes of the\n        // tempBytes memory.\n            length := mload(_postBytes)\n            mstore(tempBytes, add(length, mload(tempBytes)))\n\n        // Move the memory counter back from a multiple of 0x20 to the\n        // actual end of the _preBytes data.\n            mc := end\n        // Stop copying when the memory counter reaches the new combined\n        // length of the arrays.\n            end := add(mc, length)\n\n            for {\n                let cc := add(_postBytes, 0x20)\n            } lt(mc, end) {\n                mc := add(mc, 0x20)\n                cc := add(cc, 0x20)\n            } {\n                mstore(mc, mload(cc))\n            }\n\n        // Update the free-memory pointer by padding our last write location\n        // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\n        // next 32 byte block, then round down to the nearest multiple of\n        // 32. If the sum of the length of the two arrays is zero then add\n        // one before rounding down to leave a blank 32 bytes (the length block with 0).\n            mstore(0x40, and(\n            add(add(end, iszero(add(length, mload(_preBytes)))), 31),\n            not(31) // Round down to the nearest 32 bytes.\n            ))\n        }\n\n        return tempBytes;\n    }\n\n    function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal {\n        assembly {\n        // Read the first 32 bytes of _preBytes storage, which is the length\n        // of the array. (We don't need to use the offset into the slot\n        // because arrays use the entire slot.)\n            let fslot := sload(_preBytes.slot)\n        // Arrays of 31 bytes or less have an even value in their slot,\n        // while longer arrays have an odd value. The actual length is\n        // the slot divided by two for odd values, and the lowest order\n        // byte divided by two for even values.\n        // If the slot is even, bitwise and the slot with 255 and divide by\n        // two to get the length. If the slot is odd, bitwise and the slot\n        // with -1 and divide by two.\n            let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)\n            let mlength := mload(_postBytes)\n            let newlength := add(slength, mlength)\n        // slength can contain both the length and contents of the array\n        // if length < 32 bytes so let's prepare for that\n        // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage\n            switch add(lt(slength, 32), lt(newlength, 32))\n            case 2 {\n            // Since the new array still fits in the slot, we just need to\n            // update the contents of the slot.\n            // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length\n                sstore(\n                _preBytes.slot,\n                // all the modifications to the slot are inside this\n                // next block\n                add(\n                // we can just add to the slot contents because the\n                // bytes we want to change are the LSBs\n                fslot,\n                add(\n                mul(\n                div(\n                // load the bytes from memory\n                mload(add(_postBytes, 0x20)),\n                // zero all bytes to the right\n                exp(0x100, sub(32, mlength))\n                ),\n                // and now shift left the number of bytes to\n                // leave space for the length in the slot\n                exp(0x100, sub(32, newlength))\n                ),\n                // increase length by the double of the memory\n                // bytes length\n                mul(mlength, 2)\n                )\n                )\n                )\n            }\n            case 1 {\n            // The stored value fits in the slot, but the combined value\n            // will exceed it.\n            // get the keccak hash to get the contents of the array\n                mstore(0x0, _preBytes.slot)\n                let sc := add(keccak256(0x0, 0x20), div(slength, 32))\n\n            // save new length\n                sstore(_preBytes.slot, add(mul(newlength, 2), 1))\n\n            // The contents of the _postBytes array start 32 bytes into\n            // the structure. Our first read should obtain the `submod`\n            // bytes that can fit into the unused space in the last word\n            // of the stored array. To get this, we read 32 bytes starting\n            // from `submod`, so the data we read overlaps with the array\n            // contents by `submod` bytes. Masking the lowest-order\n            // `submod` bytes allows us to add that value directly to the\n            // stored value.\n\n                let submod := sub(32, slength)\n                let mc := add(_postBytes, submod)\n                let end := add(_postBytes, mlength)\n                let mask := sub(exp(0x100, submod), 1)\n\n                sstore(\n                sc,\n                add(\n                and(\n                fslot,\n                0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00\n                ),\n                and(mload(mc), mask)\n                )\n                )\n\n                for {\n                    mc := add(mc, 0x20)\n                    sc := add(sc, 1)\n                } lt(mc, end) {\n                    sc := add(sc, 1)\n                    mc := add(mc, 0x20)\n                } {\n                    sstore(sc, mload(mc))\n                }\n\n                mask := exp(0x100, sub(mc, end))\n\n                sstore(sc, mul(div(mload(mc), mask), mask))\n            }\n            default {\n            // get the keccak hash to get the contents of the array\n                mstore(0x0, _preBytes.slot)\n            // Start copying to the last used word of the stored array.\n                let sc := add(keccak256(0x0, 0x20), div(slength, 32))\n\n            // save new length\n                sstore(_preBytes.slot, add(mul(newlength, 2), 1))\n\n            // Copy over the first `submod` bytes of the new data as in\n            // case 1 above.\n                let slengthmod := mod(slength, 32)\n                let mlengthmod := mod(mlength, 32)\n                let submod := sub(32, slengthmod)\n                let mc := add(_postBytes, submod)\n                let end := add(_postBytes, mlength)\n                let mask := sub(exp(0x100, submod), 1)\n\n                sstore(sc, add(sload(sc), and(mload(mc), mask)))\n\n                for {\n                    sc := add(sc, 1)\n                    mc := add(mc, 0x20)\n                } lt(mc, end) {\n                    sc := add(sc, 1)\n                    mc := add(mc, 0x20)\n                } {\n                    sstore(sc, mload(mc))\n                }\n\n                mask := exp(0x100, sub(mc, end))\n\n                sstore(sc, mul(div(mload(mc), mask), mask))\n            }\n        }\n    }\n\n    function slice(\n        bytes memory _bytes,\n        uint256 _start,\n        uint256 _length\n    )\n    internal\n    pure\n    returns (bytes memory)\n    {\n        require(_length + 31 >= _length, \"slice_overflow\");\n        require(_bytes.length >= _start + _length, \"slice_outOfBounds\");\n\n        bytes memory tempBytes;\n\n        assembly {\n            switch iszero(_length)\n            case 0 {\n            // Get a location of some free memory and store it in tempBytes as\n            // Solidity does for memory variables.\n                tempBytes := mload(0x40)\n\n            // The first word of the slice result is potentially a partial\n            // word read from the original array. To read it, we calculate\n            // the length of that partial word and start copying that many\n            // bytes into the array. The first word we copy will start with\n            // data we don't care about, but the last `lengthmod` bytes will\n            // land at the beginning of the contents of the new array. When\n            // we're done copying, we overwrite the full first word with\n            // the actual length of the slice.\n                let lengthmod := and(_length, 31)\n\n            // The multiplication in the next line is necessary\n            // because when slicing multiples of 32 bytes (lengthmod == 0)\n            // the following copy loop was copying the origin's length\n            // and then ending prematurely not copying everything it should.\n                let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\n                let end := add(mc, _length)\n\n                for {\n                // The multiplication in the next line has the same exact purpose\n                // as the one above.\n                    let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\n                } lt(mc, end) {\n                    mc := add(mc, 0x20)\n                    cc := add(cc, 0x20)\n                } {\n                    mstore(mc, mload(cc))\n                }\n\n                mstore(tempBytes, _length)\n\n            //update free-memory pointer\n            //allocating the array padded to 32 bytes like the compiler does now\n                mstore(0x40, and(add(mc, 31), not(31)))\n            }\n            //if we want a zero-length slice let's just return a zero-length array\n            default {\n                tempBytes := mload(0x40)\n            //zero out the 32 bytes slice we are about to return\n            //we need to do it because Solidity does not garbage collect\n                mstore(tempBytes, 0)\n\n                mstore(0x40, add(tempBytes, 0x20))\n            }\n        }\n\n        return tempBytes;\n    }\n\n    function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\n        require(_bytes.length >= _start + 20, \"toAddress_outOfBounds\");\n        address tempAddress;\n\n        assembly {\n            tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\n        }\n\n        return tempAddress;\n    }\n\n    function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\n        require(_bytes.length >= _start + 1 , \"toUint8_outOfBounds\");\n        uint8 tempUint;\n\n        assembly {\n            tempUint := mload(add(add(_bytes, 0x1), _start))\n        }\n\n        return tempUint;\n    }\n\n    function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16) {\n        require(_bytes.length >= _start + 2, \"toUint16_outOfBounds\");\n        uint16 tempUint;\n\n        assembly {\n            tempUint := mload(add(add(_bytes, 0x2), _start))\n        }\n\n        return tempUint;\n    }\n\n    function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32) {\n        require(_bytes.length >= _start + 4, \"toUint32_outOfBounds\");\n        uint32 tempUint;\n\n        assembly {\n            tempUint := mload(add(add(_bytes, 0x4), _start))\n        }\n\n        return tempUint;\n    }\n\n    function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64) {\n        require(_bytes.length >= _start + 8, \"toUint64_outOfBounds\");\n        uint64 tempUint;\n\n        assembly {\n            tempUint := mload(add(add(_bytes, 0x8), _start))\n        }\n\n        return tempUint;\n    }\n\n    function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96) {\n        require(_bytes.length >= _start + 12, \"toUint96_outOfBounds\");\n        uint96 tempUint;\n\n        assembly {\n            tempUint := mload(add(add(_bytes, 0xc), _start))\n        }\n\n        return tempUint;\n    }\n\n    function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128) {\n        require(_bytes.length >= _start + 16, \"toUint128_outOfBounds\");\n        uint128 tempUint;\n\n        assembly {\n            tempUint := mload(add(add(_bytes, 0x10), _start))\n        }\n\n        return tempUint;\n    }\n\n    function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) {\n        require(_bytes.length >= _start + 32, \"toUint256_outOfBounds\");\n        uint256 tempUint;\n\n        assembly {\n            tempUint := mload(add(add(_bytes, 0x20), _start))\n        }\n\n        return tempUint;\n    }\n\n    function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) {\n        require(_bytes.length >= _start + 32, \"toBytes32_outOfBounds\");\n        bytes32 tempBytes32;\n\n        assembly {\n            tempBytes32 := mload(add(add(_bytes, 0x20), _start))\n        }\n\n        return tempBytes32;\n    }\n\n    function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) {\n        bool success = true;\n\n        assembly {\n            let length := mload(_preBytes)\n\n        // if lengths don't match the arrays are not equal\n            switch eq(length, mload(_postBytes))\n            case 1 {\n            // cb is a circuit breaker in the for loop since there's\n            //  no said feature for inline assembly loops\n            // cb = 1 - don't breaker\n            // cb = 0 - break\n                let cb := 1\n\n                let mc := add(_preBytes, 0x20)\n                let end := add(mc, length)\n\n                for {\n                    let cc := add(_postBytes, 0x20)\n                // the next line is the loop condition:\n                // while(uint256(mc < end) + cb == 2)\n                } eq(add(lt(mc, end), cb), 2) {\n                    mc := add(mc, 0x20)\n                    cc := add(cc, 0x20)\n                } {\n                // if any of these checks fails then arrays are not equal\n                    if iszero(eq(mload(mc), mload(cc))) {\n                    // unsuccess:\n                        success := 0\n                        cb := 0\n                    }\n                }\n            }\n            default {\n            // unsuccess:\n                success := 0\n            }\n        }\n\n        return success;\n    }\n\n    function equalStorage(\n        bytes storage _preBytes,\n        bytes memory _postBytes\n    )\n    internal\n    view\n    returns (bool)\n    {\n        bool success = true;\n\n        assembly {\n        // we know _preBytes_offset is 0\n            let fslot := sload(_preBytes.slot)\n        // Decode the length of the stored array like in concatStorage().\n            let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)\n            let mlength := mload(_postBytes)\n\n        // if lengths don't match the arrays are not equal\n            switch eq(slength, mlength)\n            case 1 {\n            // slength can contain both the length and contents of the array\n            // if length < 32 bytes so let's prepare for that\n            // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage\n                if iszero(iszero(slength)) {\n                    switch lt(slength, 32)\n                    case 1 {\n                    // blank the last byte which is the length\n                        fslot := mul(div(fslot, 0x100), 0x100)\n\n                        if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) {\n                        // unsuccess:\n                            success := 0\n                        }\n                    }\n                    default {\n                    // cb is a circuit breaker in the for loop since there's\n                    //  no said feature for inline assembly loops\n                    // cb = 1 - don't breaker\n                    // cb = 0 - break\n                        let cb := 1\n\n                    // get the keccak hash to get the contents of the array\n                        mstore(0x0, _preBytes.slot)\n                        let sc := keccak256(0x0, 0x20)\n\n                        let mc := add(_postBytes, 0x20)\n                        let end := add(mc, mlength)\n\n                    // the next line is the loop condition:\n                    // while(uint256(mc < end) + cb == 2)\n                        for {} eq(add(lt(mc, end), cb), 2) {\n                            sc := add(sc, 1)\n                            mc := add(mc, 0x20)\n                        } {\n                            if iszero(eq(sload(sc), mload(mc))) {\n                            // unsuccess:\n                                success := 0\n                                cb := 0\n                            }\n                        }\n                    }\n                }\n            }\n            default {\n            // unsuccess:\n                success := 0\n            }\n        }\n\n        return success;\n    }\n}\n"},{"file_path":"@layerzerolabs/solidity-examples/contracts/util/ExcessivelySafeCall.sol","source_code":"// SPDX-License-Identifier: MIT OR Apache-2.0\npragma solidity >=0.7.6;\n\nlibrary ExcessivelySafeCall {\n    uint256 constant LOW_28_MASK =\n    0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff;\n\n    /// @notice Use when you _really_ really _really_ don't trust the called\n    /// contract. This prevents the called contract from causing reversion of\n    /// the caller in as many ways as we can.\n    /// @dev The main difference between this and a solidity low-level call is\n    /// that we limit the number of bytes that the callee can cause to be\n    /// copied to caller memory. This prevents stupid things like malicious\n    /// contracts returning 10,000,000 bytes causing a local OOG when copying\n    /// to memory.\n    /// @param _target The address to call\n    /// @param _gas The amount of gas to forward to the remote contract\n    /// @param _maxCopy The maximum number of bytes of returndata to copy\n    /// to memory.\n    /// @param _calldata The data to send to the remote contract\n    /// @return success and returndata, as `.call()`. Returndata is capped to\n    /// `_maxCopy` bytes.\n    function excessivelySafeCall(\n        address _target,\n        uint256 _gas,\n        uint16 _maxCopy,\n        bytes memory _calldata\n    ) internal returns (bool, bytes memory) {\n        // set up for assembly call\n        uint256 _toCopy;\n        bool _success;\n        bytes memory _returnData = new bytes(_maxCopy);\n        // dispatch message to recipient\n        // by assembly calling \"handle\" function\n        // we call via assembly to avoid memcopying a very large returndata\n        // returned by a malicious contract\n        assembly {\n            _success := call(\n            _gas, // gas\n            _target, // recipient\n            0, // ether value\n            add(_calldata, 0x20), // inloc\n            mload(_calldata), // inlen\n            0, // outloc\n            0 // outlen\n            )\n        // limit our copy to 256 bytes\n            _toCopy := returndatasize()\n            if gt(_toCopy, _maxCopy) {\n                _toCopy := _maxCopy\n            }\n        // Store the length of the copied bytes\n            mstore(_returnData, _toCopy)\n        // copy the bytes from returndata[0:_toCopy]\n            returndatacopy(add(_returnData, 0x20), 0, _toCopy)\n        }\n        return (_success, _returnData);\n    }\n\n    /// @notice Use when you _really_ really _really_ don't trust the called\n    /// contract. This prevents the called contract from causing reversion of\n    /// the caller in as many ways as we can.\n    /// @dev The main difference between this and a solidity low-level call is\n    /// that we limit the number of bytes that the callee can cause to be\n    /// copied to caller memory. This prevents stupid things like malicious\n    /// contracts returning 10,000,000 bytes causing a local OOG when copying\n    /// to memory.\n    /// @param _target The address to call\n    /// @param _gas The amount of gas to forward to the remote contract\n    /// @param _maxCopy The maximum number of bytes of returndata to copy\n    /// to memory.\n    /// @param _calldata The data to send to the remote contract\n    /// @return success and returndata, as `.call()`. Returndata is capped to\n    /// `_maxCopy` bytes.\n    function excessivelySafeStaticCall(\n        address _target,\n        uint256 _gas,\n        uint16 _maxCopy,\n        bytes memory _calldata\n    ) internal view returns (bool, bytes memory) {\n        // set up for assembly call\n        uint256 _toCopy;\n        bool _success;\n        bytes memory _returnData = new bytes(_maxCopy);\n        // dispatch message to recipient\n        // by assembly calling \"handle\" function\n        // we call via assembly to avoid memcopying a very large returndata\n        // returned by a malicious contract\n        assembly {\n            _success := staticcall(\n            _gas, // gas\n            _target, // recipient\n            add(_calldata, 0x20), // inloc\n            mload(_calldata), // inlen\n            0, // outloc\n            0 // outlen\n            )\n        // limit our copy to 256 bytes\n            _toCopy := returndatasize()\n            if gt(_toCopy, _maxCopy) {\n                _toCopy := _maxCopy\n            }\n        // Store the length of the copied bytes\n            mstore(_returnData, _toCopy)\n        // copy the bytes from returndata[0:_toCopy]\n            returndatacopy(add(_returnData, 0x20), 0, _toCopy)\n        }\n        return (_success, _returnData);\n    }\n\n    /**\n     * @notice Swaps function selectors in encoded contract calls\n     * @dev Allows reuse of encoded calldata for functions with identical\n     * argument types but different names. It simply swaps out the first 4 bytes\n     * for the new selector. This function modifies memory in place, and should\n     * only be used with caution.\n     * @param _newSelector The new 4-byte selector\n     * @param _buf The encoded contract args\n     */\n    function swapSelector(bytes4 _newSelector, bytes memory _buf)\n    internal\n    pure\n    {\n        require(_buf.length >= 4);\n        uint256 _mask = LOW_28_MASK;\n        assembly {\n        // load the first word of\n            let _word := mload(add(_buf, 0x20))\n        // mask out the top 4 bytes\n        // /x\n            _word := and(_word, _mask)\n            _word := or(_newSelector, _word)\n            mstore(add(_buf, 0x20), _word)\n        }\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/access/Ownable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n    address private _owner;\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the deployer as the initial owner.\n     */\n    constructor() {\n        _transferOwnership(_msgSender());\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if the sender is not the owner.\n     */\n    function _checkOwner() internal view virtual {\n        require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby disabling any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        _transferOwnership(address(0));\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/security/ReentrancyGuard.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant _NOT_ENTERED = 1;\n    uint256 private constant _ENTERED = 2;\n\n    uint256 private _status;\n\n    constructor() {\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    function _nonReentrantBefore() private {\n        // On the first call to nonReentrant, _status will be _NOT_ENTERED\n        require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n        // Any calls to nonReentrant after this point will fail\n        _status = _ENTERED;\n    }\n\n    function _nonReentrantAfter() private {\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n     * `nonReentrant` function in the call stack.\n     */\n    function _reentrancyGuardEntered() internal view returns (bool) {\n        return _status == _ENTERED;\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/token/ERC20/ERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n    mapping(address => uint256) private _balances;\n\n    mapping(address => mapping(address => uint256)) private _allowances;\n\n    uint256 private _totalSupply;\n\n    string private _name;\n    string private _symbol;\n\n    /**\n     * @dev Sets the values for {name} and {symbol}.\n     *\n     * All two of these values are immutable: they can only be set once during\n     * construction.\n     */\n    constructor(string memory name_, string memory symbol_) {\n        _name = name_;\n        _symbol = symbol_;\n    }\n\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() public view virtual override returns (string memory) {\n        return _name;\n    }\n\n    /**\n     * @dev Returns the symbol of the token, usually a shorter version of the\n     * name.\n     */\n    function symbol() public view virtual override returns (string memory) {\n        return _symbol;\n    }\n\n    /**\n     * @dev Returns the number of decimals used to get its user representation.\n     * For example, if `decimals` equals `2`, a balance of `505` tokens should\n     * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n     *\n     * Tokens usually opt for a value of 18, imitating the relationship between\n     * Ether and Wei. This is the default value returned by this function, unless\n     * it's overridden.\n     *\n     * NOTE: This information is only used for _display_ purposes: it in\n     * no way affects any of the arithmetic of the contract, including\n     * {IERC20-balanceOf} and {IERC20-transfer}.\n     */\n    function decimals() public view virtual override returns (uint8) {\n        return 18;\n    }\n\n    /**\n     * @dev See {IERC20-totalSupply}.\n     */\n    function totalSupply() public view virtual override returns (uint256) {\n        return _totalSupply;\n    }\n\n    /**\n     * @dev See {IERC20-balanceOf}.\n     */\n    function balanceOf(address account) public view virtual override returns (uint256) {\n        return _balances[account];\n    }\n\n    /**\n     * @dev See {IERC20-transfer}.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - the caller must have a balance of at least `amount`.\n     */\n    function transfer(address to, uint256 amount) public virtual override returns (bool) {\n        address owner = _msgSender();\n        _transfer(owner, to, amount);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-allowance}.\n     */\n    function allowance(address owner, address spender) public view virtual override returns (uint256) {\n        return _allowances[owner][spender];\n    }\n\n    /**\n     * @dev See {IERC20-approve}.\n     *\n     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n     * `transferFrom`. This is semantically equivalent to an infinite approval.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function approve(address spender, uint256 amount) public virtual override returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, amount);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-transferFrom}.\n     *\n     * Emits an {Approval} event indicating the updated allowance. This is not\n     * required by the EIP. See the note at the beginning of {ERC20}.\n     *\n     * NOTE: Does not update the allowance if the current allowance\n     * is the maximum `uint256`.\n     *\n     * Requirements:\n     *\n     * - `from` and `to` cannot be the zero address.\n     * - `from` must have a balance of at least `amount`.\n     * - the caller must have allowance for ``from``'s tokens of at least\n     * `amount`.\n     */\n    function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n        address spender = _msgSender();\n        _spendAllowance(from, spender, amount);\n        _transfer(from, to, amount);\n        return true;\n    }\n\n    /**\n     * @dev Atomically increases the allowance granted to `spender` by the caller.\n     *\n     * This is an alternative to {approve} that can be used as a mitigation for\n     * problems described in {IERC20-approve}.\n     *\n     * Emits an {Approval} event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, allowance(owner, spender) + addedValue);\n        return true;\n    }\n\n    /**\n     * @dev Atomically decreases the allowance granted to `spender` by the caller.\n     *\n     * This is an alternative to {approve} that can be used as a mitigation for\n     * problems described in {IERC20-approve}.\n     *\n     * Emits an {Approval} event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `spender` must have allowance for the caller of at least\n     * `subtractedValue`.\n     */\n    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n        address owner = _msgSender();\n        uint256 currentAllowance = allowance(owner, spender);\n        require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n        unchecked {\n            _approve(owner, spender, currentAllowance - subtractedValue);\n        }\n\n        return true;\n    }\n\n    /**\n     * @dev Moves `amount` of tokens from `from` to `to`.\n     *\n     * This internal function is equivalent to {transfer}, and can be used to\n     * e.g. implement automatic token fees, slashing mechanisms, etc.\n     *\n     * Emits a {Transfer} event.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `from` must have a balance of at least `amount`.\n     */\n    function _transfer(address from, address to, uint256 amount) internal virtual {\n        require(from != address(0), \"ERC20: transfer from the zero address\");\n        require(to != address(0), \"ERC20: transfer to the zero address\");\n\n        _beforeTokenTransfer(from, to, amount);\n\n        uint256 fromBalance = _balances[from];\n        require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n        unchecked {\n            _balances[from] = fromBalance - amount;\n            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n            // decrementing then incrementing.\n            _balances[to] += amount;\n        }\n\n        emit Transfer(from, to, amount);\n\n        _afterTokenTransfer(from, to, amount);\n    }\n\n    /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n     * the total supply.\n     *\n     * Emits a {Transfer} event with `from` set to the zero address.\n     *\n     * Requirements:\n     *\n     * - `account` cannot be the zero address.\n     */\n    function _mint(address account, uint256 amount) internal virtual {\n        require(account != address(0), \"ERC20: mint to the zero address\");\n\n        _beforeTokenTransfer(address(0), account, amount);\n\n        _totalSupply += amount;\n        unchecked {\n            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n            _balances[account] += amount;\n        }\n        emit Transfer(address(0), account, amount);\n\n        _afterTokenTransfer(address(0), account, amount);\n    }\n\n    /**\n     * @dev Destroys `amount` tokens from `account`, reducing the\n     * total supply.\n     *\n     * Emits a {Transfer} event with `to` set to the zero address.\n     *\n     * Requirements:\n     *\n     * - `account` cannot be the zero address.\n     * - `account` must have at least `amount` tokens.\n     */\n    function _burn(address account, uint256 amount) internal virtual {\n        require(account != address(0), \"ERC20: burn from the zero address\");\n\n        _beforeTokenTransfer(account, address(0), amount);\n\n        uint256 accountBalance = _balances[account];\n        require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n        unchecked {\n            _balances[account] = accountBalance - amount;\n            // Overflow not possible: amount <= accountBalance <= totalSupply.\n            _totalSupply -= amount;\n        }\n\n        emit Transfer(account, address(0), amount);\n\n        _afterTokenTransfer(account, address(0), amount);\n    }\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n     *\n     * This internal function is equivalent to `approve`, and can be used to\n     * e.g. set automatic allowances for certain subsystems, etc.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `owner` cannot be the zero address.\n     * - `spender` cannot be the zero address.\n     */\n    function _approve(address owner, address spender, uint256 amount) internal virtual {\n        require(owner != address(0), \"ERC20: approve from the zero address\");\n        require(spender != address(0), \"ERC20: approve to the zero address\");\n\n        _allowances[owner][spender] = amount;\n        emit Approval(owner, spender, amount);\n    }\n\n    /**\n     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n     *\n     * Does not update the allowance amount in case of infinite allowance.\n     * Revert if not enough allowance is available.\n     *\n     * Might emit an {Approval} event.\n     */\n    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n        uint256 currentAllowance = allowance(owner, spender);\n        if (currentAllowance != type(uint256).max) {\n            require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n            unchecked {\n                _approve(owner, spender, currentAllowance - amount);\n            }\n        }\n    }\n\n    /**\n     * @dev Hook that is called before any transfer of tokens. This includes\n     * minting and burning.\n     *\n     * Calling conditions:\n     *\n     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n     * will be transferred to `to`.\n     * - when `from` is zero, `amount` tokens will be minted for `to`.\n     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n     * - `from` and `to` are never both zero.\n     *\n     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n     */\n    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n    /**\n     * @dev Hook that is called after any transfer of tokens. This includes\n     * minting and burning.\n     *\n     * Calling conditions:\n     *\n     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n     * has been transferred to `to`.\n     * - when `from` is zero, `amount` tokens have been minted for `to`.\n     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n     * - `from` and `to` are never both zero.\n     *\n     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n     */\n    function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n"},{"file_path":"@openzeppelin/contracts/token/ERC20/IERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `from` to `to` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n"},{"file_path":"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"},{"file_path":"@openzeppelin/contracts/utils/Context.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/utils/introspection/ERC165.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IERC165).interfaceId;\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/utils/introspection/IERC165.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"},{"file_path":"@openzeppelin/contracts/utils/structs/EnumerableSet.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n *     // Add the library methods\n *     using EnumerableSet for EnumerableSet.AddressSet;\n *\n *     // Declare a set state variable\n *     EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n    // To implement this library for multiple types with as little code\n    // repetition as possible, we write it in terms of a generic Set type with\n    // bytes32 values.\n    // The Set implementation uses private functions, and user-facing\n    // implementations (such as AddressSet) are just wrappers around the\n    // underlying Set.\n    // This means that we can only create new EnumerableSets for types that fit\n    // in bytes32.\n\n    struct Set {\n        // Storage of set values\n        bytes32[] _values;\n        // Position of the value in the `values` array, plus 1 because index 0\n        // means a value is not in the set.\n        mapping(bytes32 => uint256) _indexes;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function _add(Set storage set, bytes32 value) private returns (bool) {\n        if (!_contains(set, value)) {\n            set._values.push(value);\n            // The value is stored at length-1, but we add 1 to all indexes\n            // and use 0 as a sentinel value\n            set._indexes[value] = set._values.length;\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function _remove(Set storage set, bytes32 value) private returns (bool) {\n        // We read and store the value's index to prevent multiple reads from the same storage slot\n        uint256 valueIndex = set._indexes[value];\n\n        if (valueIndex != 0) {\n            // Equivalent to contains(set, value)\n            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n            // the array, and then remove the last element (sometimes called as 'swap and pop').\n            // This modifies the order of the array, as noted in {at}.\n\n            uint256 toDeleteIndex = valueIndex - 1;\n            uint256 lastIndex = set._values.length - 1;\n\n            if (lastIndex != toDeleteIndex) {\n                bytes32 lastValue = set._values[lastIndex];\n\n                // Move the last value to the index where the value to delete is\n                set._values[toDeleteIndex] = lastValue;\n                // Update the index for the moved value\n                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n            }\n\n            // Delete the slot where the moved value was stored\n            set._values.pop();\n\n            // Delete the index for the deleted slot\n            delete set._indexes[value];\n\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function _contains(Set storage set, bytes32 value) private view returns (bool) {\n        return set._indexes[value] != 0;\n    }\n\n    /**\n     * @dev Returns the number of values on the set. O(1).\n     */\n    function _length(Set storage set) private view returns (uint256) {\n        return set._values.length;\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function _at(Set storage set, uint256 index) private view returns (bytes32) {\n        return set._values[index];\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function _values(Set storage set) private view returns (bytes32[] memory) {\n        return set._values;\n    }\n\n    // Bytes32Set\n\n    struct Bytes32Set {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n        return _add(set._inner, value);\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n        return _remove(set._inner, value);\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n        return _contains(set._inner, value);\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(Bytes32Set storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n        return _at(set._inner, index);\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        bytes32[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // AddressSet\n\n    struct AddressSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(AddressSet storage set, address value) internal returns (bool) {\n        return _add(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(AddressSet storage set, address value) internal returns (bool) {\n        return _remove(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(AddressSet storage set, address value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(AddressSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(AddressSet storage set, uint256 index) internal view returns (address) {\n        return address(uint160(uint256(_at(set._inner, index))));\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(AddressSet storage set) internal view returns (address[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        address[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // UintSet\n\n    struct UintSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(UintSet storage set, uint256 value) internal returns (bool) {\n        return _add(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(UintSet storage set, uint256 value) internal returns (bool) {\n        return _remove(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(UintSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n        return uint256(_at(set._inner, index));\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(UintSet storage set) internal view returns (uint256[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        uint256[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n}\n"},{"file_path":"@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.6.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\nlibrary TransferHelper {\n    /// @notice Transfers tokens from the targeted address to the given destination\n    /// @notice Errors with 'STF' if transfer fails\n    /// @param token The contract address of the token to be transferred\n    /// @param from The originating address from which the tokens will be transferred\n    /// @param to The destination address of the transfer\n    /// @param value The amount to be transferred\n    function safeTransferFrom(\n        address token,\n        address from,\n        address to,\n        uint256 value\n    ) internal {\n        (bool success, bytes memory data) =\n            token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));\n        require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF');\n    }\n\n    /// @notice Transfers tokens from msg.sender to a recipient\n    /// @dev Errors with ST if transfer fails\n    /// @param token The contract address of the token which will be transferred\n    /// @param to The recipient of the transfer\n    /// @param value The value of the transfer\n    function safeTransfer(\n        address token,\n        address to,\n        uint256 value\n    ) internal {\n        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value));\n        require(success && (data.length == 0 || abi.decode(data, (bool))), 'ST');\n    }\n\n    /// @notice Approves the stipulated contract to spend the given allowance in the given token\n    /// @dev Errors with 'SA' if transfer fails\n    /// @param token The contract address of the token to be approved\n    /// @param to The target of the approval\n    /// @param value The amount of the given token the target will be allowed to spend\n    function safeApprove(\n        address token,\n        address to,\n        uint256 value\n    ) internal {\n        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value));\n        require(success && (data.length == 0 || abi.decode(data, (bool))), 'SA');\n    }\n\n    /// @notice Transfers ETH to the recipient address\n    /// @dev Fails with `STE`\n    /// @param to The destination of the transfer\n    /// @param value The value to be transferred\n    function safeTransferETH(address to, uint256 value) internal {\n        (bool success, ) = to.call{value: value}(new bytes(0));\n        require(success, 'STE');\n    }\n}\n"}],"is_verified_via_sourcify":false,"can_be_visualized_via_sol2uml":true,"evm_version":"shanghai","language":"solidity","is_verified_via_eth_bytecode_db":true,"is_fully_verified":false,"license_type":"none","is_blueprint":false,"name":"StoneVault","creation_bytecode":"0x6101006040526201518060025534801562000018575f80fd5b5060405162004d2538038062004d258339810160408190526200003b91620003b3565b60015f556200004a3362000260565b6001600160a01b038516158015906200006b57506001600160a01b03841615155b80156200008057506001600160a01b03831615155b620000a85760405162461bcd60e51b81526004016200009f90620004bf565b60405180910390fd5b81515f5b818110156200011a575f6001600160a01b0316848281518110620000d457620000d4620004e5565b60200260200101516001600160a01b031603620001055760405162461bcd60e51b81526004016200009f90620004bf565b806200011181620004f9565b915050620000ac565b506001600160a01b03808716608052600380548783166001600160a01b03199182161790915590851660e05260048054909116331790556040515f908590859085906200016790620002b1565b62000175939291906200051e565b604051809103905ff0801580156200018f573d5f803e3d5ffd5b509050806001600160a01b031660c0816001600160a01b031681525050866001600160a01b0316630167eb856040518163ffffffff1660e01b8152600401602060405180830381865afa158015620001e9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906200020f9190620005b4565b6001600160a01b031660a05250505f808052600b602052670de0b6b3a76400007fdf7de25b7f1fd6d0b5205f0e18f1f35bd7b8d84cce336588d184533ce43a6f765560055550620005d99350505050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b611d1f806200300683390190565b6001600160a01b0381168114620002d4575f80fd5b50565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b0381118282101715620003165762000316620002d7565b604052919050565b5f6001600160401b03821115620003395762000339620002d7565b5060051b60200190565b5f82601f83011262000353575f80fd5b815160206200036c62000366836200031e565b620002eb565b82815260059290921b840181019181810190868411156200038b575f80fd5b8286015b84811015620003a857805183529183019183016200038f565b509695505050505050565b5f805f805f60a08688031215620003c8575f80fd5b8551620003d581620002bf565b80955050602080870151620003ea81620002bf565b6040880151909550620003fd81620002bf565b60608801519094506001600160401b03808211156200041a575f80fd5b818901915089601f8301126200042e575f80fd5b81516200043f62000366826200031e565b81815260059190911b8301840190848101908c8311156200045e575f80fd5b938501935b82851015620004895784516200047981620002bf565b8252938501939085019062000463565b60808c01519097509450505080831115620004a2575f80fd5b5050620004b28882890162000343565b9150509295509295909350565b6020808252600c908201526b5a45524f204144445245535360a01b604082015260600190565b634e487b7160e01b5f52603260045260245ffd5b5f600182016200051757634e487b7160e01b5f52601160045260245ffd5b5060010190565b6001600160a01b0384811682526060602080840182905285519184018290525f92868201929091906080860190855b818110156200056d5785518516835294830194918301916001016200054d565b505085810360408701528651808252908201935091508086015f5b83811015620005a65781518552938201939082019060010162000588565b509298975050505050505050565b5f60208284031215620005c5575f80fd5b8151620005d281620002bf565b9392505050565b60805160a05160c05160e051612958620006ae5f395f81816104390152818161087f01528181610a9d01528181610bdb015281816112d601528181611630015261230401525f81816101c701528181610720015281816108f801528181610a1c01528181610bba01528181610e9301528181611236015281816113d2015281816119400152611e3a01525f81816102100152818161096301528181610fb101528181611097015261154c01525f81816102430152818161080801528181610fd301528181611651015261238601526129585ff3fe6080604052600436106101ab575f3560e01c8062258d6b146101b65780630167eb85146101ff5780630754617214610232578063096015b014610265578063223e54791461028657806324f3082a146102a55780632712b539146102c857806328a79576146102e75780633c49fc0f146102fb57806346904840146103265780635069fb571461034557806351b77fb31461035957806360e760d51461036e578063715018a6146103835780637155133614610397578063717dd445146103ac578063745400c9146103cb578063753ec103146103ea578063768aac5d146104095780637b0c1f291461042857806382f1631f1461045b57806387153eb11461047d5780638da5cb5b146104a85780639f01f7ba146104bc578063a4786f3d146104db578063aa67c91914610524578063b18f2e9114610537578063d0e30db014610556578063e74b981b1461055e578063e8ac623a1461057d578063ea99e6891461059c578063ef037fb9146105b1578063f2fde38b146105d0578063f76339dc146105ef578063fccbebf514610604578063fe73511714610623578063ffa1ad7414610638575f80fd5b366101b257005b5f80fd5b3480156101c1575f80fd5b506101e97f000000000000000000000000000000000000000000000000000000000000000081565b6040516101f6919061243c565b60405180910390f35b34801561020a575f80fd5b506101e97f000000000000000000000000000000000000000000000000000000000000000081565b34801561023d575f80fd5b506101e97f000000000000000000000000000000000000000000000000000000000000000081565b348015610270575f80fd5b5061028461027f366004612450565b61064c565b005b348015610291575f80fd5b506102846102a036600461247d565b6106e7565b3480156102b0575f80fd5b506102ba600a5481565b6040519081526020016101f6565b3480156102d3575f80fd5b506102846102e236600461247d565b6107c7565b3480156102f2575f80fd5b506102ba61095f565b348015610306575f80fd5b506102ba610315366004612450565b600c6020525f908152604090205481565b348015610331575f80fd5b506004546101e9906001600160a01b031681565b348015610350575f80fd5b50610284610b68565b348015610364575f80fd5b506102ba60075481565b348015610379575f80fd5b506102ba60085481565b34801561038e575f80fd5b50610284610e69565b3480156103a2575f80fd5b506102ba60025481565b3480156103b7575f80fd5b506102846103c636600461247d565b610e7c565b3480156103d6575f80fd5b506102846103e5366004612450565b610f2e565b3480156103f5575f80fd5b506003546101e9906001600160a01b031681565b348015610414575f80fd5b5061028461042336600461247d565b61121f565b348015610433575f80fd5b506101e97f000000000000000000000000000000000000000000000000000000000000000081565b348015610466575f80fd5b5061046f6112d1565b6040516101f6929190612496565b348015610488575f80fd5b506102ba610497366004612450565b600b6020525f908152604090205481565b3480156104b3575f80fd5b506101e9611458565b3480156104c7575f80fd5b506102846104d6366004612450565b611467565b3480156104e6575f80fd5b506105156104f536600461247d565b600d6020525f908152604090208054600182015460029092015490919083565b6040516101f6939291906124a4565b6102ba61053236600461247d565b6115d9565b348015610542575f80fd5b506102ba6105513660046124ba565b6115fc565b6102ba611be8565b348015610569575f80fd5b5061028461057836600461247d565b611c09565b348015610588575f80fd5b5061028461059736600461247d565b611cbf565b3480156105a7575f80fd5b506102ba60095481565b3480156105bc575f80fd5b506102846105cb366004612450565b611d0b565b3480156105db575f80fd5b506102846105ea36600461247d565b611d8b565b3480156105fa575f80fd5b506102ba60055481565b34801561060f575f80fd5b5061028461061e3660046125a8565b611e01565b34801561062e575f80fd5b506102ba60065481565b348015610643575f80fd5b506102ba600181565b610654611ee6565b6106626064620f4240612675565b8111156106a75760405162461bcd60e51b815260206004820152600e60248201526d657863656564206d6178696d756d60901b60448201526064015b60405180910390fd5b7f4b3c5e4d7a59d85563d40eacdce201f42b27dd0f184fc2aef47c140a9775617d600954826040516106da929190612496565b60405180910390a1600955565b6003546001600160a01b031633146107115760405162461bcd60e51b815260040161069e90612694565b60405163223e547960e01b81527f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b0382169063223e54799061075f90859060040161243c565b5f604051808303815f87803b158015610776575f80fd5b505af1158015610788573d5f803e3d5ffd5b505050507f75ccacf0275778be70cc58a56b78401d8e60a7c1e153fd4338738dd08f26605e826040516107bb919061243c565b60405180910390a15050565b6003546001600160a01b031633146107f15760405162461bcd60e51b815260040161069e90612694565b604051630e7b77f760e41b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e7b77f709061083d90849060040161243c565b5f604051808303815f87803b158015610854575f80fd5b505af1158015610866573d5f803e3d5ffd5b5050604051630e7b77f760e41b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016925063e7b77f7091506108b690849060040161243c565b5f604051808303815f87803b1580156108cd575f80fd5b505af11580156108df573d5f803e3d5ffd5b5050604051630e7b77f760e41b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016925063e7b77f70915061092f90849060040161243c565b5f604051808303815f87803b158015610946575f80fd5b505af1158015610958573d5f803e3d5ffd5b5050505050565b5f807f000000000000000000000000000000000000000000000000000000000000000090505f816001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109c1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109e591906126ba565b90506005545f14806109f5575080155b80610a01575060075481145b15610a1657670de0b6b3a76400009250505090565b5f6006547f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639d241e7a6040518163ffffffff1660e01b81526004016020604051808303815f875af1158015610a77573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a9b91906126ba565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166312065fe06040518163ffffffff1660e01b8152600401602060405180830381865afa158015610af7573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b1b91906126ba565b610b2591906126d1565b610b2f91906126e4565b90505f60075483610b4091906126e4565b905080610b55670de0b6b3a7640000846126f7565b610b5f9190612675565b94505050505090565b600254600a54610b7891906126d1565b4211610bb85760405162461bcd60e51b815260206004820152600f60248201526e185b1c9958591e481c9958985cd959608a1b604482015260640161069e565b7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000005f610c0361095f565b90505f826001600160a01b03166312065fe06040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c42573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c6691906126ba565b90505f610c7560085484611f45565b90505f81600654610c8691906126d1565b90505f866001600160a01b031663f41d7a186040518163ffffffff1660e01b81526004016020604051808303815f875af1158015610cc6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cea91906126ba565b90505f8083861115610d0757610d0084876126e4565b9150610d30565b83610d1284886126d1565b1015610d305782610d2387866126e4565b610d2d91906126e4565b90505b604051630ecc3e7160e21b81526001600160a01b038a1690633b30f9c490610d5e9085908590600401612496565b5f604051808303815f87803b158015610d75575f80fd5b505af1158015610d87573d5f803e3d5ffd5b505050505f610d9461095f565b9050808810610da35780610da5565b875b600580545f908152600b602090815260408083209490945582548252600c90529190912042905554610dd89060016126d1565b600555600854600754610deb91906126d1565b600755600854610dfb9082611f45565b600654610e0891906126d1565b6006555f60085542600a5560055460408051918252602082018590528101839052606081018290527fd2792f2bd70f462289b37051570ea123ec2faa689d0966f04ea499497c47aea49060800160405180910390a150505050505050505050565b610e71611ee6565b610e7a5f611fbd565b565b610e84611ee6565b60405163717dd44560e01b81527f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b0382169063717dd44590610ed290859060040161243c565b5f604051808303815f87803b158015610ee9575f80fd5b505af1158015610efb573d5f803e3d5ffd5b505050507feed65fb1c2451c54bb6eb3a6f3fe2fbe77ffd432b1f447c171237f36b8947202826040516107bb919061243c565b610f3661200e565b805f03610f555760405162461bcd60e51b815260040161069e9061270e565b6005545f03610fa25760405162461bcd60e51b815260206004820152601960248201527873686f756c6420776974686472617720696e7374616e746c7960381b604482015260640161069e565b6040516370a0823160e01b81527f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009083906001600160a01b038416906370a082319061101490339060040161243c565b602060405180830381865afa15801561102f573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061105391906126ba565b10156110925760405162461bcd60e51b815260206004820152600e60248201526d6578636565642062616c616e636560901b604482015260640161069e565b6110be7f0000000000000000000000000000000000000000000000000000000000000000333086612065565b826008546110cc91906126d1565b600855335f908152600d60205260409020600554815403611101578381600101546110f791906126d1565b60018201556111d3565b80545f0361111a576001810184905560055481556111d3565b600181015481545f908152600b6020526040812054909161113a91611f45565b6001830154604051632770a7eb60e21b81529192506001600160a01b03851691639dc29fac9161116f91309190600401612731565b5f604051808303815f87803b158015611186575f80fd5b505af1158015611198573d5f803e3d5ffd5b50505060018301546007546111ad92506126e4565b6007556001820185905560028201546111c79082906126d1565b60028301555060055481555b60055460405133917f0c53c82ad07e2d592d88ece3b066777dd60f1118e2a081b380efc4358f0d9e2a91611208918891612496565b60405180910390a250505061121c60015f55565b50565b611227611ee6565b60405163768aac5d60e01b81527f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b0382169063768aac5d9061127590859060040161243c565b5f604051808303815f87803b15801561128c575f80fd5b505af115801561129e573d5f803e3d5ffd5b505050507f700c330a34830acb29f2b4927829f605fae4e5b7197df45a7973d246039e1e01826040516107bb919061243c565b5f805f7f00000000000000000000000000000000000000000000000000000000000000009050600654816001600160a01b03166312065fe06040518163ffffffff1660e01b8152600401602060405180830381865afa158015611336573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061135a91906126ba565b11156113d057600654816001600160a01b03166312065fe06040518163ffffffff1660e01b8152600401602060405180830381865afa15801561139f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113c391906126ba565b6113cd91906126e4565b92505b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663f837df256040518163ffffffff1660e01b81526004016020604051808303815f875af115801561142d573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061145191906126ba565b9150509091565b6001546001600160a01b031690565b61146f61200e565b805f0361148e5760405162461bcd60e51b815260040161069e9061270e565b335f908152600d602052604090206005548154146114e45760405162461bcd60e51b81526020600482015260136024820152726e6f2070656e64696e6720776974686472617760681b604482015260640161069e565b81816001015410156115325760405162461bcd60e51b81526020600482015260176024820152766578636565642070656e64696e6720776974686472617760481b604482015260640161069e565b81816001015461154291906126e4565b60018201556115727f0000000000000000000000000000000000000000000000000000000000000000338461216a565b80600101545f03611581575f81555b8160085461158f91906126e4565b60085560055460405133917f39e2e01794006bc1f63835af5c05db790beca4bfb40de3f02cc3ddf22dccc0fb916115c7918691612496565b60405180910390a25061121c60015f55565b5f6115e261200e565b6115ec3483612268565b90506115f760015f55565b919050565b5f61160561200e565b8215158061161257508115155b61162e5760405162461bcd60e51b815260040161069e9061270e565b7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000005f6116796112d1565b50905085156117fd57335f908152600d602052604090206005548154148015906116a35750805415155b1561175e57600181015481545f908152600b602052604081205490916116c891611f45565b6001830154604051632770a7eb60e21b81529192506001600160a01b03861691639dc29fac916116fd91309190600401612731565b5f604051808303815f87803b158015611714575f80fd5b505af1158015611726573d5f803e3d5ffd5b505050600183015460075461173b92506126e4565b6007555f600183015560028201546117549082906126d1565b6002830155505f81555b86816002015410156117a85760405162461bcd60e51b815260206004820152601360248201527265786365656420776974686472617761626c6560681b604482015260640161069e565b8681600201546117b891906126e4565b60028201556006546117cb9088906126e4565b60065560055460405188965033915f80516020612903833981519152916117f3918991612496565b60405180910390a2505b8415611a11575f6005545f0361181c5750670de0b6b3a764000061185e565b5f61182561095f565b90505f600b5f600160055461183a91906126e4565b81526020019081526020015f205490508181106118575781611859565b805b925050505b5f6118698783611f45565b604051632770a7eb60e21b81529091506001600160a01b03851690639dc29fac9061189a9033908b90600401612731565b5f604051808303815f87803b1580156118b1575f80fd5b505af11580156118c3573d5f803e3d5ffd5b50505050828111611911576118d881876126d1565b9550336001600160a01b03165f8051602061290383398151915282600554604051611904929190612496565b60405180910390a2611a0e565b61191b83876126d1565b955061192783826126e4565b604051630fcc56f760e01b8152600481018290529091507f0000000000000000000000000000000000000000000000000000000000000000905f906001600160a01b03831690630fcc56f7906024016020604051808303815f875af1158015611992573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119b691906126ba565b90506119c281896126d1565b9750336001600160a01b03167f1b84e2f0660a601edc93ceed0d08fa5e9b3cbe4e2450c262f2ea8531d2c52e958483600554604051611a03939291906124a4565b60405180910390a250505b50505b83836001600160a01b03166312065fe06040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a4e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a7291906126ba565b1015611ab25760405162461bcd60e51b815260206004820152600f60248201526e1cdd1a5b1b081b995959081dd85a5d608a1b604482015260640161069e565b5f6009545f14611b7157620f424060095486611ace91906126f7565b611ad89190612675565b6004805460405163f3fef3a360e01b81529293506001600160a01b038088169363f3fef3a393611b0e9390921691869101612731565b5f604051808303815f87803b158015611b25575f80fd5b505af1158015611b37573d5f803e3d5ffd5b50506040518381523392507f55bb3cade9d43b798a4fe5ffdd05024b2d7870df53920673bfc7e68047cd0ab1915060200160405180910390a25b6001600160a01b03841663f3fef3a333611b8b84896126e4565b6040518363ffffffff1660e01b8152600401611ba8929190612731565b5f604051808303815f87803b158015611bbf575f80fd5b505af1158015611bd1573d5f803e3d5ffd5b5050505050505050611be260015f55565b92915050565b5f611bf161200e565b611bfb3433612268565b9050611c0660015f55565b90565b611c11611ee6565b6001600160a01b038116611c565760405162461bcd60e51b815260206004820152600c60248201526b7a65726f206164647265737360a01b604482015260640161069e565b600454604080516001600160a01b03928316815291831660208301527fd9d6b85b6d670cd443496fc6d03390f739bbff47f96a8e33fb0cdd52ad26f5c2910160405180910390a1600480546001600160a01b0319166001600160a01b0392909216919091179055565b6003546001600160a01b03163314611ce95760405162461bcd60e51b815260040161069e90612694565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b611d13611ee6565b62093a80811115611d505760405162461bcd60e51b81526020600482015260076024820152661a5b9d985b1a5960ca1b604482015260640161069e565b60028190556040518181527f73b75c75399b0450cd07a0e5188f0e06ce9e484fea18044b25e0326feb8e0e2a9060200160405180910390a150565b611d93611ee6565b6001600160a01b038116611df85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161069e565b61121c81611fbd565b6003546001600160a01b03163314611e2b5760405162461bcd60e51b815260040161069e90612694565b604051633fea70a760e01b81527f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b03821690633fea70a790611e7b908690869060040161274a565b5f604051808303815f87803b158015611e92575f80fd5b505af1158015611ea4573d5f803e3d5ffd5b505050507fb08ed47ad81ee926c18b77f6be44a5d49bf687355a669936e1f02cfe4e2c84f78383604051611ed992919061274a565b60405180910390a1505050565b33611eef611458565b6001600160a01b031614610e7a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161069e565b5f60018211611f965760405162461bcd60e51b815260206004820181905260248201527f5661756c74204c69623a20696e76616c69642061737365745065725368617265604482015260640161069e565b611fa26012600a6128ac565b611fac83856126f7565b611fb69190612675565b9392505050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b60025f540361205f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161069e565b60025f55565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17905291515f928392908816916120c891906128b7565b5f604051808303815f865af19150503d805f8114612101576040519150601f19603f3d011682016040523d82523d5f602084013e612106565b606091505b509150915081801561213057508051158061213057508080602001905181019061213091906128e3565b6121625760405162461bcd60e51b815260206004820152600360248201526229aa2360e91b604482015260640161069e565b505050505050565b5f80846001600160a01b031663a9059cbb60e01b8585604051602401612191929190612731565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516121cf91906128b7565b5f604051808303815f865af19150503d805f8114612208576040519150601f19603f3d011682016040523d82523d5f602084013e61220d565b606091505b509150915081801561223757508051158061223757508080602001905181019061223791906128e3565b6109585760405162461bcd60e51b815260206004820152600260248201526114d560f21b604482015260640161069e565b5f825f036122885760405162461bcd60e51b815260040161069e9061270e565b5f8061229261095f565b90506005545f036122ad57670de0b6b3a764000091506122e3565b5f600b5f60016005546122c091906126e4565b81526020019081526020015f205490508181116122dd57816122df565b805b9250505b816122f6670de0b6b3a7640000876126f7565b6123009190612675565b92507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0476040518263ffffffff1660e01b81526004015f604051808303818588803b15801561235b575f80fd5b505af115801561236d573d5f803e3d5ffd5b50506040516340c10f1960e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001693506340c10f1992506123c0915087908790600401612731565b5f604051808303815f87803b1580156123d7575f80fd5b505af11580156123e9573d5f803e3d5ffd5b50505050836001600160a01b03167f36af321ec8d3c75236829c5317affd40ddb308863a1236d2d277a4025cccee1e868560055460405161242c939291906124a4565b60405180910390a2505092915050565b6001600160a01b0391909116815260200190565b5f60208284031215612460575f80fd5b5035919050565b80356001600160a01b03811681146115f7575f80fd5b5f6020828403121561248d575f80fd5b611fb682612467565b918252602082015260400190565b9283526020830191909152604082015260600190565b5f80604083850312156124cb575f80fd5b50508035926020909101359150565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b0381118282101715612516576125166124da565b604052919050565b5f6001600160401b03821115612536576125366124da565b5060051b60200190565b5f82601f83011261254f575f80fd5b8135602061256461255f8361251e565b6124ee565b82815260059290921b84018101918181019086841115612582575f80fd5b8286015b8481101561259d5780358352918301918301612586565b509695505050505050565b5f80604083850312156125b9575f80fd5b82356001600160401b03808211156125cf575f80fd5b818501915085601f8301126125e2575f80fd5b813560206125f261255f8361251e565b82815260059290921b84018101918181019089841115612610575f80fd5b948201945b838610156126355761262686612467565b82529482019490820190612615565b9650508601359250508082111561264a575f80fd5b5061265785828601612540565b9150509250929050565b634e487b7160e01b5f52601160045260245ffd5b5f8261268f57634e487b7160e01b5f52601260045260245ffd5b500490565b6020808252600c908201526b1b9bdd081c1c9bdc1bdcd85b60a21b604082015260600190565b5f602082840312156126ca575f80fd5b5051919050565b80820180821115611be257611be2612661565b81810381811115611be257611be2612661565b8082028115828204841417611be257611be2612661565b6020808252600990820152681d1bdbc81cdb585b1b60ba1b604082015260600190565b6001600160a01b03929092168252602082015260400190565b604080825283519082018190525f906020906060840190828701845b8281101561278b5781516001600160a01b031684529284019290840190600101612766565b505050838103828501528451808252858301918301905f5b818110156127bf578351835292840192918401916001016127a3565b5090979650505050505050565b600181815b8085111561280657815f19048211156127ec576127ec612661565b808516156127f957918102915b93841c93908002906127d1565b509250929050565b5f8261281c57506001611be2565b8161282857505f611be2565b816001811461283e576002811461284857612864565b6001915050611be2565b60ff84111561285957612859612661565b50506001821b611be2565b5060208310610133831016604e8410600b8410161715612887575081810a611be2565b61289183836127cc565b805f19048211156128a4576128a4612661565b029392505050565b5f611fb6838361280e565b5f82515f5b818110156128d657602081860181015185830152016128bc565b505f920191825250919050565b5f602082840312156128f3575f80fd5b81518015158114611fb6575f80fdfe92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc6a2646970667358221220589edafabb62e4e2222be100a867ae28cb8024a70f3b12ceec8fc29df5b0aeaa64736f6c6343000815003360a060405234801562000010575f80fd5b5060405162001d1f38038062001d1f8339810160408190526200003391620003df565b6001600160a01b038316620000655760405162461bcd60e51b81526004016200005c90620004c0565b60405180910390fd5b81515f5b81811015620000d7575f6001600160a01b0316848281518110620000915762000091620004e6565b60200260200101516001600160a01b031603620000c25760405162461bcd60e51b81526004016200005c90620004c0565b80620000ce816200050e565b91505062000069565b505f80546001600160a01b031916331790556001600160a01b0384166080526200010283836200010c565b505050506200053f565b8051825114620001505760405162461bcd60e51b815260206004820152600e60248201526d0d2dcecc2d8d2c840d8cadccee8d60931b60448201526064016200005c565b81515f90815b81811015620002335762000191858281518110620001785762000178620004e6565b602002602001015160016200027d60201b90919060201c565b50838181518110620001a757620001a7620004e6565b602002602001015160035f878481518110620001c757620001c7620004e6565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020015f2081905550838181518110620002075762000207620004e6565b6020026020010151836200021c919062000529565b9250806200022a816200050e565b91505062000156565b50620f4240821115620002775760405162461bcd60e51b815260206004820152600b60248201526a657863656564203130302560a81b60448201526064016200005c565b50505050565b5f62000293836001600160a01b0384166200029c565b90505b92915050565b5f818152600183016020526040812054620002e357508154600181810184555f84815260208082209093018490558454848252828601909352604090209190915562000296565b505f62000296565b6001600160a01b038116811462000300575f80fd5b50565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b038111828210171562000342576200034262000303565b604052919050565b5f6001600160401b0382111562000365576200036562000303565b5060051b60200190565b5f82601f8301126200037f575f80fd5b815160206200039862000392836200034a565b62000317565b82815260059290921b84018101918181019086841115620003b7575f80fd5b8286015b84811015620003d45780518352918301918301620003bb565b509695505050505050565b5f805f60608486031215620003f2575f80fd5b8351620003ff81620002eb565b602085810151919450906001600160401b03808211156200041e575f80fd5b818701915087601f83011262000432575f80fd5b81516200044362000392826200034a565b81815260059190911b8301840190848101908a83111562000462575f80fd5b938501935b828510156200048d5784516200047d81620002eb565b8252938501939085019062000467565b60408a01519097509450505080831115620004a6575f80fd5b5050620004b6868287016200036f565b9150509250925092565b6020808252600c908201526b5a45524f204144445245535360a01b604082015260600190565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b5f60018201620005225762000522620004fa565b5060010190565b80820180821115620002965762000296620004fa565b6080516117b9620005665f395f81816101e50152818161083c01526109fa01526117b95ff3fe6080604052600436106100db575f3560e01c80630fcc56f7146100e6578063223e54791461011857806324c71ece146101395780633b30f9c4146101645780633fea70a714610177578063717dd44514610196578063768aac5d146101b55780637b0c1f29146101d457806397663b741461021f5780639841ab00146102335780639d241e7a14610252578063b49a60bb14610266578063ba93ec2914610288578063e7b77f70146102a6578063f111a5c3146102c5578063f25ddb62146102e4578063f41d7a1814610303578063f837df2514610317575f80fd5b366100e257005b5f80fd5b3480156100f1575f80fd5b506101056101003660046113cc565b61032b565b6040519081526020015b60405180910390f35b348015610123575f80fd5b506101376101323660046113f7565b61039c565b005b348015610144575f80fd5b506101056101533660046113f7565b60036020525f908152604090205481565b610137610172366004611412565b61041c565b348015610182575f80fd5b50610137610191366004611500565b61044f565b3480156101a1575f80fd5b506101376101b03660046113f7565b610482565b3480156101c0575f80fd5b506101376101cf3660046113f7565b6104b7565b3480156101df575f80fd5b506102077f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010f565b34801561022a575f80fd5b506101376104ea565b34801561023e575f80fd5b5061010561024d3660046113f7565b6104f6565b34801561025d575f80fd5b5061010561055e565b348015610271575f80fd5b5061027a6105a7565b60405161010f9291906115bb565b348015610293575f80fd5b505f54610207906001600160a01b031681565b3480156102b1575f80fd5b506101376102c03660046113f7565b6106e4565b3480156102d0575f80fd5b506101056102df3660046113f7565b61072e565b3480156102ef575f80fd5b506101056102fe3660046113f7565b61076b565b34801561030e575f80fd5b506101056107a9565b348015610322575f80fd5b506101056107ed565b5f80546001600160a01b0316331461035e5760405162461bcd60e51b81526004016103559061163d565b60405180910390fd5b478281106103765761036e610831565b809150610396565b806103896103848286611674565b610861565b6103939190611687565b91505b50919050565b5f546001600160a01b031633146103c55760405162461bcd60e51b81526004016103559061163d565b6103d0600182610957565b1561040d5760405162461bcd60e51b815260206004820152600d60248201526c185b1c9958591e48195e1a5cdd609a1b6044820152606401610355565b610418600182610972565b5050565b5f546001600160a01b031633146104455760405162461bcd60e51b81526004016103559061163d565b6104188282610986565b5f546001600160a01b031633146104785760405162461bcd60e51b81526004016103559061163d565b6104188282610d1b565b5f546001600160a01b031633146104ab5760405162461bcd60e51b81526004016103559061163d565b6104b481610f94565b50565b5f546001600160a01b031633146104e05760405162461bcd60e51b81526004016103559061163d565b6104b4815f610fec565b6104f45f80610986565b565b5f816001600160a01b0316637654f7ab6040518163ffffffff1660e01b81526004016020604051808303815f875af1158015610534573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610558919061169a565b92915050565b5f8061056a600161105b565b90505f5b818110156105a25761058461024d600183611064565b61058e9084611687565b92508061059a816116b1565b91505061056e565b505090565b6060805f6105b5600161105b565b9050806001600160401b038111156105cf576105cf611432565b6040519080825280602002602001820160405280156105f8578160200160208202803683370190505b509250806001600160401b0381111561061357610613611432565b60405190808252806020026020018201604052801561063c578160200160208202803683370190505b5091505f5b818110156106de575f610655600183611064565b90508085838151811061066a5761066a6116c9565b60200260200101906001600160a01b031690816001600160a01b03168152505060035f826001600160a01b03166001600160a01b031681526020019081526020015f20548483815181106106c0576106c06116c9565b602090810291909101015250806106d6816116b1565b915050610641565b50509091565b5f546001600160a01b0316331461070d5760405162461bcd60e51b81526004016103559061163d565b5f80546001600160a01b0319166001600160a01b0392909216919091179055565b5f816001600160a01b0316621a55976040518163ffffffff1660e01b81526004016020604051808303815f875af1158015610534573d5f803e3d5ffd5b5f816001600160a01b0316636c23ab4c6040518163ffffffff1660e01b81526004016020604051808303815f875af1158015610534573d5f803e3d5ffd5b5f806107b5600161105b565b90505f5b818110156105a2576107cf6102df600183611064565b6107d99084611687565b9250806107e5816116b1565b9150506107b9565b5f806107f9600161105b565b90505f5b818110156105a2576108136102fe600183611064565b61081d9084611687565b925080610829816116b1565b9150506107fd565b47156104f4576104f47f00000000000000000000000000000000000000000000000000000000000000004761106f565b5f8061086d600161105b565b90505f5b8181101561094e575f610885600183611064565b6001600160a01b0381165f9081526003602052604081205491925090620f4240906108b090886116dd565b6108ba91906116f4565b9050801561093957604051637ec95ff960e11b81526004810182905285906001600160a01b0384169063fd92bff2906024016020604051808303815f875af1158015610908573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061092c919061169a565b6109369190611687565b94505b50508080610946906116b1565b915050610871565b50610396610831565b5f61096b836001600160a01b038416611113565b9392505050565b5f61096b836001600160a01b03841661112a565b811580610991575080155b6109d85760405162461bcd60e51b81526020600482015260186024820152776f6e6c79206465706f736974206f7220776974686472617760401b6044820152606401610355565b8115610a5a5760405163f3fef3a360e01b8152306004820152602481018390527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063f3fef3a3906044015f604051808303815f87803b158015610a43575f80fd5b505af1158015610a55573d5f803e3d5ffd5b505050505b5f610a636107ed565b905081811015610a7457505f610a8c565b81610a7f8483611687565b610a899190611674565b90505b5f610a97600161105b565b90505f816001600160401b03811115610ab257610ab2611432565b604051908082528060200260200182016040528015610afb57816020015b604080516060810182525f80825260208083018290529282015282525f19909201910181610ad05790505b5090505f80610b0b600185611674565b90505f5b84811015610c74575f610b23600183611064565b6001600160a01b0381165f9081526003602052604081205491925003610b5457610b4e816001610fec565b50610c62565b6001600160a01b0381165f90815260036020526040812054620f424090610b7b908a6116dd565b610b8591906116f4565b90505f610b918361076b565b905080821015610bf757604080516060810182526001600160a01b03851681525f6020820152908101610bc48484611674565b815250878781518110610bd957610bd96116c9565b60200260200101819052508580610bef906116b1565b965050610c5e565b80821115610c5e57604080516060810182526001600160a01b038516815260016020820152908101610c298385611674565b815250878681518110610c3e57610c3e6116c9565b6020026020010181905250845f14610c5e5784610c5a81611713565b9550505b5050505b80610c6c816116b1565b915050610b0f565b50825193505f5b84811015610d09575f848281518110610c9657610c966116c9565b6020026020010151905080604001515f03610cb15750610cf7565b806020015115610ce4578060400151471015610cce574760408201525b610cdf815f01518260400151611171565b610cf5565b610cf5815f015182604001516111bc565b505b80610d01816116b1565b915050610c7b565b50610d12610831565b50505050505050565b815181518114610d5e5760405162461bcd60e51b815260206004820152600e60248201526d0d2dcecc2d8d2c840d8cadccee8d60931b6044820152606401610355565b5f610d69600161105b565b90505f5b81811015610daf575f600381610d84600185611064565b6001600160a01b0316815260208101919091526040015f205580610da7816116b1565b915050610d6d565b505f805b83811015610f4b57306001600160a01b0316868281518110610dd757610dd76116c9565b60200260200101516001600160a01b031663f77c47916040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e1a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e3e9190611728565b6001600160a01b031614610e8a5760405162461bcd60e51b81526020600482015260136024820152720c6dedce8e4ded8d8cae440dad2e6dac2e8c6d606b1b6044820152606401610355565b610eb7868281518110610e9f57610e9f6116c9565b6020026020010151600161097290919063ffffffff16565b50848181518110610eca57610eca6116c9565b602002602001015160035f888481518110610ee757610ee76116c9565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020015f2081905550848181518110610f2457610f246116c9565b602002602001015182610f379190611687565b915080610f43816116b1565b915050610db3565b50620f4240811115610f8d5760405162461bcd60e51b815260206004820152600b60248201526a657863656564203130302560a81b6044820152606401610355565b5050505050565b610f9d81611224565b610fd85760405162461bcd60e51b815260206004820152600c60248201526b7374696c6c2061637469766560a01b6044820152606401610355565b610fe36001826112af565b506104b4610831565b816001600160a01b03166352efea6e6040518163ffffffff1660e01b81526004016020604051808303815f875af1158015611029573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061104d919061169a565b508061041857610418610831565b5f610558825490565b5f61096b83836112c3565b604080515f808252602082019092526001600160a01b0384169083906040516110989190611743565b5f6040518083038185875af1925050503d805f81146110d2576040519150601f19603f3d011682016040523d82523d5f602084013e6110d7565b606091505b505090508061110e5760405162461bcd60e51b815260206004820152600360248201526253544560e81b6044820152606401610355565b505050565b5f9081526001919091016020526040902054151590565b5f6111358383611113565b61116a57508154600181810184555f848152602080822090930184905584548482528286019093526040902091909155610558565b505f610558565b816001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004015f604051808303818588803b1580156111aa575f80fd5b505af1158015610d12573d5f803e3d5ffd5b604051632e1a7d4d60e01b8152600481018290526001600160a01b03831690632e1a7d4d906024016020604051808303815f875af1158015611200573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061110e919061169a565b6001600160a01b0381165f908152600360205260408120541580156105585750612710826001600160a01b0316637654f7ab6040518163ffffffff1660e01b81526004016020604051808303815f875af1158015611284573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112a8919061169a565b1092915050565b5f61096b836001600160a01b0384166112e9565b5f825f0182815481106112d8576112d86116c9565b905f5260205f200154905092915050565b5f81815260018301602052604081205480156113c3575f61130b600183611674565b85549091505f9061131e90600190611674565b905081811461137d575f865f01828154811061133c5761133c6116c9565b905f5260205f200154905080875f01848154811061135c5761135c6116c9565b5f918252602080832090910192909255918252600188019052604090208390555b855486908061138e5761138e61176f565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f905560019350505050610558565b5f915050610558565b5f602082840312156113dc575f80fd5b5035919050565b6001600160a01b03811681146104b4575f80fd5b5f60208284031215611407575f80fd5b813561096b816113e3565b5f8060408385031215611423575f80fd5b50508035926020909101359150565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b038111828210171561146e5761146e611432565b604052919050565b5f6001600160401b0382111561148e5761148e611432565b5060051b60200190565b5f82601f8301126114a7575f80fd5b813560206114bc6114b783611476565b611446565b82815260059290921b840181019181810190868411156114da575f80fd5b8286015b848110156114f557803583529183019183016114de565b509695505050505050565b5f8060408385031215611511575f80fd5b82356001600160401b0380821115611527575f80fd5b818501915085601f83011261153a575f80fd5b8135602061154a6114b783611476565b82815260059290921b84018101918181019089841115611568575f80fd5b948201945b8386101561158f578535611580816113e3565b8252948201949082019061156d565b965050860135925050808211156115a4575f80fd5b506115b185828601611498565b9150509250929050565b604080825283519082018190525f906020906060840190828701845b828110156115fc5781516001600160a01b0316845292840192908401906001016115d7565b505050838103828501528451808252858301918301905f5b8181101561163057835183529284019291840191600101611614565b5090979650505050505050565b6020808252600990820152681b9bdd081d985d5b1d60ba1b604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561055857610558611660565b8082018082111561055857610558611660565b5f602082840312156116aa575f80fd5b5051919050565b5f600182016116c2576116c2611660565b5060010190565b634e487b7160e01b5f52603260045260245ffd5b808202811582820484141761055857610558611660565b5f8261170e57634e487b7160e01b5f52601260045260245ffd5b500490565b5f8161172157611721611660565b505f190190565b5f60208284031215611738575f80fd5b815161096b816113e3565b5f82515f5b818110156117625760208186018101518583015201611748565b505f920191825250919050565b634e487b7160e01b5f52603160045260245ffdfea2646970667358221220c3b133e34d49b8d48a24baaba288593e602faa536b943886e53af085ebcbe5ec64736f6c63430008150033000000000000000000000000ec306e46549a7e8f4fce823d3058f2d134133b170000000000000000000000003aa0670e24cb122e1d5307ed74b0c44d619aff9b0000000000000000000000009485711f11b17f73f2ccc8561bcae05bdc7e9ad900000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000004000000000000000000000000363d200e54fe86985790f4e210df9bfb142342020000000000000000000000009221fbe66be06f43dcbda3fc17cdd66ef1b236f9000000000000000000000000a66723d951f15423ef2c9c11edcb821e38301836000000000000000000000000856edf1b835ea02bf11b16f041df5a13ef1ec3d10000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000c35000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000061a800000000000000000000000000000000000000000000000000000000000086470","external_libraries":[],"proxy_type":null,"implementations":[],"verified_at":"2025-05-17T16:12:44.316625Z","is_verified_via_verifier_alliance":true,"compiler_version":"0.8.21+commit.d9974bed","decoded_constructor_args":[["0xEc306E46549A7E8f4fCE823D3058f2D134133B17",{"internalType":"address","name":"_minter","type":"address"}],["0x3aa0670E24Cb122e1d5307Ed74b0c44d619aFF9b",{"internalType":"address","name":"_proposal","type":"address"}],["0x9485711f11B17f73f2CCc8561bcae05BDc7E9ad9",{"internalType":"address payable","name":"_assetsVault","type":"address"}],[["0x363D200E54FE86985790f4E210dF9BfB14234202","0x9221FbE66Be06F43dCBda3FC17CdD66ef1b236f9","0xa66723D951F15423Ef2C9C11edcb821E38301836","0x856EdF1B835ea02Bf11B16F041DF5A13Ef1EC3d1"],{"internalType":"address[]","name":"_strategies","type":"address[]"}],[["50000","0","400000","550000"],{"internalType":"uint256[]","name":"_ratios","type":"uint256[]"}]],"sourcify_repo_url":null,"optimization_runs":10,"compiler_settings":{"evmVersion":"shanghai","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":10},"remappings":[]},"is_verified":true,"verified_twin_address_hash":null,"optimization_enabled":true,"deployed_bytecode":"0x6080604052600436106101ab575f3560e01c8062258d6b146101b65780630167eb85146101ff5780630754617214610232578063096015b014610265578063223e54791461028657806324f3082a146102a55780632712b539146102c857806328a79576146102e75780633c49fc0f146102fb57806346904840146103265780635069fb571461034557806351b77fb31461035957806360e760d51461036e578063715018a6146103835780637155133614610397578063717dd445146103ac578063745400c9146103cb578063753ec103146103ea578063768aac5d146104095780637b0c1f291461042857806382f1631f1461045b57806387153eb11461047d5780638da5cb5b146104a85780639f01f7ba146104bc578063a4786f3d146104db578063aa67c91914610524578063b18f2e9114610537578063d0e30db014610556578063e74b981b1461055e578063e8ac623a1461057d578063ea99e6891461059c578063ef037fb9146105b1578063f2fde38b146105d0578063f76339dc146105ef578063fccbebf514610604578063fe73511714610623578063ffa1ad7414610638575f80fd5b366101b257005b5f80fd5b3480156101c1575f80fd5b506101e97f000000000000000000000000396abf9ff46e21694f4ef01ca77c6d7893a017b281565b6040516101f6919061243c565b60405180910390f35b34801561020a575f80fd5b506101e97f0000000000000000000000007122985656e38bdc0302db86685bb972b145bd3c81565b34801561023d575f80fd5b506101e97f000000000000000000000000ec306e46549a7e8f4fce823d3058f2d134133b1781565b348015610270575f80fd5b5061028461027f366004612450565b61064c565b005b348015610291575f80fd5b506102846102a036600461247d565b6106e7565b3480156102b0575f80fd5b506102ba600a5481565b6040519081526020016101f6565b3480156102d3575f80fd5b506102846102e236600461247d565b6107c7565b3480156102f2575f80fd5b506102ba61095f565b348015610306575f80fd5b506102ba610315366004612450565b600c6020525f908152604090205481565b348015610331575f80fd5b506004546101e9906001600160a01b031681565b348015610350575f80fd5b50610284610b68565b348015610364575f80fd5b506102ba60075481565b348015610379575f80fd5b506102ba60085481565b34801561038e575f80fd5b50610284610e69565b3480156103a2575f80fd5b506102ba60025481565b3480156103b7575f80fd5b506102846103c636600461247d565b610e7c565b3480156103d6575f80fd5b506102846103e5366004612450565b610f2e565b3480156103f5575f80fd5b506003546101e9906001600160a01b031681565b348015610414575f80fd5b5061028461042336600461247d565b61121f565b348015610433575f80fd5b506101e97f0000000000000000000000009485711f11b17f73f2ccc8561bcae05bdc7e9ad981565b348015610466575f80fd5b5061046f6112d1565b6040516101f6929190612496565b348015610488575f80fd5b506102ba610497366004612450565b600b6020525f908152604090205481565b3480156104b3575f80fd5b506101e9611458565b3480156104c7575f80fd5b506102846104d6366004612450565b611467565b3480156104e6575f80fd5b506105156104f536600461247d565b600d6020525f908152604090208054600182015460029092015490919083565b6040516101f6939291906124a4565b6102ba61053236600461247d565b6115d9565b348015610542575f80fd5b506102ba6105513660046124ba565b6115fc565b6102ba611be8565b348015610569575f80fd5b5061028461057836600461247d565b611c09565b348015610588575f80fd5b5061028461059736600461247d565b611cbf565b3480156105a7575f80fd5b506102ba60095481565b3480156105bc575f80fd5b506102846105cb366004612450565b611d0b565b3480156105db575f80fd5b506102846105ea36600461247d565b611d8b565b3480156105fa575f80fd5b506102ba60055481565b34801561060f575f80fd5b5061028461061e3660046125a8565b611e01565b34801561062e575f80fd5b506102ba60065481565b348015610643575f80fd5b506102ba600181565b610654611ee6565b6106626064620f4240612675565b8111156106a75760405162461bcd60e51b815260206004820152600e60248201526d657863656564206d6178696d756d60901b60448201526064015b60405180910390fd5b7f4b3c5e4d7a59d85563d40eacdce201f42b27dd0f184fc2aef47c140a9775617d600954826040516106da929190612496565b60405180910390a1600955565b6003546001600160a01b031633146107115760405162461bcd60e51b815260040161069e90612694565b60405163223e547960e01b81527f000000000000000000000000396abf9ff46e21694f4ef01ca77c6d7893a017b2906001600160a01b0382169063223e54799061075f90859060040161243c565b5f604051808303815f87803b158015610776575f80fd5b505af1158015610788573d5f803e3d5ffd5b505050507f75ccacf0275778be70cc58a56b78401d8e60a7c1e153fd4338738dd08f26605e826040516107bb919061243c565b60405180910390a15050565b6003546001600160a01b031633146107f15760405162461bcd60e51b815260040161069e90612694565b604051630e7b77f760e41b81526001600160a01b037f000000000000000000000000ec306e46549a7e8f4fce823d3058f2d134133b17169063e7b77f709061083d90849060040161243c565b5f604051808303815f87803b158015610854575f80fd5b505af1158015610866573d5f803e3d5ffd5b5050604051630e7b77f760e41b81526001600160a01b037f0000000000000000000000009485711f11b17f73f2ccc8561bcae05bdc7e9ad916925063e7b77f7091506108b690849060040161243c565b5f604051808303815f87803b1580156108cd575f80fd5b505af11580156108df573d5f803e3d5ffd5b5050604051630e7b77f760e41b81526001600160a01b037f000000000000000000000000396abf9ff46e21694f4ef01ca77c6d7893a017b216925063e7b77f70915061092f90849060040161243c565b5f604051808303815f87803b158015610946575f80fd5b505af1158015610958573d5f803e3d5ffd5b5050505050565b5f807f0000000000000000000000007122985656e38bdc0302db86685bb972b145bd3c90505f816001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109c1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109e591906126ba565b90506005545f14806109f5575080155b80610a01575060075481145b15610a1657670de0b6b3a76400009250505090565b5f6006547f000000000000000000000000396abf9ff46e21694f4ef01ca77c6d7893a017b26001600160a01b0316639d241e7a6040518163ffffffff1660e01b81526004016020604051808303815f875af1158015610a77573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a9b91906126ba565b7f0000000000000000000000009485711f11b17f73f2ccc8561bcae05bdc7e9ad96001600160a01b03166312065fe06040518163ffffffff1660e01b8152600401602060405180830381865afa158015610af7573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b1b91906126ba565b610b2591906126d1565b610b2f91906126e4565b90505f60075483610b4091906126e4565b905080610b55670de0b6b3a7640000846126f7565b610b5f9190612675565b94505050505090565b600254600a54610b7891906126d1565b4211610bb85760405162461bcd60e51b815260206004820152600f60248201526e185b1c9958591e481c9958985cd959608a1b604482015260640161069e565b7f000000000000000000000000396abf9ff46e21694f4ef01ca77c6d7893a017b27f0000000000000000000000009485711f11b17f73f2ccc8561bcae05bdc7e9ad95f610c0361095f565b90505f826001600160a01b03166312065fe06040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c42573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c6691906126ba565b90505f610c7560085484611f45565b90505f81600654610c8691906126d1565b90505f866001600160a01b031663f41d7a186040518163ffffffff1660e01b81526004016020604051808303815f875af1158015610cc6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cea91906126ba565b90505f8083861115610d0757610d0084876126e4565b9150610d30565b83610d1284886126d1565b1015610d305782610d2387866126e4565b610d2d91906126e4565b90505b604051630ecc3e7160e21b81526001600160a01b038a1690633b30f9c490610d5e9085908590600401612496565b5f604051808303815f87803b158015610d75575f80fd5b505af1158015610d87573d5f803e3d5ffd5b505050505f610d9461095f565b9050808810610da35780610da5565b875b600580545f908152600b602090815260408083209490945582548252600c90529190912042905554610dd89060016126d1565b600555600854600754610deb91906126d1565b600755600854610dfb9082611f45565b600654610e0891906126d1565b6006555f60085542600a5560055460408051918252602082018590528101839052606081018290527fd2792f2bd70f462289b37051570ea123ec2faa689d0966f04ea499497c47aea49060800160405180910390a150505050505050505050565b610e71611ee6565b610e7a5f611fbd565b565b610e84611ee6565b60405163717dd44560e01b81527f000000000000000000000000396abf9ff46e21694f4ef01ca77c6d7893a017b2906001600160a01b0382169063717dd44590610ed290859060040161243c565b5f604051808303815f87803b158015610ee9575f80fd5b505af1158015610efb573d5f803e3d5ffd5b505050507feed65fb1c2451c54bb6eb3a6f3fe2fbe77ffd432b1f447c171237f36b8947202826040516107bb919061243c565b610f3661200e565b805f03610f555760405162461bcd60e51b815260040161069e9061270e565b6005545f03610fa25760405162461bcd60e51b815260206004820152601960248201527873686f756c6420776974686472617720696e7374616e746c7960381b604482015260640161069e565b6040516370a0823160e01b81527f0000000000000000000000007122985656e38bdc0302db86685bb972b145bd3c907f000000000000000000000000ec306e46549a7e8f4fce823d3058f2d134133b179083906001600160a01b038416906370a082319061101490339060040161243c565b602060405180830381865afa15801561102f573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061105391906126ba565b10156110925760405162461bcd60e51b815260206004820152600e60248201526d6578636565642062616c616e636560901b604482015260640161069e565b6110be7f0000000000000000000000007122985656e38bdc0302db86685bb972b145bd3c333086612065565b826008546110cc91906126d1565b600855335f908152600d60205260409020600554815403611101578381600101546110f791906126d1565b60018201556111d3565b80545f0361111a576001810184905560055481556111d3565b600181015481545f908152600b6020526040812054909161113a91611f45565b6001830154604051632770a7eb60e21b81529192506001600160a01b03851691639dc29fac9161116f91309190600401612731565b5f604051808303815f87803b158015611186575f80fd5b505af1158015611198573d5f803e3d5ffd5b50505060018301546007546111ad92506126e4565b6007556001820185905560028201546111c79082906126d1565b60028301555060055481555b60055460405133917f0c53c82ad07e2d592d88ece3b066777dd60f1118e2a081b380efc4358f0d9e2a91611208918891612496565b60405180910390a250505061121c60015f55565b50565b611227611ee6565b60405163768aac5d60e01b81527f000000000000000000000000396abf9ff46e21694f4ef01ca77c6d7893a017b2906001600160a01b0382169063768aac5d9061127590859060040161243c565b5f604051808303815f87803b15801561128c575f80fd5b505af115801561129e573d5f803e3d5ffd5b505050507f700c330a34830acb29f2b4927829f605fae4e5b7197df45a7973d246039e1e01826040516107bb919061243c565b5f805f7f0000000000000000000000009485711f11b17f73f2ccc8561bcae05bdc7e9ad99050600654816001600160a01b03166312065fe06040518163ffffffff1660e01b8152600401602060405180830381865afa158015611336573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061135a91906126ba565b11156113d057600654816001600160a01b03166312065fe06040518163ffffffff1660e01b8152600401602060405180830381865afa15801561139f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113c391906126ba565b6113cd91906126e4565b92505b7f000000000000000000000000396abf9ff46e21694f4ef01ca77c6d7893a017b26001600160a01b031663f837df256040518163ffffffff1660e01b81526004016020604051808303815f875af115801561142d573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061145191906126ba565b9150509091565b6001546001600160a01b031690565b61146f61200e565b805f0361148e5760405162461bcd60e51b815260040161069e9061270e565b335f908152600d602052604090206005548154146114e45760405162461bcd60e51b81526020600482015260136024820152726e6f2070656e64696e6720776974686472617760681b604482015260640161069e565b81816001015410156115325760405162461bcd60e51b81526020600482015260176024820152766578636565642070656e64696e6720776974686472617760481b604482015260640161069e565b81816001015461154291906126e4565b60018201556115727f0000000000000000000000007122985656e38bdc0302db86685bb972b145bd3c338461216a565b80600101545f03611581575f81555b8160085461158f91906126e4565b60085560055460405133917f39e2e01794006bc1f63835af5c05db790beca4bfb40de3f02cc3ddf22dccc0fb916115c7918691612496565b60405180910390a25061121c60015f55565b5f6115e261200e565b6115ec3483612268565b90506115f760015f55565b919050565b5f61160561200e565b8215158061161257508115155b61162e5760405162461bcd60e51b815260040161069e9061270e565b7f0000000000000000000000009485711f11b17f73f2ccc8561bcae05bdc7e9ad97f000000000000000000000000ec306e46549a7e8f4fce823d3058f2d134133b175f6116796112d1565b50905085156117fd57335f908152600d602052604090206005548154148015906116a35750805415155b1561175e57600181015481545f908152600b602052604081205490916116c891611f45565b6001830154604051632770a7eb60e21b81529192506001600160a01b03861691639dc29fac916116fd91309190600401612731565b5f604051808303815f87803b158015611714575f80fd5b505af1158015611726573d5f803e3d5ffd5b505050600183015460075461173b92506126e4565b6007555f600183015560028201546117549082906126d1565b6002830155505f81555b86816002015410156117a85760405162461bcd60e51b815260206004820152601360248201527265786365656420776974686472617761626c6560681b604482015260640161069e565b8681600201546117b891906126e4565b60028201556006546117cb9088906126e4565b60065560055460405188965033915f80516020612903833981519152916117f3918991612496565b60405180910390a2505b8415611a11575f6005545f0361181c5750670de0b6b3a764000061185e565b5f61182561095f565b90505f600b5f600160055461183a91906126e4565b81526020019081526020015f205490508181106118575781611859565b805b925050505b5f6118698783611f45565b604051632770a7eb60e21b81529091506001600160a01b03851690639dc29fac9061189a9033908b90600401612731565b5f604051808303815f87803b1580156118b1575f80fd5b505af11580156118c3573d5f803e3d5ffd5b50505050828111611911576118d881876126d1565b9550336001600160a01b03165f8051602061290383398151915282600554604051611904929190612496565b60405180910390a2611a0e565b61191b83876126d1565b955061192783826126e4565b604051630fcc56f760e01b8152600481018290529091507f000000000000000000000000396abf9ff46e21694f4ef01ca77c6d7893a017b2905f906001600160a01b03831690630fcc56f7906024016020604051808303815f875af1158015611992573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119b691906126ba565b90506119c281896126d1565b9750336001600160a01b03167f1b84e2f0660a601edc93ceed0d08fa5e9b3cbe4e2450c262f2ea8531d2c52e958483600554604051611a03939291906124a4565b60405180910390a250505b50505b83836001600160a01b03166312065fe06040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a4e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a7291906126ba565b1015611ab25760405162461bcd60e51b815260206004820152600f60248201526e1cdd1a5b1b081b995959081dd85a5d608a1b604482015260640161069e565b5f6009545f14611b7157620f424060095486611ace91906126f7565b611ad89190612675565b6004805460405163f3fef3a360e01b81529293506001600160a01b038088169363f3fef3a393611b0e9390921691869101612731565b5f604051808303815f87803b158015611b25575f80fd5b505af1158015611b37573d5f803e3d5ffd5b50506040518381523392507f55bb3cade9d43b798a4fe5ffdd05024b2d7870df53920673bfc7e68047cd0ab1915060200160405180910390a25b6001600160a01b03841663f3fef3a333611b8b84896126e4565b6040518363ffffffff1660e01b8152600401611ba8929190612731565b5f604051808303815f87803b158015611bbf575f80fd5b505af1158015611bd1573d5f803e3d5ffd5b5050505050505050611be260015f55565b92915050565b5f611bf161200e565b611bfb3433612268565b9050611c0660015f55565b90565b611c11611ee6565b6001600160a01b038116611c565760405162461bcd60e51b815260206004820152600c60248201526b7a65726f206164647265737360a01b604482015260640161069e565b600454604080516001600160a01b03928316815291831660208301527fd9d6b85b6d670cd443496fc6d03390f739bbff47f96a8e33fb0cdd52ad26f5c2910160405180910390a1600480546001600160a01b0319166001600160a01b0392909216919091179055565b6003546001600160a01b03163314611ce95760405162461bcd60e51b815260040161069e90612694565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b611d13611ee6565b62093a80811115611d505760405162461bcd60e51b81526020600482015260076024820152661a5b9d985b1a5960ca1b604482015260640161069e565b60028190556040518181527f73b75c75399b0450cd07a0e5188f0e06ce9e484fea18044b25e0326feb8e0e2a9060200160405180910390a150565b611d93611ee6565b6001600160a01b038116611df85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161069e565b61121c81611fbd565b6003546001600160a01b03163314611e2b5760405162461bcd60e51b815260040161069e90612694565b604051633fea70a760e01b81527f000000000000000000000000396abf9ff46e21694f4ef01ca77c6d7893a017b2906001600160a01b03821690633fea70a790611e7b908690869060040161274a565b5f604051808303815f87803b158015611e92575f80fd5b505af1158015611ea4573d5f803e3d5ffd5b505050507fb08ed47ad81ee926c18b77f6be44a5d49bf687355a669936e1f02cfe4e2c84f78383604051611ed992919061274a565b60405180910390a1505050565b33611eef611458565b6001600160a01b031614610e7a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161069e565b5f60018211611f965760405162461bcd60e51b815260206004820181905260248201527f5661756c74204c69623a20696e76616c69642061737365745065725368617265604482015260640161069e565b611fa26012600a6128ac565b611fac83856126f7565b611fb69190612675565b9392505050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b60025f540361205f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161069e565b60025f55565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17905291515f928392908816916120c891906128b7565b5f604051808303815f865af19150503d805f8114612101576040519150601f19603f3d011682016040523d82523d5f602084013e612106565b606091505b509150915081801561213057508051158061213057508080602001905181019061213091906128e3565b6121625760405162461bcd60e51b815260206004820152600360248201526229aa2360e91b604482015260640161069e565b505050505050565b5f80846001600160a01b031663a9059cbb60e01b8585604051602401612191929190612731565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516121cf91906128b7565b5f604051808303815f865af19150503d805f8114612208576040519150601f19603f3d011682016040523d82523d5f602084013e61220d565b606091505b509150915081801561223757508051158061223757508080602001905181019061223791906128e3565b6109585760405162461bcd60e51b815260206004820152600260248201526114d560f21b604482015260640161069e565b5f825f036122885760405162461bcd60e51b815260040161069e9061270e565b5f8061229261095f565b90506005545f036122ad57670de0b6b3a764000091506122e3565b5f600b5f60016005546122c091906126e4565b81526020019081526020015f205490508181116122dd57816122df565b805b9250505b816122f6670de0b6b3a7640000876126f7565b6123009190612675565b92507f0000000000000000000000009485711f11b17f73f2ccc8561bcae05bdc7e9ad96001600160a01b031663d0e30db0476040518263ffffffff1660e01b81526004015f604051808303818588803b15801561235b575f80fd5b505af115801561236d573d5f803e3d5ffd5b50506040516340c10f1960e01b81526001600160a01b037f000000000000000000000000ec306e46549a7e8f4fce823d3058f2d134133b171693506340c10f1992506123c0915087908790600401612731565b5f604051808303815f87803b1580156123d7575f80fd5b505af11580156123e9573d5f803e3d5ffd5b50505050836001600160a01b03167f36af321ec8d3c75236829c5317affd40ddb308863a1236d2d277a4025cccee1e868560055460405161242c939291906124a4565b60405180910390a2505092915050565b6001600160a01b0391909116815260200190565b5f60208284031215612460575f80fd5b5035919050565b80356001600160a01b03811681146115f7575f80fd5b5f6020828403121561248d575f80fd5b611fb682612467565b918252602082015260400190565b9283526020830191909152604082015260600190565b5f80604083850312156124cb575f80fd5b50508035926020909101359150565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b0381118282101715612516576125166124da565b604052919050565b5f6001600160401b03821115612536576125366124da565b5060051b60200190565b5f82601f83011261254f575f80fd5b8135602061256461255f8361251e565b6124ee565b82815260059290921b84018101918181019086841115612582575f80fd5b8286015b8481101561259d5780358352918301918301612586565b509695505050505050565b5f80604083850312156125b9575f80fd5b82356001600160401b03808211156125cf575f80fd5b818501915085601f8301126125e2575f80fd5b813560206125f261255f8361251e565b82815260059290921b84018101918181019089841115612610575f80fd5b948201945b838610156126355761262686612467565b82529482019490820190612615565b9650508601359250508082111561264a575f80fd5b5061265785828601612540565b9150509250929050565b634e487b7160e01b5f52601160045260245ffd5b5f8261268f57634e487b7160e01b5f52601260045260245ffd5b500490565b6020808252600c908201526b1b9bdd081c1c9bdc1bdcd85b60a21b604082015260600190565b5f602082840312156126ca575f80fd5b5051919050565b80820180821115611be257611be2612661565b81810381811115611be257611be2612661565b8082028115828204841417611be257611be2612661565b6020808252600990820152681d1bdbc81cdb585b1b60ba1b604082015260600190565b6001600160a01b03929092168252602082015260400190565b604080825283519082018190525f906020906060840190828701845b8281101561278b5781516001600160a01b031684529284019290840190600101612766565b505050838103828501528451808252858301918301905f5b818110156127bf578351835292840192918401916001016127a3565b5090979650505050505050565b600181815b8085111561280657815f19048211156127ec576127ec612661565b808516156127f957918102915b93841c93908002906127d1565b509250929050565b5f8261281c57506001611be2565b8161282857505f611be2565b816001811461283e576002811461284857612864565b6001915050611be2565b60ff84111561285957612859612661565b50506001821b611be2565b5060208310610133831016604e8410600b8410161715612887575081810a611be2565b61289183836127cc565b805f19048211156128a4576128a4612661565b029392505050565b5f611fb6838361280e565b5f82515f5b818110156128d657602081860181015185830152016128bc565b505f920191825250919050565b5f602082840312156128f3575f80fd5b81518015158114611fb6575f80fdfe92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc6a2646970667358221220589edafabb62e4e2222be100a867ae28cb8024a70f3b12ceec8fc29df5b0aeaa64736f6c63430008150033","source_code":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {TransferHelper} from \"@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol\";\n\nimport {Minter} from \"./token/Minter.sol\";\nimport {Stone} from \"./token/Stone.sol\";\nimport {AssetsVault} from \"./AssetsVault.sol\";\nimport {StrategyController} from \"./strategies/StrategyController.sol\";\n\nimport {VaultMath} from \"./libraries/VaultMath.sol\";\n\ncontract StoneVault is ReentrancyGuard, Ownable {\n    uint256 internal constant MULTIPLIER = 1e18;\n    uint256 internal constant ONE_HUNDRED_PERCENT = 1e6;\n    uint256 internal constant MAXMIUM_FEE_RATE = ONE_HUNDRED_PERCENT / 100; // 1%\n    uint256 internal constant MINIMUM_REBASE_INTERVAL = 7 * 24 * 60 * 60;\n\n    uint256 public constant VERSION = 1;\n\n    uint256 public rebaseTimeInterval = 24 * 60 * 60;\n\n    address public immutable minter;\n    address public immutable stone;\n    address payable public immutable strategyController;\n    address payable public immutable assetsVault;\n\n    address public proposal;\n\n    address public feeRecipient;\n\n    uint256 public latestRoundID;\n\n    uint256 public withdrawableAmountInPast;\n    uint256 public withdrawingSharesInPast;\n    uint256 public withdrawingSharesInRound;\n\n    uint256 public withdrawFeeRate;\n\n    uint256 public rebaseTime;\n\n    mapping(uint256 => uint256) public roundPricePerShare;\n    mapping(uint256 => uint256) public settlementTime;\n\n    mapping(address => UserReceipt) public userReceipts;\n\n    struct UserReceipt {\n        uint256 withdrawRound;\n        uint256 withdrawShares;\n        uint256 withdrawableAmount;\n    }\n\n    event Deposit(\n        address indexed account,\n        uint256 amount,\n        uint256 mint,\n        uint256 round\n    );\n    event InitiateWithdraw(\n        address indexed account,\n        uint256 shares,\n        uint256 round\n    );\n    event CancelWithdraw(\n        address indexed account,\n        uint256 amount,\n        uint256 round\n    );\n    event Withdrawn(address indexed account, uint256 amount, uint256 round);\n    event WithdrawnFromStrategy(\n        address indexed account,\n        uint256 amount,\n        uint256 actualAmount,\n        uint256 round\n    );\n    event RollToNextRound(\n        uint256 round,\n        uint256 vaultIn,\n        uint256 vaultOut,\n        uint256 sharePrice\n    );\n    event StragetyAdded(address strategy);\n    event StragetyDestroyed(address strategy);\n    event StragetyCleared(address strategy);\n    event PortfolioConfigUpdated(address[] strategies, uint256[] ratios);\n    event FeeCharged(address indexed account, uint256 amount);\n    event SetWithdrawFeeRate(uint256 oldRate, uint256 newRate);\n    event SetFeeRecipient(address oldAddr, address newAddr);\n    event SetRebaseInterval(uint256 interval);\n\n    modifier onlyProposal() {\n        require(proposal == msg.sender, \"not proposal\");\n        _;\n    }\n\n    constructor(\n        address _minter,\n        address _proposal,\n        address payable _assetsVault,\n        address[] memory _strategies,\n        uint256[] memory _ratios\n    ) {\n        require(\n            _minter != address(0) &&\n                _proposal != address(0) &&\n                _assetsVault != address(0),\n            \"ZERO ADDRESS\"\n        );\n\n        uint256 length = _strategies.length;\n        for (uint256 i; i < length; i++) {\n            require(_strategies[i] != address(0), \"ZERO ADDRESS\");\n        }\n\n        minter = _minter;\n        proposal = _proposal;\n        assetsVault = _assetsVault;\n\n        feeRecipient = msg.sender;\n\n        StrategyController controller = new StrategyController(\n            _assetsVault,\n            _strategies,\n            _ratios\n        );\n        strategyController = payable(address(controller));\n        stone = Minter(_minter).stone();\n\n        roundPricePerShare[0] = MULTIPLIER;\n        latestRoundID = 0;\n    }\n\n    function deposit()\n        external\n        payable\n        nonReentrant\n        returns (uint256 mintAmount)\n    {\n        mintAmount = _depositFor(msg.value, msg.sender);\n    }\n\n    function depositFor(\n        address _user\n    ) external payable nonReentrant returns (uint256 mintAmount) {\n        mintAmount = _depositFor(msg.value, _user);\n    }\n\n    function _depositFor(\n        uint256 _amount,\n        address _user\n    ) internal returns (uint256 mintAmount) {\n        require(_amount != 0, \"too small\");\n\n        uint256 sharePrice;\n        uint256 currSharePrice = currentSharePrice();\n        if (latestRoundID == 0) {\n            sharePrice = MULTIPLIER;\n        } else {\n            uint256 latestSharePrice = roundPricePerShare[latestRoundID - 1];\n            sharePrice = latestSharePrice > currSharePrice\n                ? latestSharePrice\n                : currSharePrice;\n        }\n\n        mintAmount = (_amount * MULTIPLIER) / sharePrice;\n\n        AssetsVault(assetsVault).deposit{value: address(this).balance}();\n        Minter(minter).mint(_user, mintAmount);\n\n        emit Deposit(_user, _amount, mintAmount, latestRoundID);\n    }\n\n    function requestWithdraw(uint256 _shares) external nonReentrant {\n        require(_shares != 0, \"too small\");\n        require(latestRoundID != 0, \"should withdraw instantly\");\n        Stone stoneToken = Stone(stone);\n        Minter stoneMinter = Minter(minter);\n\n        require(stoneToken.balanceOf(msg.sender) >= _shares, \"exceed balance\");\n\n        TransferHelper.safeTransferFrom(\n            stone,\n            msg.sender,\n            address(this),\n            _shares\n        );\n\n        withdrawingSharesInRound = withdrawingSharesInRound + _shares;\n\n        UserReceipt storage receipt = userReceipts[msg.sender];\n\n        if (receipt.withdrawRound == latestRoundID) {\n            receipt.withdrawShares = receipt.withdrawShares + _shares;\n        } else if (receipt.withdrawRound == 0) {\n            receipt.withdrawShares = _shares;\n            receipt.withdrawRound = latestRoundID;\n        } else {\n            // Withdraw previous round share first\n            uint256 withdrawAmount = VaultMath.sharesToAsset(\n                receipt.withdrawShares,\n                roundPricePerShare[receipt.withdrawRound]\n            );\n\n            stoneMinter.burn(address(this), receipt.withdrawShares);\n            withdrawingSharesInPast =\n                withdrawingSharesInPast -\n                receipt.withdrawShares;\n\n            receipt.withdrawShares = _shares;\n            receipt.withdrawableAmount =\n                receipt.withdrawableAmount +\n                withdrawAmount;\n            receipt.withdrawRound = latestRoundID;\n        }\n\n        emit InitiateWithdraw(msg.sender, _shares, latestRoundID);\n    }\n\n    function cancelWithdraw(uint256 _shares) external nonReentrant {\n        require(_shares != 0, \"too small\");\n\n        UserReceipt storage receipt = userReceipts[msg.sender];\n        require(receipt.withdrawRound == latestRoundID, \"no pending withdraw\");\n        require(receipt.withdrawShares >= _shares, \"exceed pending withdraw\");\n\n        receipt.withdrawShares = receipt.withdrawShares - _shares;\n\n        TransferHelper.safeTransfer(stone, msg.sender, _shares);\n\n        if (receipt.withdrawShares == 0) {\n            receipt.withdrawRound = 0;\n        }\n\n        withdrawingSharesInRound = withdrawingSharesInRound - _shares;\n\n        emit CancelWithdraw(msg.sender, _shares, latestRoundID);\n    }\n\n    function instantWithdraw(\n        uint256 _amount,\n        uint256 _shares\n    ) external nonReentrant returns (uint256 actualWithdrawn) {\n        require(_amount != 0 || _shares != 0, \"too small\");\n\n        AssetsVault aVault = AssetsVault(assetsVault);\n        Minter stoneMinter = Minter(minter);\n\n        (uint256 idleAmount, ) = getVaultAvailableAmount();\n\n        if (_amount != 0) {\n            UserReceipt storage receipt = userReceipts[msg.sender];\n\n            if (\n                receipt.withdrawRound != latestRoundID &&\n                receipt.withdrawRound != 0\n            ) {\n                // Withdraw previous round share first\n                uint256 withdrawAmount = VaultMath.sharesToAsset(\n                    receipt.withdrawShares,\n                    roundPricePerShare[receipt.withdrawRound]\n                );\n\n                stoneMinter.burn(address(this), receipt.withdrawShares);\n\n                withdrawingSharesInPast =\n                    withdrawingSharesInPast -\n                    receipt.withdrawShares;\n                receipt.withdrawShares = 0;\n                receipt.withdrawableAmount =\n                    receipt.withdrawableAmount +\n                    withdrawAmount;\n                receipt.withdrawRound = 0;\n            }\n\n            require(\n                receipt.withdrawableAmount >= _amount,\n                \"exceed withdrawable\"\n            );\n\n            receipt.withdrawableAmount = receipt.withdrawableAmount - _amount;\n            withdrawableAmountInPast = withdrawableAmountInPast - _amount;\n            actualWithdrawn = _amount;\n\n            emit Withdrawn(msg.sender, _amount, latestRoundID);\n        }\n\n        if (_shares != 0) {\n            uint256 sharePrice;\n\n            if (latestRoundID == 0) {\n                sharePrice = MULTIPLIER;\n            } else {\n                uint256 currSharePrice = currentSharePrice();\n                uint256 latestSharePrice = roundPricePerShare[\n                    latestRoundID - 1\n                ];\n\n                sharePrice = latestSharePrice < currSharePrice\n                    ? latestSharePrice\n                    : currSharePrice;\n            }\n\n            uint256 ethAmount = VaultMath.sharesToAsset(_shares, sharePrice);\n\n            stoneMinter.burn(msg.sender, _shares);\n\n            if (ethAmount <= idleAmount) {\n                actualWithdrawn = actualWithdrawn + ethAmount;\n\n                emit Withdrawn(msg.sender, ethAmount, latestRoundID);\n            } else {\n                actualWithdrawn = actualWithdrawn + idleAmount;\n                ethAmount = ethAmount - idleAmount;\n\n                StrategyController controller = StrategyController(\n                    strategyController\n                );\n                uint256 actualAmount = controller.forceWithdraw(ethAmount);\n\n                actualWithdrawn = actualWithdrawn + actualAmount;\n\n                emit WithdrawnFromStrategy(\n                    msg.sender,\n                    ethAmount,\n                    actualAmount,\n                    latestRoundID\n                );\n            }\n        }\n\n        require(aVault.getBalance() >= actualWithdrawn, \"still need wait\");\n\n        uint256 withFee;\n        if (withdrawFeeRate != 0) {\n            withFee = (actualWithdrawn * withdrawFeeRate) / ONE_HUNDRED_PERCENT;\n            aVault.withdraw(feeRecipient, withFee);\n\n            emit FeeCharged(msg.sender, withFee);\n        }\n        aVault.withdraw(msg.sender, actualWithdrawn - withFee);\n    }\n\n    function rollToNextRound() external {\n        require(\n            block.timestamp > rebaseTime + rebaseTimeInterval,\n            \"already rebased\"\n        );\n\n        StrategyController controller = StrategyController(strategyController);\n        AssetsVault aVault = AssetsVault(assetsVault);\n        uint256 previewSharePrice = currentSharePrice();\n\n        uint256 vaultBalance = aVault.getBalance();\n        uint256 amountToWithdraw = VaultMath.sharesToAsset(\n            withdrawingSharesInRound,\n            previewSharePrice\n        );\n        uint256 amountVaultNeed = withdrawableAmountInPast + amountToWithdraw;\n        uint256 allPendingValue = controller.getAllStrategyPendingValue();\n\n        uint256 vaultIn;\n        uint256 vaultOut;\n\n        if (vaultBalance > amountVaultNeed) {\n            vaultIn = vaultBalance - amountVaultNeed;\n        } else if (vaultBalance + allPendingValue < amountVaultNeed) {\n            vaultOut = amountVaultNeed - vaultBalance - allPendingValue;\n        }\n\n        controller.rebaseStrategies(vaultIn, vaultOut);\n\n        uint256 newSharePrice = currentSharePrice();\n        roundPricePerShare[latestRoundID] = previewSharePrice < newSharePrice\n            ? previewSharePrice\n            : newSharePrice;\n\n        settlementTime[latestRoundID] = block.timestamp;\n        latestRoundID = latestRoundID + 1;\n\n        withdrawingSharesInPast =\n            withdrawingSharesInPast +\n            withdrawingSharesInRound;\n        withdrawableAmountInPast =\n            withdrawableAmountInPast +\n            VaultMath.sharesToAsset(withdrawingSharesInRound, newSharePrice);\n        withdrawingSharesInRound = 0;\n        rebaseTime = block.timestamp;\n\n        emit RollToNextRound(latestRoundID, vaultIn, vaultOut, newSharePrice);\n    }\n\n    function addStrategy(address _strategy) external onlyProposal {\n        StrategyController controller = StrategyController(strategyController);\n\n        controller.addStrategy(_strategy);\n        emit StragetyAdded(_strategy);\n    }\n\n    function destroyStrategy(address _strategy) external onlyOwner {\n        StrategyController controller = StrategyController(strategyController);\n\n        controller.destroyStrategy(_strategy);\n        emit StragetyDestroyed(_strategy);\n    }\n\n    function clearStrategy(address _strategy) external onlyOwner {\n        StrategyController controller = StrategyController(strategyController);\n\n        controller.clearStrategy(_strategy);\n        emit StragetyCleared(_strategy);\n    }\n\n    function updatePortfolioConfig(\n        address[] memory _strategies,\n        uint256[] memory _ratios\n    ) external onlyProposal {\n        StrategyController controller = StrategyController(strategyController);\n\n        controller.setStrategies(_strategies, _ratios);\n\n        emit PortfolioConfigUpdated(_strategies, _ratios);\n    }\n\n    function updateProposal(address _proposal) external onlyProposal {\n        proposal = _proposal;\n    }\n\n    function migrateVault(address _vault) external onlyProposal {\n        Minter(minter).setNewVault(_vault);\n        AssetsVault(assetsVault).setNewVault(_vault);\n        StrategyController(strategyController).setNewVault(_vault);\n    }\n\n    function currentSharePrice() public returns (uint256 price) {\n        Stone stoneToken = Stone(stone);\n        uint256 totalStone = stoneToken.totalSupply();\n        if (\n            latestRoundID == 0 ||\n            totalStone == 0 ||\n            totalStone == withdrawingSharesInPast\n        ) {\n            return MULTIPLIER;\n        }\n\n        uint256 etherAmount = AssetsVault(assetsVault).getBalance() +\n            StrategyController(strategyController).getAllStrategiesValue() -\n            withdrawableAmountInPast;\n        uint256 activeShare = totalStone - withdrawingSharesInPast;\n\n        return (etherAmount * MULTIPLIER) / activeShare;\n    }\n\n    function getVaultAvailableAmount()\n        public\n        returns (uint256 idleAmount, uint256 investedAmount)\n    {\n        AssetsVault vault = AssetsVault(assetsVault);\n\n        if (vault.getBalance() > withdrawableAmountInPast) {\n            idleAmount = vault.getBalance() - withdrawableAmountInPast;\n        }\n\n        investedAmount = StrategyController(strategyController)\n            .getAllStrategyValidValue();\n    }\n\n    function setWithdrawFeeRate(uint256 _withdrawFeeRate) external onlyOwner {\n        require(_withdrawFeeRate <= MAXMIUM_FEE_RATE, \"exceed maximum\");\n\n        emit SetWithdrawFeeRate(withdrawFeeRate, _withdrawFeeRate);\n\n        withdrawFeeRate = _withdrawFeeRate;\n    }\n\n    function setFeeRecipient(address _feeRecipient) external onlyOwner {\n        require(_feeRecipient != address(0), \"zero address\");\n\n        emit SetFeeRecipient(feeRecipient, _feeRecipient);\n\n        feeRecipient = _feeRecipient;\n    }\n\n    function setRebaseInterval(uint256 _interval) external onlyOwner {\n        require(_interval <= MINIMUM_REBASE_INTERVAL, \"invalid\");\n\n        rebaseTimeInterval = _interval;\n        emit SetRebaseInterval(rebaseTimeInterval);\n    }\n\n    receive() external payable {}\n}\n","creation_status":"success","file_path":"/contracts/StoneVault.sol"}