{"file_path":"contracts/NestVaultOFT.sol","creation_status":"success","source_code":"// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.30;\n\n// contracts\nimport {NestVaultPermit2} from \"contracts/NestVaultPermit2.sol\";\nimport {NestShareOFT} from \"contracts/NestShareOFT.sol\";\nimport {ERC20} from \"@solmate/tokens/ERC20.sol\";\nimport {OwnableUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {OFTCoreUpgradeable} from \"@layerzerolabs/oft-evm-upgradeable/contracts/oft/OFTCoreUpgradeable.sol\";\nimport {AuthUpgradeable} from \"contracts/auth/AuthUpgradeable.sol\";\nimport {Errors} from \"contracts/types/Errors.sol\";\nimport {ITransferHook} from \"contracts/interfaces/ITransferHook.sol\";\n\n// interfaces\nimport {\n    IOFT,\n    SendParam,\n    OFTReceipt,\n    MessagingReceipt,\n    MessagingFee\n} from \"@layerzerolabs/oft-evm/contracts/interfaces/IOFT.sol\";\n\n/// @title  NestVaultOFT\n/// @notice NestVaultOFT is an IOFT & IERC7575 & IERC7540Redeem-compatible vault\n///         It allows users to deposit assets and mint shares, redeem shares for assets, and interact with operators\n///         via the ERC7540 standard. The vault uses NestShare for managing underlying assets\n/// @dev    This contract is upgradeable and combines `NestVaultPermit2` vault behavior with\n///         LayerZero OFT bridging for share balances across chains.\n/// @author plumenetwork\ncontract NestVaultOFT is NestVaultPermit2, OFTCoreUpgradeable {\n    /// @param _share      Address of the NestShare token used by the vault\n    /// @param _lzEndpoint LayerZero endpoint used by OFTCore\n    /// @param _permit2    Canonical Permit2 contract used for signature-based transfers\n    constructor(address payable _share, address _lzEndpoint, address _permit2)\n        NestVaultPermit2(_share, _permit2)\n        OFTCoreUpgradeable(NestShareOFT(_share).decimals(), _lzEndpoint)\n    {\n        _disableInitializers();\n    }\n\n    /// @notice Initializes the vault with the necessary configurations\n    /// @dev    Initializes key components such as the accountant, asset, and owner\n    ///         `_delegate` is set as LZ delegate whereas `_owner` is used for Auth\n    /// @param  _accountant                  address The address of the NestHubAccountant contract\n    /// @param  _asset                       address The underlying asset that users deposit (e.g., ERC20 token)\n    /// @param  _delegate                    address The address of the LayerZero delegate\n    /// @param  _owner                       address The address of the owner of the vault\n    /// @param  _minRate                     uint256 The minimum rate allowed for the vault,\n    ///                                              it should be less than the decimals of the underlying asset\n    /// @param  _operatorRegistry            address The operator registry (zero disables registry)\n    function initialize(\n        address _accountant,\n        address _asset, // underlying aka deposit asset\n        address _delegate,\n        address _owner,\n        uint256 _minRate,\n        address _operatorRegistry\n    ) external virtual initializer {\n        __NestVaultCore_init(_accountant, _asset, _owner, _minRate, _operatorRegistry, version());\n        __OFTCore_init(_delegate);\n    }\n\n    /// @notice Returns the version of the NestVault contract.\n    /// @dev    This version is used to track contract upgrades.\n    /// @return string A string representing the version of the contract.\n    function version() public pure returns (string memory) {\n        return \"1.1.0\";\n    }\n\n    /// @inheritdoc IOFT\n    function token() external view returns (address) {\n        return address(SHARE);\n    }\n\n    /// @inheritdoc IOFT\n    function approvalRequired() external pure returns (bool) {\n        return false;\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                    OFTCoreUpgradeable OVERRIDDEN LOGIC\n    //////////////////////////////////////////////////////////////*/\n\n    /// @inheritdoc IOFT\n    function send(SendParam calldata _sendParam, MessagingFee calldata _fee, address _refundAddress)\n        external\n        payable\n        override\n        requiresAuth\n        returns (MessagingReceipt memory msgReceipt, OFTReceipt memory oftReceipt)\n    {\n        return _send(_sendParam, _fee, _refundAddress);\n    }\n\n    /// @dev   Internal function to perform a debit operation\n    /// @param _from             address The address to debit\n    /// @param _amountLD         uint256 The amount to send in local decimals\n    /// @param _minAmountLD      uint256 The minimum amount to send in local decimals\n    /// @param _dstEid           uint32  The destination chain ID\n    /// @return amountSentLD     uint256 The amount sent in local decimals\n    /// @return amountReceivedLD uint256 The amount received in local decimals on the remote\n    function _debit(address _from, uint256 _amountLD, uint256 _minAmountLD, uint32 _dstEid)\n        internal\n        override\n        returns (uint256 amountSentLD, uint256 amountReceivedLD)\n    {\n        (amountSentLD, amountReceivedLD) = _debitView(_amountLD, _minAmountLD, _dstEid);\n\n        ITransferHook beforeTransferHook = SHARE.hook();\n        if (address(beforeTransferHook) != address(0)) beforeTransferHook.beforeTransfer(_from);\n\n        // Burn _amountLD shares from sender (_from) and don't transfer any assets out\n        SHARE.exit(address(0), ERC20(address(0)), 0, _from, amountSentLD);\n\n        return (amountSentLD, amountReceivedLD);\n    }\n\n    /// @dev   Internal function to perform a credit operation.\n    /// @param _to               address The address to credit.\n    /// @param _amountLD         uint256 The amount to credit in local decimals.\n    /// @return amountReceivedLD uint256 The amount ACTUALLY received in local decimals.\n    function _credit(address _to, uint256 _amountLD, uint32) internal override returns (uint256 amountReceivedLD) {\n        // Mint _amountLD shares to receiver (_to) and don't transfer any assets in\n        SHARE.enter(address(0), ERC20(address(0)), 0, _to, _amountLD);\n\n        return _amountLD;\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                        Ownable OVERRIDDEN LOGIC\n    //////////////////////////////////////////////////////////////*/\n\n    /// @inheritdoc AuthUpgradeable\n    function owner() public view override(OwnableUpgradeable, AuthUpgradeable) returns (address) {\n        return AuthUpgradeable.owner();\n    }\n\n    /// @inheritdoc AuthUpgradeable\n    function transferOwnership(address newOwner) public override(OwnableUpgradeable, AuthUpgradeable) requiresAuth {\n        AuthUpgradeable.transferOwnership(newOwner);\n    }\n\n    /// @inheritdoc OwnableUpgradeable\n    function renounceOwnership() public view override(OwnableUpgradeable) requiresAuth {\n        revert Errors.RenounceOwnershipDisabled();\n    }\n}\n","deployed_bytecode":"0x60806040526004361015610011575f80fd5b5f5f358060e01c90816301e1d114146144b757816301ffc9a71461440257816305728126146143b057816306fdde031461432257816307a2d13a146142e7578163095ea7b31461421e5781630a28a477146133d05781630cb60443146141f55781630d35b415146140ad578163111ecdad1461406657816313137d6514613d68578163134d4f2514613d4c578163156a0d0f14613d2557816317442b7014613d0357816317bf2c8114613bf257816318160ddd14613bd75781631e15d67514613b7e5781631f5e133414613b6257816323b872dd14613a6d5781632df1360c146139e6578163313ce5671461395d57816333c1d9301461384a5781633400288b146137cf578163357c13541461376957816336ac15ef1461363357816338d52e0f146135fe5781633b6f743b1461347c578163402d267d146111d857816348ea7127146133d55781634cdad506146133d05781634fb3ccc51461339b57816352ae28791461338057816353c425c114612a9157816354fd4d5014612a495781635535d46114612943578163558a7297146128ad57816358c2225b146128655781635a0dfe4d146128185781635e280f11146127d357816362b4aab0146126b55781636afdd850146126705781636e553f651461263c5781636fc1b31e146125af578163705e10e31461254057816370a08231146124c2578163711b58ff14612339578163715018a61461230e57816377a843171461212c57816379ba5097146120815781637a9e5e4b14611f49575080637d25a05e14611f235780637d41c86e14611e3657806382413eac14611dd957806384b0196e14611c8b578063857749b014611c6f5780638da5cb5b14611c3a57806394bf804d14611c0657806395d89b4114611b6c578063963efcaa14611b315780639d28fb8614611aa85780639f68b96414611a8c578063a8d5fd651461047f578063a9059cbb14611a5a578063ad52f1dc14611a19578063b3d7f6b9146119fa578063b460af94146119a0578063b6363cf214611969578063b731ea0a14611921578063b98bd07014611622578063ba08765214611560578063babd37eb146114fa578063bb0b6a53146114ba578063bc70b35414611450578063bd815db014611212578063bf7e214f146111dd578063c63d75b6146111d8578063c6e6f59214611184578063c7c7f5b314610bf4578063ca1435f314610b5d578063ca5eb5e114610abb578063cdf5bba314610a55578063ce96cb7714610a2d578063cf321745146109f0578063d045a0dc14610703578063d424388514610676578063d905777e14610655578063dd62ed3e14610628578063e30c3978146105f3578063eaed1d0714610590578063ef8b30f714610569578063f2fde38b146104db578063f5a23d8d14610484578063fc0c546a1461047f5763ff7bd03d14610427575f80fd5b3461047c57606036600319011261047c576004359063ffffffff8216820361047c5760206104708363ffffffff165f525f516020615dd35f395f51905f5260205260405f205490565b60405190602435148152f35b80fd5b614834565b503461047c57604036600319011261047c5760406020916104a3614543565b6001600160a01b031681527f8d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c20583522054604051908152f35b503461047c57602036600319011261047c576104f561452d565b6104fd6150e5565b6105056150e5565b6001600160a01b0316801561055a575f516020615d735f395f51905f5280546001600160a01b03191682179055337f93c09a290de449db41d63ce4cd5cf996d7e4f706ee68a7c46fec23632a70e9c18380a380f35b63f0558d5560e01b8252600482fd5b503461047c57602036600319011261047c576020610588600435614ee5565b604051908152f35b503461047c57604036600319011261047c57602060016105e96105b1614543565b6001600160a01b03165f9081527f8d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c2066020526040902090565b0154604051908152f35b503461047c578060031936011261047c575f516020615d735f395f51905f52546040516001600160a01b039091168152602090f35b503461047c57604036600319011261047c57602061058861064761452d565b61064f614543565b90614e7a565b503461047c57602036600319011261047c57602060016105e96105b161452d565b503461047c57602036600319011261047c577fd48d879cef83a1c0bdda516f27b13ddb1b3f8bbac1c9e1511bb2a659c242776060206106b361452d565b6106bb61522d565b7fefb041d771d6daaa55702fff6eb740d63ba559a75d2d1d3e151c78ff2480b60080546001600160a01b0319166001600160a01b03929092169182179055604051908152a180f35b5061070d366145bc565b5050509290923033036109e1578060201161098a5783356001600160a01b031693859061078161073d8483614c8b565b6001600160c01b0319913591821691600882106109c1575b50507f00000000000000000000000000000000000000000000000000000000000000019060c01c615960565b9261078b8561492f565b507f000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f6001600160a01b0316803b1561099d57604051631ceb5d1960e11b81525f600482018190526024820181905260448201526001600160a01b038916606482015260848101869052908490829060a490829084905af19081156109b65784916109a1575b505060288111610863575b5050506108487fefed6d3500546b29533b128a29e3a94d70788727f0507505ac12eaf2e578fd9c9261492f565b6040805163ffffffff9290921682526020820192909252a380f35b6040850135906001600160401b038216820361099d576108f191602061089f61089884604c956108928c61492f565b98614c9c565b36916147fe565b6040519586936001600160401b0360c01b9060c01b168385015263ffffffff60e01b9060e01b16602884015287602c8401528051918291018484015e810185838201520301601f1981018352826147c2565b7f000000000000000000000000c1b15d3b262beec0e3565c11c9e0f6134bdacb366001600160a01b0316803b15610999576109608392918392604051948580948193633e5ac80960e11b83528d60048401528c6024840152836044840152608060648401526084830190614509565b03925af1801561098e57610975575b8061081b565b8161097f916147c2565b61098a57845f61096f565b8480fd5b6040513d84823e3d90fd5b8280fd5b8380fd5b816109ab916147c2565b61099957825f610810565b6040513d86823e3d90fd5b6001600160c01b031960089290920360031b82901b161690505f80610755565b63029a949d60e31b8552600485fd5b503461047c578060031936011261047c5760207f8d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c20154604051908152f35b503461047c57602036600319011261047c576020610a4c6105b161452d565b54604051908152f35b503461047c57604036600319011261047c5760ff6040602092610a7661452d565b6001600160a01b031681527f8d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c2048452818120602435825284522054604051911615158152f35b503461047c57602036600319011261047c5780610ad661452d565b610ade61522d565b7f000000000000000000000000c1b15d3b262beec0e3565c11c9e0f6134bdacb366001600160a01b031690813b15610b595760405163ca5eb5e160e01b81526001600160a01b0390911660048201529082908290602490829084905af1801561098e57610b485750f35b81610b52916147c2565b61047c5780f35b5050fd5b503461047c57602036600319011261047c57610be881604092508080525f516020615ed35f395f51905f52602052610bd483822091610bcf610b9d614f8b565b610bc67f000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f6158fe565b90600435615b5e565b615757565b90600163ffffffff8254169101549161571d565b82519182526020820152f35b50608036600319011261047c57600435906001600160401b03821161047c578160040160e06003198436030112610f5b576040366023190112610f5b57610c39614559565b92610c42614e48565b50610c4b614917565b50610c546150e5565b610c5c614e48565b50610c65614917565b50610cae6044610ca9606484013593610c7d8661492f565b507f00000000000000000000000000000000000000000000000000000000000000019283910135615956565b615960565b9080821061116c5750604051637f5a7c7b60e01b81527f000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f6001600160a01b031690602081600481855afa90811561111f57859161112a575b506001600160a01b0316806110d2575b50803b1561099d576040516318457e6160e01b81525f6004820181905260248201819052604482015233606482015260848101839052908490829060a490829084905af180156109b6579084916110bd575b5050610d748183615260565b610d7d8461492f565b9060405190610d8b8261475d565b602435825260208201916044358352610da2614e48565b5051938434036110aa57825180610f72575b5091839160809593610dc9610e129b96615074565b925115159263ffffffff60405195610de08761478c565b168552602085015260408401526060830152848201526040518098819482936302637a4560e41b84526004840161544d565b03917f000000000000000000000000c1b15d3b262beec0e3565c11c9e0f6134bdacb366001600160a01b03165af1928315610f66578093610eee575b5060c0935060405190610e608261475d565b8082526020820192818452610e7685519161492f565b9163ffffffff6040519316835280602084015260408301527f85496b760a4b7f8d66384b9df21b381f5d1b1e79f229a47aaf4c232edc2fe59a60603393a360206040805194805186526001600160401b03838201511683870152015180516040860152015160608401525160808301525160a0820152f35b90925060803d608011610f5f575b610f0681866147c2565b840193608081860312610f5b5760405191610f20836147a7565b815183526020820151906001600160401b038216820361047c5750602083015260c094610f4f91604001615425565b6040820152915f610e4e565b5080fd5b503d610efc565b604051903d90823e3d90fd5b60405163393f876560e21b81527f000000000000000000000000c1b15d3b262beec0e3565c11c9e0f6134bdacb366001600160a01b031690602081600481855afa90811561109f578b91611059575b506001600160a01b031691821561104a576020918b9160405190848201926323b872dd60e01b845233602484015260448301526064820152606481526110086084826147c2565b519082855af11561103f5788513d6110365750803b155b15610db457635274afe760e01b8952600452602488fd5b6001141561101f565b6040513d8a823e3d90fd5b6329b99a9560e11b8b5260048bfd5b90506020813d602011611097575b81611074602093836147c2565b8101031261109357516001600160a01b0381168103611093575f610fc1565b8a80fd5b3d9150611067565b6040513d8d823e3d90fd5b6304fb820960e51b885234600452602488fd5b816110c7916147c2565b61099957825f610d68565b803b1561098a57846024916040519283809263e83931af60e01b82523360048301525afa801561111f5790859161110a575b50610d16565b81611114916147c2565b61099d57835f611104565b6040513d87823e3d90fd5b90506020813d602011611164575b81611145602093836147c2565b8101031261098a57516001600160a01b038116810361098a575f610d06565b3d9150611138565b6371c4efed60e01b8452600491909152602452604482fd5b503461047c57602036600319011261047c57610588602091610bcf6111a7614f8b565b6111d07f000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f6158fe565b600435615b5e565b614727565b503461047c578060031936011261047c575f516020615d535f395f51905f52546040516001600160a01b039091168152602090f35b50602036600319011261047c576004356001600160401b038111610f5b5761123e903690600401614878565b903681900361013e1901835b838110156113b057848160051b84013583811215610f5b576112999085016112718161492f565b602082013592839163ffffffff165f525f516020615dd35f395f51905f5260205260405f2090565b54036113a5576112ad610100820182614c43565b60e08301356001600160a01b038116939192908490036113a1576112d5610120830183614c43565b939091303b1561139d57604051633411683760e21b81529663ffffffff6112fb86614707565b16600489015260248801526040840135916001600160401b0383168093036113995788968896879561134f87956113669560c098604489015260a08b0135606489015260e0608489015260e4880191614a82565b9260a48601526003198584030160c4860152614a82565b03920135305af1801561098e57611384575b50506001905b0161124a565b8161138e916147c2565b61098a57845f611378565b8880fd5b8780fd5b8580fd5b50505060019061137e565b604051638e9e709960e01b8152858082600481335afa908115610f665780916113fa575b604051638351eea760e01b815260206004820152806113f66024820185614509565b0390fd5b90503d8082843e61140b81846147c2565b820191602081840312610f5b578051906001600160401b03821161099957019082601f8301121561047c57506113f69181602061144a935191016148a8565b826113d4565b503461047c57606036600319011261047c5761146a6146f4565b61147261474c565b91604435906001600160401b03821161047c576114b66114a2858561149a366004880161458f565b929091614cb9565b604051918291602083526020830190614509565b0390f35b503461047c57602036600319011261047c5760206105886114d96146f4565b63ffffffff165f525f516020615dd35f395f51905f5260205260405f205490565b503461047c57602036600319011261047c576004356003811015610f5b579060409181525f516020615d935f395f51905f5260205220600163ffffffff825416910154906114b6604051928392836020909392919363ffffffff60408201951681520152565b503461047c576020906115723661465b565b9061157e9492946150e5565b5f516020615e335f395f51905f5254604051633a358bdd60e21b815295869384936115ba936001600160a01b0316923392919060048701614a24565b0381734abbedef694143da297f6d18b019da7b1870140c5af4908115610f6657906115eb575b602090604051908152f35b506020813d60201161161a575b81611605602093836147c2565b8101031261161657602090516115e0565b5f80fd5b3d91506115f8565b503461047c57602036600319011261047c576004356001600160401b038111610f5b57611653903690600401614878565b61165b61522d565b825b81811061175d575060405191816020840160208552526040830160408360051b85010192828690605e19813603015b8383106116bd57887fbe4864a8e820971c0247f5992e2da559595f7bf076a21cb5928d443d2a13b6748989038aa180f35b909192939495603f1988820301865286358281121561175957830163ffffffff6116e682614707565b168252602081013561ffff81168091036110935760208301526040810135601e19823603018112156110935701602081359101906001600160401b0381116110935780360382136110935761174b602092839260608681604060019901520191614a82565b98019601949301919061168c565b8980fd5b92919061178161177b611771868486614c0d565b6040810190614c43565b906158b0565b61178f611771858385614c0d565b63ffffffff6117aa6117a58886889a969a614c0d565b61492f565b1685527f8d2bda5d9f6ffb5796910376005392955773acee5548d0fcdb10e7c264ea00006020526040852060206117e2848688614c0d565b013561ffff8116810361191d5761ffff165f5260205260405f20906001600160401b038111611909576118158254614af4565b601f81116118ce575b508596601f821160011461186757908087986118539360019798999261185c575b50508160011b915f199060031b1c19161790565b90555b0161165d565b013590505f8061183f565b8287526020872090601f198316885b8181106118b657509060019697989984889594931061189d575b505050811b019055611856565b01355f19600384901b60f8161c191690555f8080611890565b99926020600181928686013581550194019a01611876565b6118f99083885260208820601f840160051c810191602085106118ff575b601f0160051c0190614c75565b5f61181e565b90915081906118ec565b634e487b7160e01b86526041600452602486fd5b8680fd5b503461047c578060031936011261047c577fefb041d771d6daaa55702fff6eb740d63ba559a75d2d1d3e151c78ff2480b600546040516001600160a01b039091168152602090f35b503461047c57604036600319011261047c57602061199661198861452d565b611990614543565b906157c0565b6040519015158152f35b503461047c576020906119b23661465b565b906119be9492946150e5565b5f516020615e335f395f51905f5254604051632b29888360e01b815295869384936115ba936001600160a01b0316923392919060048701614a24565b503461047c57602036600319011261047c576020610588600435614b5a565b503461047c57602036600319011261047c57610be88160409250600281525f516020615ed35f395f51905f52602052610bd483822091610bcf610b9d614f8b565b503461047c57604036600319011261047c57611a81611a7761452d565b6024359033615110565b602060405160018152f35b503461047c578060031936011261047c57602090604051908152f35b503461047c57602036600319011261047c5780611ac361452d565b611acb6150e5565b734f0530d72412d10741dbd3e09e8cdb2ccb322ccd90813b15610b595760405163572c248f60e11b81525f516020615e735f395f51905f5260048201526001600160a01b039091166024820152908290829060449082905af4801561098e57610b485750f35b503461047c578060031936011261047c5760206040517f00000000000000000000000000000000000000000000000000000000000000018152f35b503461047c578060031936011261047c576040516395d89b4160e01b815281816004817f000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f6001600160a01b03165afa90811561098e57826114b69392611be3575b5050604051918291602083526020830190614509565b611bff92503d8091833e611bf781836147c2565b8101906148de565b5f80611bcd565b503461047c57604036600319011261047c576020600435610588611c28614543565b91611c3281614b5a565b8093336154bb565b503461047c578060031936011261047c575f516020615eb35f395f51905f52546040516001600160a01b039091168152602090f35b503461047c578060031936011261047c57602060405160068152f35b503461047c578060031936011261047c577fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d100541580611db0575b15611d7357611d1790611cd66155a3565b90611cdf615670565b906020611d2560405193611cf383866147c2565b8385525f368137604051968796600f60f81b885260e08589015260e0880190614509565b908682036040880152614509565b904660608601523060808601528260a086015284820360c08601528080855193848152019401925b828110611d5c57505050500390f35b835185528695509381019392810192600101611d4d565b60405162461bcd60e51b81526020600482015260156024820152741152540dcc4c8e88155b9a5b9a5d1a585b1a5e9959605a1b6044820152606490fd5b507fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d1015415611cc5565b503461047c57366003190160a08112610f5b5760601361047c576064356001600160401b038111610f5b57611e1290369060040161458f565b50506084356001600160a01b03811690819003610f5b576020906040519030148152f35b503461047c57611e453661465b565b611e509392936150e5565b604051634b94dd8f60e11b81526001600160a01b037f000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f8116600483018190529083166024830152306044830152606482018690529290602081608481736403f298dbf3fcaba1b91cb87bb08a7802a24ce35af4801561111f57611ef1575b506115ba60209360405196879485946251533760e71b8652339260048701614a24565b6020813d602011611f1b575b81611f0a602093836147c2565b8101031261161657506115ba611ece565b3d9150611efd565b503461047c57604036600319011261047c57602090611f406146f4565b50604051908152f35b905034610f5b576020366003190112610f5b576004356001600160a01b0381169190829003610999575f516020615eb35f395f51905f52546001600160a01b03163314908115611fe0575b5015610f5b575f516020615d535f395f51905f5280546001600160a01b03191682179055337fdefab8204f3d7db070ae44700a6ce84f9a66ba6b280478ae65e48177cd2cb67e8380a380f35b5f516020615d535f395f51905f525460405163b700961360e01b81523360048201523060248201526001600160e01b0319929092166044830152909150602090829060649082906001600160a01b03165afa908115612076578391612047575b505f611f94565b612069915060203d60201161206f575b61206181836147c2565b810190614b2c565b5f612040565b503d612057565b6040513d85823e3d90fd5b823461047c578060031936011261047c575f516020615d735f395f51905f52546001600160a01b03163381900361211d575f516020615eb35f395f51905f5280546001600160a01b031980821684179092555f516020615d735f395f51905f5280549092169091556001600160a01b0391821691167f41d91c43805b25f14b05b0279a83da8895d24b5ac3083afdd926be2cd23785968380a380f35b6344bd9b6360e11b8252600482fd5b823461047c5761213b3661465b565b6121436150e5565b61214b6150b0565b604051634b94dd8f60e11b81527f000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f6001600160a01b03818116600484015283166024830152306044830152606482018590529290602081608481736403f298dbf3fcaba1b91cb87bb08a7802a24ce35af48015612303576122d1575b505f516020615e335f395f51905f5254604093612258916001600160a01b03166121ef614f8b565b8651635b955d1b60e01b81525f516020615e735f395f51905f52600482015260248101989098526001600160a01b039485166044890152948416606488015233608488015290831660a487015290911660c485015260e484019190915282908190610104820190565b0381734abbedef694143da297f6d18b019da7b1870140c5af4801561098e578260409392819261229f575b505f516020615e535f395f51905f525d82519182526020820152f35b9092506122c29150833d85116122ca575b6122ba81836147c2565b810190614b44565b909184612283565b503d6122b0565b6020813d6020116122fb575b816122ea602093836147c2565b8101031261161657506122586121c7565b3d91506122dd565b6040513d88823e3d90fd5b823461047c578060031936011261047c5760049061232a6150e5565b6001623f026d60e01b03198152fd5b823461047c5760c036600319011261047c5761235361452d565b61235b614543565b906044359182151580930361099d5760a435916001600160401b03831161098a573660238401121561098a5761239d60209336906024816004013591016147fe565b61246b6123a8615bfc565b6123b0615c66565b60405190878201927f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f8452604083015260608201524660808201523060a082015260a0815261240060c0826147c2565b5190209160405196879586956347e068ad60e01b87525f516020615e735f395f51905f52600488015260018060a01b0316602487015260018060a01b031660448601526064850152606435608485015260843560a485015261010060c4850152610104840190614509565b9060e48301520381739b1a22e38b43f551cbff28b9813ca8e178994e565af490811561098e57602092916124a5575b506040519015158152f35b6124bc9150823d841161206f5761206181836147c2565b8261249a565b823461047c57602036600319011261047c576124dc61452d565b6040516370a0823160e01b81526001600160a01b0391821660048201529190602090839060249082907f000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f165afa908115610f6657906115eb57602090604051908152f35b823461047c578061255036614630565b906125596150e5565b734f0530d72412d10741dbd3e09e8cdb2ccb322ccd91823b156125aa576040516394e1473760e01b815292849284928391829161259991600484016149e0565b03915af4801561098e57610b485750f35b505050fd5b823461047c57602036600319011261047c577ff0be4f1e87349231d80c36b33f9e8639658eeaf474014dee15a3e6a4d441419760206125ec61452d565b6125f461522d565b7f41db8a78b0206aba5c54bcbfc2bda0d84082a84eb88e680379a57b9e9f653c0080546001600160a01b0319166001600160a01b03929092169182179055604051908152a180f35b823461047c57604036600319011261047c57602060043561058861265e614543565b61266783614ee5565b928391336154bb565b823461047c578060031936011261047c576040517f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba36001600160a01b03168152602090f35b823461047c57602061274b6126c936614695565b6126d8989496929791986150e5565b6126e06150b0565b7f000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f98604051988995869563050e3c7d60e41b87528c8b30917f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba39060018060a01b031660048b01614aa2565b0381736403f298dbf3fcaba1b91cb87bb08a7802a24ce35af492831561111f57859361279d575b505f516020615e335f395f51905f5254929360409361225891906001600160a01b03166121ef614f8b565b92506020833d6020116127cb575b816127b8602093836147c2565b8101031261161657915191612258612772565b3d91506127ab565b823461047c578060031936011261047c576040517f000000000000000000000000c1b15d3b262beec0e3565c11c9e0f6134bdacb366001600160a01b03168152602090f35b823461047c57604036600319011261047c5760206128346146f4565b61285b6024359163ffffffff165f525f516020615dd35f395f51905f5260205260405f2090565b5414604051908152f35b823461047c578060031936011261047c577f8d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c20a546040516001600160a01b039091168152602090f35b823461047c57604036600319011261047c576128c761452d565b6128cf614718565b6040516392f3931960e01b81525f516020615e735f395f51905f5260048201526001600160a01b03909216602483015215156044820152336064820152602081608481739b1a22e38b43f551cbff28b9813ca8e178994e565af490811561098e57602092916124a557506040519015158152f35b823461047c57604036600319011261047c5761295d6146f4565b63ffffffff61296a61474c565b911682527f8d2bda5d9f6ffb5796910376005392955773acee5548d0fcdb10e7c264ea000060205261ffff6040832091165f5260205260405f209060405191818154916129b683614af4565b8086529260018116908115612a1f57506001146129de575b6114b6856114a2818703826147c2565b815260208120939250905b808210612a05575090915081016020016114a2826114b66129ce565b9192600181602092548385880101520191019092916129e9565b8695506114b6969350602092506114a294915060ff191682840152151560051b82010192936129ce565b823461047c578060031936011261047c576114b6604051612a6b6040826147c2565b60058152640312e312e360dc1b6020820152604051918291602083526020830190614509565b823461047c5760c036600319011261047c57612aab61452d565b612ab3614543565b906044356001600160a01b0381169081900361099d57612ad1614559565b926084359360a4359360018060a01b03851680950361191d575f516020615e935f395f51905f52549460ff8660401c1615956001600160401b03811680159081613378575b600114908161336e575b159081613365575b506133565767ffffffffffffffff1981166001175f516020615e935f395f51905f52558661332a575b50604096875192612b6289856147c2565b60058452640312e312e360dc1b6020850152612b7c615a3e565b612b84615a3e565b6001600160a01b031694851561331b576001600160a01b031693841561331b576001600160a01b031694851561331b57885163313ce56760e01b8152602081600481895afa801561331157612be0918c916132e2575b506158ed565b8210156132d357908992916bffffffffffffffffffffffff60a01b5f516020615e135f395f51905f525416175f516020615e135f395f51905f52558280525f516020615d935f395f51905f5260205288832062030d4063ffffffff19825416179055600183525f516020615d935f395f51905f5260205288832062030d4063ffffffff19825416179055600283525f516020615d935f395f51905f5260205288832062030d4063ffffffff198254161790555f516020615e735f395f51905f5255734f0530d72412d10741dbd3e09e8cdb2ccb322ccd90813b1561099957829060448a518094819363572c248f60e11b83525f516020615e735f395f51905f52600484015260248301525af480156132c9576132b4575b505085516306fdde0360e01b815287816004817f000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f6001600160a01b03165afa9081156132aa578891613290575b50612d4d615a3e565b612d55615a3e565b8051906001600160401b03821161327c57612d7d5f516020615db35f395f51905f5254614af4565b601f8111613222575b50602090601f83116001146131a657612db592918a918361319b5750508160011b915f199060031b1c19161790565b5f516020615db35f395f51905f52555b8051906001600160401b03821161318757612ded5f516020615df35f395f51905f5254614af4565b601f811161312d575b50602090601f83116001146130b157612e2592918991836130a65750508160011b915f199060031b1c19161790565b5f516020615df35f395f51905f52555b857fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10055857fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10155612e83615a3e565b612e8b615a3e565b612e9481615cab565b901561309e575b5f516020615e335f395f51905f52549060ff60a01b9060a01b16906affffffffffffffffffffff60a81b1617175f516020615e335f395f51905f5255612edf615a3e565b612ee7615a3e565b5f516020615eb35f395f51905f5280546001600160a01b03191682179055847f41d91c43805b25f14b05b0279a83da8895d24b5ac3083afdd926be2cd23785968180a35f516020615d535f395f51905f5280546001600160a01b031916905583337fdefab8204f3d7db070ae44700a6ce84f9a66ba6b280478ae65e48177cd2cb67e8280a3612f74615a3e565b612f7c615a3e565b612f84615a3e565b612f8c615a3e565b801561308f5783907f000000000000000000000000c1b15d3b262beec0e3565c11c9e0f6134bdacb366001600160a01b031690813b15610999578291602483928751948593849263ca5eb5e160e01b845260048401525af1801561308557613070575b5050612ff9615a3e565b613001615a3e565b613009615a3e565b613011615a3e565b613019575080f35b60207fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29168ff0000000000000000195f516020615e935f395f51905f5254165f516020615e935f395f51905f52555160018152a180f35b8161307a916147c2565b610999578284612fef565b84513d84823e3d90fd5b632d618d8160e21b8452600484fd5b506012612e9b565b01519050898061183f565b5f516020615df35f395f51905f5289528189209190601f1984168a5b81811061311557509084600195949392106130fd575b505050811b015f516020615df35f395f51905f5255612e35565b01515f1960f88460031b161c191690558880806130e3565b929360206001819287860151815501950193016130cd565b5f516020615df35f395f51905f528952613181907f5f9ce34815f8e11431c7bb75a8e6886a91478f7ffc1dbb0a98dc240fddd76b75601f850160051c810191602086106118ff57601f0160051c0190614c75565b88612df6565b634e487b7160e01b88526041600452602488fd5b015190508a8061183f565b5f516020615db35f395f51905f528a52818a209190601f1984168b5b81811061320a57509084600195949392106131f2575b505050811b015f516020615db35f395f51905f5255612dc5565b01515f1960f88460031b161c191690558980806131d8565b929360206001819287860151815501950193016131c2565b5f516020615db35f395f51905f528a52613276907f42ad5d3e1f2e6e70edcf6d991b8a3023d3fca8047a131592f9edb9fd9b89d57d601f850160051c810191602086106118ff57601f0160051c0190614c75565b89612d86565b634e487b7160e01b89526041600452602489fd5b6132a491503d808a833e611bf781836147c2565b88612d44565b87513d8a823e3d90fd5b816132be916147c2565b61191d578688612cf7565b88513d84823e3d90fd5b636a43f8d160e01b8a5260048afd5b613304915060203d60201161330a575b6132fc81836147c2565b810190614a69565b8c612bda565b503d6132f2565b8a513d8d823e3d90fd5b63d92e233d60e01b8a5260048afd5b68ffffffffffffffffff191668010000000000000001175f516020615e935f395f51905f525588612b51565b63f92ee8a960e01b8952600489fd5b9050158a612b28565b303b159150612b20565b889150612b16565b823461047c578060031936011261047c576020604051308152f35b823461047c578060031936011261047c575f516020615e135f395f51905f52546040516001600160a01b039091168152602090f35b61456f565b823461047c57602036600319011261047c57806133f061452d565b6133f86150e5565b5f516020615e335f395f51905f5254734f0530d72412d10741dbd3e09e8cdb2ccb322ccd91906001600160a01b0316823b156125aa5760405163c572912760e01b81525f516020615e735f395f51905f5260048201526001600160a01b0390921660248301526044820152908290829060649082905af4801561098e57610b485750f35b823461047c57604036600319011261047c576004356001600160401b038111610f5b57806004019060e06003198236030112610999576134ba614718565b906134c3614917565b506134db6044610ca9606484013593610c7d8761492f565b908082106135e65750916040916135006134f86135579584615260565b91909361492f565b92613509614917565b5061351384615074565b63ffffffff8651956135248761478c565b168552602085015284840152606083015215156080820152815180938192631bb8518b60e31b835230906004840161544d565b03817f000000000000000000000000c1b15d3b262beec0e3565c11c9e0f6134bdacb366001600160a01b03165afa90811561098e5782916135a8575b60408260208251918051835201516020820152f35b905060403d6040116135df575b6135bf81836147c2565b81019160408284031261047c57506040916135d991615425565b82613593565b503d6135b5565b6371c4efed60e01b8552600491909152602452604483fd5b823461047c578060031936011261047c575f516020615e335f395f51905f52546040516001600160a01b039091168152602090f35b823461047c57604036600319011261047c5761364d61452d565b906136566150e5565b61365e6150b0565b5f516020615e335f395f51905f52546001600160a01b031661367e614f8b565b604051639298f11760e01b81525f516020615e735f395f51905f5260048201526001600160a01b039485166024808301919091523560448201527f000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f9094166064850152608484019190915260a483015260208260c481734abbedef694143da297f6d18b019da7b1870140c5af4908115610f66578091613734575b602092505f516020615e535f395f51905f525d604051908152f35b90506020823d602011613761575b8161374f602093836147c2565b81010312611616576020915190613719565b3d9150613742565b823461047c57602036600319011261047c576004356003811015610f5b579060409181525f516020615ed35f395f51905f5260205220600163ffffffff825416910154906114b6604051928392836020909392919363ffffffff60408201951681520152565b823461047c57604036600319011261047c577f238399d427b947898edb290f5ff0f9109849b1c3ba196a42e35f00c50a54b98b61380a6146f4565b6024359061381661522d565b63ffffffff168084525f516020615dd35f395f51905f5260209081526040808620849055805192835290820192909252a180f35b823461047c576138d960209161385f36614695565b61386e999496929891996150e5565b60018060a01b037f000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f1699604051998a95869563050e3c7d60e41b87528d8b30917f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba39060048b01614aa2565b0381736403f298dbf3fcaba1b91cb87bb08a7802a24ce35af4938415612076578394613925575b506115ba602093949560405196879485946251533760e71b8652339260048701614a24565b9293506020833d602011613955575b81613941602093836147c2565b8101031261161657915192916115ba613900565b3d9150613934565b823461047c578060031936011261047c5760405163313ce56760e01b81526020816004817f000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f6001600160a01b03165afa90811561098e57602092916139c9575b5060ff60405191168152f35b6139e09150823d841161330a576132fc81836147c2565b826139bd565b823461047c57806139f63661465b565b906139ff6150e5565b734abbedef694143da297f6d18b019da7b1870140c803b1561098a57604051631797c6ad60e01b8152938593859384928392612599927f000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f6001600160a01b0316923392919060048701614a24565b823461047c57606036600319011261047c57613a8761452d565b613a8f614543565b60443591613a9d3382614e7a565b5f198110613ab1575b50611a819350615110565b838110613b47576001600160a01b03821615613b33573315613b1f576001600160a01b0382165f9081527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace01602090815260408083203384529091529020908490039055611a81935084613aa6565b634a1406b160e11b85526004859052602485fd5b63e602df0560e01b85526004859052602485fd5b637dc7a0d960e11b8552336004526024526044839052606484fd5b823461047c578060031936011261047c57602060405160018152f35b823461047c5780613b8e36614630565b90613b976150e5565b734f0530d72412d10741dbd3e09e8cdb2ccb322ccd91823b156125aa5760405163b003923d60e01b815292849284928391829161259991600484016149e0565b823461047c578060031936011261047c576020610588614961565b823461047c57604036600319011261047c5760043590600382101561047c57613c19614543565b613c216150b0565b7f000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f6001600160a01b03163303613cf4575f516020615e335f395f51905f52546040516375ba8a9960e11b81525f516020615e735f395f51905f526004820152936001600160a01b039091169190613c9c906024860190614940565b6001600160a01b031660448401526064830152602082608481734f0530d72412d10741dbd3e09e8cdb2ccb322ccd5af4908115610f6657809161373457602092505f516020615e535f395f51905f525d604051908152f35b63f22eef3d60e01b8252600482fd5b823461047c578060031936011261047c57604080516001815260026020820152f35b823461047c578060031936011261047c576040805162b9270b60e21b815260016020820152f35b823461047c578060031936011261047c57602060405160028152f35b82613d72366145bc565b50507f000000000000000000000000c1b15d3b262beec0e3565c11c9e0f6134bdacb366001600160a01b03169492905033850361405357613dba613db58461492f565b615074565b602084013580910361402f5750816020116116165780356001600160a01b031694613e2b613de88484614c8b565b6001600160c01b03199135918216916008821061400f5750507f00000000000000000000000000000000000000000000000000000000000000019060c01c615960565b92613e358561492f565b507f000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f6001600160a01b0316803b1561161657604051631ceb5d1960e11b81525f6004820181905260248201819052604482018190526001600160a01b038a166064830152608482018790529091829060a490829084905af1801561400457613feb575b509081602889949311613ef4575b505050506108487fefed6d3500546b29533b128a29e3a94d70788727f0507505ac12eaf2e578fd9c9261492f565b6040860135906001600160401b038216820361098a57613f7b916020613f2961089884604c95613f238d61492f565b99614c9c565b6040519687936001600160401b0360c01b9060c01b168385015263ffffffff60e01b9060e01b16602884015288602c8401528051918291018484015e810186838201520301601f1981018452836147c2565b803b1561099957613fc08392918392604051948580948193633e5ac80960e11b83528d60048401528c6024840152836044840152608060648401526084830190614509565b03925af1801561098e57613fd6575b8080613ec6565b81613fe0916147c2565b61098a578486613fcf565b613ffa91939298505f906147c2565b5f96909188613eb8565b6040513d5f823e3d90fd5b6001600160c01b031960089290920360031b82901b161690508980610755565b63ffffffff61403d8561492f565b63309afaf360e21b5f521660045260245260445ffd5b6391ac5e4f60e01b5f523360045260245ffd5b34611616575f366003190112611616577f41db8a78b0206aba5c54bcbfc2bda0d84082a84eb88e680379a57b9e9f653c00546040516001600160a01b039091168152602090f35b34611616576020366003190112611616576004356001600160401b0381116116165760e06003198236030112611616576140e5614917565b506140ee614917565b506040516140fb8161475d565b5f815260208101905f1982526020926040519161411885846147c2565b5f83526141356044610ca9606485013594610c7d8160040161492f565b918083106141df5750936040519461414c8661475d565b8286528186019283526040519460a0860191518652518286015260a06040860152835180915260c08501918060c08360051b8801019501925f905b8382106141a257885160608901528551608089015287870388f35b909192939583806141d060019360bf198c82030186526040838c518051845201519181858201520190614509565b98019201920190939291614187565b826371c4efed60e01b5f5260045260245260445ffd5b34611616575f3660031901126116165760205f516020615e735f395f51905f5254604051908152f35b346116165760403660031901126116165761423761452d565b6024359033156142d4576001600160a01b03169081156142c157335f9081527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace0160205260409020825f526020528060405f20556040519081527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560203392a3602060405160018152f35b634a1406b160e11b5f525f60045260245ffd5b63e602df0560e01b5f525f60045260245ffd5b3461161657602036600319011261161657614303610b9d614f8b565b604051908152602090f35b634e487b7160e01b5f52601160045260245ffd5b34611616575f366003190112611616576040516306fdde0360e01b81525f816004817f000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f6001600160a01b03165afa8015614004576114b6915f91614396575b50604051918291602083526020830190614509565b6143aa91503d805f833e611bf781836147c2565b82614381565b34611616576020366003190112611616576004356003811015611616575f527f8d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c209602052602060405f2054604051908152f35b346116165760203660031901126116165760043563ffffffff60e01b81168091036116165760209063e3bc4e6560e01b81149081156144a6575b8115614495575b8115614484575b8115614473575b811561446257506040519015158152f35b63a219a02560e01b1490508261249a565b6336372b0760e01b81149150614451565b632f0a18c560e01b8114915061444a565b631883ba3960e21b81149150614443565b6301ffc9a760e01b8114915061443c565b34611616575f366003190112611616576143036144d2614961565b6144da614f8b565b6145037f000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f6158fe565b91615b5e565b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b600435906001600160a01b038216820361161657565b602435906001600160a01b038216820361161657565b606435906001600160a01b038216820361161657565b34611616576020366003190112611616576313bdc27160e21b5f5260045ffd5b9181601f84011215611616578235916001600160401b038311611616576020838186019501011161161657565b90600319820160e081126116165760601361161657600491606435916084356001600160401b03811161161657826145f69160040161458f565b9092909160a4356001600160a01b0381168103611616579160c435906001600160401b0382116116165761462c9160040161458f565b9091565b9060606003198301126116165760043560038110156116165760409092602319011261161657602490565b606090600319011261161657600435906024356001600160a01b038116810361161657906044356001600160a01b03811681036116165790565b9060c060031983011261161657600435916024356001600160a01b038116810361161657916044356001600160a01b03811681036116165791606435916084359160a435906001600160401b0382116116165761462c9160040161458f565b6004359063ffffffff8216820361161657565b359063ffffffff8216820361161657565b60243590811515820361161657565b346116165760203660031901126116165761474061452d565b5060206040515f198152f35b6024359061ffff8216820361161657565b604081019081106001600160401b0382111761477857604052565b634e487b7160e01b5f52604160045260245ffd5b60a081019081106001600160401b0382111761477857604052565b606081019081106001600160401b0382111761477857604052565b90601f801991011681019081106001600160401b0382111761477857604052565b6001600160401b03811161477857601f01601f191660200190565b92919261480a826147e3565b9161481860405193846147c2565b829481845281830111611616578281602093845f960137010152565b34611616575f366003190112611616576040517f000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f6001600160a01b03168152602090f35b9181601f84011215611616578235916001600160401b038311611616576020808501948460051b01011161161657565b9291926148b4826147e3565b916148c260405193846147c2565b829481845281830111611616578281602093845f96015e010152565b602081830312611616578051906001600160401b03821161161657019080601f83011215611616578151614914926020016148a8565b90565b604051906149248261475d565b5f6020838281520152565b3563ffffffff811681036116165790565b90600382101561494d5752565b634e487b7160e01b5f52602160045260245ffd5b6040516318160ddd60e01b81526020816004817f000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f6001600160a01b03165afa908115614004575f916149b1575090565b90506020813d6020116149d8575b816149cc602093836147c2565b81010312611616575190565b3d91506149bf565b9092916020606091614a0960808501965f516020615e735f395f51905f52865283860190614940565b63ffffffff614a1782614707565b1660408501520135910152565b5f516020615e735f395f51905f52815260208101919091526001600160a01b03918216604082015291811660608301529182166080820152911660a082015260c00190565b90816020910312611616575160ff811681036116165790565b908060209392818452848401375f828201840152601f01601f1916010190565b6001600160a01b0391821681529181166020830152918216604082015291166060820152608081019190915260a081019190915260c081019190915261010060e0820181905261491493910191614a82565b90600182811c92168015614b22575b6020831014614b0e57565b634e487b7160e01b5f52602260045260245ffd5b91607f1691614b03565b90816020910312611616575180151581036116165790565b9190826040910312611616576020825192015190565b60015f525f516020615ed35f395f51905f526020527f629ac872e9f7661e92a1b088b8cebc1bdb10a91e22c7662916a2978e670740e6614b98614f8b565b91614bc27f000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f6158fe565b614bcd818584615b5e565b908015614bf95761491494614be59309151590615757565b90600163ffffffff82541691015491615764565b634e487b7160e01b5f52601260045260245ffd5b9190811015614c2f5760051b81013590605e1981360301821215611616570190565b634e487b7160e01b5f52603260045260245ffd5b903590601e198136030182121561161657018035906001600160401b0382116116165760200191813603831361161657565b818110614c80575050565b5f8155600101614c75565b906028116116165760200190600890565b909291928360281161161657831161161657602801916027190190565b63ffffffff90949294165f527f8d2bda5d9f6ffb5796910376005392955773acee5548d0fcdb10e7c264ea000060205261ffff60405f2091165f5260205260405f20604051905f9082815492614d0e84614af4565b9283835260208301946001811690815f14614e295750600114614de5575b50614d39925003836147c2565b815115614dd7578315614dd0576002841015614d77575050604051639a6d49cd60e01b8152602060048201529283926113f692506024840191614a82565b9092614d85818694966158b0565b806002116116165761491492602092604051955180918588015e8501908382015f8152600260011985019201903701015f60011982015282600119910301601f1981018352826147c2565b5092509050565b5050916149149136916147fe565b90505f9291925260205f20905f915b818310614e0d575050906020614d39928201015f614d2c565b6020919350806001915483858901015201910190918492614df4565b60ff1916865250614d3993151560051b830160200191505f9050614d2c565b60405190614e55826147a7565b815f81525f60208201526040805191614e6d8361475d565b5f83525f60208401520152565b604051636eb1769f60e11b81526001600160a01b03918216600482015291166024820152602081806044810103817f000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f6001600160a01b03165afa908115614004575f916149b1575090565b60015f525f516020615ed35f395f51905f526020527f629ac872e9f7661e92a1b088b8cebc1bdb10a91e22c7662916a2978e670740e6547f629ac872e9f7661e92a1b088b8cebc1bdb10a91e22c7662916a2978e670740e75461491492614f529263ffffffff169061571d565b50614f5b614f8b565b90614f857f000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f6158fe565b90615b5e565b5f516020615e135f395f51905f52545f516020615e335f395f51905f5254604051634104b9ed60e11b81526001600160a01b039182166004820152929160209184916024918391165afa918215614004575f92615040575b50818015615031575f516020615e735f395f51905f5254811090811561501a575b5061500b57565b632e2039ab60e21b5f5260045ffd5b6c0c9f2c9cd04674edea400000009150115f615004565b636a43f8d160e01b5f5260045ffd5b9091506020813d60201161506c575b8161505c602093836147c2565b810103126116165751905f614fe3565b3d915061504f565b63ffffffff16805f525f516020615dd35f395f51905f5260205260405f205490811561509e575090565b63f6ff4fb760e01b5f5260045260245ffd5b5f516020615e535f395f51905f525c6150d65760015f516020615e535f395f51905f525d565b633ee5aeb560e01b5f5260045ffd5b6150fa5f356001600160e01b03191633615973565b1561510157565b6344bd9b6360e11b5f5260045ffd5b6001600160a01b031690811561521a576001600160a01b031691821561520757815f527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace0060205260405f20548181106151ee57817fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92602092855f527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace0084520360405f2055845f527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00825260405f20818154019055604051908152a3565b8263391434e360e21b5f5260045260245260445260645ffd5b63ec442f0560e01b5f525f60045260245ffd5b634b637e8f60e11b5f525f60045260245ffd5b5f516020615eb35f395f51905f52546001600160a01b0316330361524d57565b63118cdaa760e01b5f523360045260245ffd5b90916152926020830135937f000000000000000000000000000000000000000000000000000000000000000190615956565b6001600160401b03811161541357615333906152b461089860a0860186614c43565b80511580159691906153de5761530e916020606892604051958693838501526001600160401b0360c01b9060c01b1660408401523360488401528051918291018484015e81015f838201520301601f1981018352826147c2565b925b83945f146153d6576002905b61149a6153288261492f565b916080810190614c43565b7f41db8a78b0206aba5c54bcbfc2bda0d84082a84eb88e680379a57b9e9f653c00549092906001600160a01b03168061536a575050565b6153986020916153aa9360405180958194829363043a78eb60e01b8452604060048501526044840190614509565b82810360031901602484015289614509565b03915afa8015614004576153bb5750565b6153d39060203d60201161206f5761206181836147c2565b50565b60019061531c565b50906040519160208301526001600160401b0360c01b9060c01b1660408201526028815261540d6048826147c2565b92615310565b63e2ce941360e01b5f5260045260245ffd5b91908260409103126116165760405161543d8161475d565b6020808294805184520151910152565b906020909392936040835263ffffffff815116604084015281810151606084015260806154a161548b604084015160a08488015260e0870190614509565b6060840151868203603f190160a0880152614509565b910151151560c08401526001600160a01b03909416910152565b5f516020615e335f395f51905f52549293907375258e4991d7b7bbb3f25fd07e47816a62bddfea6154f75f356001600160e01b03191633615973565b813b1561161657604051637904fa1360e01b81525f516020615e735f395f51905f5260048201526001600160a01b0393841660248201529483166044860152606485019690965260848401929092527f000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f811660a484015290921660c482015291151560e48301525f9082906101049082905af48015614004576155975750565b5f6155a1916147c2565b565b604051905f825f516020615db35f395f51905f5254916155c283614af4565b808352926001811690811561565157506001146155e6575b6155a1925003836147c2565b505f516020615db35f395f51905f525f90815290917f42ad5d3e1f2e6e70edcf6d991b8a3023d3fca8047a131592f9edb9fd9b89d57d5b8183106156355750509060206155a1928201016155da565b602091935080600191548385890101520191019091849261561d565b602092506155a194915060ff191682840152151560051b8201016155da565b604051905f825f516020615df35f395f51905f52549161568f83614af4565b808352926001811690811561565157506001146156b2576155a1925003836147c2565b505f516020615df35f395f51905f525f90815290917f5f9ce34815f8e11431c7bb75a8e6886a91478f7ffc1dbb0a98dc240fddd76b755b8183106157015750509060206155a1928201016155da565b60209193508060019154838589010152019101909184926156e9565b9163ffffffff8216158061574f575b6157485761573a9183615a69565b9081810390811161430e5791565b5050905f90565b50801561572c565b9190820180921161430e57565b91909180156157b95763ffffffff9161577c91615757565b911680156157b557620f424003620f4240811161430e575f19820191821161430e576157a791615aba565b6001810180911161430e5790565b5090565b5050505f90565b6001600160a01b038181165f9081527f8d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c2036020908152604080832086851684529091529020547f8d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c20a54929360ff90911692909116801561583f578215615846575b5050905090565b604051635b1b1e7960e11b81526001600160a01b0394851660048201529190931660248201529160209150829060449082905afa908115614004575f91615891575b50805f8061583f565b6158aa915060203d60201161206f5761206181836147c2565b5f615888565b9080600211611616576003823560f01c036158c9575050565b6113f6604051928392639a6d49cd60e01b8452602060048501526024840191614a82565b60ff16604d811161430e57600a0a90565b60405163313ce56760e01b815290602090829060049082906001600160a01b03165afa801561400457614914915f9161593757506158ed565b615950915060203d60201161330a576132fc81836147c2565b5f612bda565b8115614bf9570490565b8181029291811591840414171561430e57565b5f516020615d535f395f51905f52546001600160a01b03168015159290836159c4575b505081156159a2575090565b5f516020615eb35f395f51905f52546001600160a01b03918216911614919050565b60405163b700961360e01b81526001600160a01b03841660048201523060248201526001600160e01b031992909216604483015291925090602090829060649082905afa908115614004575f91615a1f575b50905f80615996565b615a38915060203d60201161206f5761206181836147c2565b5f615a16565b60ff5f516020615e935f395f51905f525460401c1615615a5a57565b631afcd79f60e31b5f5260045ffd5b90929181811015615ab55763ffffffff81941680615a92575b5050808311615a8e5750565b9150565b615aa491929450620f42409085615b5e565b615aad91615757565b915f80615a82565b509150565b5f19620f4240820991620f4240820291828085109403938085039414615b525783821115615b3a57620f4240829109815f0382168092046002816003021880820260020302808202600203028082026002030280820260020302808202600203028091026002030293600183805f03040190848311900302920304170290565b50634e487b715f52156003026011186020526024601cfd5b50906149149250615956565b90915f198383099280830292838086109503948086039514615bef5784831115615bd75790829109815f0382168092046002816003021880820260020302808202600203028082026002030280820260020302808202600203028091026002030293600183805f03040190848311900302920304170290565b82634e487b715f52156003026011186020526024601cfd5b5050906149149250615956565b615c046155a3565b8051908115615c14576020012090565b50507fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d100548015615c415790565b507fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47090565b615c6e615670565b8051908115615c7e576020012090565b50507fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d101548015615c415790565b5f8091604051602081019063313ce56760e01b825260048152615ccf6024826147c2565b51916001600160a01b03165afa3d15615d4a573d90615ced826147e3565b91615cfb60405193846147c2565b82523d5f602084013e5b80615d3e575b615d17575b505f905f90565b60208151918180820193849201010312611616575160ff8111615d10579060ff6001921690565b50602081511015615d0b565b606090615d0556fe341f7c713c76cb881fd7047f7cccebe3fe10eddfc5e20fe83ee7e0b505e8ea01341f7c713c76cb881fd7047f7cccebe3fe10eddfc5e20fe83ee7e0b505e8ea028d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c207a16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10272ab1bc1039b79dc4724ffca13de82c96834302d3c7e0d4252232d4b2dd8f900a16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d1038d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c2020773e532dfede91f04b12a73d3d2acd361424f41f76b4fb79f090161e36b4e009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f008d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c200f0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00341f7c713c76cb881fd7047f7cccebe3fe10eddfc5e20fe83ee7e0b505e8ea008d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c208a26469706673582212209458a96d718343c8bf886eb8f28f78ff487484340d09a9f314e1f9b872e9fb3664736f6c634300081e0033","optimization_enabled":true,"verified_twin_address_hash":null,"is_verified":true,"github_repository_metadata":null,"compiler_settings":{"evmVersion":"osaka","libraries":{"contracts/libraries/NestVaultAdminLogic.sol":{"NestVaultAdminLogic":"0x4F0530D72412d10741dbd3e09E8CDb2CCb322cCD"},"contracts/libraries/NestVaultCoreValidationLogic.sol":{"NestVaultCoreValidationLogic":"0x7167a414E6E71C3bc6b37dd8aC0F93933D118Fff"},"contracts/libraries/NestVaultDepositLogic.sol":{"NestVaultDepositLogic":"0x75258e4991d7b7bbb3F25fD07E47816A62BdDFeA"},"contracts/libraries/NestVaultOperatorLogic.sol":{"NestVaultOperatorLogic":"0x9b1A22E38B43f551CBFF28B9813CA8e178994E56"},"contracts/libraries/NestVaultRedeemLogic.sol":{"NestVaultRedeemLogic":"0x4aBbeDEf694143DA297f6d18B019Da7b1870140C"},"contracts/libraries/NestVaultTransferLogic.sol":{"NestVaultTransferLogic":"0x6403f298Dbf3fcaBA1B91Cb87Bb08A7802A24cE3"}},"metadata":{"appendCBOR":true,"bytecodeHash":"ipfs","useLiteralContent":false},"optimizer":{"enabled":true,"runs":200},"outputSelection":{"*":{"":["*"],"*":["*"]}},"remappings":["forge-std/=node_modules/forge-std/src/","@openzeppelin/=node_modules/@openzeppelin/","@openzeppelin-4.9.3/=script/vendor/openzeppelin-4.9.3/","@solmate/=node_modules/solmate/src/","@boring-vault/=node_modules/boring-vault/","src/=node_modules/boring-vault/src/","@predicate/=node_modules/@predicate/contracts/","@predicate-v2/=contracts/vendor/predicate-v2/","@pendle/=node_modules/@pendle/","createx/=node_modules/createx/src/","solidity-bytes-utils/contracts/=node_modules/@layerzerolabs/toolbox-foundry/lib/solidity-bytes-utils/","@layerzerolabs/=node_modules/@layerzerolabs/","@uniswap/permit2/=node_modules/@uniswap/permit2/src/","@morpho/=node_modules/morpho/src/","boring-vault/=node_modules/boring-vault/","ds-test/=node_modules/@layerzerolabs/toolbox-foundry/lib/ds-test/","hardhat-deploy/=node_modules/hardhat-deploy/","hardhat/=node_modules/hardhat/","morpho/=node_modules/morpho/","solmate/=node_modules/solmate/"],"viaIR":true},"optimization_runs":200,"sourcify_repo_url":null,"decoded_constructor_args":[["0xdddD73F5Df1F0DC31373357beAC77545dC5A6f3F",{"internalType":"address payable","name":"_share","type":"address"}],["0xC1b15d3B262bEeC0e3565C11C9e0F6134BdaCB36",{"internalType":"address","name":"_lzEndpoint","type":"address"}],["0x000000000022D473030F116dDEE9F6B43aC78BA3",{"internalType":"address","name":"_permit2","type":"address"}]],"compiler_version":"v0.8.30+commit.73712a01","is_verified_via_verifier_alliance":true,"verified_at":"2026-09-12T00:51:45.510093Z","implementations":[],"proxy_type":null,"external_libraries":[{"name":"contracts/libraries/NestVaultAdminLogic.sol:NestVaultAdminLogic","address_hash":"0x4F0530D72412d10741dbd3e09E8CDb2CCb322cCD"},{"name":"contracts/libraries/NestVaultCoreValidationLogic.sol:NestVaultCoreValidationLogic","address_hash":"0x7167a414E6E71C3bc6b37dd8aC0F93933D118Fff"},{"name":"contracts/libraries/NestVaultDepositLogic.sol:NestVaultDepositLogic","address_hash":"0x75258e4991d7b7bbb3F25fD07E47816A62BdDFeA"},{"name":"contracts/libraries/NestVaultOperatorLogic.sol:NestVaultOperatorLogic","address_hash":"0x9b1A22E38B43f551CBFF28B9813CA8e178994E56"},{"name":"contracts/libraries/NestVaultRedeemLogic.sol:NestVaultRedeemLogic","address_hash":"0x4aBbeDEf694143DA297f6d18B019Da7b1870140C"},{"name":"contracts/libraries/NestVaultTransferLogic.sol:NestVaultTransferLogic","address_hash":"0x6403f298Dbf3fcaBA1B91Cb87Bb08A7802A24cE3"}],"creation_bytecode":"0x6101008060405234610273576060816162b48038038091610020828561028a565b8339810103126102735780516001600160a01b0381169081900361027357610056604061004f602085016102c1565b93016102c1565b60405163313ce56760e01b815291602083600481845afa92831561027f575f9361023d575b50801561022e5760805261008d6102d5565b6001600160a01b031691821561022e5760ff9260a05260018060a01b031660c052166006811061021f576005190160ff811161020b5760ff16604d811161020b57600a0a60e0526100dc6102d5565b604051615f28908161036c823960805181818161078e01528181610ba201528181610cc6015281816111ac01528181611b9101528181611e670152818161215a01528181612507015281816126e201528181612d0c015281816136ba015281816138770152818161398301528181613a3701528181613c2301528181613e3801528181614346015281816144df015281816148490152818161497601528181614b9e01528181614eaa01528181614f610152615548015260a0518181816126860152818161271a01526138b0015260c0518181816108f301528181610ae001528181610e1601528181610f81015281816127e901528181612f960152818161355b0152613d76015260e05181818161075901528181610c8001528181611b4901528181613e03015261526d0152f35b634e487b7160e01b5f52601160045260245ffd5b6301e9714b60e41b5f5260045ffd5b63d92e233d60e01b5f5260045ffd5b9092506020813d602011610277575b816102596020938361028a565b81010312610273575160ff8116810361027357915f61007b565b5f80fd5b3d915061024c565b6040513d5f823e3d90fd5b601f909101601f19168101906001600160401b038211908210176102ad57604052565b634e487b7160e01b5f52604160045260245ffd5b51906001600160a01b038216820361027357565b5f5160206162945f395f51905f525460ff8160401c1661035c576002600160401b03196001600160401b0382160161030a5750565b6001600160401b0319166001600160401b039081175f5160206162945f395f51905f52556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a1565b63f92ee8a960e01b5f5260045ffdfe60806040526004361015610011575f80fd5b5f5f358060e01c90816301e1d114146144b757816301ffc9a71461440257816305728126146143b057816306fdde031461432257816307a2d13a146142e7578163095ea7b31461421e5781630a28a477146133d05781630cb60443146141f55781630d35b415146140ad578163111ecdad1461406657816313137d6514613d68578163134d4f2514613d4c578163156a0d0f14613d2557816317442b7014613d0357816317bf2c8114613bf257816318160ddd14613bd75781631e15d67514613b7e5781631f5e133414613b6257816323b872dd14613a6d5781632df1360c146139e6578163313ce5671461395d57816333c1d9301461384a5781633400288b146137cf578163357c13541461376957816336ac15ef1461363357816338d52e0f146135fe5781633b6f743b1461347c578163402d267d146111d857816348ea7127146133d55781634cdad506146133d05781634fb3ccc51461339b57816352ae28791461338057816353c425c114612a9157816354fd4d5014612a495781635535d46114612943578163558a7297146128ad57816358c2225b146128655781635a0dfe4d146128185781635e280f11146127d357816362b4aab0146126b55781636afdd850146126705781636e553f651461263c5781636fc1b31e146125af578163705e10e31461254057816370a08231146124c2578163711b58ff14612339578163715018a61461230e57816377a843171461212c57816379ba5097146120815781637a9e5e4b14611f49575080637d25a05e14611f235780637d41c86e14611e3657806382413eac14611dd957806384b0196e14611c8b578063857749b014611c6f5780638da5cb5b14611c3a57806394bf804d14611c0657806395d89b4114611b6c578063963efcaa14611b315780639d28fb8614611aa85780639f68b96414611a8c578063a8d5fd651461047f578063a9059cbb14611a5a578063ad52f1dc14611a19578063b3d7f6b9146119fa578063b460af94146119a0578063b6363cf214611969578063b731ea0a14611921578063b98bd07014611622578063ba08765214611560578063babd37eb146114fa578063bb0b6a53146114ba578063bc70b35414611450578063bd815db014611212578063bf7e214f146111dd578063c63d75b6146111d8578063c6e6f59214611184578063c7c7f5b314610bf4578063ca1435f314610b5d578063ca5eb5e114610abb578063cdf5bba314610a55578063ce96cb7714610a2d578063cf321745146109f0578063d045a0dc14610703578063d424388514610676578063d905777e14610655578063dd62ed3e14610628578063e30c3978146105f3578063eaed1d0714610590578063ef8b30f714610569578063f2fde38b146104db578063f5a23d8d14610484578063fc0c546a1461047f5763ff7bd03d14610427575f80fd5b3461047c57606036600319011261047c576004359063ffffffff8216820361047c5760206104708363ffffffff165f525f516020615dd35f395f51905f5260205260405f205490565b60405190602435148152f35b80fd5b614834565b503461047c57604036600319011261047c5760406020916104a3614543565b6001600160a01b031681527f8d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c20583522054604051908152f35b503461047c57602036600319011261047c576104f561452d565b6104fd6150e5565b6105056150e5565b6001600160a01b0316801561055a575f516020615d735f395f51905f5280546001600160a01b03191682179055337f93c09a290de449db41d63ce4cd5cf996d7e4f706ee68a7c46fec23632a70e9c18380a380f35b63f0558d5560e01b8252600482fd5b503461047c57602036600319011261047c576020610588600435614ee5565b604051908152f35b503461047c57604036600319011261047c57602060016105e96105b1614543565b6001600160a01b03165f9081527f8d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c2066020526040902090565b0154604051908152f35b503461047c578060031936011261047c575f516020615d735f395f51905f52546040516001600160a01b039091168152602090f35b503461047c57604036600319011261047c57602061058861064761452d565b61064f614543565b90614e7a565b503461047c57602036600319011261047c57602060016105e96105b161452d565b503461047c57602036600319011261047c577fd48d879cef83a1c0bdda516f27b13ddb1b3f8bbac1c9e1511bb2a659c242776060206106b361452d565b6106bb61522d565b7fefb041d771d6daaa55702fff6eb740d63ba559a75d2d1d3e151c78ff2480b60080546001600160a01b0319166001600160a01b03929092169182179055604051908152a180f35b5061070d366145bc565b5050509290923033036109e1578060201161098a5783356001600160a01b031693859061078161073d8483614c8b565b6001600160c01b0319913591821691600882106109c1575b50507f00000000000000000000000000000000000000000000000000000000000000009060c01c615960565b9261078b8561492f565b507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316803b1561099d57604051631ceb5d1960e11b81525f600482018190526024820181905260448201526001600160a01b038916606482015260848101869052908490829060a490829084905af19081156109b65784916109a1575b505060288111610863575b5050506108487fefed6d3500546b29533b128a29e3a94d70788727f0507505ac12eaf2e578fd9c9261492f565b6040805163ffffffff9290921682526020820192909252a380f35b6040850135906001600160401b038216820361099d576108f191602061089f61089884604c956108928c61492f565b98614c9c565b36916147fe565b6040519586936001600160401b0360c01b9060c01b168385015263ffffffff60e01b9060e01b16602884015287602c8401528051918291018484015e810185838201520301601f1981018352826147c2565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316803b15610999576109608392918392604051948580948193633e5ac80960e11b83528d60048401528c6024840152836044840152608060648401526084830190614509565b03925af1801561098e57610975575b8061081b565b8161097f916147c2565b61098a57845f61096f565b8480fd5b6040513d84823e3d90fd5b8280fd5b8380fd5b816109ab916147c2565b61099957825f610810565b6040513d86823e3d90fd5b6001600160c01b031960089290920360031b82901b161690505f80610755565b63029a949d60e31b8552600485fd5b503461047c578060031936011261047c5760207f8d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c20154604051908152f35b503461047c57602036600319011261047c576020610a4c6105b161452d565b54604051908152f35b503461047c57604036600319011261047c5760ff6040602092610a7661452d565b6001600160a01b031681527f8d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c2048452818120602435825284522054604051911615158152f35b503461047c57602036600319011261047c5780610ad661452d565b610ade61522d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690813b15610b595760405163ca5eb5e160e01b81526001600160a01b0390911660048201529082908290602490829084905af1801561098e57610b485750f35b81610b52916147c2565b61047c5780f35b5050fd5b503461047c57602036600319011261047c57610be881604092508080525f516020615ed35f395f51905f52602052610bd483822091610bcf610b9d614f8b565b610bc67f00000000000000000000000000000000000000000000000000000000000000006158fe565b90600435615b5e565b615757565b90600163ffffffff8254169101549161571d565b82519182526020820152f35b50608036600319011261047c57600435906001600160401b03821161047c578160040160e06003198436030112610f5b576040366023190112610f5b57610c39614559565b92610c42614e48565b50610c4b614917565b50610c546150e5565b610c5c614e48565b50610c65614917565b50610cae6044610ca9606484013593610c7d8661492f565b507f00000000000000000000000000000000000000000000000000000000000000009283910135615956565b615960565b9080821061116c5750604051637f5a7c7b60e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690602081600481855afa90811561111f57859161112a575b506001600160a01b0316806110d2575b50803b1561099d576040516318457e6160e01b81525f6004820181905260248201819052604482015233606482015260848101839052908490829060a490829084905af180156109b6579084916110bd575b5050610d748183615260565b610d7d8461492f565b9060405190610d8b8261475d565b602435825260208201916044358352610da2614e48565b5051938434036110aa57825180610f72575b5091839160809593610dc9610e129b96615074565b925115159263ffffffff60405195610de08761478c565b168552602085015260408401526060830152848201526040518098819482936302637a4560e41b84526004840161544d565b03917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165af1928315610f66578093610eee575b5060c0935060405190610e608261475d565b8082526020820192818452610e7685519161492f565b9163ffffffff6040519316835280602084015260408301527f85496b760a4b7f8d66384b9df21b381f5d1b1e79f229a47aaf4c232edc2fe59a60603393a360206040805194805186526001600160401b03838201511683870152015180516040860152015160608401525160808301525160a0820152f35b90925060803d608011610f5f575b610f0681866147c2565b840193608081860312610f5b5760405191610f20836147a7565b815183526020820151906001600160401b038216820361047c5750602083015260c094610f4f91604001615425565b6040820152915f610e4e565b5080fd5b503d610efc565b604051903d90823e3d90fd5b60405163393f876560e21b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690602081600481855afa90811561109f578b91611059575b506001600160a01b031691821561104a576020918b9160405190848201926323b872dd60e01b845233602484015260448301526064820152606481526110086084826147c2565b519082855af11561103f5788513d6110365750803b155b15610db457635274afe760e01b8952600452602488fd5b6001141561101f565b6040513d8a823e3d90fd5b6329b99a9560e11b8b5260048bfd5b90506020813d602011611097575b81611074602093836147c2565b8101031261109357516001600160a01b0381168103611093575f610fc1565b8a80fd5b3d9150611067565b6040513d8d823e3d90fd5b6304fb820960e51b885234600452602488fd5b816110c7916147c2565b61099957825f610d68565b803b1561098a57846024916040519283809263e83931af60e01b82523360048301525afa801561111f5790859161110a575b50610d16565b81611114916147c2565b61099d57835f611104565b6040513d87823e3d90fd5b90506020813d602011611164575b81611145602093836147c2565b8101031261098a57516001600160a01b038116810361098a575f610d06565b3d9150611138565b6371c4efed60e01b8452600491909152602452604482fd5b503461047c57602036600319011261047c57610588602091610bcf6111a7614f8b565b6111d07f00000000000000000000000000000000000000000000000000000000000000006158fe565b600435615b5e565b614727565b503461047c578060031936011261047c575f516020615d535f395f51905f52546040516001600160a01b039091168152602090f35b50602036600319011261047c576004356001600160401b038111610f5b5761123e903690600401614878565b903681900361013e1901835b838110156113b057848160051b84013583811215610f5b576112999085016112718161492f565b602082013592839163ffffffff165f525f516020615dd35f395f51905f5260205260405f2090565b54036113a5576112ad610100820182614c43565b60e08301356001600160a01b038116939192908490036113a1576112d5610120830183614c43565b939091303b1561139d57604051633411683760e21b81529663ffffffff6112fb86614707565b16600489015260248801526040840135916001600160401b0383168093036113995788968896879561134f87956113669560c098604489015260a08b0135606489015260e0608489015260e4880191614a82565b9260a48601526003198584030160c4860152614a82565b03920135305af1801561098e57611384575b50506001905b0161124a565b8161138e916147c2565b61098a57845f611378565b8880fd5b8780fd5b8580fd5b50505060019061137e565b604051638e9e709960e01b8152858082600481335afa908115610f665780916113fa575b604051638351eea760e01b815260206004820152806113f66024820185614509565b0390fd5b90503d8082843e61140b81846147c2565b820191602081840312610f5b578051906001600160401b03821161099957019082601f8301121561047c57506113f69181602061144a935191016148a8565b826113d4565b503461047c57606036600319011261047c5761146a6146f4565b61147261474c565b91604435906001600160401b03821161047c576114b66114a2858561149a366004880161458f565b929091614cb9565b604051918291602083526020830190614509565b0390f35b503461047c57602036600319011261047c5760206105886114d96146f4565b63ffffffff165f525f516020615dd35f395f51905f5260205260405f205490565b503461047c57602036600319011261047c576004356003811015610f5b579060409181525f516020615d935f395f51905f5260205220600163ffffffff825416910154906114b6604051928392836020909392919363ffffffff60408201951681520152565b503461047c576020906115723661465b565b9061157e9492946150e5565b5f516020615e335f395f51905f5254604051633a358bdd60e21b815295869384936115ba936001600160a01b0316923392919060048701614a24565b0381734abbedef694143da297f6d18b019da7b1870140c5af4908115610f6657906115eb575b602090604051908152f35b506020813d60201161161a575b81611605602093836147c2565b8101031261161657602090516115e0565b5f80fd5b3d91506115f8565b503461047c57602036600319011261047c576004356001600160401b038111610f5b57611653903690600401614878565b61165b61522d565b825b81811061175d575060405191816020840160208552526040830160408360051b85010192828690605e19813603015b8383106116bd57887fbe4864a8e820971c0247f5992e2da559595f7bf076a21cb5928d443d2a13b6748989038aa180f35b909192939495603f1988820301865286358281121561175957830163ffffffff6116e682614707565b168252602081013561ffff81168091036110935760208301526040810135601e19823603018112156110935701602081359101906001600160401b0381116110935780360382136110935761174b602092839260608681604060019901520191614a82565b98019601949301919061168c565b8980fd5b92919061178161177b611771868486614c0d565b6040810190614c43565b906158b0565b61178f611771858385614c0d565b63ffffffff6117aa6117a58886889a969a614c0d565b61492f565b1685527f8d2bda5d9f6ffb5796910376005392955773acee5548d0fcdb10e7c264ea00006020526040852060206117e2848688614c0d565b013561ffff8116810361191d5761ffff165f5260205260405f20906001600160401b038111611909576118158254614af4565b601f81116118ce575b508596601f821160011461186757908087986118539360019798999261185c575b50508160011b915f199060031b1c19161790565b90555b0161165d565b013590505f8061183f565b8287526020872090601f198316885b8181106118b657509060019697989984889594931061189d575b505050811b019055611856565b01355f19600384901b60f8161c191690555f8080611890565b99926020600181928686013581550194019a01611876565b6118f99083885260208820601f840160051c810191602085106118ff575b601f0160051c0190614c75565b5f61181e565b90915081906118ec565b634e487b7160e01b86526041600452602486fd5b8680fd5b503461047c578060031936011261047c577fefb041d771d6daaa55702fff6eb740d63ba559a75d2d1d3e151c78ff2480b600546040516001600160a01b039091168152602090f35b503461047c57604036600319011261047c57602061199661198861452d565b611990614543565b906157c0565b6040519015158152f35b503461047c576020906119b23661465b565b906119be9492946150e5565b5f516020615e335f395f51905f5254604051632b29888360e01b815295869384936115ba936001600160a01b0316923392919060048701614a24565b503461047c57602036600319011261047c576020610588600435614b5a565b503461047c57602036600319011261047c57610be88160409250600281525f516020615ed35f395f51905f52602052610bd483822091610bcf610b9d614f8b565b503461047c57604036600319011261047c57611a81611a7761452d565b6024359033615110565b602060405160018152f35b503461047c578060031936011261047c57602090604051908152f35b503461047c57602036600319011261047c5780611ac361452d565b611acb6150e5565b734f0530d72412d10741dbd3e09e8cdb2ccb322ccd90813b15610b595760405163572c248f60e11b81525f516020615e735f395f51905f5260048201526001600160a01b039091166024820152908290829060449082905af4801561098e57610b485750f35b503461047c578060031936011261047c5760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b503461047c578060031936011261047c576040516395d89b4160e01b815281816004817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa90811561098e57826114b69392611be3575b5050604051918291602083526020830190614509565b611bff92503d8091833e611bf781836147c2565b8101906148de565b5f80611bcd565b503461047c57604036600319011261047c576020600435610588611c28614543565b91611c3281614b5a565b8093336154bb565b503461047c578060031936011261047c575f516020615eb35f395f51905f52546040516001600160a01b039091168152602090f35b503461047c578060031936011261047c57602060405160068152f35b503461047c578060031936011261047c577fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d100541580611db0575b15611d7357611d1790611cd66155a3565b90611cdf615670565b906020611d2560405193611cf383866147c2565b8385525f368137604051968796600f60f81b885260e08589015260e0880190614509565b908682036040880152614509565b904660608601523060808601528260a086015284820360c08601528080855193848152019401925b828110611d5c57505050500390f35b835185528695509381019392810192600101611d4d565b60405162461bcd60e51b81526020600482015260156024820152741152540dcc4c8e88155b9a5b9a5d1a585b1a5e9959605a1b6044820152606490fd5b507fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d1015415611cc5565b503461047c57366003190160a08112610f5b5760601361047c576064356001600160401b038111610f5b57611e1290369060040161458f565b50506084356001600160a01b03811690819003610f5b576020906040519030148152f35b503461047c57611e453661465b565b611e509392936150e5565b604051634b94dd8f60e11b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116600483018190529083166024830152306044830152606482018690529290602081608481736403f298dbf3fcaba1b91cb87bb08a7802a24ce35af4801561111f57611ef1575b506115ba60209360405196879485946251533760e71b8652339260048701614a24565b6020813d602011611f1b575b81611f0a602093836147c2565b8101031261161657506115ba611ece565b3d9150611efd565b503461047c57604036600319011261047c57602090611f406146f4565b50604051908152f35b905034610f5b576020366003190112610f5b576004356001600160a01b0381169190829003610999575f516020615eb35f395f51905f52546001600160a01b03163314908115611fe0575b5015610f5b575f516020615d535f395f51905f5280546001600160a01b03191682179055337fdefab8204f3d7db070ae44700a6ce84f9a66ba6b280478ae65e48177cd2cb67e8380a380f35b5f516020615d535f395f51905f525460405163b700961360e01b81523360048201523060248201526001600160e01b0319929092166044830152909150602090829060649082906001600160a01b03165afa908115612076578391612047575b505f611f94565b612069915060203d60201161206f575b61206181836147c2565b810190614b2c565b5f612040565b503d612057565b6040513d85823e3d90fd5b823461047c578060031936011261047c575f516020615d735f395f51905f52546001600160a01b03163381900361211d575f516020615eb35f395f51905f5280546001600160a01b031980821684179092555f516020615d735f395f51905f5280549092169091556001600160a01b0391821691167f41d91c43805b25f14b05b0279a83da8895d24b5ac3083afdd926be2cd23785968380a380f35b6344bd9b6360e11b8252600482fd5b823461047c5761213b3661465b565b6121436150e5565b61214b6150b0565b604051634b94dd8f60e11b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03818116600484015283166024830152306044830152606482018590529290602081608481736403f298dbf3fcaba1b91cb87bb08a7802a24ce35af48015612303576122d1575b505f516020615e335f395f51905f5254604093612258916001600160a01b03166121ef614f8b565b8651635b955d1b60e01b81525f516020615e735f395f51905f52600482015260248101989098526001600160a01b039485166044890152948416606488015233608488015290831660a487015290911660c485015260e484019190915282908190610104820190565b0381734abbedef694143da297f6d18b019da7b1870140c5af4801561098e578260409392819261229f575b505f516020615e535f395f51905f525d82519182526020820152f35b9092506122c29150833d85116122ca575b6122ba81836147c2565b810190614b44565b909184612283565b503d6122b0565b6020813d6020116122fb575b816122ea602093836147c2565b8101031261161657506122586121c7565b3d91506122dd565b6040513d88823e3d90fd5b823461047c578060031936011261047c5760049061232a6150e5565b6001623f026d60e01b03198152fd5b823461047c5760c036600319011261047c5761235361452d565b61235b614543565b906044359182151580930361099d5760a435916001600160401b03831161098a573660238401121561098a5761239d60209336906024816004013591016147fe565b61246b6123a8615bfc565b6123b0615c66565b60405190878201927f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f8452604083015260608201524660808201523060a082015260a0815261240060c0826147c2565b5190209160405196879586956347e068ad60e01b87525f516020615e735f395f51905f52600488015260018060a01b0316602487015260018060a01b031660448601526064850152606435608485015260843560a485015261010060c4850152610104840190614509565b9060e48301520381739b1a22e38b43f551cbff28b9813ca8e178994e565af490811561098e57602092916124a5575b506040519015158152f35b6124bc9150823d841161206f5761206181836147c2565b8261249a565b823461047c57602036600319011261047c576124dc61452d565b6040516370a0823160e01b81526001600160a01b0391821660048201529190602090839060249082907f0000000000000000000000000000000000000000000000000000000000000000165afa908115610f6657906115eb57602090604051908152f35b823461047c578061255036614630565b906125596150e5565b734f0530d72412d10741dbd3e09e8cdb2ccb322ccd91823b156125aa576040516394e1473760e01b815292849284928391829161259991600484016149e0565b03915af4801561098e57610b485750f35b505050fd5b823461047c57602036600319011261047c577ff0be4f1e87349231d80c36b33f9e8639658eeaf474014dee15a3e6a4d441419760206125ec61452d565b6125f461522d565b7f41db8a78b0206aba5c54bcbfc2bda0d84082a84eb88e680379a57b9e9f653c0080546001600160a01b0319166001600160a01b03929092169182179055604051908152a180f35b823461047c57604036600319011261047c57602060043561058861265e614543565b61266783614ee5565b928391336154bb565b823461047c578060031936011261047c576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b823461047c57602061274b6126c936614695565b6126d8989496929791986150e5565b6126e06150b0565b7f000000000000000000000000000000000000000000000000000000000000000098604051988995869563050e3c7d60e41b87528c8b30917f00000000000000000000000000000000000000000000000000000000000000009060018060a01b031660048b01614aa2565b0381736403f298dbf3fcaba1b91cb87bb08a7802a24ce35af492831561111f57859361279d575b505f516020615e335f395f51905f5254929360409361225891906001600160a01b03166121ef614f8b565b92506020833d6020116127cb575b816127b8602093836147c2565b8101031261161657915191612258612772565b3d91506127ab565b823461047c578060031936011261047c576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b823461047c57604036600319011261047c5760206128346146f4565b61285b6024359163ffffffff165f525f516020615dd35f395f51905f5260205260405f2090565b5414604051908152f35b823461047c578060031936011261047c577f8d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c20a546040516001600160a01b039091168152602090f35b823461047c57604036600319011261047c576128c761452d565b6128cf614718565b6040516392f3931960e01b81525f516020615e735f395f51905f5260048201526001600160a01b03909216602483015215156044820152336064820152602081608481739b1a22e38b43f551cbff28b9813ca8e178994e565af490811561098e57602092916124a557506040519015158152f35b823461047c57604036600319011261047c5761295d6146f4565b63ffffffff61296a61474c565b911682527f8d2bda5d9f6ffb5796910376005392955773acee5548d0fcdb10e7c264ea000060205261ffff6040832091165f5260205260405f209060405191818154916129b683614af4565b8086529260018116908115612a1f57506001146129de575b6114b6856114a2818703826147c2565b815260208120939250905b808210612a05575090915081016020016114a2826114b66129ce565b9192600181602092548385880101520191019092916129e9565b8695506114b6969350602092506114a294915060ff191682840152151560051b82010192936129ce565b823461047c578060031936011261047c576114b6604051612a6b6040826147c2565b60058152640312e312e360dc1b6020820152604051918291602083526020830190614509565b823461047c5760c036600319011261047c57612aab61452d565b612ab3614543565b906044356001600160a01b0381169081900361099d57612ad1614559565b926084359360a4359360018060a01b03851680950361191d575f516020615e935f395f51905f52549460ff8660401c1615956001600160401b03811680159081613378575b600114908161336e575b159081613365575b506133565767ffffffffffffffff1981166001175f516020615e935f395f51905f52558661332a575b50604096875192612b6289856147c2565b60058452640312e312e360dc1b6020850152612b7c615a3e565b612b84615a3e565b6001600160a01b031694851561331b576001600160a01b031693841561331b576001600160a01b031694851561331b57885163313ce56760e01b8152602081600481895afa801561331157612be0918c916132e2575b506158ed565b8210156132d357908992916bffffffffffffffffffffffff60a01b5f516020615e135f395f51905f525416175f516020615e135f395f51905f52558280525f516020615d935f395f51905f5260205288832062030d4063ffffffff19825416179055600183525f516020615d935f395f51905f5260205288832062030d4063ffffffff19825416179055600283525f516020615d935f395f51905f5260205288832062030d4063ffffffff198254161790555f516020615e735f395f51905f5255734f0530d72412d10741dbd3e09e8cdb2ccb322ccd90813b1561099957829060448a518094819363572c248f60e11b83525f516020615e735f395f51905f52600484015260248301525af480156132c9576132b4575b505085516306fdde0360e01b815287816004817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa9081156132aa578891613290575b50612d4d615a3e565b612d55615a3e565b8051906001600160401b03821161327c57612d7d5f516020615db35f395f51905f5254614af4565b601f8111613222575b50602090601f83116001146131a657612db592918a918361319b5750508160011b915f199060031b1c19161790565b5f516020615db35f395f51905f52555b8051906001600160401b03821161318757612ded5f516020615df35f395f51905f5254614af4565b601f811161312d575b50602090601f83116001146130b157612e2592918991836130a65750508160011b915f199060031b1c19161790565b5f516020615df35f395f51905f52555b857fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10055857fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10155612e83615a3e565b612e8b615a3e565b612e9481615cab565b901561309e575b5f516020615e335f395f51905f52549060ff60a01b9060a01b16906affffffffffffffffffffff60a81b1617175f516020615e335f395f51905f5255612edf615a3e565b612ee7615a3e565b5f516020615eb35f395f51905f5280546001600160a01b03191682179055847f41d91c43805b25f14b05b0279a83da8895d24b5ac3083afdd926be2cd23785968180a35f516020615d535f395f51905f5280546001600160a01b031916905583337fdefab8204f3d7db070ae44700a6ce84f9a66ba6b280478ae65e48177cd2cb67e8280a3612f74615a3e565b612f7c615a3e565b612f84615a3e565b612f8c615a3e565b801561308f5783907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690813b15610999578291602483928751948593849263ca5eb5e160e01b845260048401525af1801561308557613070575b5050612ff9615a3e565b613001615a3e565b613009615a3e565b613011615a3e565b613019575080f35b60207fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29168ff0000000000000000195f516020615e935f395f51905f5254165f516020615e935f395f51905f52555160018152a180f35b8161307a916147c2565b610999578284612fef565b84513d84823e3d90fd5b632d618d8160e21b8452600484fd5b506012612e9b565b01519050898061183f565b5f516020615df35f395f51905f5289528189209190601f1984168a5b81811061311557509084600195949392106130fd575b505050811b015f516020615df35f395f51905f5255612e35565b01515f1960f88460031b161c191690558880806130e3565b929360206001819287860151815501950193016130cd565b5f516020615df35f395f51905f528952613181907f5f9ce34815f8e11431c7bb75a8e6886a91478f7ffc1dbb0a98dc240fddd76b75601f850160051c810191602086106118ff57601f0160051c0190614c75565b88612df6565b634e487b7160e01b88526041600452602488fd5b015190508a8061183f565b5f516020615db35f395f51905f528a52818a209190601f1984168b5b81811061320a57509084600195949392106131f2575b505050811b015f516020615db35f395f51905f5255612dc5565b01515f1960f88460031b161c191690558980806131d8565b929360206001819287860151815501950193016131c2565b5f516020615db35f395f51905f528a52613276907f42ad5d3e1f2e6e70edcf6d991b8a3023d3fca8047a131592f9edb9fd9b89d57d601f850160051c810191602086106118ff57601f0160051c0190614c75565b89612d86565b634e487b7160e01b89526041600452602489fd5b6132a491503d808a833e611bf781836147c2565b88612d44565b87513d8a823e3d90fd5b816132be916147c2565b61191d578688612cf7565b88513d84823e3d90fd5b636a43f8d160e01b8a5260048afd5b613304915060203d60201161330a575b6132fc81836147c2565b810190614a69565b8c612bda565b503d6132f2565b8a513d8d823e3d90fd5b63d92e233d60e01b8a5260048afd5b68ffffffffffffffffff191668010000000000000001175f516020615e935f395f51905f525588612b51565b63f92ee8a960e01b8952600489fd5b9050158a612b28565b303b159150612b20565b889150612b16565b823461047c578060031936011261047c576020604051308152f35b823461047c578060031936011261047c575f516020615e135f395f51905f52546040516001600160a01b039091168152602090f35b61456f565b823461047c57602036600319011261047c57806133f061452d565b6133f86150e5565b5f516020615e335f395f51905f5254734f0530d72412d10741dbd3e09e8cdb2ccb322ccd91906001600160a01b0316823b156125aa5760405163c572912760e01b81525f516020615e735f395f51905f5260048201526001600160a01b0390921660248301526044820152908290829060649082905af4801561098e57610b485750f35b823461047c57604036600319011261047c576004356001600160401b038111610f5b57806004019060e06003198236030112610999576134ba614718565b906134c3614917565b506134db6044610ca9606484013593610c7d8761492f565b908082106135e65750916040916135006134f86135579584615260565b91909361492f565b92613509614917565b5061351384615074565b63ffffffff8651956135248761478c565b168552602085015284840152606083015215156080820152815180938192631bb8518b60e31b835230906004840161544d565b03817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa90811561098e5782916135a8575b60408260208251918051835201516020820152f35b905060403d6040116135df575b6135bf81836147c2565b81019160408284031261047c57506040916135d991615425565b82613593565b503d6135b5565b6371c4efed60e01b8552600491909152602452604483fd5b823461047c578060031936011261047c575f516020615e335f395f51905f52546040516001600160a01b039091168152602090f35b823461047c57604036600319011261047c5761364d61452d565b906136566150e5565b61365e6150b0565b5f516020615e335f395f51905f52546001600160a01b031661367e614f8b565b604051639298f11760e01b81525f516020615e735f395f51905f5260048201526001600160a01b039485166024808301919091523560448201527f00000000000000000000000000000000000000000000000000000000000000009094166064850152608484019190915260a483015260208260c481734abbedef694143da297f6d18b019da7b1870140c5af4908115610f66578091613734575b602092505f516020615e535f395f51905f525d604051908152f35b90506020823d602011613761575b8161374f602093836147c2565b81010312611616576020915190613719565b3d9150613742565b823461047c57602036600319011261047c576004356003811015610f5b579060409181525f516020615ed35f395f51905f5260205220600163ffffffff825416910154906114b6604051928392836020909392919363ffffffff60408201951681520152565b823461047c57604036600319011261047c577f238399d427b947898edb290f5ff0f9109849b1c3ba196a42e35f00c50a54b98b61380a6146f4565b6024359061381661522d565b63ffffffff168084525f516020615dd35f395f51905f5260209081526040808620849055805192835290820192909252a180f35b823461047c576138d960209161385f36614695565b61386e999496929891996150e5565b60018060a01b037f00000000000000000000000000000000000000000000000000000000000000001699604051998a95869563050e3c7d60e41b87528d8b30917f00000000000000000000000000000000000000000000000000000000000000009060048b01614aa2565b0381736403f298dbf3fcaba1b91cb87bb08a7802a24ce35af4938415612076578394613925575b506115ba602093949560405196879485946251533760e71b8652339260048701614a24565b9293506020833d602011613955575b81613941602093836147c2565b8101031261161657915192916115ba613900565b3d9150613934565b823461047c578060031936011261047c5760405163313ce56760e01b81526020816004817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa90811561098e57602092916139c9575b5060ff60405191168152f35b6139e09150823d841161330a576132fc81836147c2565b826139bd565b823461047c57806139f63661465b565b906139ff6150e5565b734abbedef694143da297f6d18b019da7b1870140c803b1561098a57604051631797c6ad60e01b8152938593859384928392612599927f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316923392919060048701614a24565b823461047c57606036600319011261047c57613a8761452d565b613a8f614543565b60443591613a9d3382614e7a565b5f198110613ab1575b50611a819350615110565b838110613b47576001600160a01b03821615613b33573315613b1f576001600160a01b0382165f9081527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace01602090815260408083203384529091529020908490039055611a81935084613aa6565b634a1406b160e11b85526004859052602485fd5b63e602df0560e01b85526004859052602485fd5b637dc7a0d960e11b8552336004526024526044839052606484fd5b823461047c578060031936011261047c57602060405160018152f35b823461047c5780613b8e36614630565b90613b976150e5565b734f0530d72412d10741dbd3e09e8cdb2ccb322ccd91823b156125aa5760405163b003923d60e01b815292849284928391829161259991600484016149e0565b823461047c578060031936011261047c576020610588614961565b823461047c57604036600319011261047c5760043590600382101561047c57613c19614543565b613c216150b0565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163303613cf4575f516020615e335f395f51905f52546040516375ba8a9960e11b81525f516020615e735f395f51905f526004820152936001600160a01b039091169190613c9c906024860190614940565b6001600160a01b031660448401526064830152602082608481734f0530d72412d10741dbd3e09e8cdb2ccb322ccd5af4908115610f6657809161373457602092505f516020615e535f395f51905f525d604051908152f35b63f22eef3d60e01b8252600482fd5b823461047c578060031936011261047c57604080516001815260026020820152f35b823461047c578060031936011261047c576040805162b9270b60e21b815260016020820152f35b823461047c578060031936011261047c57602060405160028152f35b82613d72366145bc565b50507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169492905033850361405357613dba613db58461492f565b615074565b602084013580910361402f5750816020116116165780356001600160a01b031694613e2b613de88484614c8b565b6001600160c01b03199135918216916008821061400f5750507f00000000000000000000000000000000000000000000000000000000000000009060c01c615960565b92613e358561492f565b507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316803b1561161657604051631ceb5d1960e11b81525f6004820181905260248201819052604482018190526001600160a01b038a166064830152608482018790529091829060a490829084905af1801561400457613feb575b509081602889949311613ef4575b505050506108487fefed6d3500546b29533b128a29e3a94d70788727f0507505ac12eaf2e578fd9c9261492f565b6040860135906001600160401b038216820361098a57613f7b916020613f2961089884604c95613f238d61492f565b99614c9c565b6040519687936001600160401b0360c01b9060c01b168385015263ffffffff60e01b9060e01b16602884015288602c8401528051918291018484015e810186838201520301601f1981018452836147c2565b803b1561099957613fc08392918392604051948580948193633e5ac80960e11b83528d60048401528c6024840152836044840152608060648401526084830190614509565b03925af1801561098e57613fd6575b8080613ec6565b81613fe0916147c2565b61098a578486613fcf565b613ffa91939298505f906147c2565b5f96909188613eb8565b6040513d5f823e3d90fd5b6001600160c01b031960089290920360031b82901b161690508980610755565b63ffffffff61403d8561492f565b63309afaf360e21b5f521660045260245260445ffd5b6391ac5e4f60e01b5f523360045260245ffd5b34611616575f366003190112611616577f41db8a78b0206aba5c54bcbfc2bda0d84082a84eb88e680379a57b9e9f653c00546040516001600160a01b039091168152602090f35b34611616576020366003190112611616576004356001600160401b0381116116165760e06003198236030112611616576140e5614917565b506140ee614917565b506040516140fb8161475d565b5f815260208101905f1982526020926040519161411885846147c2565b5f83526141356044610ca9606485013594610c7d8160040161492f565b918083106141df5750936040519461414c8661475d565b8286528186019283526040519460a0860191518652518286015260a06040860152835180915260c08501918060c08360051b8801019501925f905b8382106141a257885160608901528551608089015287870388f35b909192939583806141d060019360bf198c82030186526040838c518051845201519181858201520190614509565b98019201920190939291614187565b826371c4efed60e01b5f5260045260245260445ffd5b34611616575f3660031901126116165760205f516020615e735f395f51905f5254604051908152f35b346116165760403660031901126116165761423761452d565b6024359033156142d4576001600160a01b03169081156142c157335f9081527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace0160205260409020825f526020528060405f20556040519081527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560203392a3602060405160018152f35b634a1406b160e11b5f525f60045260245ffd5b63e602df0560e01b5f525f60045260245ffd5b3461161657602036600319011261161657614303610b9d614f8b565b604051908152602090f35b634e487b7160e01b5f52601160045260245ffd5b34611616575f366003190112611616576040516306fdde0360e01b81525f816004817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa8015614004576114b6915f91614396575b50604051918291602083526020830190614509565b6143aa91503d805f833e611bf781836147c2565b82614381565b34611616576020366003190112611616576004356003811015611616575f527f8d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c209602052602060405f2054604051908152f35b346116165760203660031901126116165760043563ffffffff60e01b81168091036116165760209063e3bc4e6560e01b81149081156144a6575b8115614495575b8115614484575b8115614473575b811561446257506040519015158152f35b63a219a02560e01b1490508261249a565b6336372b0760e01b81149150614451565b632f0a18c560e01b8114915061444a565b631883ba3960e21b81149150614443565b6301ffc9a760e01b8114915061443c565b34611616575f366003190112611616576143036144d2614961565b6144da614f8b565b6145037f00000000000000000000000000000000000000000000000000000000000000006158fe565b91615b5e565b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b600435906001600160a01b038216820361161657565b602435906001600160a01b038216820361161657565b606435906001600160a01b038216820361161657565b34611616576020366003190112611616576313bdc27160e21b5f5260045ffd5b9181601f84011215611616578235916001600160401b038311611616576020838186019501011161161657565b90600319820160e081126116165760601361161657600491606435916084356001600160401b03811161161657826145f69160040161458f565b9092909160a4356001600160a01b0381168103611616579160c435906001600160401b0382116116165761462c9160040161458f565b9091565b9060606003198301126116165760043560038110156116165760409092602319011261161657602490565b606090600319011261161657600435906024356001600160a01b038116810361161657906044356001600160a01b03811681036116165790565b9060c060031983011261161657600435916024356001600160a01b038116810361161657916044356001600160a01b03811681036116165791606435916084359160a435906001600160401b0382116116165761462c9160040161458f565b6004359063ffffffff8216820361161657565b359063ffffffff8216820361161657565b60243590811515820361161657565b346116165760203660031901126116165761474061452d565b5060206040515f198152f35b6024359061ffff8216820361161657565b604081019081106001600160401b0382111761477857604052565b634e487b7160e01b5f52604160045260245ffd5b60a081019081106001600160401b0382111761477857604052565b606081019081106001600160401b0382111761477857604052565b90601f801991011681019081106001600160401b0382111761477857604052565b6001600160401b03811161477857601f01601f191660200190565b92919261480a826147e3565b9161481860405193846147c2565b829481845281830111611616578281602093845f960137010152565b34611616575f366003190112611616576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b9181601f84011215611616578235916001600160401b038311611616576020808501948460051b01011161161657565b9291926148b4826147e3565b916148c260405193846147c2565b829481845281830111611616578281602093845f96015e010152565b602081830312611616578051906001600160401b03821161161657019080601f83011215611616578151614914926020016148a8565b90565b604051906149248261475d565b5f6020838281520152565b3563ffffffff811681036116165790565b90600382101561494d5752565b634e487b7160e01b5f52602160045260245ffd5b6040516318160ddd60e01b81526020816004817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa908115614004575f916149b1575090565b90506020813d6020116149d8575b816149cc602093836147c2565b81010312611616575190565b3d91506149bf565b9092916020606091614a0960808501965f516020615e735f395f51905f52865283860190614940565b63ffffffff614a1782614707565b1660408501520135910152565b5f516020615e735f395f51905f52815260208101919091526001600160a01b03918216604082015291811660608301529182166080820152911660a082015260c00190565b90816020910312611616575160ff811681036116165790565b908060209392818452848401375f828201840152601f01601f1916010190565b6001600160a01b0391821681529181166020830152918216604082015291166060820152608081019190915260a081019190915260c081019190915261010060e0820181905261491493910191614a82565b90600182811c92168015614b22575b6020831014614b0e57565b634e487b7160e01b5f52602260045260245ffd5b91607f1691614b03565b90816020910312611616575180151581036116165790565b9190826040910312611616576020825192015190565b60015f525f516020615ed35f395f51905f526020527f629ac872e9f7661e92a1b088b8cebc1bdb10a91e22c7662916a2978e670740e6614b98614f8b565b91614bc27f00000000000000000000000000000000000000000000000000000000000000006158fe565b614bcd818584615b5e565b908015614bf95761491494614be59309151590615757565b90600163ffffffff82541691015491615764565b634e487b7160e01b5f52601260045260245ffd5b9190811015614c2f5760051b81013590605e1981360301821215611616570190565b634e487b7160e01b5f52603260045260245ffd5b903590601e198136030182121561161657018035906001600160401b0382116116165760200191813603831361161657565b818110614c80575050565b5f8155600101614c75565b906028116116165760200190600890565b909291928360281161161657831161161657602801916027190190565b63ffffffff90949294165f527f8d2bda5d9f6ffb5796910376005392955773acee5548d0fcdb10e7c264ea000060205261ffff60405f2091165f5260205260405f20604051905f9082815492614d0e84614af4565b9283835260208301946001811690815f14614e295750600114614de5575b50614d39925003836147c2565b815115614dd7578315614dd0576002841015614d77575050604051639a6d49cd60e01b8152602060048201529283926113f692506024840191614a82565b9092614d85818694966158b0565b806002116116165761491492602092604051955180918588015e8501908382015f8152600260011985019201903701015f60011982015282600119910301601f1981018352826147c2565b5092509050565b5050916149149136916147fe565b90505f9291925260205f20905f915b818310614e0d575050906020614d39928201015f614d2c565b6020919350806001915483858901015201910190918492614df4565b60ff1916865250614d3993151560051b830160200191505f9050614d2c565b60405190614e55826147a7565b815f81525f60208201526040805191614e6d8361475d565b5f83525f60208401520152565b604051636eb1769f60e11b81526001600160a01b03918216600482015291166024820152602081806044810103817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa908115614004575f916149b1575090565b60015f525f516020615ed35f395f51905f526020527f629ac872e9f7661e92a1b088b8cebc1bdb10a91e22c7662916a2978e670740e6547f629ac872e9f7661e92a1b088b8cebc1bdb10a91e22c7662916a2978e670740e75461491492614f529263ffffffff169061571d565b50614f5b614f8b565b90614f857f00000000000000000000000000000000000000000000000000000000000000006158fe565b90615b5e565b5f516020615e135f395f51905f52545f516020615e335f395f51905f5254604051634104b9ed60e11b81526001600160a01b039182166004820152929160209184916024918391165afa918215614004575f92615040575b50818015615031575f516020615e735f395f51905f5254811090811561501a575b5061500b57565b632e2039ab60e21b5f5260045ffd5b6c0c9f2c9cd04674edea400000009150115f615004565b636a43f8d160e01b5f5260045ffd5b9091506020813d60201161506c575b8161505c602093836147c2565b810103126116165751905f614fe3565b3d915061504f565b63ffffffff16805f525f516020615dd35f395f51905f5260205260405f205490811561509e575090565b63f6ff4fb760e01b5f5260045260245ffd5b5f516020615e535f395f51905f525c6150d65760015f516020615e535f395f51905f525d565b633ee5aeb560e01b5f5260045ffd5b6150fa5f356001600160e01b03191633615973565b1561510157565b6344bd9b6360e11b5f5260045ffd5b6001600160a01b031690811561521a576001600160a01b031691821561520757815f527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace0060205260405f20548181106151ee57817fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92602092855f527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace0084520360405f2055845f527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00825260405f20818154019055604051908152a3565b8263391434e360e21b5f5260045260245260445260645ffd5b63ec442f0560e01b5f525f60045260245ffd5b634b637e8f60e11b5f525f60045260245ffd5b5f516020615eb35f395f51905f52546001600160a01b0316330361524d57565b63118cdaa760e01b5f523360045260245ffd5b90916152926020830135937f000000000000000000000000000000000000000000000000000000000000000090615956565b6001600160401b03811161541357615333906152b461089860a0860186614c43565b80511580159691906153de5761530e916020606892604051958693838501526001600160401b0360c01b9060c01b1660408401523360488401528051918291018484015e81015f838201520301601f1981018352826147c2565b925b83945f146153d6576002905b61149a6153288261492f565b916080810190614c43565b7f41db8a78b0206aba5c54bcbfc2bda0d84082a84eb88e680379a57b9e9f653c00549092906001600160a01b03168061536a575050565b6153986020916153aa9360405180958194829363043a78eb60e01b8452604060048501526044840190614509565b82810360031901602484015289614509565b03915afa8015614004576153bb5750565b6153d39060203d60201161206f5761206181836147c2565b50565b60019061531c565b50906040519160208301526001600160401b0360c01b9060c01b1660408201526028815261540d6048826147c2565b92615310565b63e2ce941360e01b5f5260045260245ffd5b91908260409103126116165760405161543d8161475d565b6020808294805184520151910152565b906020909392936040835263ffffffff815116604084015281810151606084015260806154a161548b604084015160a08488015260e0870190614509565b6060840151868203603f190160a0880152614509565b910151151560c08401526001600160a01b03909416910152565b5f516020615e335f395f51905f52549293907375258e4991d7b7bbb3f25fd07e47816a62bddfea6154f75f356001600160e01b03191633615973565b813b1561161657604051637904fa1360e01b81525f516020615e735f395f51905f5260048201526001600160a01b0393841660248201529483166044860152606485019690965260848401929092527f0000000000000000000000000000000000000000000000000000000000000000811660a484015290921660c482015291151560e48301525f9082906101049082905af48015614004576155975750565b5f6155a1916147c2565b565b604051905f825f516020615db35f395f51905f5254916155c283614af4565b808352926001811690811561565157506001146155e6575b6155a1925003836147c2565b505f516020615db35f395f51905f525f90815290917f42ad5d3e1f2e6e70edcf6d991b8a3023d3fca8047a131592f9edb9fd9b89d57d5b8183106156355750509060206155a1928201016155da565b602091935080600191548385890101520191019091849261561d565b602092506155a194915060ff191682840152151560051b8201016155da565b604051905f825f516020615df35f395f51905f52549161568f83614af4565b808352926001811690811561565157506001146156b2576155a1925003836147c2565b505f516020615df35f395f51905f525f90815290917f5f9ce34815f8e11431c7bb75a8e6886a91478f7ffc1dbb0a98dc240fddd76b755b8183106157015750509060206155a1928201016155da565b60209193508060019154838589010152019101909184926156e9565b9163ffffffff8216158061574f575b6157485761573a9183615a69565b9081810390811161430e5791565b5050905f90565b50801561572c565b9190820180921161430e57565b91909180156157b95763ffffffff9161577c91615757565b911680156157b557620f424003620f4240811161430e575f19820191821161430e576157a791615aba565b6001810180911161430e5790565b5090565b5050505f90565b6001600160a01b038181165f9081527f8d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c2036020908152604080832086851684529091529020547f8d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c20a54929360ff90911692909116801561583f578215615846575b5050905090565b604051635b1b1e7960e11b81526001600160a01b0394851660048201529190931660248201529160209150829060449082905afa908115614004575f91615891575b50805f8061583f565b6158aa915060203d60201161206f5761206181836147c2565b5f615888565b9080600211611616576003823560f01c036158c9575050565b6113f6604051928392639a6d49cd60e01b8452602060048501526024840191614a82565b60ff16604d811161430e57600a0a90565b60405163313ce56760e01b815290602090829060049082906001600160a01b03165afa801561400457614914915f9161593757506158ed565b615950915060203d60201161330a576132fc81836147c2565b5f612bda565b8115614bf9570490565b8181029291811591840414171561430e57565b5f516020615d535f395f51905f52546001600160a01b03168015159290836159c4575b505081156159a2575090565b5f516020615eb35f395f51905f52546001600160a01b03918216911614919050565b60405163b700961360e01b81526001600160a01b03841660048201523060248201526001600160e01b031992909216604483015291925090602090829060649082905afa908115614004575f91615a1f575b50905f80615996565b615a38915060203d60201161206f5761206181836147c2565b5f615a16565b60ff5f516020615e935f395f51905f525460401c1615615a5a57565b631afcd79f60e31b5f5260045ffd5b90929181811015615ab55763ffffffff81941680615a92575b5050808311615a8e5750565b9150565b615aa491929450620f42409085615b5e565b615aad91615757565b915f80615a82565b509150565b5f19620f4240820991620f4240820291828085109403938085039414615b525783821115615b3a57620f4240829109815f0382168092046002816003021880820260020302808202600203028082026002030280820260020302808202600203028091026002030293600183805f03040190848311900302920304170290565b50634e487b715f52156003026011186020526024601cfd5b50906149149250615956565b90915f198383099280830292838086109503948086039514615bef5784831115615bd75790829109815f0382168092046002816003021880820260020302808202600203028082026002030280820260020302808202600203028091026002030293600183805f03040190848311900302920304170290565b82634e487b715f52156003026011186020526024601cfd5b5050906149149250615956565b615c046155a3565b8051908115615c14576020012090565b50507fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d100548015615c415790565b507fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47090565b615c6e615670565b8051908115615c7e576020012090565b50507fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d101548015615c415790565b5f8091604051602081019063313ce56760e01b825260048152615ccf6024826147c2565b51916001600160a01b03165afa3d15615d4a573d90615ced826147e3565b91615cfb60405193846147c2565b82523d5f602084013e5b80615d3e575b615d17575b505f905f90565b60208151918180820193849201010312611616575160ff8111615d10579060ff6001921690565b50602081511015615d0b565b606090615d0556fe341f7c713c76cb881fd7047f7cccebe3fe10eddfc5e20fe83ee7e0b505e8ea01341f7c713c76cb881fd7047f7cccebe3fe10eddfc5e20fe83ee7e0b505e8ea028d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c207a16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10272ab1bc1039b79dc4724ffca13de82c96834302d3c7e0d4252232d4b2dd8f900a16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d1038d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c2020773e532dfede91f04b12a73d3d2acd361424f41f76b4fb79f090161e36b4e009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f008d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c200f0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00341f7c713c76cb881fd7047f7cccebe3fe10eddfc5e20fe83ee7e0b505e8ea008d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c208a26469706673582212209458a96d718343c8bf886eb8f28f78ff487484340d09a9f314e1f9b872e9fb3664736f6c634300081e0033f0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f000000000000000000000000c1b15d3b262beec0e3565c11c9e0f6134bdacb36000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3","name":"NestVaultOFT","is_blueprint":false,"license_type":"none","is_fully_verified":false,"is_verified_via_eth_bytecode_db":true,"language":"solidity","evm_version":"osaka","can_be_visualized_via_sol2uml":true,"is_verified_via_sourcify":false,"additional_sources":[{"file_path":"node_modules/@openzeppelin/contracts/utils/cryptography/ECDSA.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n    enum RecoverError {\n        NoError,\n        InvalidSignature,\n        InvalidSignatureLength,\n        InvalidSignatureS\n    }\n\n    /**\n     * @dev The signature derives the `address(0)`.\n     */\n    error ECDSAInvalidSignature();\n\n    /**\n     * @dev The signature has an invalid length.\n     */\n    error ECDSAInvalidSignatureLength(uint256 length);\n\n    /**\n     * @dev The signature has an S value that is in the upper half order.\n     */\n    error ECDSAInvalidSignatureS(bytes32 s);\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not\n     * return address(0) without also returning an error description. Errors are documented using an enum (error type)\n     * and a bytes32 providing additional information about the error.\n     *\n     * If no error is returned, then the address can be used for verification purposes.\n     *\n     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:\n     * this function rejects them by requiring the `s` value to be in the lower\n     * half order, and the `v` value to be either 27 or 28.\n     *\n     * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n     * verification to be secure: it is possible to craft signatures that\n     * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n     * this is by receiving a hash of the original message (which may otherwise\n     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.\n     *\n     * Documentation for signature generation:\n     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n     */\n    function tryRecover(\n        bytes32 hash,\n        bytes memory signature\n    ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n        if (signature.length == 65) {\n            bytes32 r;\n            bytes32 s;\n            uint8 v;\n            // ecrecover takes the signature parameters, and the only way to get them\n            // currently is to use assembly.\n            assembly (\"memory-safe\") {\n                r := mload(add(signature, 0x20))\n                s := mload(add(signature, 0x40))\n                v := byte(0, mload(add(signature, 0x60)))\n            }\n            return tryRecover(hash, v, r, s);\n        } else {\n            return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));\n        }\n    }\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with\n     * `signature`. This address can then be used for verification purposes.\n     *\n     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:\n     * this function rejects them by requiring the `s` value to be in the lower\n     * half order, and the `v` value to be either 27 or 28.\n     *\n     * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n     * verification to be secure: it is possible to craft signatures that\n     * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n     * this is by receiving a hash of the original message (which may otherwise\n     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.\n     */\n    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);\n        _throwError(error, errorArg);\n        return recovered;\n    }\n\n    /**\n     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n     *\n     * See https://eips.ethereum.org/EIPS/eip-2098[ERC-2098 short signatures]\n     */\n    function tryRecover(\n        bytes32 hash,\n        bytes32 r,\n        bytes32 vs\n    ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n        unchecked {\n            bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n            // We do not check for an overflow here since the shift operation results in 0 or 1.\n            uint8 v = uint8((uint256(vs) >> 255) + 27);\n            return tryRecover(hash, v, r, s);\n        }\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n     */\n    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);\n        _throwError(error, errorArg);\n        return recovered;\n    }\n\n    /**\n     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     */\n    function tryRecover(\n        bytes32 hash,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n        // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n        //\n        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n        // these malleable signatures as well.\n        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n            return (address(0), RecoverError.InvalidSignatureS, s);\n        }\n\n        // If the signature is valid (and not malleable), return the signer address\n        address signer = ecrecover(hash, v, r, s);\n        if (signer == address(0)) {\n            return (address(0), RecoverError.InvalidSignature, bytes32(0));\n        }\n\n        return (signer, RecoverError.NoError, bytes32(0));\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     */\n    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);\n        _throwError(error, errorArg);\n        return recovered;\n    }\n\n    /**\n     * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.\n     */\n    function _throwError(RecoverError error, bytes32 errorArg) private pure {\n        if (error == RecoverError.NoError) {\n            return; // no error: do nothing\n        } else if (error == RecoverError.InvalidSignature) {\n            revert ECDSAInvalidSignature();\n        } else if (error == RecoverError.InvalidSignatureLength) {\n            revert ECDSAInvalidSignatureLength(uint256(errorArg));\n        } else if (error == RecoverError.InvalidSignatureS) {\n            revert ECDSAInvalidSignatureS(errorArg);\n        }\n    }\n}\n"},{"file_path":"contracts/libraries/NestVaultAdminLogic.sol","source_code":"// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.30;\n\nimport {ERC20} from \"@solmate/tokens/ERC20.sol\";\nimport {NestHubAccountant} from \"contracts/accountant/NestHubAccountant.sol\";\nimport {NestVaultCoreTypes} from \"contracts/types/NestVaultCoreTypes.sol\";\nimport {NestVaultCoreValidationLogic} from \"contracts/libraries/NestVaultCoreValidationLogic.sol\";\nimport {NestVaultTransferLogic} from \"contracts/libraries/NestVaultTransferLogic.sol\";\nimport {OperatorRegistry} from \"contracts/operators/OperatorRegistry.sol\";\n\n/// @title  NestVaultAdminLogic\n/// @notice Library containing admin-related logic for NestVaultCore\n/// @author plumenetwork\n/// @custom:oz-upgrades-unsafe-allow external-library-linking\nlibrary NestVaultAdminLogic {\n    using NestVaultCoreValidationLogic for NestVaultCoreTypes.NestVaultCoreStorage;\n    using NestVaultTransferLogic for ERC20;\n\n    /*//////////////////////////////////////////////////////////////\n                                EVENTS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @dev    Emitted when the fee configuration for a fee type is updated\n    /// @param  f      NestVaultCoreTypes.Fees indexed fee type\n    /// @param  oldFee NestVaultCoreTypes.Fee    Previous fee configuration\n    /// @param  fee    NestVaultCoreTypes.Fee    New fee configuration\n    event SetFee(NestVaultCoreTypes.Fees indexed f, NestVaultCoreTypes.Fee oldFee, NestVaultCoreTypes.Fee fee);\n\n    /// @dev    Emitted when the maximum fee cap for a fee type is updated\n    /// @param  f         NestVaultCoreTypes.Fees indexed fee type\n    /// @param  oldMaxFee NestVaultCoreTypes.Fee    Previous max fee configuration\n    /// @param  maxFee    NestVaultCoreTypes.Fee    New max fee configuration\n    event SetMaxFee(NestVaultCoreTypes.Fees indexed f, NestVaultCoreTypes.Fee oldMaxFee, NestVaultCoreTypes.Fee maxFee);\n\n    /// @notice Emitted when the operator registry address is updated.\n    /// @param oldOperatorRegistry address The previous operator registry address.\n    /// @param newOperatorRegistry address The new operator registry address.\n    event OperatorRegistryUpdated(address indexed oldOperatorRegistry, address indexed newOperatorRegistry);\n\n    /// @notice Emitted when accountant address is updated.\n    /// @param oldAccountant The previous accountant address.\n    /// @param newAccountant The new accountant address.\n    event SetAccountant(address indexed oldAccountant, address indexed newAccountant);\n\n    /// @notice Emitted when fees are claimed\n    /// @param f        NestVaultCoreTypes.Fees The fee type being claimed\n    /// @param receiver address The address receiving claimed fees\n    /// @param amount   uint256 The amount of fees claimed\n    event FeeClaimed(NestVaultCoreTypes.Fees indexed f, address indexed receiver, uint256 amount);\n\n    /*//////////////////////////////////////////////////////////////\n                          EXECUTE FUNCTIONS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Sets the operator registry used for global operator approvals\n    /// @param  $         NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _registry address                                 The operator registry address (zero disables registry)\n    function executeSetOperatorRegistry(NestVaultCoreTypes.NestVaultCoreStorage storage $, address _registry) external {\n        address oldOperatorRegistry = address($.operatorRegistry);\n        $.validateOperatorRegistry(_registry);\n        $.operatorRegistry = OperatorRegistry(_registry);\n\n        emit OperatorRegistryUpdated(oldOperatorRegistry, _registry);\n    }\n\n    /// @notice Executes accountant update with compatibility checks\n    /// @dev    Compatibility note:\n    ///         - Legacy AccountantWithRateProviders is supported.\n    ///         - Global pending-share methods are treated as optional and handled best-effort.\n    /// @param  $           NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _accountant address                                 Candidate accountant address\n    /// @param  _asset      ERC20                                   Vault asset used to probe safe quote rates\n    function executeSetAccountant(NestVaultCoreTypes.NestVaultCoreStorage storage $, address _accountant, ERC20 _asset)\n        external\n    {\n        $.validateSetAccountant(_accountant, _asset);\n\n        address _oldAccountant = address($.accountant);\n        $.accountant = NestHubAccountant(_accountant);\n\n        emit SetAccountant(_oldAccountant, _accountant);\n    }\n\n    /// @notice Executes fee configuration update for a fee type\n    /// @param  $    NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _f   NestVaultCoreTypes.Fees                 Fee type\n    /// @param  _fee NestVaultCoreTypes.Fee             New fee configuration (rate + flat)\n    function executeSetFee(\n        NestVaultCoreTypes.NestVaultCoreStorage storage $,\n        NestVaultCoreTypes.Fees _f,\n        NestVaultCoreTypes.Fee calldata _fee\n    ) external {\n        $.validateSetFee(_f, _fee);\n\n        NestVaultCoreTypes.Fee memory _oldFee = NestVaultCoreTypes.Fee({rate: $.fees[_f].rate, flat: $.fees[_f].flat});\n        $.fees[_f].rate = _fee.rate;\n        $.fees[_f].flat = _fee.flat;\n\n        emit SetFee(_f, _oldFee, _fee);\n    }\n\n    /// @notice Executes max fee configuration update for a fee type\n    /// @param  $       NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _f      NestVaultCoreTypes.Fees                 Fee type\n    /// @param  _maxFee NestVaultCoreTypes.Fee             New max fee configuration (rate + flat)\n    function executeSetMaxFee(\n        NestVaultCoreTypes.NestVaultCoreStorage storage $,\n        NestVaultCoreTypes.Fees _f,\n        NestVaultCoreTypes.Fee calldata _maxFee\n    ) external {\n        $.validateSetMaxFee(_f, _maxFee);\n\n        NestVaultCoreTypes.Fee memory _oldMaxFee =\n            NestVaultCoreTypes.Fee({rate: $.maxFees[_f].rate, flat: $.maxFees[_f].flat});\n        $.maxFees[_f].rate = _maxFee.rate;\n        $.maxFees[_f].flat = _maxFee.flat;\n\n        emit SetMaxFee(_f, _oldMaxFee, _maxFee);\n    }\n\n    /// @notice Claims accrued fees for a given fee type to a receiver\n    /// @param  $          NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _f         NestVaultCoreTypes.Fees                 Fee type to claim\n    /// @param  _receiver  address                                 The address receiving claimed fees\n    /// @param  _assetToken ERC20                                  Vault asset token used for payout\n    /// @return _feeAmount uint256                                 The amount of fees claimed\n    function executeClaimFee(\n        NestVaultCoreTypes.NestVaultCoreStorage storage $,\n        NestVaultCoreTypes.Fees _f,\n        address _receiver,\n        ERC20 _assetToken\n    ) external returns (uint256 _feeAmount) {\n        $.validateClaimFee(_f, _receiver);\n\n        _feeAmount = $.claimableFees[_f];\n        $.claimableFees[_f] = 0;\n        _assetToken.safeTransferFrom(address(this), _receiver, _feeAmount);\n\n        emit FeeClaimed(_f, _receiver, _feeAmount);\n    }\n}\n"},{"file_path":"node_modules/@uniswap/permit2/src/interfaces/ISignatureTransfer.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IEIP712} from \"./IEIP712.sol\";\n\n/// @title SignatureTransfer\n/// @notice Handles ERC20 token transfers through signature based actions\n/// @dev Requires user's token approval on the Permit2 contract\ninterface ISignatureTransfer is IEIP712 {\n    /// @notice Thrown when the requested amount for a transfer is larger than the permissioned amount\n    /// @param maxAmount The maximum amount a spender can request to transfer\n    error InvalidAmount(uint256 maxAmount);\n\n    /// @notice Thrown when the number of tokens permissioned to a spender does not match the number of tokens being transferred\n    /// @dev If the spender does not need to transfer the number of tokens permitted, the spender can request amount 0 to be transferred\n    error LengthMismatch();\n\n    /// @notice Emits an event when the owner successfully invalidates an unordered nonce.\n    event UnorderedNonceInvalidation(address indexed owner, uint256 word, uint256 mask);\n\n    /// @notice The token and amount details for a transfer signed in the permit transfer signature\n    struct TokenPermissions {\n        // ERC20 token address\n        address token;\n        // the maximum amount that can be spent\n        uint256 amount;\n    }\n\n    /// @notice The signed permit message for a single token transfer\n    struct PermitTransferFrom {\n        TokenPermissions permitted;\n        // a unique value for every token owner's signature to prevent signature replays\n        uint256 nonce;\n        // deadline on the permit signature\n        uint256 deadline;\n    }\n\n    /// @notice Specifies the recipient address and amount for batched transfers.\n    /// @dev Recipients and amounts correspond to the index of the signed token permissions array.\n    /// @dev Reverts if the requested amount is greater than the permitted signed amount.\n    struct SignatureTransferDetails {\n        // recipient address\n        address to;\n        // spender requested amount\n        uint256 requestedAmount;\n    }\n\n    /// @notice Used to reconstruct the signed permit message for multiple token transfers\n    /// @dev Do not need to pass in spender address as it is required that it is msg.sender\n    /// @dev Note that a user still signs over a spender address\n    struct PermitBatchTransferFrom {\n        // the tokens and corresponding amounts permitted for a transfer\n        TokenPermissions[] permitted;\n        // a unique value for every token owner's signature to prevent signature replays\n        uint256 nonce;\n        // deadline on the permit signature\n        uint256 deadline;\n    }\n\n    /// @notice A map from token owner address and a caller specified word index to a bitmap. Used to set bits in the bitmap to prevent against signature replay protection\n    /// @dev Uses unordered nonces so that permit messages do not need to be spent in a certain order\n    /// @dev The mapping is indexed first by the token owner, then by an index specified in the nonce\n    /// @dev It returns a uint256 bitmap\n    /// @dev The index, or wordPosition is capped at type(uint248).max\n    function nonceBitmap(address, uint256) external view returns (uint256);\n\n    /// @notice Transfers a token using a signed permit message\n    /// @dev Reverts if the requested amount is greater than the permitted signed amount\n    /// @param permit The permit data signed over by the owner\n    /// @param owner The owner of the tokens to transfer\n    /// @param transferDetails The spender's requested transfer details for the permitted token\n    /// @param signature The signature to verify\n    function permitTransferFrom(\n        PermitTransferFrom memory permit,\n        SignatureTransferDetails calldata transferDetails,\n        address owner,\n        bytes calldata signature\n    ) external;\n\n    /// @notice Transfers a token using a signed permit message\n    /// @notice Includes extra data provided by the caller to verify signature over\n    /// @dev The witness type string must follow EIP712 ordering of nested structs and must include the TokenPermissions type definition\n    /// @dev Reverts if the requested amount is greater than the permitted signed amount\n    /// @param permit The permit data signed over by the owner\n    /// @param owner The owner of the tokens to transfer\n    /// @param transferDetails The spender's requested transfer details for the permitted token\n    /// @param witness Extra data to include when checking the user signature\n    /// @param witnessTypeString The EIP-712 type definition for remaining string stub of the typehash\n    /// @param signature The signature to verify\n    function permitWitnessTransferFrom(\n        PermitTransferFrom memory permit,\n        SignatureTransferDetails calldata transferDetails,\n        address owner,\n        bytes32 witness,\n        string calldata witnessTypeString,\n        bytes calldata signature\n    ) external;\n\n    /// @notice Transfers multiple tokens using a signed permit message\n    /// @param permit The permit data signed over by the owner\n    /// @param owner The owner of the tokens to transfer\n    /// @param transferDetails Specifies the recipient and requested amount for the token transfer\n    /// @param signature The signature to verify\n    function permitTransferFrom(\n        PermitBatchTransferFrom memory permit,\n        SignatureTransferDetails[] calldata transferDetails,\n        address owner,\n        bytes calldata signature\n    ) external;\n\n    /// @notice Transfers multiple tokens using a signed permit message\n    /// @dev The witness type string must follow EIP712 ordering of nested structs and must include the TokenPermissions type definition\n    /// @notice Includes extra data provided by the caller to verify signature over\n    /// @param permit The permit data signed over by the owner\n    /// @param owner The owner of the tokens to transfer\n    /// @param transferDetails Specifies the recipient and requested amount for the token transfer\n    /// @param witness Extra data to include when checking the user signature\n    /// @param witnessTypeString The EIP-712 type definition for remaining string stub of the typehash\n    /// @param signature The signature to verify\n    function permitWitnessTransferFrom(\n        PermitBatchTransferFrom memory permit,\n        SignatureTransferDetails[] calldata transferDetails,\n        address owner,\n        bytes32 witness,\n        string calldata witnessTypeString,\n        bytes calldata signature\n    ) external;\n\n    /// @notice Invalidates the bits specified in mask for the bitmap at the word position\n    /// @dev The wordPos is maxed at type(uint248).max\n    /// @param wordPos A number to index the nonceBitmap at\n    /// @param mask A bitmap masked against msg.sender's current bitmap at the word position\n    function invalidateUnorderedNonces(uint256 wordPos, uint256 mask) external;\n}\n"},{"file_path":"node_modules/@layerzerolabs/oft-evm/contracts/libs/OFTComposeMsgCodec.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\nlibrary OFTComposeMsgCodec {\n    // Offset constants for decoding composed messages\n    uint8 private constant NONCE_OFFSET = 8;\n    uint8 private constant SRC_EID_OFFSET = 12;\n    uint8 private constant AMOUNT_LD_OFFSET = 44;\n    uint8 private constant COMPOSE_FROM_OFFSET = 76;\n\n    /**\n     * @dev Encodes a OFT composed message.\n     * @param _nonce The nonce value.\n     * @param _srcEid The source endpoint ID.\n     * @param _amountLD The amount in local decimals.\n     * @param _composeMsg The composed message.\n     * @return _msg The encoded Composed message.\n     */\n    function encode(\n        uint64 _nonce,\n        uint32 _srcEid,\n        uint256 _amountLD,\n        bytes memory _composeMsg // 0x[composeFrom][composeMsg]\n    ) internal pure returns (bytes memory _msg) {\n        _msg = abi.encodePacked(_nonce, _srcEid, _amountLD, _composeMsg);\n    }\n\n    /**\n     * @dev Retrieves the nonce for the composed message.\n     * @param _msg The message.\n     * @return The nonce value.\n     */\n    function nonce(bytes calldata _msg) internal pure returns (uint64) {\n        return uint64(bytes8(_msg[:NONCE_OFFSET]));\n    }\n\n    /**\n     * @dev Retrieves the source endpoint ID for the composed message.\n     * @param _msg The message.\n     * @return The source endpoint ID.\n     */\n    function srcEid(bytes calldata _msg) internal pure returns (uint32) {\n        return uint32(bytes4(_msg[NONCE_OFFSET:SRC_EID_OFFSET]));\n    }\n\n    /**\n     * @dev Retrieves the amount in local decimals from the composed message.\n     * @param _msg The message.\n     * @return The amount in local decimals.\n     */\n    function amountLD(bytes calldata _msg) internal pure returns (uint256) {\n        return uint256(bytes32(_msg[SRC_EID_OFFSET:AMOUNT_LD_OFFSET]));\n    }\n\n    /**\n     * @dev Retrieves the composeFrom value from the composed message.\n     * @param _msg The message.\n     * @return The composeFrom value.\n     */\n    function composeFrom(bytes calldata _msg) internal pure returns (bytes32) {\n        return bytes32(_msg[AMOUNT_LD_OFFSET:COMPOSE_FROM_OFFSET]);\n    }\n\n    /**\n     * @dev Retrieves the composed message.\n     * @param _msg The message.\n     * @return The composed message.\n     */\n    function composeMsg(bytes calldata _msg) internal pure returns (bytes memory) {\n        return _msg[COMPOSE_FROM_OFFSET:];\n    }\n\n    /**\n     * @dev Converts an address to bytes32.\n     * @param _addr The address to convert.\n     * @return The bytes32 representation of the address.\n     */\n    function addressToBytes32(address _addr) internal pure returns (bytes32) {\n        return bytes32(uint256(uint160(_addr)));\n    }\n\n    /**\n     * @dev Converts bytes32 to an address.\n     * @param _b The bytes32 value to convert.\n     * @return The address representation of bytes32.\n     */\n    function bytes32ToAddress(bytes32 _b) internal pure returns (address) {\n        return address(uint160(uint256(_b)));\n    }\n}\n"},{"file_path":"node_modules/@layerzerolabs/oapp-evm/contracts/precrime/interfaces/IOAppPreCrimeSimulator.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\n// @dev Import the Origin so it's exposed to OAppPreCrimeSimulator implementers.\n// solhint-disable-next-line no-unused-import\nimport { InboundPacket, Origin } from \"../libs/Packet.sol\";\n\n/**\n * @title IOAppPreCrimeSimulator Interface\n * @dev Interface for the preCrime simulation functionality in an OApp.\n */\ninterface IOAppPreCrimeSimulator {\n    // @dev simulation result used in PreCrime implementation\n    error SimulationResult(bytes result);\n    error OnlySelf();\n\n    /**\n     * @dev Emitted when the preCrime contract address is set.\n     * @param preCrimeAddress The address of the preCrime contract.\n     */\n    event PreCrimeSet(address preCrimeAddress);\n\n    /**\n     * @dev Retrieves the address of the preCrime contract implementation.\n     * @return The address of the preCrime contract.\n     */\n    function preCrime() external view returns (address);\n\n    /**\n     * @dev Retrieves the address of the OApp contract.\n     * @return The address of the OApp contract.\n     */\n    function oApp() external view returns (address);\n\n    /**\n     * @dev Sets the preCrime contract address.\n     * @param _preCrime The address of the preCrime contract.\n     */\n    function setPreCrime(address _preCrime) external;\n\n    /**\n     * @dev Mocks receiving a packet, then reverts with a series of data to infer the state/result.\n     * @param _packets An array of LayerZero InboundPacket objects representing received packets.\n     */\n    function lzReceiveAndRevert(InboundPacket[] calldata _packets) external payable;\n\n    /**\n     * @dev checks if the specified peer is considered 'trusted' by the OApp.\n     * @param _eid The endpoint Id to check.\n     * @param _peer The peer to check.\n     * @return Whether the peer passed is considered 'trusted' by the OApp.\n     */\n    function isPeer(uint32 _eid, bytes32 _peer) external view returns (bool);\n}\n"},{"file_path":"node_modules/@layerzerolabs/oapp-evm/contracts/oapp/interfaces/IOAppMsgInspector.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\n/**\n * @title IOAppMsgInspector\n * @dev Interface for the OApp Message Inspector, allowing examination of message and options contents.\n */\ninterface IOAppMsgInspector {\n    // Custom error message for inspection failure\n    error InspectionFailed(bytes message, bytes options);\n\n    /**\n     * @notice Allows the inspector to examine LayerZero message contents and optionally throw a revert if invalid.\n     * @param _message The message payload to be inspected.\n     * @param _options Additional options or parameters for inspection.\n     * @return valid A boolean indicating whether the inspection passed (true) or failed (false).\n     *\n     * @dev Optionally done as a revert, OR use the boolean provided to handle the failure.\n     */\n    function inspect(bytes calldata _message, bytes calldata _options) external view returns (bool valid);\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/Bytes.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (utils/Bytes.sol)\n\npragma solidity ^0.8.24;\n\nimport {Math} from \"./math/Math.sol\";\n\n/**\n * @dev Bytes operations.\n */\nlibrary Bytes {\n    /**\n     * @dev Forward search for `s` in `buffer`\n     * * If `s` is present in the buffer, returns the index of the first instance\n     * * If `s` is not present in the buffer, returns type(uint256).max\n     *\n     * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf[Javascript's `Array.indexOf`]\n     */\n    function indexOf(bytes memory buffer, bytes1 s) internal pure returns (uint256) {\n        return indexOf(buffer, s, 0);\n    }\n\n    /**\n     * @dev Forward search for `s` in `buffer` starting at position `pos`\n     * * If `s` is present in the buffer (at or after `pos`), returns the index of the next instance\n     * * If `s` is not present in the buffer (at or after `pos`), returns type(uint256).max\n     *\n     * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf[Javascript's `Array.indexOf`]\n     */\n    function indexOf(bytes memory buffer, bytes1 s, uint256 pos) internal pure returns (uint256) {\n        uint256 length = buffer.length;\n        for (uint256 i = pos; i < length; ++i) {\n            if (bytes1(_unsafeReadBytesOffset(buffer, i)) == s) {\n                return i;\n            }\n        }\n        return type(uint256).max;\n    }\n\n    /**\n     * @dev Backward search for `s` in `buffer`\n     * * If `s` is present in the buffer, returns the index of the last instance\n     * * If `s` is not present in the buffer, returns type(uint256).max\n     *\n     * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf[Javascript's `Array.lastIndexOf`]\n     */\n    function lastIndexOf(bytes memory buffer, bytes1 s) internal pure returns (uint256) {\n        return lastIndexOf(buffer, s, type(uint256).max);\n    }\n\n    /**\n     * @dev Backward search for `s` in `buffer` starting at position `pos`\n     * * If `s` is present in the buffer (at or before `pos`), returns the index of the previous instance\n     * * If `s` is not present in the buffer (at or before `pos`), returns type(uint256).max\n     *\n     * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf[Javascript's `Array.lastIndexOf`]\n     */\n    function lastIndexOf(bytes memory buffer, bytes1 s, uint256 pos) internal pure returns (uint256) {\n        unchecked {\n            uint256 length = buffer.length;\n            for (uint256 i = Math.min(Math.saturatingAdd(pos, 1), length); i > 0; --i) {\n                if (bytes1(_unsafeReadBytesOffset(buffer, i - 1)) == s) {\n                    return i - 1;\n                }\n            }\n            return type(uint256).max;\n        }\n    }\n\n    /**\n     * @dev Copies the content of `buffer`, from `start` (included) to the end of `buffer` into a new bytes object in\n     * memory.\n     *\n     * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]\n     */\n    function slice(bytes memory buffer, uint256 start) internal pure returns (bytes memory) {\n        return slice(buffer, start, buffer.length);\n    }\n\n    /**\n     * @dev Copies the content of `buffer`, from `start` (included) to `end` (excluded) into a new bytes object in\n     * memory.\n     *\n     * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]\n     */\n    function slice(bytes memory buffer, uint256 start, uint256 end) internal pure returns (bytes memory) {\n        // sanitize\n        uint256 length = buffer.length;\n        end = Math.min(end, length);\n        start = Math.min(start, end);\n\n        // allocate and copy\n        bytes memory result = new bytes(end - start);\n        assembly (\"memory-safe\") {\n            mcopy(add(result, 0x20), add(add(buffer, 0x20), start), sub(end, start))\n        }\n\n        return result;\n    }\n\n    /**\n     * @dev Reads a bytes32 from a bytes array without bounds checking.\n     *\n     * NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the\n     * assembly block as such would prevent some optimizations.\n     */\n    function _unsafeReadBytesOffset(bytes memory buffer, uint256 offset) private pure returns (bytes32 value) {\n        // This is not memory safe in the general case, but all calls to this private function are within bounds.\n        assembly (\"memory-safe\") {\n            value := mload(add(add(buffer, 0x20), offset))\n        }\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC4626Upgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/ERC4626.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC20Metadata} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport {ERC20Upgradeable} from \"../ERC20Upgradeable.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport {IERC4626} from \"@openzeppelin/contracts/interfaces/IERC4626.sol\";\nimport {Math} from \"@openzeppelin/contracts/utils/math/Math.sol\";\nimport {Initializable} from \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the ERC-4626 \"Tokenized Vault Standard\" as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\n *\n * This extension allows the minting and burning of \"shares\" (represented using the ERC-20 inheritance) in exchange for\n * underlying \"assets\" through standardized {deposit}, {mint}, {redeem} and {burn} workflows. This contract extends\n * the ERC-20 standard. Any additional extensions included along it would affect the \"shares\" token represented by this\n * contract and not the \"assets\" token which is an independent contract.\n *\n * [CAUTION]\n * ====\n * In empty (or nearly empty) ERC-4626 vaults, deposits are at high risk of being stolen through frontrunning\n * with a \"donation\" to the vault that inflates the price of a share. This is variously known as a donation or inflation\n * attack and is essentially a problem of slippage. Vault deployers can protect against this attack by making an initial\n * deposit of a non-trivial amount of the asset, such that price manipulation becomes infeasible. Withdrawals may\n * similarly be affected by slippage. Users can protect against this attack as well as unexpected slippage in general by\n * verifying the amount received is as expected, using a wrapper that performs these checks such as\n * https://github.com/fei-protocol/ERC4626#erc4626router-and-base[ERC4626Router].\n *\n * Since v4.9, this implementation introduces configurable virtual assets and shares to help developers mitigate that risk.\n * The `_decimalsOffset()` corresponds to an offset in the decimal representation between the underlying asset's decimals\n * and the vault decimals. This offset also determines the rate of virtual shares to virtual assets in the vault, which\n * itself determines the initial exchange rate. While not fully preventing the attack, analysis shows that the default\n * offset (0) makes it non-profitable even if an attacker is able to capture value from multiple user deposits, as a result\n * of the value being captured by the virtual shares (out of the attacker's donation) matching the attacker's expected gains.\n * With a larger offset, the attack becomes orders of magnitude more expensive than it is profitable. More details about the\n * underlying math can be found xref:ROOT:erc4626.adoc#inflation-attack[here].\n *\n * The drawback of this approach is that the virtual shares do capture (a very small) part of the value being accrued\n * to the vault. Also, if the vault experiences losses, the users try to exit the vault, the virtual shares and assets\n * will cause the first user to exit to experience reduced losses in detriment to the last users that will experience\n * bigger losses. Developers willing to revert back to the pre-v4.9 behavior just need to override the\n * `_convertToShares` and `_convertToAssets` functions.\n *\n * To learn more, check out our xref:ROOT:erc4626.adoc[ERC-4626 guide].\n * ====\n */\nabstract contract ERC4626Upgradeable is Initializable, ERC20Upgradeable, IERC4626 {\n    using Math for uint256;\n\n    /// @custom:storage-location erc7201:openzeppelin.storage.ERC4626\n    struct ERC4626Storage {\n        IERC20 _asset;\n        uint8 _underlyingDecimals;\n    }\n\n    // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.ERC4626\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant ERC4626StorageLocation = 0x0773e532dfede91f04b12a73d3d2acd361424f41f76b4fb79f090161e36b4e00;\n\n    function _getERC4626Storage() private pure returns (ERC4626Storage storage $) {\n        assembly {\n            $.slot := ERC4626StorageLocation\n        }\n    }\n\n    /**\n     * @dev Attempted to deposit more assets than the max amount for `receiver`.\n     */\n    error ERC4626ExceededMaxDeposit(address receiver, uint256 assets, uint256 max);\n\n    /**\n     * @dev Attempted to mint more shares than the max amount for `receiver`.\n     */\n    error ERC4626ExceededMaxMint(address receiver, uint256 shares, uint256 max);\n\n    /**\n     * @dev Attempted to withdraw more assets than the max amount for `receiver`.\n     */\n    error ERC4626ExceededMaxWithdraw(address owner, uint256 assets, uint256 max);\n\n    /**\n     * @dev Attempted to redeem more shares than the max amount for `receiver`.\n     */\n    error ERC4626ExceededMaxRedeem(address owner, uint256 shares, uint256 max);\n\n    /**\n     * @dev Set the underlying asset contract. This must be an ERC20-compatible contract (ERC-20 or ERC-777).\n     */\n    function __ERC4626_init(IERC20 asset_) internal onlyInitializing {\n        __ERC4626_init_unchained(asset_);\n    }\n\n    function __ERC4626_init_unchained(IERC20 asset_) internal onlyInitializing {\n        ERC4626Storage storage $ = _getERC4626Storage();\n        (bool success, uint8 assetDecimals) = _tryGetAssetDecimals(asset_);\n        $._underlyingDecimals = success ? assetDecimals : 18;\n        $._asset = asset_;\n    }\n\n    /**\n     * @dev Attempts to fetch the asset decimals. A return value of false indicates that the attempt failed in some way.\n     */\n    function _tryGetAssetDecimals(IERC20 asset_) private view returns (bool ok, uint8 assetDecimals) {\n        (bool success, bytes memory encodedDecimals) = address(asset_).staticcall(\n            abi.encodeCall(IERC20Metadata.decimals, ())\n        );\n        if (success && encodedDecimals.length >= 32) {\n            uint256 returnedDecimals = abi.decode(encodedDecimals, (uint256));\n            if (returnedDecimals <= type(uint8).max) {\n                return (true, uint8(returnedDecimals));\n            }\n        }\n        return (false, 0);\n    }\n\n    /**\n     * @dev Decimals are computed by adding the decimal offset on top of the underlying asset's decimals. This\n     * \"original\" value is cached during construction of the vault contract. If this read operation fails (e.g., the\n     * asset has not been created yet), a default of 18 is used to represent the underlying asset's decimals.\n     *\n     * See {IERC20Metadata-decimals}.\n     */\n    function decimals() public view virtual override(IERC20Metadata, ERC20Upgradeable) returns (uint8) {\n        ERC4626Storage storage $ = _getERC4626Storage();\n        return $._underlyingDecimals + _decimalsOffset();\n    }\n\n    /// @inheritdoc IERC4626\n    function asset() public view virtual returns (address) {\n        ERC4626Storage storage $ = _getERC4626Storage();\n        return address($._asset);\n    }\n\n    /// @inheritdoc IERC4626\n    function totalAssets() public view virtual returns (uint256) {\n        return IERC20(asset()).balanceOf(address(this));\n    }\n\n    /// @inheritdoc IERC4626\n    function convertToShares(uint256 assets) public view virtual returns (uint256) {\n        return _convertToShares(assets, Math.Rounding.Floor);\n    }\n\n    /// @inheritdoc IERC4626\n    function convertToAssets(uint256 shares) public view virtual returns (uint256) {\n        return _convertToAssets(shares, Math.Rounding.Floor);\n    }\n\n    /// @inheritdoc IERC4626\n    function maxDeposit(address) public view virtual returns (uint256) {\n        return type(uint256).max;\n    }\n\n    /// @inheritdoc IERC4626\n    function maxMint(address) public view virtual returns (uint256) {\n        return type(uint256).max;\n    }\n\n    /// @inheritdoc IERC4626\n    function maxWithdraw(address owner) public view virtual returns (uint256) {\n        return _convertToAssets(balanceOf(owner), Math.Rounding.Floor);\n    }\n\n    /// @inheritdoc IERC4626\n    function maxRedeem(address owner) public view virtual returns (uint256) {\n        return balanceOf(owner);\n    }\n\n    /// @inheritdoc IERC4626\n    function previewDeposit(uint256 assets) public view virtual returns (uint256) {\n        return _convertToShares(assets, Math.Rounding.Floor);\n    }\n\n    /// @inheritdoc IERC4626\n    function previewMint(uint256 shares) public view virtual returns (uint256) {\n        return _convertToAssets(shares, Math.Rounding.Ceil);\n    }\n\n    /// @inheritdoc IERC4626\n    function previewWithdraw(uint256 assets) public view virtual returns (uint256) {\n        return _convertToShares(assets, Math.Rounding.Ceil);\n    }\n\n    /// @inheritdoc IERC4626\n    function previewRedeem(uint256 shares) public view virtual returns (uint256) {\n        return _convertToAssets(shares, Math.Rounding.Floor);\n    }\n\n    /// @inheritdoc IERC4626\n    function deposit(uint256 assets, address receiver) public virtual returns (uint256) {\n        uint256 maxAssets = maxDeposit(receiver);\n        if (assets > maxAssets) {\n            revert ERC4626ExceededMaxDeposit(receiver, assets, maxAssets);\n        }\n\n        uint256 shares = previewDeposit(assets);\n        _deposit(_msgSender(), receiver, assets, shares);\n\n        return shares;\n    }\n\n    /// @inheritdoc IERC4626\n    function mint(uint256 shares, address receiver) public virtual returns (uint256) {\n        uint256 maxShares = maxMint(receiver);\n        if (shares > maxShares) {\n            revert ERC4626ExceededMaxMint(receiver, shares, maxShares);\n        }\n\n        uint256 assets = previewMint(shares);\n        _deposit(_msgSender(), receiver, assets, shares);\n\n        return assets;\n    }\n\n    /// @inheritdoc IERC4626\n    function withdraw(uint256 assets, address receiver, address owner) public virtual returns (uint256) {\n        uint256 maxAssets = maxWithdraw(owner);\n        if (assets > maxAssets) {\n            revert ERC4626ExceededMaxWithdraw(owner, assets, maxAssets);\n        }\n\n        uint256 shares = previewWithdraw(assets);\n        _withdraw(_msgSender(), receiver, owner, assets, shares);\n\n        return shares;\n    }\n\n    /// @inheritdoc IERC4626\n    function redeem(uint256 shares, address receiver, address owner) public virtual returns (uint256) {\n        uint256 maxShares = maxRedeem(owner);\n        if (shares > maxShares) {\n            revert ERC4626ExceededMaxRedeem(owner, shares, maxShares);\n        }\n\n        uint256 assets = previewRedeem(shares);\n        _withdraw(_msgSender(), receiver, owner, assets, shares);\n\n        return assets;\n    }\n\n    /**\n     * @dev Internal conversion function (from assets to shares) with support for rounding direction.\n     */\n    function _convertToShares(uint256 assets, Math.Rounding rounding) internal view virtual returns (uint256) {\n        return assets.mulDiv(totalSupply() + 10 ** _decimalsOffset(), totalAssets() + 1, rounding);\n    }\n\n    /**\n     * @dev Internal conversion function (from shares to assets) with support for rounding direction.\n     */\n    function _convertToAssets(uint256 shares, Math.Rounding rounding) internal view virtual returns (uint256) {\n        return shares.mulDiv(totalAssets() + 1, totalSupply() + 10 ** _decimalsOffset(), rounding);\n    }\n\n    /**\n     * @dev Deposit/mint common workflow.\n     */\n    function _deposit(address caller, address receiver, uint256 assets, uint256 shares) internal virtual {\n        // If asset() is ERC-777, `transferFrom` can trigger a reentrancy BEFORE the transfer happens through the\n        // `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer,\n        // calls the vault, which is assumed not malicious.\n        //\n        // Conclusion: we need to do the transfer before we mint so that any reentrancy would happen before the\n        // assets are transferred and before the shares are minted, which is a valid state.\n        // slither-disable-next-line reentrancy-no-eth\n        SafeERC20.safeTransferFrom(IERC20(asset()), caller, address(this), assets);\n        _mint(receiver, shares);\n\n        emit Deposit(caller, receiver, assets, shares);\n    }\n\n    /**\n     * @dev Withdraw/redeem common workflow.\n     */\n    function _withdraw(\n        address caller,\n        address receiver,\n        address owner,\n        uint256 assets,\n        uint256 shares\n    ) internal virtual {\n        if (caller != owner) {\n            _spendAllowance(owner, caller, shares);\n        }\n\n        // If asset() is ERC-777, `transfer` can trigger a reentrancy AFTER the transfer happens through the\n        // `tokensReceived` hook. On the other hand, the `tokensToSend` hook, that is triggered before the transfer,\n        // calls the vault, which is assumed not malicious.\n        //\n        // Conclusion: we need to do the transfer after the burn so that any reentrancy would happen after the\n        // shares are burned and after the assets are transferred, which is a valid state.\n        _burn(owner, shares);\n        SafeERC20.safeTransfer(IERC20(asset()), receiver, assets);\n\n        emit Withdraw(caller, receiver, owner, assets, shares);\n    }\n\n    function _decimalsOffset() internal view virtual returns (uint8) {\n        return 0;\n    }\n}\n"},{"file_path":"contracts/libraries/NestVaultAccountingLogic.sol","source_code":"// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.30;\n\nimport {NestShareOFT} from \"contracts/NestShareOFT.sol\";\nimport {Math} from \"@openzeppelin/contracts/utils/math/Math.sol\";\n\n/// @title  NestVaultAccountingLogic\n/// @notice Library containing common accounting utilities for NestVault operations\n/// @dev    View/pure functions for share/asset conversions and fee calculations\n/// @author plumenetwork\nlibrary NestVaultAccountingLogic {\n    using Math for uint256;\n\n    uint256 internal constant FEE_DENOMINATOR = 1_000_000;\n\n    /// @notice Converts shares to assets using the provided rate\n    /// @param  _shares   uint256 The shares to convert\n    /// @param  _rate     uint256 The exchange rate\n    /// @param  _share    NestShareOFT Share token used to derive decimals\n    /// @param  _rounding Math.Rounding The rounding direction\n    /// @return _assets   uint256 The calculated assets\n    function convertToAssets(uint256 _shares, uint256 _rate, NestShareOFT _share, Math.Rounding _rounding)\n        internal\n        pure\n        returns (uint256 _assets)\n    {\n        _assets = _shares.mulDiv(_rate, oneShare(_share), _rounding);\n    }\n\n    /// @notice Converts assets to shares using the provided rate\n    /// @param  _assets   uint256 The assets to convert\n    /// @param  _rate     uint256 The exchange rate\n    /// @param  _share    NestShareOFT Share token used to derive decimals\n    /// @param  _rounding Math.Rounding The rounding direction\n    /// @return _shares   uint256 The calculated shares\n    function convertToShares(uint256 _assets, uint256 _rate, NestShareOFT _share, Math.Rounding _rounding)\n        internal\n        pure\n        returns (uint256 _shares)\n    {\n        _shares = _assets.mulDiv(oneShare(_share), _rate, _rounding);\n    }\n\n    /// @notice Calculates combined flat + percentage fee amount from assets\n    /// @param  _assets  uint256 The asset amount\n    /// @param  _feeRate uint32  The percentage fee rate (denominated in 1e6)\n    /// @param  _flatFee uint256 The flat fee in asset token units\n    /// @return _fee     uint256 The total fee amount, capped at _assets\n    function calculateFee(uint256 _assets, uint32 _feeRate, uint256 _flatFee) internal pure returns (uint256 _fee) {\n        if (_flatFee >= _assets) return _assets;\n        _fee = _flatFee;\n        if (_feeRate != 0) {\n            _fee += _assets.mulDiv(_feeRate, FEE_DENOMINATOR, Math.Rounding.Floor);\n        }\n        if (_fee > _assets) _fee = _assets;\n    }\n\n    /// @notice Calculates post-fee amount and combined flat + percentage fee from assets\n    /// @param  _assets        uint256 The asset amount\n    /// @param  _feeRate       uint32  The percentage fee rate (denominated in 1e6)\n    /// @param  _flatFee       uint256 The flat fee in asset token units\n    /// @return _postFeeAmount uint256 The amount after fees\n    /// @return _feeAmount     uint256 The total fee amount\n    function calculatePostFeeAmounts(uint256 _assets, uint32 _feeRate, uint256 _flatFee)\n        internal\n        pure\n        returns (uint256 _postFeeAmount, uint256 _feeAmount)\n    {\n        if (_feeRate == 0 && _flatFee == 0) return (_assets, 0);\n        _feeAmount = calculateFee(_assets, _feeRate, _flatFee);\n        _postFeeAmount = _assets - _feeAmount;\n    }\n\n    /// @notice Calculates the minimum gross asset amount needed to realize a target post-fee amount\n    ///         under combined flat + percentage fees\n    /// @dev    Solves `gross - flatFee - floor(gross * feeRate / 1e6) >= postFeeAmount` for the smallest integer `gross`.\n    /// @param  _postFeeAmount uint256 Target amount after fees\n    /// @param  _feeRate       uint32  The percentage fee rate (denominated in 1e6)\n    /// @param  _flatFee       uint256 The flat fee in asset token units\n    /// @return _grossAmount   uint256 The minimum gross amount that satisfies the target post-fee amount\n    function calculatePreFeeAmount(uint256 _postFeeAmount, uint32 _feeRate, uint256 _flatFee)\n        internal\n        pure\n        returns (uint256 _grossAmount)\n    {\n        if (_postFeeAmount == 0) return 0;\n\n        uint256 _target = _postFeeAmount + _flatFee;\n\n        if (_feeRate == 0) return _target;\n\n        uint256 _postFeeDenominator = FEE_DENOMINATOR - uint256(_feeRate);\n        _grossAmount = (_target - 1).mulDiv(FEE_DENOMINATOR, _postFeeDenominator) + 1;\n    }\n\n    /// @notice Returns the scaling factor for one share based on its decimals\n    /// @param  _share NestShareOFT Share token used to derive decimals\n    /// @return uint256 The scaling factor representing one share\n    function oneShare(NestShareOFT _share) internal pure returns (uint256) {\n        return 10 ** _share.decimals();\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/StorageSlot.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC-1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n *     // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.\n *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n *     function _getImplementation() internal view returns (address) {\n *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n *     }\n *\n *     function _setImplementation(address newImplementation) internal {\n *         require(newImplementation.code.length > 0);\n *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n *     }\n * }\n * ```\n *\n * TIP: Consider using this library along with {SlotDerivation}.\n */\nlibrary StorageSlot {\n    struct AddressSlot {\n        address value;\n    }\n\n    struct BooleanSlot {\n        bool value;\n    }\n\n    struct Bytes32Slot {\n        bytes32 value;\n    }\n\n    struct Uint256Slot {\n        uint256 value;\n    }\n\n    struct Int256Slot {\n        int256 value;\n    }\n\n    struct StringSlot {\n        string value;\n    }\n\n    struct BytesSlot {\n        bytes value;\n    }\n\n    /**\n     * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n     */\n    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n        assembly (\"memory-safe\") {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns a `BooleanSlot` with member `value` located at `slot`.\n     */\n    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n        assembly (\"memory-safe\") {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns a `Bytes32Slot` with member `value` located at `slot`.\n     */\n    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n        assembly (\"memory-safe\") {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns a `Uint256Slot` with member `value` located at `slot`.\n     */\n    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n        assembly (\"memory-safe\") {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns a `Int256Slot` with member `value` located at `slot`.\n     */\n    function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {\n        assembly (\"memory-safe\") {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns a `StringSlot` with member `value` located at `slot`.\n     */\n    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n        assembly (\"memory-safe\") {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n     */\n    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n        assembly (\"memory-safe\") {\n            r.slot := store.slot\n        }\n    }\n\n    /**\n     * @dev Returns a `BytesSlot` with member `value` located at `slot`.\n     */\n    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n        assembly (\"memory-safe\") {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n     */\n    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n        assembly (\"memory-safe\") {\n            r.slot := store.slot\n        }\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/interfaces/draft-IERC6093.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/draft-IERC6093.sol)\npragma solidity >=0.8.4;\n\n/**\n * @dev Standard ERC-20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.\n */\ninterface IERC20Errors {\n    /**\n     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param balance Current balance for the interacting account.\n     * @param needed Minimum amount required to perform a transfer.\n     */\n    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC20InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC20InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n     * @param spender Address that may be allowed to operate on tokens without being their owner.\n     * @param allowance Amount of tokens a `spender` is allowed to operate with.\n     * @param needed Minimum amount required to perform a transfer.\n     */\n    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC20InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n     * @param spender Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC-721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.\n */\ninterface IERC721Errors {\n    /**\n     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.\n     * Used in balance queries.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC721InvalidOwner(address owner);\n\n    /**\n     * @dev Indicates a `tokenId` whose `owner` is the zero address.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC721NonexistentToken(uint256 tokenId);\n\n    /**\n     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param tokenId Identifier number of a token.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC721InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC721InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC721InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC-1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.\n */\ninterface IERC1155Errors {\n    /**\n     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param balance Current balance for the interacting account.\n     * @param needed Minimum amount required to perform a transfer.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC1155InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC1155InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC1155MissingApprovalForAll(address operator, address owner);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC1155InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC1155InvalidOperator(address operator);\n\n    /**\n     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n     * Used in batch transfers.\n     * @param idsLength Length of the array of token identifiers\n     * @param valuesLength Length of the array of token amounts\n     */\n    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n"},{"file_path":"contracts/NestShareOFT.sol","source_code":"// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.30;\n\n// contracts\nimport {OFTUpgradeable} from \"@layerzerolabs/oft-evm-upgradeable/contracts/oft/OFTUpgradeable.sol\";\nimport {OwnableUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {AuthUpgradeable} from \"contracts/auth/AuthUpgradeable.sol\";\nimport {Authority} from \"@solmate/auth/Auth.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {ERC20} from \"@solmate/tokens/ERC20.sol\";\nimport {\n    ERC20PermitUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol\";\nimport {Errors} from \"contracts/types/Errors.sol\";\n\n// interfaces\nimport {IERC7575Share} from \"forge-std/interfaces/IERC7575.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {IOFT} from \"@layerzerolabs/oft-evm/contracts/interfaces/IOFT.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC1271} from \"@openzeppelin/contracts/interfaces/IERC1271.sol\";\nimport {ITransferHook} from \"contracts/interfaces/ITransferHook.sol\";\n\n// libraries\nimport {SafeTransferLib} from \"@solmate/utils/SafeTransferLib.sol\";\nimport {ECDSA} from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport {MessageHashUtils} from \"@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol\";\n\n/// @title  NestShareOFT – Cross-Chain Share Token for NestVault Assets\n/// @author plumenetwork\n/// @notice ERC-20 share token with LayerZero OFT support enabling cross-chain minting and burning of shares backed by vault assets.\n/// @dev    Implements upgradeable OFT, Auth, and IERC7575Share logic. Manages asset-to-share flows via authorized roles and maintains per-asset vault mappings.\ncontract NestShareOFT is OFTUpgradeable, AuthUpgradeable, IERC7575Share, ERC20PermitUpgradeable, IERC1271 {\n    using Address for address;\n    using SafeTransferLib for ERC20;\n\n    struct NestShareOFTStorage {\n        // vault look up that returns the address of the Vault for a specific asset\n        mapping(address => address) vault;\n        // responsible for implementing `beforeTransfer`.\n        ITransferHook hook;\n        // authorized off-chain signer for EIP-1271 isValidSignature\n        address strategistSigner;\n        // contracts allowed to call isValidSignature (e.g. Permit2)\n        mapping(address => bool) signatureChecker;\n    }\n\n    /// @dev Type hash used to wrap the input hash with this contract's EIP-712 domain\n    ///      before signature recovery. Binds signatures to (chainId, address(this)) so\n    ///      a signature valid against one NestShareOFT instance cannot be replayed against\n    ///      another instance that shares the same strategistSigner.\n    bytes32 private constant NEST_MESSAGE_TYPEHASH = keccak256(\"NestMessage(bytes32 hash)\");\n\n    // keccak256(abi.encode(uint256(keccak256(\"plumenetwork.storage.nestshare\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant NEST_SHARE_STORAGE_LOCATION =\n        0xe362d12f87dacbebef0c9593e58b8b9ba0a58c01c2bee0269d69407ecbfd9e00;\n\n    /// @dev Returns the storage struct for NestShare using a fixed storage slot derived from EIP-7201-style namespacing\n    /// @return $ NestShareOFTStorage The NestShareOFTStorage struct reference\n    function _getNestShareOFTStorage() internal pure returns (NestShareOFTStorage storage $) {\n        assembly {\n            $.slot := NEST_SHARE_STORAGE_LOCATION\n        }\n    }\n\n    /// @notice Emitted when a user deposits an asset and receives shares\n    /// @dev    Logs the deposit source, asset, deposited amount, share recipient, and number of shares minted\n    /// @param  from   address indexed The address providing the underlying asset\n    /// @param  asset  address indexed The ERC20 asset being deposited\n    /// @param  amount uint256         The amount of the asset deposited\n    /// @param  to     address indexed The address receiving the minted shares\n    /// @param  shares uint256         The number of shares minted\n    event Enter(address indexed from, address indexed asset, uint256 amount, address indexed to, uint256 shares);\n\n    /// @notice Emitted when a user burns shares and withdraws an asset\n    /// @dev    Logs the withdrawal recipient, asset, withdrawal amount, share holder, and number of shares burned\n    /// @param  to     address indexed The address receiving the withdrawn asset\n    /// @param  asset  address indexed The ERC20 asset being withdrawn\n    /// @param  amount uint256         The amount of the asset withdrawn\n    /// @param  from   address         The address whose shares are being burned\n    /// @param  shares uint256         The number of shares burned\n    event Exit(address indexed to, address indexed asset, uint256 amount, address indexed from, uint256 shares);\n\n    /// @notice Emitted when token name and symbol are updated.\n    /// @param  newName    string The updated token name.\n    /// @param  newSymbol  string The updated token symbol.\n    /// @param  version    uint64 The consumed reinitializer version.\n    event NameAndSymbolUpdated(string newName, string newSymbol, uint64 version);\n\n    /// @notice Emitted when the authorized off-chain strategist signer is updated.\n    /// @param  newSigner address The new strategist signer address.\n    event StrategistSignerUpdated(address indexed newSigner);\n\n    /// @notice Emitted when a contract's permission to call isValidSignature is updated.\n    /// @param  checker address The contract whose permission changed.\n    /// @param  allowed bool    True if allowed to call isValidSignature, false otherwise.\n    event SignatureCheckerUpdated(address indexed checker, bool allowed);\n\n    /// @dev Constructor for the NestShare contract.\n    /// @param _lzEndpoint address The LayerZero endpoint address.\n    constructor(address _lzEndpoint) OFTUpgradeable(_lzEndpoint) {\n        _disableInitializers();\n    }\n\n    /// @notice Initializes the NestShare token with its metadata and authorization settings\n    /// @dev    Initializes OFT and Auth modules using the provided parameters\n    /// @param  _name     string The name of the NestShare.\n    /// @param  _symbol   string The symbol of the NestShare.\n    /// @param  _owner    address The address that will be set as the owner of the contract.\n    /// @param  _delegate address The delegate capable of making OApp configurations inside of the endpoint.\n    function initialize(string memory _name, string memory _symbol, address _owner, address _delegate)\n        public\n        initializer\n    {\n        if (_owner == address(0)) revert Errors.ZeroAddress();\n        if (bytes(_name).length == 0 || bytes(_symbol).length == 0) revert Errors.EmptyNameOrSymbol();\n\n        __OFT_init(_name, _symbol, _delegate);\n        __Auth_init(_owner, Authority(address(0)));\n        __ERC20Permit_init(_name);\n    }\n\n    /// @dev    Returns the decimals of the NestShare token\n    /// @return uint8 The decimals value (always 6)\n    function decimals() public pure override returns (uint8) {\n        return 6;\n    }\n\n    /// @notice Returns the version of the NestShareOFT contract.\n    /// @dev    This version is used to track contract upgrades.\n    /// @return string A string representing the version of the contract.\n    function version() public pure returns (string memory) {\n        return \"1.2.0\";\n    }\n\n    /// @notice Returns the NestVault address associated with a given asset.\n    /// @dev    Returns the address of the NestVault for the given asset\n    /// @param  _asset address the ERC-20 token to deposit with into the NestVault\n    /// @return        address The address of the NestVault for the given asset\n    function vault(address _asset) external view returns (address) {\n        return _getNestShareOFTStorage().vault[_asset];\n    }\n\n    /// @notice Sets the NestVault address for a specified asset.\n    /// @dev    Sets the address of the NestVault for the given asset\n    /// @param  _asset address the ERC-20 token to deposit with into the NestVault\n    /// @param  _vault address the address of the NestVault\n    function setVault(address _asset, address _vault) external requiresAuth {\n        _getNestShareOFTStorage().vault[_asset] = _vault;\n\n        emit VaultUpdate(_asset, _vault);\n    }\n\n    /// @notice Sets the share token name and symbol.\n    /// @dev    Reinitializer step used after upgrades to reset ERC20 metadata.\n    /// @dev    This updates the EIP712 domain name, which invalidates all previously signed ERC2612 permit signatures.\n    /// @param  _name    string The new token name.\n    /// @param  _symbol  string The new token symbol.\n    /// @param  _version uint64 The reinitializer version to consume for this metadata update.\n    function setNameAndSymbol(string calldata _name, string calldata _symbol, uint64 _version)\n        external\n        requiresAuth\n        reinitializer(_version)\n    {\n        if (bytes(_name).length == 0 || bytes(_symbol).length == 0) revert Errors.EmptyNameOrSymbol();\n\n        __ERC20_init(_name, _symbol);\n\n        emit NameAndSymbolUpdated(_name, _symbol, _version);\n    }\n\n    /// @notice Executes an arbitrary function call from this contract\n    /// @dev    Callable by authorized roles (MANAGER_ROLE)\n    /// @param  target address The target contract to call\n    /// @param  data   bytes   The calldata for the function call\n    /// @param  value  uint256 The ETH value to forward with the call\n    /// @return result bytes   The raw returned data from the call\n    function manage(address target, bytes calldata data, uint256 value)\n        external\n        payable\n        requiresAuth\n        returns (bytes memory result)\n    {\n        result = target.functionCallWithValue(data, value);\n    }\n\n    /// @notice Executes multiple arbitrary function calls from this contract\n    /// @dev    Callable by authorized roles (MANAGER_ROLE)\n    /// @param  targets address[] The list of target contracts\n    /// @param  data    bytes[]   The list of calldata blobs\n    /// @param  values  uint256[] The list of ETH values to forward with each call\n    /// @return results bytes[]   The returned data for each call\n    function manage(address[] calldata targets, bytes[] calldata data, uint256[] calldata values)\n        external\n        payable\n        requiresAuth\n        returns (bytes[] memory results)\n    {\n        uint256 targetsLength = targets.length;\n        results = new bytes[](targetsLength);\n        for (uint256 i; i < targetsLength; ++i) {\n            results[i] = targets[i].functionCallWithValue(data[i], values[i]);\n        }\n    }\n\n    /// @notice Allows the contract to receive native ETH for calls made through `manage`.\n    receive() external payable {}\n\n    /// @notice Mints shares in exchange for depositing assets\n    /// @dev    Callable by authorized roles (MINTER_ROLE)\n    ///         If `assetAmount` is zero, no assets are transferred\n    /// @param  from        address The address from which assets are transferred\n    /// @param  asset       ERC20   The ERC20 asset deposited\n    /// @param  assetAmount uint256 The amount of assets transferred in\n    /// @param  to          address The address receiving the minted shares\n    /// @param  shareAmount uint256 The number of shares minted\n    function enter(address from, ERC20 asset, uint256 assetAmount, address to, uint256 shareAmount)\n        external\n        requiresAuth\n    {\n        // Transfer assets in\n        if (assetAmount > 0) asset.safeTransferFrom(from, address(this), assetAmount);\n\n        // Mint shares.\n        _mint(to, shareAmount);\n\n        emit Enter(from, address(asset), assetAmount, to, shareAmount);\n    }\n\n    /// @notice Burns shares and releases assets in return\n    /// @dev    Callable by authorized roles (BURNER_ROLE)\n    ///         If `assetAmount` is zero, no assets are transferred out\n    /// @param  to          address The address receiving the assets\n    /// @param  asset       ERC20   The ERC20 asset being withdrawn\n    /// @param  assetAmount uint256 The amount of assets transferred out\n    /// @param  from        address The address whose shares are burned\n    /// @param  shareAmount uint256 The number of shares burned\n    function exit(address to, ERC20 asset, uint256 assetAmount, address from, uint256 shareAmount)\n        external\n        requiresAuth\n    {\n        // Burn shares.\n        _burn(from, shareAmount);\n\n        // Transfer assets out.\n        if (assetAmount > 0) asset.safeTransfer(to, assetAmount);\n\n        emit Exit(to, address(asset), assetAmount, from, shareAmount);\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                    TRANSFER HOOK LOGIC\n    //////////////////////////////////////////////////////////////*/\n    /**\n     * @notice Sets the share locker.\n     * @notice If set to zero address, the share locker logic is disabled.\n     * @dev Callable by OWNER_ROLE.\n     * @param _hook address The hook contract implementing `beforeTransfer`.\n     */\n    function setBeforeTransferHook(address _hook) external requiresAuth {\n        _getNestShareOFTStorage().hook = ITransferHook(_hook);\n    }\n\n    /// @notice Returns the current before-transfer hook.\n    /// @return The hook contract implementing `beforeTransfer` (or zero address if disabled).\n    function hook() public view returns (ITransferHook) {\n        return _getNestShareOFTStorage().hook;\n    }\n\n    /**\n     * @notice Check if from addresses shares are locked, reverting if so.\n     * @param from address The address sending shares.\n     */\n    function _callBeforeTransfer(address from) internal view {\n        ITransferHook beforeTransferHook = _getNestShareOFTStorage().hook;\n        if (address(beforeTransferHook) != address(0)) beforeTransferHook.beforeTransfer(from);\n    }\n\n    /// @notice Overrides ERC20 `_update` to enforce the before-transfer hook.\n    /// @param from address The address sending shares, or address(0) when minting.\n    /// @param to address The address receiving shares, or address(0) when burning.\n    /// @param value uint256 The amount of shares being moved.\n    function _update(address from, address to, uint256 value) internal override {\n        if (from != address(0)) {\n            _callBeforeTransfer(from);\n        }\n        super._update(from, to, value);\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                    EIP-1271 LOGIC\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Returns the authorized off-chain signer for isValidSignature.\n    /// @return The strategist signer address (zero if unset).\n    function strategistSigner() external view returns (address) {\n        return _getNestShareOFTStorage().strategistSigner;\n    }\n\n    /// @notice Sets the authorized off-chain strategist signer.\n    /// @dev    Callable by authorized roles. Setting to address(0) disables EIP-1271 validation.\n    /// @param  _signer address The new strategist signer.\n    function setStrategistSigner(address _signer) external requiresAuth {\n        _getNestShareOFTStorage().strategistSigner = _signer;\n        emit StrategistSignerUpdated(_signer);\n    }\n\n    /// @notice Returns whether a caller is whitelisted to invoke isValidSignature.\n    /// @param  _caller address The caller to check.\n    /// @return         bool    True if whitelisted, false otherwise.\n    function isSignatureChecker(address _caller) external view returns (bool) {\n        return _getNestShareOFTStorage().signatureChecker[_caller];\n    }\n\n    /// @notice Updates the whitelist of contracts allowed to call isValidSignature.\n    /// @dev    Defense-in-depth: only whitelisted callers (e.g. Permit2) receive a positive\n    ///         response. Non-whitelisted callers always receive 0xffffffff regardless of the\n    ///         signature's validity.\n    /// @param  _checker address The contract whose permission to update.\n    /// @param  _allowed bool    True to whitelist, false to remove.\n    function setSignatureChecker(address _checker, bool _allowed) external requiresAuth {\n        _getNestShareOFTStorage().signatureChecker[_checker] = _allowed;\n        emit SignatureCheckerUpdated(_checker, _allowed);\n    }\n\n    /// @notice EIP-1271 signature validation entry point.\n    /// @dev    The input hash is wrapped with this contract's EIP-712 domain separator\n    ///         (which binds chainId + address(this)) before recovery. This prevents a\n    ///         signature valid against one NestShareOFT instance from being replayed\n    ///         against another instance that shares the same strategistSigner.\n    ///         Off-chain signers must therefore sign the wrapped digest:\n    ///             keccak256(\"\\x19\\x01\" || domainSeparator || keccak256(NEST_MESSAGE_TYPEHASH || _hash))\n    ///         not the raw _hash.\n    /// @param  _hash      bytes32 The hash that the calling protocol intends to validate.\n    /// @param  _signature bytes   The off-chain signature over the wrapped digest.\n    /// @return            bytes4  0x1626ba7e on success, 0xffffffff otherwise.\n    function isValidSignature(bytes32 _hash, bytes memory _signature) external view override returns (bytes4) {\n        NestShareOFTStorage storage $ = _getNestShareOFTStorage();\n\n        // Defense-in-depth: only whitelisted callers (e.g. Permit2) get a positive response.\n        if (!$.signatureChecker[msg.sender]) return 0xffffffff;\n\n        address signer = $.strategistSigner;\n        if (signer == address(0)) return 0xffffffff;\n\n        // Bind the signature to this contract's EIP-712 domain (chainId, address(this)).\n        bytes32 wrapped =\n            MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), keccak256(abi.encode(NEST_MESSAGE_TYPEHASH, _hash)));\n\n        (address recovered, ECDSA.RecoverError err,) = ECDSA.tryRecover(wrapped, _signature);\n        if (err == ECDSA.RecoverError.NoError && recovered == signer) {\n            return IERC1271.isValidSignature.selector;\n        }\n        return 0xffffffff;\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                    INTERFACE SUPPORT LOGIC\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Checks if the contract supports a given interface\n    /// @dev    Supports IERC165, IERC7575Share, IERC20, IOFT and IERC1271 interfaces\n    /// @param  _interfaceId bytes4 The interface ID to check for support\n    /// @return              bool   true if the contract supports the given interface ID, false otherwise\n    function supportsInterface(bytes4 _interfaceId) public pure override returns (bool) {\n        return _interfaceId == type(IERC7575Share).interfaceId || _interfaceId == type(IERC165).interfaceId\n            || _interfaceId == type(IOFT).interfaceId || _interfaceId == type(IERC20).interfaceId\n            || _interfaceId == type(IERC1271).interfaceId;\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                        Ownable OVERRIDDEN LOGIC\n    //////////////////////////////////////////////////////////////*/\n\n    /// @inheritdoc AuthUpgradeable\n    function owner() public view override(OwnableUpgradeable, AuthUpgradeable) returns (address) {\n        return AuthUpgradeable.owner();\n    }\n\n    /// @inheritdoc AuthUpgradeable\n    function transferOwnership(address newOwner) public override(OwnableUpgradeable, AuthUpgradeable) requiresAuth {\n        AuthUpgradeable.transferOwnership(newOwner);\n    }\n\n    /// @inheritdoc AuthUpgradeable\n    function acceptOwnership() public override {\n        address oldOwner = owner();\n        AuthUpgradeable.acceptOwnership();\n\n        emit OwnershipTransferred(oldOwner, owner());\n    }\n\n    /// @inheritdoc OwnableUpgradeable\n    function renounceOwnership() public view override(OwnableUpgradeable) requiresAuth {\n        revert Errors.RenounceOwnershipDisabled();\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                    ERC20PermitUpgradeable OVERRIDDEN LOGIC\n    //////////////////////////////////////////////////////////////*/\n\n    /// @dev Uses the current ERC20 name for EIP712 domain calculations.\n    function _EIP712Name() internal view override returns (string memory) {\n        return name();\n    }\n\n    /// @dev Fallback to version \"1\" for proxies upgraded before permit initialization existed.\n    function _EIP712Version() internal view override returns (string memory) {\n        string memory version_ = super._EIP712Version();\n        if (bytes(version_).length == 0) return \"1\";\n\n        return version_;\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/math/Math.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.3.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.20;\n\nimport {Panic} from \"../Panic.sol\";\nimport {SafeCast} from \"./SafeCast.sol\";\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n    enum Rounding {\n        Floor, // Toward negative infinity\n        Ceil, // Toward positive infinity\n        Trunc, // Toward zero\n        Expand // Away from zero\n    }\n\n    /**\n     * @dev Return the 512-bit addition of two uint256.\n     *\n     * The result is stored in two 256 variables such that sum = high * 2²⁵⁶ + low.\n     */\n    function add512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {\n        assembly (\"memory-safe\") {\n            low := add(a, b)\n            high := lt(low, a)\n        }\n    }\n\n    /**\n     * @dev Return the 512-bit multiplication of two uint256.\n     *\n     * The result is stored in two 256 variables such that product = high * 2²⁵⁶ + low.\n     */\n    function mul512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {\n        // 512-bit multiply [high low] = x * y. Compute the product mod 2²⁵⁶ and mod 2²⁵⁶ - 1, then use\n        // the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n        // variables such that product = high * 2²⁵⁶ + low.\n        assembly (\"memory-safe\") {\n            let mm := mulmod(a, b, not(0))\n            low := mul(a, b)\n            high := sub(sub(mm, low), lt(mm, low))\n        }\n    }\n\n    /**\n     * @dev Returns the addition of two unsigned integers, with a success flag (no overflow).\n     */\n    function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            uint256 c = a + b;\n            success = c >= a;\n            result = c * SafeCast.toUint(success);\n        }\n    }\n\n    /**\n     * @dev Returns the subtraction of two unsigned integers, with a success flag (no overflow).\n     */\n    function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            uint256 c = a - b;\n            success = c <= a;\n            result = c * SafeCast.toUint(success);\n        }\n    }\n\n    /**\n     * @dev Returns the multiplication of two unsigned integers, with a success flag (no overflow).\n     */\n    function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            uint256 c = a * b;\n            assembly (\"memory-safe\") {\n                // Only true when the multiplication doesn't overflow\n                // (c / a == b) || (a == 0)\n                success := or(eq(div(c, a), b), iszero(a))\n            }\n            // equivalent to: success ? c : 0\n            result = c * SafeCast.toUint(success);\n        }\n    }\n\n    /**\n     * @dev Returns the division of two unsigned integers, with a success flag (no division by zero).\n     */\n    function tryDiv(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            success = b > 0;\n            assembly (\"memory-safe\") {\n                // The `DIV` opcode returns zero when the denominator is 0.\n                result := div(a, b)\n            }\n        }\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero).\n     */\n    function tryMod(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            success = b > 0;\n            assembly (\"memory-safe\") {\n                // The `MOD` opcode returns zero when the denominator is 0.\n                result := mod(a, b)\n            }\n        }\n    }\n\n    /**\n     * @dev Unsigned saturating addition, bounds to `2²⁵⁶ - 1` instead of overflowing.\n     */\n    function saturatingAdd(uint256 a, uint256 b) internal pure returns (uint256) {\n        (bool success, uint256 result) = tryAdd(a, b);\n        return ternary(success, result, type(uint256).max);\n    }\n\n    /**\n     * @dev Unsigned saturating subtraction, bounds to zero instead of overflowing.\n     */\n    function saturatingSub(uint256 a, uint256 b) internal pure returns (uint256) {\n        (, uint256 result) = trySub(a, b);\n        return result;\n    }\n\n    /**\n     * @dev Unsigned saturating multiplication, bounds to `2²⁵⁶ - 1` instead of overflowing.\n     */\n    function saturatingMul(uint256 a, uint256 b) internal pure returns (uint256) {\n        (bool success, uint256 result) = tryMul(a, b);\n        return ternary(success, result, type(uint256).max);\n    }\n\n    /**\n     * @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.\n     *\n     * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.\n     * However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute\n     * one branch when needed, making this function more expensive.\n     */\n    function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256) {\n        unchecked {\n            // branchless ternary works because:\n            // b ^ (a ^ b) == a\n            // b ^ 0 == b\n            return b ^ ((a ^ b) * SafeCast.toUint(condition));\n        }\n    }\n\n    /**\n     * @dev Returns the largest of two numbers.\n     */\n    function max(uint256 a, uint256 b) internal pure returns (uint256) {\n        return ternary(a > b, a, b);\n    }\n\n    /**\n     * @dev Returns the smallest of two numbers.\n     */\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\n        return ternary(a < b, a, b);\n    }\n\n    /**\n     * @dev Returns the average of two numbers. The result is rounded towards\n     * zero.\n     */\n    function average(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b) / 2 can overflow.\n        return (a & b) + (a ^ b) / 2;\n    }\n\n    /**\n     * @dev Returns the ceiling of the division of two numbers.\n     *\n     * This differs from standard division with `/` in that it rounds towards infinity instead\n     * of rounding towards zero.\n     */\n    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        if (b == 0) {\n            // Guarantee the same behavior as in a regular Solidity division.\n            Panic.panic(Panic.DIVISION_BY_ZERO);\n        }\n\n        // The following calculation ensures accurate ceiling division without overflow.\n        // Since a is non-zero, (a - 1) / b will not overflow.\n        // The largest possible result occurs when (a - 1) / b is type(uint256).max,\n        // but the largest value we can obtain is type(uint256).max - 1, which happens\n        // when a = type(uint256).max and b = 1.\n        unchecked {\n            return SafeCast.toUint(a > 0) * ((a - 1) / b + 1);\n        }\n    }\n\n    /**\n     * @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or\n     * denominator == 0.\n     *\n     * Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by\n     * Uniswap Labs also under MIT license.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n        unchecked {\n            (uint256 high, uint256 low) = mul512(x, y);\n\n            // Handle non-overflow cases, 256 by 256 division.\n            if (high == 0) {\n                // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n                // The surrounding unchecked block does not change this fact.\n                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n                return low / denominator;\n            }\n\n            // Make sure the result is less than 2²⁵⁶. Also prevents denominator == 0.\n            if (denominator <= high) {\n                Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_OVERFLOW));\n            }\n\n            ///////////////////////////////////////////////\n            // 512 by 256 division.\n            ///////////////////////////////////////////////\n\n            // Make division exact by subtracting the remainder from [high low].\n            uint256 remainder;\n            assembly (\"memory-safe\") {\n                // Compute remainder using mulmod.\n                remainder := mulmod(x, y, denominator)\n\n                // Subtract 256 bit number from 512 bit number.\n                high := sub(high, gt(remainder, low))\n                low := sub(low, remainder)\n            }\n\n            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.\n            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.\n\n            uint256 twos = denominator & (0 - denominator);\n            assembly (\"memory-safe\") {\n                // Divide denominator by twos.\n                denominator := div(denominator, twos)\n\n                // Divide [high low] by twos.\n                low := div(low, twos)\n\n                // Flip twos such that it is 2²⁵⁶ / twos. If twos is zero, then it becomes one.\n                twos := add(div(sub(0, twos), twos), 1)\n            }\n\n            // Shift in bits from high into low.\n            low |= high * twos;\n\n            // Invert denominator mod 2²⁵⁶. Now that denominator is an odd number, it has an inverse modulo 2²⁵⁶ such\n            // that denominator * inv ≡ 1 mod 2²⁵⁶. Compute the inverse by starting with a seed that is correct for\n            // four bits. That is, denominator * inv ≡ 1 mod 2⁴.\n            uint256 inverse = (3 * denominator) ^ 2;\n\n            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also\n            // works in modular arithmetic, doubling the correct bits in each step.\n            inverse *= 2 - denominator * inverse; // inverse mod 2⁸\n            inverse *= 2 - denominator * inverse; // inverse mod 2¹⁶\n            inverse *= 2 - denominator * inverse; // inverse mod 2³²\n            inverse *= 2 - denominator * inverse; // inverse mod 2⁶⁴\n            inverse *= 2 - denominator * inverse; // inverse mod 2¹²⁸\n            inverse *= 2 - denominator * inverse; // inverse mod 2²⁵⁶\n\n            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n            // This will give us the correct result modulo 2²⁵⁶. Since the preconditions guarantee that the outcome is\n            // less than 2²⁵⁶, this is the final result. We don't need to compute the high bits of the result and high\n            // is no longer required.\n            result = low * inverse;\n            return result;\n        }\n    }\n\n    /**\n     * @dev Calculates x * y / denominator with full precision, following the selected rounding direction.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n        return mulDiv(x, y, denominator) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0);\n    }\n\n    /**\n     * @dev Calculates floor(x * y >> n) with full precision. Throws if result overflows a uint256.\n     */\n    function mulShr(uint256 x, uint256 y, uint8 n) internal pure returns (uint256 result) {\n        unchecked {\n            (uint256 high, uint256 low) = mul512(x, y);\n            if (high >= 1 << n) {\n                Panic.panic(Panic.UNDER_OVERFLOW);\n            }\n            return (high << (256 - n)) | (low >> n);\n        }\n    }\n\n    /**\n     * @dev Calculates x * y >> n with full precision, following the selected rounding direction.\n     */\n    function mulShr(uint256 x, uint256 y, uint8 n, Rounding rounding) internal pure returns (uint256) {\n        return mulShr(x, y, n) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, 1 << n) > 0);\n    }\n\n    /**\n     * @dev Calculate the modular multiplicative inverse of a number in Z/nZ.\n     *\n     * If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0.\n     * If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible.\n     *\n     * If the input value is not inversible, 0 is returned.\n     *\n     * NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the\n     * inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}.\n     */\n    function invMod(uint256 a, uint256 n) internal pure returns (uint256) {\n        unchecked {\n            if (n == 0) return 0;\n\n            // The inverse modulo is calculated using the Extended Euclidean Algorithm (iterative version)\n            // Used to compute integers x and y such that: ax + ny = gcd(a, n).\n            // When the gcd is 1, then the inverse of a modulo n exists and it's x.\n            // ax + ny = 1\n            // ax = 1 + (-y)n\n            // ax ≡ 1 (mod n) # x is the inverse of a modulo n\n\n            // If the remainder is 0 the gcd is n right away.\n            uint256 remainder = a % n;\n            uint256 gcd = n;\n\n            // Therefore the initial coefficients are:\n            // ax + ny = gcd(a, n) = n\n            // 0a + 1n = n\n            int256 x = 0;\n            int256 y = 1;\n\n            while (remainder != 0) {\n                uint256 quotient = gcd / remainder;\n\n                (gcd, remainder) = (\n                    // The old remainder is the next gcd to try.\n                    remainder,\n                    // Compute the next remainder.\n                    // Can't overflow given that (a % gcd) * (gcd // (a % gcd)) <= gcd\n                    // where gcd is at most n (capped to type(uint256).max)\n                    gcd - remainder * quotient\n                );\n\n                (x, y) = (\n                    // Increment the coefficient of a.\n                    y,\n                    // Decrement the coefficient of n.\n                    // Can overflow, but the result is casted to uint256 so that the\n                    // next value of y is \"wrapped around\" to a value between 0 and n - 1.\n                    x - y * int256(quotient)\n                );\n            }\n\n            if (gcd != 1) return 0; // No inverse exists.\n            return ternary(x < 0, n - uint256(-x), uint256(x)); // Wrap the result if it's negative.\n        }\n    }\n\n    /**\n     * @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`.\n     *\n     * From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is\n     * prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that\n     * `a**(p-2)` is the modular multiplicative inverse of a in Fp.\n     *\n     * NOTE: this function does NOT check that `p` is a prime greater than `2`.\n     */\n    function invModPrime(uint256 a, uint256 p) internal view returns (uint256) {\n        unchecked {\n            return Math.modExp(a, p - 2, p);\n        }\n    }\n\n    /**\n     * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m)\n     *\n     * Requirements:\n     * - modulus can't be zero\n     * - underlying staticcall to precompile must succeed\n     *\n     * IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make\n     * sure the chain you're using it on supports the precompiled contract for modular exponentiation\n     * at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise,\n     * the underlying function will succeed given the lack of a revert, but the result may be incorrectly\n     * interpreted as 0.\n     */\n    function modExp(uint256 b, uint256 e, uint256 m) internal view returns (uint256) {\n        (bool success, uint256 result) = tryModExp(b, e, m);\n        if (!success) {\n            Panic.panic(Panic.DIVISION_BY_ZERO);\n        }\n        return result;\n    }\n\n    /**\n     * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m).\n     * It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying\n     * to operate modulo 0 or if the underlying precompile reverted.\n     *\n     * IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain\n     * you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in\n     * https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack\n     * of a revert, but the result may be incorrectly interpreted as 0.\n     */\n    function tryModExp(uint256 b, uint256 e, uint256 m) internal view returns (bool success, uint256 result) {\n        if (m == 0) return (false, 0);\n        assembly (\"memory-safe\") {\n            let ptr := mload(0x40)\n            // | Offset    | Content    | Content (Hex)                                                      |\n            // |-----------|------------|--------------------------------------------------------------------|\n            // | 0x00:0x1f | size of b  | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n            // | 0x20:0x3f | size of e  | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n            // | 0x40:0x5f | size of m  | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n            // | 0x60:0x7f | value of b | 0x<.............................................................b> |\n            // | 0x80:0x9f | value of e | 0x<.............................................................e> |\n            // | 0xa0:0xbf | value of m | 0x<.............................................................m> |\n            mstore(ptr, 0x20)\n            mstore(add(ptr, 0x20), 0x20)\n            mstore(add(ptr, 0x40), 0x20)\n            mstore(add(ptr, 0x60), b)\n            mstore(add(ptr, 0x80), e)\n            mstore(add(ptr, 0xa0), m)\n\n            // Given the result < m, it's guaranteed to fit in 32 bytes,\n            // so we can use the memory scratch space located at offset 0.\n            success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20)\n            result := mload(0x00)\n        }\n    }\n\n    /**\n     * @dev Variant of {modExp} that supports inputs of arbitrary length.\n     */\n    function modExp(bytes memory b, bytes memory e, bytes memory m) internal view returns (bytes memory) {\n        (bool success, bytes memory result) = tryModExp(b, e, m);\n        if (!success) {\n            Panic.panic(Panic.DIVISION_BY_ZERO);\n        }\n        return result;\n    }\n\n    /**\n     * @dev Variant of {tryModExp} that supports inputs of arbitrary length.\n     */\n    function tryModExp(\n        bytes memory b,\n        bytes memory e,\n        bytes memory m\n    ) internal view returns (bool success, bytes memory result) {\n        if (_zeroBytes(m)) return (false, new bytes(0));\n\n        uint256 mLen = m.length;\n\n        // Encode call args in result and move the free memory pointer\n        result = abi.encodePacked(b.length, e.length, mLen, b, e, m);\n\n        assembly (\"memory-safe\") {\n            let dataPtr := add(result, 0x20)\n            // Write result on top of args to avoid allocating extra memory.\n            success := staticcall(gas(), 0x05, dataPtr, mload(result), dataPtr, mLen)\n            // Overwrite the length.\n            // result.length > returndatasize() is guaranteed because returndatasize() == m.length\n            mstore(result, mLen)\n            // Set the memory pointer after the returned data.\n            mstore(0x40, add(dataPtr, mLen))\n        }\n    }\n\n    /**\n     * @dev Returns whether the provided byte array is zero.\n     */\n    function _zeroBytes(bytes memory byteArray) private pure returns (bool) {\n        for (uint256 i = 0; i < byteArray.length; ++i) {\n            if (byteArray[i] != 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    /**\n     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded\n     * towards zero.\n     *\n     * This method is based on Newton's method for computing square roots; the algorithm is restricted to only\n     * using integer operations.\n     */\n    function sqrt(uint256 a) internal pure returns (uint256) {\n        unchecked {\n            // Take care of easy edge cases when a == 0 or a == 1\n            if (a <= 1) {\n                return a;\n            }\n\n            // In this function, we use Newton's method to get a root of `f(x) := x² - a`. It involves building a\n            // sequence x_n that converges toward sqrt(a). For each iteration x_n, we also define the error between\n            // the current value as `ε_n = | x_n - sqrt(a) |`.\n            //\n            // For our first estimation, we consider `e` the smallest power of 2 which is bigger than the square root\n            // of the target. (i.e. `2**(e-1) ≤ sqrt(a) < 2**e`). We know that `e ≤ 128` because `(2¹²⁸)² = 2²⁵⁶` is\n            // bigger than any uint256.\n            //\n            // By noticing that\n            // `2**(e-1) ≤ sqrt(a) < 2**e → (2**(e-1))² ≤ a < (2**e)² → 2**(2*e-2) ≤ a < 2**(2*e)`\n            // we can deduce that `e - 1` is `log2(a) / 2`. We can thus compute `x_n = 2**(e-1)` using a method similar\n            // to the msb function.\n            uint256 aa = a;\n            uint256 xn = 1;\n\n            if (aa >= (1 << 128)) {\n                aa >>= 128;\n                xn <<= 64;\n            }\n            if (aa >= (1 << 64)) {\n                aa >>= 64;\n                xn <<= 32;\n            }\n            if (aa >= (1 << 32)) {\n                aa >>= 32;\n                xn <<= 16;\n            }\n            if (aa >= (1 << 16)) {\n                aa >>= 16;\n                xn <<= 8;\n            }\n            if (aa >= (1 << 8)) {\n                aa >>= 8;\n                xn <<= 4;\n            }\n            if (aa >= (1 << 4)) {\n                aa >>= 4;\n                xn <<= 2;\n            }\n            if (aa >= (1 << 2)) {\n                xn <<= 1;\n            }\n\n            // We now have x_n such that `x_n = 2**(e-1) ≤ sqrt(a) < 2**e = 2 * x_n`. This implies ε_n ≤ 2**(e-1).\n            //\n            // We can refine our estimation by noticing that the middle of that interval minimizes the error.\n            // If we move x_n to equal 2**(e-1) + 2**(e-2), then we reduce the error to ε_n ≤ 2**(e-2).\n            // This is going to be our x_0 (and ε_0)\n            xn = (3 * xn) >> 1; // ε_0 := | x_0 - sqrt(a) | ≤ 2**(e-2)\n\n            // From here, Newton's method give us:\n            // x_{n+1} = (x_n + a / x_n) / 2\n            //\n            // One should note that:\n            // x_{n+1}² - a = ((x_n + a / x_n) / 2)² - a\n            //              = ((x_n² + a) / (2 * x_n))² - a\n            //              = (x_n⁴ + 2 * a * x_n² + a²) / (4 * x_n²) - a\n            //              = (x_n⁴ + 2 * a * x_n² + a² - 4 * a * x_n²) / (4 * x_n²)\n            //              = (x_n⁴ - 2 * a * x_n² + a²) / (4 * x_n²)\n            //              = (x_n² - a)² / (2 * x_n)²\n            //              = ((x_n² - a) / (2 * x_n))²\n            //              ≥ 0\n            // Which proves that for all n ≥ 1, sqrt(a) ≤ x_n\n            //\n            // This gives us the proof of quadratic convergence of the sequence:\n            // ε_{n+1} = | x_{n+1} - sqrt(a) |\n            //         = | (x_n + a / x_n) / 2 - sqrt(a) |\n            //         = | (x_n² + a - 2*x_n*sqrt(a)) / (2 * x_n) |\n            //         = | (x_n - sqrt(a))² / (2 * x_n) |\n            //         = | ε_n² / (2 * x_n) |\n            //         = ε_n² / | (2 * x_n) |\n            //\n            // For the first iteration, we have a special case where x_0 is known:\n            // ε_1 = ε_0² / | (2 * x_0) |\n            //     ≤ (2**(e-2))² / (2 * (2**(e-1) + 2**(e-2)))\n            //     ≤ 2**(2*e-4) / (3 * 2**(e-1))\n            //     ≤ 2**(e-3) / 3\n            //     ≤ 2**(e-3-log2(3))\n            //     ≤ 2**(e-4.5)\n            //\n            // For the following iterations, we use the fact that, 2**(e-1) ≤ sqrt(a) ≤ x_n:\n            // ε_{n+1} = ε_n² / | (2 * x_n) |\n            //         ≤ (2**(e-k))² / (2 * 2**(e-1))\n            //         ≤ 2**(2*e-2*k) / 2**e\n            //         ≤ 2**(e-2*k)\n            xn = (xn + a / xn) >> 1; // ε_1 := | x_1 - sqrt(a) | ≤ 2**(e-4.5)  -- special case, see above\n            xn = (xn + a / xn) >> 1; // ε_2 := | x_2 - sqrt(a) | ≤ 2**(e-9)    -- general case with k = 4.5\n            xn = (xn + a / xn) >> 1; // ε_3 := | x_3 - sqrt(a) | ≤ 2**(e-18)   -- general case with k = 9\n            xn = (xn + a / xn) >> 1; // ε_4 := | x_4 - sqrt(a) | ≤ 2**(e-36)   -- general case with k = 18\n            xn = (xn + a / xn) >> 1; // ε_5 := | x_5 - sqrt(a) | ≤ 2**(e-72)   -- general case with k = 36\n            xn = (xn + a / xn) >> 1; // ε_6 := | x_6 - sqrt(a) | ≤ 2**(e-144)  -- general case with k = 72\n\n            // Because e ≤ 128 (as discussed during the first estimation phase), we know have reached a precision\n            // ε_6 ≤ 2**(e-144) < 1. Given we're operating on integers, then we can ensure that xn is now either\n            // sqrt(a) or sqrt(a) + 1.\n            return xn - SafeCast.toUint(xn > a / xn);\n        }\n    }\n\n    /**\n     * @dev Calculates sqrt(a), following the selected rounding direction.\n     */\n    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = sqrt(a);\n            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && result * result < a);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 x) internal pure returns (uint256 r) {\n        // If value has upper 128 bits set, log2 result is at least 128\n        r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;\n        // If upper 64 bits of 128-bit half set, add 64 to result\n        r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;\n        // If upper 32 bits of 64-bit half set, add 32 to result\n        r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;\n        // If upper 16 bits of 32-bit half set, add 16 to result\n        r |= SafeCast.toUint((x >> r) > 0xffff) << 4;\n        // If upper 8 bits of 16-bit half set, add 8 to result\n        r |= SafeCast.toUint((x >> r) > 0xff) << 3;\n        // If upper 4 bits of 8-bit half set, add 4 to result\n        r |= SafeCast.toUint((x >> r) > 0xf) << 2;\n\n        // Shifts value right by the current result and use it as an index into this lookup table:\n        //\n        // | x (4 bits) |  index  | table[index] = MSB position |\n        // |------------|---------|-----------------------------|\n        // |    0000    |    0    |        table[0] = 0         |\n        // |    0001    |    1    |        table[1] = 0         |\n        // |    0010    |    2    |        table[2] = 1         |\n        // |    0011    |    3    |        table[3] = 1         |\n        // |    0100    |    4    |        table[4] = 2         |\n        // |    0101    |    5    |        table[5] = 2         |\n        // |    0110    |    6    |        table[6] = 2         |\n        // |    0111    |    7    |        table[7] = 2         |\n        // |    1000    |    8    |        table[8] = 3         |\n        // |    1001    |    9    |        table[9] = 3         |\n        // |    1010    |   10    |        table[10] = 3        |\n        // |    1011    |   11    |        table[11] = 3        |\n        // |    1100    |   12    |        table[12] = 3        |\n        // |    1101    |   13    |        table[13] = 3        |\n        // |    1110    |   14    |        table[14] = 3        |\n        // |    1111    |   15    |        table[15] = 3        |\n        //\n        // The lookup table is represented as a 32-byte value with the MSB positions for 0-15 in the last 16 bytes.\n        assembly (\"memory-safe\") {\n            r := or(r, byte(shr(r, x), 0x0000010102020202030303030303030300000000000000000000000000000000))\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log2(value);\n            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << result < value);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 10 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >= 10 ** 64) {\n                value /= 10 ** 64;\n                result += 64;\n            }\n            if (value >= 10 ** 32) {\n                value /= 10 ** 32;\n                result += 32;\n            }\n            if (value >= 10 ** 16) {\n                value /= 10 ** 16;\n                result += 16;\n            }\n            if (value >= 10 ** 8) {\n                value /= 10 ** 8;\n                result += 8;\n            }\n            if (value >= 10 ** 4) {\n                value /= 10 ** 4;\n                result += 4;\n            }\n            if (value >= 10 ** 2) {\n                value /= 10 ** 2;\n                result += 2;\n            }\n            if (value >= 10 ** 1) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log10(value);\n            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 10 ** result < value);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 256 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     *\n     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n     */\n    function log256(uint256 x) internal pure returns (uint256 r) {\n        // If value has upper 128 bits set, log2 result is at least 128\n        r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;\n        // If upper 64 bits of 128-bit half set, add 64 to result\n        r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;\n        // If upper 32 bits of 64-bit half set, add 32 to result\n        r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;\n        // If upper 16 bits of 32-bit half set, add 16 to result\n        r |= SafeCast.toUint((x >> r) > 0xffff) << 4;\n        // Add 1 if upper 8 bits of 16-bit half set, and divide accumulated result by 8\n        return (r >> 3) | SafeCast.toUint((x >> r) > 0xff);\n    }\n\n    /**\n     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log256(value);\n            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << (result << 3) < value);\n        }\n    }\n\n    /**\n     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.\n     */\n    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {\n        return uint8(rounding) % 2 == 1;\n    }\n}\n"},{"file_path":"node_modules/@layerzerolabs/lz-evm-protocol-v2/contracts/messagelib/libs/PacketV1Codec.sol","source_code":"// SPDX-License-Identifier: LZBL-1.2\n\npragma solidity ^0.8.20;\n\nimport { Packet } from \"../../interfaces/ISendLib.sol\";\nimport { AddressCast } from \"../../libs/AddressCast.sol\";\n\nlibrary PacketV1Codec {\n    using AddressCast for address;\n    using AddressCast for bytes32;\n\n    uint8 internal constant PACKET_VERSION = 1;\n\n    // header (version + nonce + path)\n    // version\n    uint256 private constant PACKET_VERSION_OFFSET = 0;\n    //    nonce\n    uint256 private constant NONCE_OFFSET = 1;\n    //    path\n    uint256 private constant SRC_EID_OFFSET = 9;\n    uint256 private constant SENDER_OFFSET = 13;\n    uint256 private constant DST_EID_OFFSET = 45;\n    uint256 private constant RECEIVER_OFFSET = 49;\n    // payload (guid + message)\n    uint256 private constant GUID_OFFSET = 81; // keccak256(nonce + path)\n    uint256 private constant MESSAGE_OFFSET = 113;\n\n    function encode(Packet memory _packet) internal pure returns (bytes memory encodedPacket) {\n        encodedPacket = abi.encodePacked(\n            PACKET_VERSION,\n            _packet.nonce,\n            _packet.srcEid,\n            _packet.sender.toBytes32(),\n            _packet.dstEid,\n            _packet.receiver,\n            _packet.guid,\n            _packet.message\n        );\n    }\n\n    function encodePacketHeader(Packet memory _packet) internal pure returns (bytes memory) {\n        return\n            abi.encodePacked(\n                PACKET_VERSION,\n                _packet.nonce,\n                _packet.srcEid,\n                _packet.sender.toBytes32(),\n                _packet.dstEid,\n                _packet.receiver\n            );\n    }\n\n    function encodePayload(Packet memory _packet) internal pure returns (bytes memory) {\n        return abi.encodePacked(_packet.guid, _packet.message);\n    }\n\n    function header(bytes calldata _packet) internal pure returns (bytes calldata) {\n        return _packet[0:GUID_OFFSET];\n    }\n\n    function version(bytes calldata _packet) internal pure returns (uint8) {\n        return uint8(bytes1(_packet[PACKET_VERSION_OFFSET:NONCE_OFFSET]));\n    }\n\n    function nonce(bytes calldata _packet) internal pure returns (uint64) {\n        return uint64(bytes8(_packet[NONCE_OFFSET:SRC_EID_OFFSET]));\n    }\n\n    function srcEid(bytes calldata _packet) internal pure returns (uint32) {\n        return uint32(bytes4(_packet[SRC_EID_OFFSET:SENDER_OFFSET]));\n    }\n\n    function sender(bytes calldata _packet) internal pure returns (bytes32) {\n        return bytes32(_packet[SENDER_OFFSET:DST_EID_OFFSET]);\n    }\n\n    function senderAddressB20(bytes calldata _packet) internal pure returns (address) {\n        return sender(_packet).toAddress();\n    }\n\n    function dstEid(bytes calldata _packet) internal pure returns (uint32) {\n        return uint32(bytes4(_packet[DST_EID_OFFSET:RECEIVER_OFFSET]));\n    }\n\n    function receiver(bytes calldata _packet) internal pure returns (bytes32) {\n        return bytes32(_packet[RECEIVER_OFFSET:GUID_OFFSET]);\n    }\n\n    function receiverB20(bytes calldata _packet) internal pure returns (address) {\n        return receiver(_packet).toAddress();\n    }\n\n    function guid(bytes calldata _packet) internal pure returns (bytes32) {\n        return bytes32(_packet[GUID_OFFSET:MESSAGE_OFFSET]);\n    }\n\n    function message(bytes calldata _packet) internal pure returns (bytes calldata) {\n        return bytes(_packet[MESSAGE_OFFSET:]);\n    }\n\n    function payload(bytes calldata _packet) internal pure returns (bytes calldata) {\n        return bytes(_packet[GUID_OFFSET:]);\n    }\n\n    function payloadHash(bytes calldata _packet) internal pure returns (bytes32) {\n        return keccak256(payload(_packet));\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\n\npragma solidity ^0.8.20;\n\nimport {ContextUpgradeable} from \"../utils/ContextUpgradeable.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.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 * The initial owner is set to the address provided by the deployer. This can\n * 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 OwnableUpgradeable is Initializable, ContextUpgradeable {\n    /// @custom:storage-location erc7201:openzeppelin.storage.Ownable\n    struct OwnableStorage {\n        address _owner;\n    }\n\n    // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.Ownable\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300;\n\n    function _getOwnableStorage() private pure returns (OwnableStorage storage $) {\n        assembly {\n            $.slot := OwnableStorageLocation\n        }\n    }\n\n    /**\n     * @dev The caller account is not authorized to perform an operation.\n     */\n    error OwnableUnauthorizedAccount(address account);\n\n    /**\n     * @dev The owner is not a valid owner account. (eg. `address(0)`)\n     */\n    error OwnableInvalidOwner(address owner);\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\n     */\n    function __Ownable_init(address initialOwner) internal onlyInitializing {\n        __Ownable_init_unchained(initialOwner);\n    }\n\n    function __Ownable_init_unchained(address initialOwner) internal onlyInitializing {\n        if (initialOwner == address(0)) {\n            revert OwnableInvalidOwner(address(0));\n        }\n        _transferOwnership(initialOwner);\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        OwnableStorage storage $ = _getOwnableStorage();\n        return $._owner;\n    }\n\n    /**\n     * @dev Throws if the sender is not the owner.\n     */\n    function _checkOwner() internal view virtual {\n        if (owner() != _msgSender()) {\n            revert OwnableUnauthorizedAccount(_msgSender());\n        }\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        if (newOwner == address(0)) {\n            revert OwnableInvalidOwner(address(0));\n        }\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        OwnableStorage storage $ = _getOwnableStorage();\n        address oldOwner = $._owner;\n        $._owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n}\n"},{"file_path":"contracts/libraries/NestVaultDepositLogic.sol","source_code":"// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.30;\n\nimport {ERC20} from \"@solmate/tokens/ERC20.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {NestShareOFT} from \"contracts/NestShareOFT.sol\";\nimport {NestVaultCoreTypes} from \"contracts/types/NestVaultCoreTypes.sol\";\nimport {NestVaultAccountingLogic} from \"contracts/libraries/NestVaultAccountingLogic.sol\";\nimport {NestVaultCoreValidationLogic} from \"contracts/libraries/NestVaultCoreValidationLogic.sol\";\nimport {NestVaultTransferLogic} from \"contracts/libraries/NestVaultTransferLogic.sol\";\n\n/// @title  NestVaultDepositLogic\n/// @notice Library containing deposit-related logic for NestVaultCore\n/// @author plumenetwork\n/// @custom:oz-upgrades-unsafe-allow external-library-linking\nlibrary NestVaultDepositLogic {\n    using NestVaultAccountingLogic for uint256;\n    using NestVaultCoreValidationLogic for NestVaultCoreTypes.NestVaultCoreStorage;\n    using NestVaultTransferLogic for ERC20;\n    using NestVaultTransferLogic for NestShareOFT;\n\n    /*//////////////////////////////////////////////////////////////\n                                EVENTS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @dev   Emitted when a deposit is made\n    /// @param caller   address The caller making the deposit\n    /// @param receiver address The receiver of the shares\n    /// @param assets   uint256 The assets deposited\n    /// @param shares   uint256 The shares minted\n    event Deposit(address indexed caller, address indexed receiver, uint256 assets, uint256 shares);\n\n    /*//////////////////////////////////////////////////////////////\n                          EXECUTE FUNCTIONS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Executes the deposit/enter logic including authorization check\n    /// @param  $             NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _caller       address The caller address\n    /// @param  _receiver     address The receiver address\n    /// @param  _assets       uint256 Assets to deposit\n    /// @param  _shares       uint256 Shares to mint\n    /// @param  shareToken    NestShareOFT The share token\n    /// @param  assetToken    ERC20        The asset token\n    /// @param  _isAuthorized bool         Whether the caller is authorized\n    function executeDeposit(\n        NestVaultCoreTypes.NestVaultCoreStorage storage $,\n        address _caller,\n        address _receiver,\n        uint256 _assets,\n        uint256 _shares,\n        NestShareOFT shareToken,\n        ERC20 assetToken,\n        bool _isAuthorized\n    ) external {\n        // All validation in one call\n        $.validateDeposit(_isAuthorized, _assets, _shares);\n\n        assetToken.safeTransferFrom(_caller, address(this), _assets);\n\n        // Apply deposit fee (flat + percentage): deduct fee from assets before entering share token\n        NestVaultCoreTypes.Fee storage feeConfig = $.fees[NestVaultCoreTypes.Fees.Deposit];\n        (uint256 _netAssets, uint256 _feeAmount) = _assets.calculatePostFeeAmounts(feeConfig.rate, feeConfig.flat);\n        if (_feeAmount > 0) {\n            $.claimableFees[NestVaultCoreTypes.Fees.Deposit] += _feeAmount;\n            emit NestVaultCoreTypes.FeeAccrued(uint8(NestVaultCoreTypes.Fees.Deposit), _receiver, _feeAmount);\n        }\n\n        SafeERC20.forceApprove(IERC20(address(assetToken)), address(shareToken), _netAssets);\n\n        shareToken.safeEnter(assetToken, _netAssets, _receiver, _shares);\n\n        SafeERC20.forceApprove(IERC20(address(assetToken)), address(shareToken), 0);\n\n        emit Deposit(_caller, _receiver, _assets, _shares);\n    }\n}\n"},{"file_path":"node_modules/@layerzerolabs/lz-evm-protocol-v2/contracts/libs/AddressCast.sol","source_code":"// SPDX-License-Identifier: LZBL-1.2\n\npragma solidity ^0.8.20;\n\nlibrary AddressCast {\n    error AddressCast_InvalidSizeForAddress();\n    error AddressCast_InvalidAddress();\n\n    function toBytes32(bytes calldata _addressBytes) internal pure returns (bytes32 result) {\n        if (_addressBytes.length > 32) revert AddressCast_InvalidAddress();\n        result = bytes32(_addressBytes);\n        unchecked {\n            uint256 offset = 32 - _addressBytes.length;\n            result = result >> (offset * 8);\n        }\n    }\n\n    function toBytes32(address _address) internal pure returns (bytes32 result) {\n        result = bytes32(uint256(uint160(_address)));\n    }\n\n    function toBytes(bytes32 _addressBytes32, uint256 _size) internal pure returns (bytes memory result) {\n        if (_size == 0 || _size > 32) revert AddressCast_InvalidSizeForAddress();\n        result = new bytes(_size);\n        unchecked {\n            uint256 offset = 256 - _size * 8;\n            assembly {\n                mstore(add(result, 32), shl(offset, _addressBytes32))\n            }\n        }\n    }\n\n    function toAddress(bytes32 _addressBytes32) internal pure returns (address result) {\n        result = address(uint160(uint256(_addressBytes32)));\n    }\n\n    function toAddress(bytes calldata _addressBytes) internal pure returns (address result) {\n        if (_addressBytes.length != 20) revert AddressCast_InvalidAddress();\n        result = address(bytes20(_addressBytes));\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC20Metadata} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport {ContextUpgradeable} from \"../../utils/ContextUpgradeable.sol\";\nimport {IERC20Errors} from \"@openzeppelin/contracts/interfaces/draft-IERC6093.sol\";\nimport {Initializable} from \"../../proxy/utils/Initializable.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 *\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 ERC-20\n * applications.\n */\nabstract contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20, IERC20Metadata, IERC20Errors {\n    /// @custom:storage-location erc7201:openzeppelin.storage.ERC20\n    struct ERC20Storage {\n        mapping(address account => uint256) _balances;\n\n        mapping(address account => mapping(address spender => uint256)) _allowances;\n\n        uint256 _totalSupply;\n\n        string _name;\n        string _symbol;\n    }\n\n    // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.ERC20\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant ERC20StorageLocation = 0x52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00;\n\n    function _getERC20Storage() private pure returns (ERC20Storage storage $) {\n        assembly {\n            $.slot := ERC20StorageLocation\n        }\n    }\n\n    /**\n     * @dev Sets the values for {name} and {symbol}.\n     *\n     * Both values are immutable: they can only be set once during construction.\n     */\n    function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\n        __ERC20_init_unchained(name_, symbol_);\n    }\n\n    function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n        ERC20Storage storage $ = _getERC20Storage();\n        $._name = name_;\n        $._symbol = symbol_;\n    }\n\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() public view virtual returns (string memory) {\n        ERC20Storage storage $ = _getERC20Storage();\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 returns (string memory) {\n        ERC20Storage storage $ = _getERC20Storage();\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 returns (uint8) {\n        return 18;\n    }\n\n    /// @inheritdoc IERC20\n    function totalSupply() public view virtual returns (uint256) {\n        ERC20Storage storage $ = _getERC20Storage();\n        return $._totalSupply;\n    }\n\n    /// @inheritdoc IERC20\n    function balanceOf(address account) public view virtual returns (uint256) {\n        ERC20Storage storage $ = _getERC20Storage();\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 `value`.\n     */\n    function transfer(address to, uint256 value) public virtual returns (bool) {\n        address owner = _msgSender();\n        _transfer(owner, to, value);\n        return true;\n    }\n\n    /// @inheritdoc IERC20\n    function allowance(address owner, address spender) public view virtual returns (uint256) {\n        ERC20Storage storage $ = _getERC20Storage();\n        return $._allowances[owner][spender];\n    }\n\n    /**\n     * @dev See {IERC20-approve}.\n     *\n     * NOTE: If `value` 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 value) public virtual returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, value);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-transferFrom}.\n     *\n     * Skips emitting an {Approval} event indicating an allowance update. This is not\n     * required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].\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 `value`.\n     * - the caller must have allowance for ``from``'s tokens of at least\n     * `value`.\n     */\n    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n        address spender = _msgSender();\n        _spendAllowance(from, spender, value);\n        _transfer(from, to, value);\n        return true;\n    }\n\n    /**\n     * @dev Moves a `value` 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     * NOTE: This function is not virtual, {_update} should be overridden instead.\n     */\n    function _transfer(address from, address to, uint256 value) internal {\n        if (from == address(0)) {\n            revert ERC20InvalidSender(address(0));\n        }\n        if (to == address(0)) {\n            revert ERC20InvalidReceiver(address(0));\n        }\n        _update(from, to, value);\n    }\n\n    /**\n     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n     * this function.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _update(address from, address to, uint256 value) internal virtual {\n        ERC20Storage storage $ = _getERC20Storage();\n        if (from == address(0)) {\n            // Overflow check required: The rest of the code assumes that totalSupply never overflows\n            $._totalSupply += value;\n        } else {\n            uint256 fromBalance = $._balances[from];\n            if (fromBalance < value) {\n                revert ERC20InsufficientBalance(from, fromBalance, value);\n            }\n            unchecked {\n                // Overflow not possible: value <= fromBalance <= totalSupply.\n                $._balances[from] = fromBalance - value;\n            }\n        }\n\n        if (to == address(0)) {\n            unchecked {\n                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.\n                $._totalSupply -= value;\n            }\n        } else {\n            unchecked {\n                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n                $._balances[to] += value;\n            }\n        }\n\n        emit Transfer(from, to, value);\n    }\n\n    /**\n     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n     * Relies on the `_update` mechanism\n     *\n     * Emits a {Transfer} event with `from` set to the zero address.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead.\n     */\n    function _mint(address account, uint256 value) internal {\n        if (account == address(0)) {\n            revert ERC20InvalidReceiver(address(0));\n        }\n        _update(address(0), account, value);\n    }\n\n    /**\n     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n     * Relies on the `_update` mechanism.\n     *\n     * Emits a {Transfer} event with `to` set to the zero address.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead\n     */\n    function _burn(address account, uint256 value) internal {\n        if (account == address(0)) {\n            revert ERC20InvalidSender(address(0));\n        }\n        _update(account, address(0), value);\n    }\n\n    /**\n     * @dev Sets `value` 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     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n     */\n    function _approve(address owner, address spender, uint256 value) internal {\n        _approve(owner, spender, value, true);\n    }\n\n    /**\n     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n     *\n     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n     * `Approval` event during `transferFrom` operations.\n     *\n     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n     * true using the following override:\n     *\n     * ```solidity\n     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n     *     super._approve(owner, spender, value, true);\n     * }\n     * ```\n     *\n     * Requirements are the same as {_approve}.\n     */\n    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n        ERC20Storage storage $ = _getERC20Storage();\n        if (owner == address(0)) {\n            revert ERC20InvalidApprover(address(0));\n        }\n        if (spender == address(0)) {\n            revert ERC20InvalidSpender(address(0));\n        }\n        $._allowances[owner][spender] = value;\n        if (emitEvent) {\n            emit Approval(owner, spender, value);\n        }\n    }\n\n    /**\n     * @dev Updates `owner`'s allowance for `spender` based on spent `value`.\n     *\n     * Does not update the allowance value in case of infinite allowance.\n     * Revert if not enough allowance is available.\n     *\n     * Does not emit an {Approval} event.\n     */\n    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n        uint256 currentAllowance = allowance(owner, spender);\n        if (currentAllowance < type(uint256).max) {\n            if (currentAllowance < value) {\n                revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n            }\n            unchecked {\n                _approve(owner, spender, currentAllowance - value, false);\n            }\n        }\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/Strings.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (utils/Strings.sol)\n\npragma solidity ^0.8.20;\n\nimport {Math} from \"./math/Math.sol\";\nimport {SafeCast} from \"./math/SafeCast.sol\";\nimport {SignedMath} from \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n    using SafeCast for *;\n\n    bytes16 private constant HEX_DIGITS = \"0123456789abcdef\";\n    uint8 private constant ADDRESS_LENGTH = 20;\n    uint256 private constant SPECIAL_CHARS_LOOKUP =\n        (1 << 0x08) | // backspace\n            (1 << 0x09) | // tab\n            (1 << 0x0a) | // newline\n            (1 << 0x0c) | // form feed\n            (1 << 0x0d) | // carriage return\n            (1 << 0x22) | // double quote\n            (1 << 0x5c); // backslash\n\n    /**\n     * @dev The `value` string doesn't fit in the specified `length`.\n     */\n    error StringsInsufficientHexLength(uint256 value, uint256 length);\n\n    /**\n     * @dev The string being parsed contains characters that are not in scope of the given base.\n     */\n    error StringsInvalidChar();\n\n    /**\n     * @dev The string being parsed is not a properly formatted address.\n     */\n    error StringsInvalidAddressFormat();\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n     */\n    function toString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            uint256 length = Math.log10(value) + 1;\n            string memory buffer = new string(length);\n            uint256 ptr;\n            assembly (\"memory-safe\") {\n                ptr := add(add(buffer, 0x20), length)\n            }\n            while (true) {\n                ptr--;\n                assembly (\"memory-safe\") {\n                    mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))\n                }\n                value /= 10;\n                if (value == 0) break;\n            }\n            return buffer;\n        }\n    }\n\n    /**\n     * @dev Converts a `int256` to its ASCII `string` decimal representation.\n     */\n    function toStringSigned(int256 value) internal pure returns (string memory) {\n        return string.concat(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value)));\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n     */\n    function toHexString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            return toHexString(value, Math.log256(value) + 1);\n        }\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n     */\n    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n        uint256 localValue = value;\n        bytes memory buffer = new bytes(2 * length + 2);\n        buffer[0] = \"0\";\n        buffer[1] = \"x\";\n        for (uint256 i = 2 * length + 1; i > 1; --i) {\n            buffer[i] = HEX_DIGITS[localValue & 0xf];\n            localValue >>= 4;\n        }\n        if (localValue != 0) {\n            revert StringsInsufficientHexLength(value, length);\n        }\n        return string(buffer);\n    }\n\n    /**\n     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal\n     * representation.\n     */\n    function toHexString(address addr) internal pure returns (string memory) {\n        return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);\n    }\n\n    /**\n     * @dev Converts an `address` with fixed length of 20 bytes to its checksummed ASCII `string` hexadecimal\n     * representation, according to EIP-55.\n     */\n    function toChecksumHexString(address addr) internal pure returns (string memory) {\n        bytes memory buffer = bytes(toHexString(addr));\n\n        // hash the hex part of buffer (skip length + 2 bytes, length 40)\n        uint256 hashValue;\n        assembly (\"memory-safe\") {\n            hashValue := shr(96, keccak256(add(buffer, 0x22), 40))\n        }\n\n        for (uint256 i = 41; i > 1; --i) {\n            // possible values for buffer[i] are 48 (0) to 57 (9) and 97 (a) to 102 (f)\n            if (hashValue & 0xf > 7 && uint8(buffer[i]) > 96) {\n                // case shift by xoring with 0x20\n                buffer[i] ^= 0x20;\n            }\n            hashValue >>= 4;\n        }\n        return string(buffer);\n    }\n\n    /**\n     * @dev Returns true if the two strings are equal.\n     */\n    function equal(string memory a, string memory b) internal pure returns (bool) {\n        return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));\n    }\n\n    /**\n     * @dev Parse a decimal string and returns the value as a `uint256`.\n     *\n     * Requirements:\n     * - The string must be formatted as `[0-9]*`\n     * - The result must fit into an `uint256` type\n     */\n    function parseUint(string memory input) internal pure returns (uint256) {\n        return parseUint(input, 0, bytes(input).length);\n    }\n\n    /**\n     * @dev Variant of {parseUint-string} that parses a substring of `input` located between position `begin` (included) and\n     * `end` (excluded).\n     *\n     * Requirements:\n     * - The substring must be formatted as `[0-9]*`\n     * - The result must fit into an `uint256` type\n     */\n    function parseUint(string memory input, uint256 begin, uint256 end) internal pure returns (uint256) {\n        (bool success, uint256 value) = tryParseUint(input, begin, end);\n        if (!success) revert StringsInvalidChar();\n        return value;\n    }\n\n    /**\n     * @dev Variant of {parseUint-string} that returns false if the parsing fails because of an invalid character.\n     *\n     * NOTE: This function will revert if the result does not fit in a `uint256`.\n     */\n    function tryParseUint(string memory input) internal pure returns (bool success, uint256 value) {\n        return _tryParseUintUncheckedBounds(input, 0, bytes(input).length);\n    }\n\n    /**\n     * @dev Variant of {parseUint-string-uint256-uint256} that returns false if the parsing fails because of an invalid\n     * character.\n     *\n     * NOTE: This function will revert if the result does not fit in a `uint256`.\n     */\n    function tryParseUint(\n        string memory input,\n        uint256 begin,\n        uint256 end\n    ) internal pure returns (bool success, uint256 value) {\n        if (end > bytes(input).length || begin > end) return (false, 0);\n        return _tryParseUintUncheckedBounds(input, begin, end);\n    }\n\n    /**\n     * @dev Implementation of {tryParseUint-string-uint256-uint256} that does not check bounds. Caller should make sure that\n     * `begin <= end <= input.length`. Other inputs would result in undefined behavior.\n     */\n    function _tryParseUintUncheckedBounds(\n        string memory input,\n        uint256 begin,\n        uint256 end\n    ) private pure returns (bool success, uint256 value) {\n        bytes memory buffer = bytes(input);\n\n        uint256 result = 0;\n        for (uint256 i = begin; i < end; ++i) {\n            uint8 chr = _tryParseChr(bytes1(_unsafeReadBytesOffset(buffer, i)));\n            if (chr > 9) return (false, 0);\n            result *= 10;\n            result += chr;\n        }\n        return (true, result);\n    }\n\n    /**\n     * @dev Parse a decimal string and returns the value as a `int256`.\n     *\n     * Requirements:\n     * - The string must be formatted as `[-+]?[0-9]*`\n     * - The result must fit in an `int256` type.\n     */\n    function parseInt(string memory input) internal pure returns (int256) {\n        return parseInt(input, 0, bytes(input).length);\n    }\n\n    /**\n     * @dev Variant of {parseInt-string} that parses a substring of `input` located between position `begin` (included) and\n     * `end` (excluded).\n     *\n     * Requirements:\n     * - The substring must be formatted as `[-+]?[0-9]*`\n     * - The result must fit in an `int256` type.\n     */\n    function parseInt(string memory input, uint256 begin, uint256 end) internal pure returns (int256) {\n        (bool success, int256 value) = tryParseInt(input, begin, end);\n        if (!success) revert StringsInvalidChar();\n        return value;\n    }\n\n    /**\n     * @dev Variant of {parseInt-string} that returns false if the parsing fails because of an invalid character or if\n     * the result does not fit in a `int256`.\n     *\n     * NOTE: This function will revert if the absolute value of the result does not fit in a `uint256`.\n     */\n    function tryParseInt(string memory input) internal pure returns (bool success, int256 value) {\n        return _tryParseIntUncheckedBounds(input, 0, bytes(input).length);\n    }\n\n    uint256 private constant ABS_MIN_INT256 = 2 ** 255;\n\n    /**\n     * @dev Variant of {parseInt-string-uint256-uint256} that returns false if the parsing fails because of an invalid\n     * character or if the result does not fit in a `int256`.\n     *\n     * NOTE: This function will revert if the absolute value of the result does not fit in a `uint256`.\n     */\n    function tryParseInt(\n        string memory input,\n        uint256 begin,\n        uint256 end\n    ) internal pure returns (bool success, int256 value) {\n        if (end > bytes(input).length || begin > end) return (false, 0);\n        return _tryParseIntUncheckedBounds(input, begin, end);\n    }\n\n    /**\n     * @dev Implementation of {tryParseInt-string-uint256-uint256} that does not check bounds. Caller should make sure that\n     * `begin <= end <= input.length`. Other inputs would result in undefined behavior.\n     */\n    function _tryParseIntUncheckedBounds(\n        string memory input,\n        uint256 begin,\n        uint256 end\n    ) private pure returns (bool success, int256 value) {\n        bytes memory buffer = bytes(input);\n\n        // Check presence of a negative sign.\n        bytes1 sign = begin == end ? bytes1(0) : bytes1(_unsafeReadBytesOffset(buffer, begin)); // don't do out-of-bound (possibly unsafe) read if sub-string is empty\n        bool positiveSign = sign == bytes1(\"+\");\n        bool negativeSign = sign == bytes1(\"-\");\n        uint256 offset = (positiveSign || negativeSign).toUint();\n\n        (bool absSuccess, uint256 absValue) = tryParseUint(input, begin + offset, end);\n\n        if (absSuccess && absValue < ABS_MIN_INT256) {\n            return (true, negativeSign ? -int256(absValue) : int256(absValue));\n        } else if (absSuccess && negativeSign && absValue == ABS_MIN_INT256) {\n            return (true, type(int256).min);\n        } else return (false, 0);\n    }\n\n    /**\n     * @dev Parse a hexadecimal string (with or without \"0x\" prefix), and returns the value as a `uint256`.\n     *\n     * Requirements:\n     * - The string must be formatted as `(0x)?[0-9a-fA-F]*`\n     * - The result must fit in an `uint256` type.\n     */\n    function parseHexUint(string memory input) internal pure returns (uint256) {\n        return parseHexUint(input, 0, bytes(input).length);\n    }\n\n    /**\n     * @dev Variant of {parseHexUint-string} that parses a substring of `input` located between position `begin` (included) and\n     * `end` (excluded).\n     *\n     * Requirements:\n     * - The substring must be formatted as `(0x)?[0-9a-fA-F]*`\n     * - The result must fit in an `uint256` type.\n     */\n    function parseHexUint(string memory input, uint256 begin, uint256 end) internal pure returns (uint256) {\n        (bool success, uint256 value) = tryParseHexUint(input, begin, end);\n        if (!success) revert StringsInvalidChar();\n        return value;\n    }\n\n    /**\n     * @dev Variant of {parseHexUint-string} that returns false if the parsing fails because of an invalid character.\n     *\n     * NOTE: This function will revert if the result does not fit in a `uint256`.\n     */\n    function tryParseHexUint(string memory input) internal pure returns (bool success, uint256 value) {\n        return _tryParseHexUintUncheckedBounds(input, 0, bytes(input).length);\n    }\n\n    /**\n     * @dev Variant of {parseHexUint-string-uint256-uint256} that returns false if the parsing fails because of an\n     * invalid character.\n     *\n     * NOTE: This function will revert if the result does not fit in a `uint256`.\n     */\n    function tryParseHexUint(\n        string memory input,\n        uint256 begin,\n        uint256 end\n    ) internal pure returns (bool success, uint256 value) {\n        if (end > bytes(input).length || begin > end) return (false, 0);\n        return _tryParseHexUintUncheckedBounds(input, begin, end);\n    }\n\n    /**\n     * @dev Implementation of {tryParseHexUint-string-uint256-uint256} that does not check bounds. Caller should make sure that\n     * `begin <= end <= input.length`. Other inputs would result in undefined behavior.\n     */\n    function _tryParseHexUintUncheckedBounds(\n        string memory input,\n        uint256 begin,\n        uint256 end\n    ) private pure returns (bool success, uint256 value) {\n        bytes memory buffer = bytes(input);\n\n        // skip 0x prefix if present\n        bool hasPrefix = (end > begin + 1) && bytes2(_unsafeReadBytesOffset(buffer, begin)) == bytes2(\"0x\"); // don't do out-of-bound (possibly unsafe) read if sub-string is empty\n        uint256 offset = hasPrefix.toUint() * 2;\n\n        uint256 result = 0;\n        for (uint256 i = begin + offset; i < end; ++i) {\n            uint8 chr = _tryParseChr(bytes1(_unsafeReadBytesOffset(buffer, i)));\n            if (chr > 15) return (false, 0);\n            result *= 16;\n            unchecked {\n                // Multiplying by 16 is equivalent to a shift of 4 bits (with additional overflow check).\n                // This guarantees that adding a value < 16 will not cause an overflow, hence the unchecked.\n                result += chr;\n            }\n        }\n        return (true, result);\n    }\n\n    /**\n     * @dev Parse a hexadecimal string (with or without \"0x\" prefix), and returns the value as an `address`.\n     *\n     * Requirements:\n     * - The string must be formatted as `(0x)?[0-9a-fA-F]{40}`\n     */\n    function parseAddress(string memory input) internal pure returns (address) {\n        return parseAddress(input, 0, bytes(input).length);\n    }\n\n    /**\n     * @dev Variant of {parseAddress-string} that parses a substring of `input` located between position `begin` (included) and\n     * `end` (excluded).\n     *\n     * Requirements:\n     * - The substring must be formatted as `(0x)?[0-9a-fA-F]{40}`\n     */\n    function parseAddress(string memory input, uint256 begin, uint256 end) internal pure returns (address) {\n        (bool success, address value) = tryParseAddress(input, begin, end);\n        if (!success) revert StringsInvalidAddressFormat();\n        return value;\n    }\n\n    /**\n     * @dev Variant of {parseAddress-string} that returns false if the parsing fails because the input is not a properly\n     * formatted address. See {parseAddress-string} requirements.\n     */\n    function tryParseAddress(string memory input) internal pure returns (bool success, address value) {\n        return tryParseAddress(input, 0, bytes(input).length);\n    }\n\n    /**\n     * @dev Variant of {parseAddress-string-uint256-uint256} that returns false if the parsing fails because input is not a properly\n     * formatted address. See {parseAddress-string-uint256-uint256} requirements.\n     */\n    function tryParseAddress(\n        string memory input,\n        uint256 begin,\n        uint256 end\n    ) internal pure returns (bool success, address value) {\n        if (end > bytes(input).length || begin > end) return (false, address(0));\n\n        bool hasPrefix = (end > begin + 1) && bytes2(_unsafeReadBytesOffset(bytes(input), begin)) == bytes2(\"0x\"); // don't do out-of-bound (possibly unsafe) read if sub-string is empty\n        uint256 expectedLength = 40 + hasPrefix.toUint() * 2;\n\n        // check that input is the correct length\n        if (end - begin == expectedLength) {\n            // length guarantees that this does not overflow, and value is at most type(uint160).max\n            (bool s, uint256 v) = _tryParseHexUintUncheckedBounds(input, begin, end);\n            return (s, address(uint160(v)));\n        } else {\n            return (false, address(0));\n        }\n    }\n\n    function _tryParseChr(bytes1 chr) private pure returns (uint8) {\n        uint8 value = uint8(chr);\n\n        // Try to parse `chr`:\n        // - Case 1: [0-9]\n        // - Case 2: [a-f]\n        // - Case 3: [A-F]\n        // - otherwise not supported\n        unchecked {\n            if (value > 47 && value < 58) value -= 48;\n            else if (value > 96 && value < 103) value -= 87;\n            else if (value > 64 && value < 71) value -= 55;\n            else return type(uint8).max;\n        }\n\n        return value;\n    }\n\n    /**\n     * @dev Escape special characters in JSON strings. This can be useful to prevent JSON injection in NFT metadata.\n     *\n     * WARNING: This function should only be used in double quoted JSON strings. Single quotes are not escaped.\n     *\n     * NOTE: This function escapes all unicode characters, and not just the ones in ranges defined in section 2.5 of\n     * RFC-4627 (U+0000 to U+001F, U+0022 and U+005C). ECMAScript's `JSON.parse` does recover escaped unicode\n     * characters that are not in this range, but other tooling may provide different results.\n     */\n    function escapeJSON(string memory input) internal pure returns (string memory) {\n        bytes memory buffer = bytes(input);\n        bytes memory output = new bytes(2 * buffer.length); // worst case scenario\n        uint256 outputLength = 0;\n\n        for (uint256 i; i < buffer.length; ++i) {\n            bytes1 char = bytes1(_unsafeReadBytesOffset(buffer, i));\n            if (((SPECIAL_CHARS_LOOKUP & (1 << uint8(char))) != 0)) {\n                output[outputLength++] = \"\\\\\";\n                if (char == 0x08) output[outputLength++] = \"b\";\n                else if (char == 0x09) output[outputLength++] = \"t\";\n                else if (char == 0x0a) output[outputLength++] = \"n\";\n                else if (char == 0x0c) output[outputLength++] = \"f\";\n                else if (char == 0x0d) output[outputLength++] = \"r\";\n                else if (char == 0x5c) output[outputLength++] = \"\\\\\";\n                else if (char == 0x22) {\n                    // solhint-disable-next-line quotes\n                    output[outputLength++] = '\"';\n                }\n            } else {\n                output[outputLength++] = char;\n            }\n        }\n        // write the actual length and deallocate unused memory\n        assembly (\"memory-safe\") {\n            mstore(output, outputLength)\n            mstore(0x40, add(output, shl(5, shr(5, add(outputLength, 63)))))\n        }\n\n        return string(output);\n    }\n\n    /**\n     * @dev Reads a bytes32 from a bytes array without bounds checking.\n     *\n     * NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the\n     * assembly block as such would prevent some optimizations.\n     */\n    function _unsafeReadBytesOffset(bytes memory buffer, uint256 offset) private pure returns (bytes32 value) {\n        // This is not memory safe in the general case, but all calls to this private function are within bounds.\n        assembly (\"memory-safe\") {\n            value := mload(add(add(buffer, 0x20), offset))\n        }\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/interfaces/IERC4626.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC4626.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC20} from \"../token/ERC20/IERC20.sol\";\nimport {IERC20Metadata} from \"../token/ERC20/extensions/IERC20Metadata.sol\";\n\n/**\n * @dev Interface of the ERC-4626 \"Tokenized Vault Standard\", as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\n */\ninterface IERC4626 is IERC20, IERC20Metadata {\n    event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);\n\n    event Withdraw(\n        address indexed sender,\n        address indexed receiver,\n        address indexed owner,\n        uint256 assets,\n        uint256 shares\n    );\n\n    /**\n     * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n     *\n     * - MUST be an ERC-20 token contract.\n     * - MUST NOT revert.\n     */\n    function asset() external view returns (address assetTokenAddress);\n\n    /**\n     * @dev Returns the total amount of the underlying asset that is “managed” by Vault.\n     *\n     * - SHOULD include any compounding that occurs from yield.\n     * - MUST be inclusive of any fees that are charged against assets in the Vault.\n     * - MUST NOT revert.\n     */\n    function totalAssets() external view returns (uint256 totalManagedAssets);\n\n    /**\n     * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\n     * scenario where all the conditions are met.\n     *\n     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n     * - MUST NOT show any variations depending on the caller.\n     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n     * - MUST NOT revert.\n     *\n     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n     * from.\n     */\n    function convertToShares(uint256 assets) external view returns (uint256 shares);\n\n    /**\n     * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\n     * scenario where all the conditions are met.\n     *\n     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n     * - MUST NOT show any variations depending on the caller.\n     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n     * - MUST NOT revert.\n     *\n     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n     * from.\n     */\n    function convertToAssets(uint256 shares) external view returns (uint256 assets);\n\n    /**\n     * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n     * through a deposit call.\n     *\n     * - MUST return a limited value if receiver is subject to some deposit limit.\n     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n     * - MUST NOT revert.\n     */\n    function maxDeposit(address receiver) external view returns (uint256 maxAssets);\n\n    /**\n     * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\n     * current on-chain conditions.\n     *\n     * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\n     *   call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\n     *   in the same transaction.\n     * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\n     *   deposit would be accepted, regardless if the user has enough tokens approved, etc.\n     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n     * - MUST NOT revert.\n     *\n     * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\n     * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n     */\n    function previewDeposit(uint256 assets) external view returns (uint256 shares);\n\n    /**\n     * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\n     *\n     * - MUST emit the Deposit event.\n     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n     *   deposit execution, and are accounted for during deposit.\n     * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\n     *   approving enough underlying tokens to the Vault contract, etc).\n     *\n     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n     */\n    function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n    /**\n     * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\n     * - MUST return a limited value if receiver is subject to some mint limit.\n     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n     * - MUST NOT revert.\n     */\n    function maxMint(address receiver) external view returns (uint256 maxShares);\n\n    /**\n     * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\n     * current on-chain conditions.\n     *\n     * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\n     *   in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\n     *   same transaction.\n     * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\n     *   would be accepted, regardless if the user has enough tokens approved, etc.\n     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n     * - MUST NOT revert.\n     *\n     * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\n     * share price or some other type of condition, meaning the depositor will lose assets by minting.\n     */\n    function previewMint(uint256 shares) external view returns (uint256 assets);\n\n    /**\n     * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n     *\n     * - MUST emit the Deposit event.\n     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\n     *   execution, and are accounted for during mint.\n     * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\n     *   approving enough underlying tokens to the Vault contract, etc).\n     *\n     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n     */\n    function mint(uint256 shares, address receiver) external returns (uint256 assets);\n\n    /**\n     * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\n     * Vault, through a withdraw call.\n     *\n     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n     * - MUST NOT revert.\n     */\n    function maxWithdraw(address owner) external view returns (uint256 maxAssets);\n\n    /**\n     * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\n     * given current on-chain conditions.\n     *\n     * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\n     *   call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\n     *   called\n     *   in the same transaction.\n     * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\n     *   the withdrawal would be accepted, regardless if the user has enough shares, etc.\n     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n     * - MUST NOT revert.\n     *\n     * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\n     * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n     */\n    function previewWithdraw(uint256 assets) external view returns (uint256 shares);\n\n    /**\n     * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n     *\n     * - MUST emit the Withdraw event.\n     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n     *   withdraw execution, and are accounted for during withdraw.\n     * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\n     *   not having enough shares, etc).\n     *\n     * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n     * Those methods should be performed separately.\n     */\n    function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);\n\n    /**\n     * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n     * through a redeem call.\n     *\n     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n     * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\n     * - MUST NOT revert.\n     */\n    function maxRedeem(address owner) external view returns (uint256 maxShares);\n\n    /**\n     * @dev Allows an on-chain or off-chain user to simulate the effects of their redemption at the current block,\n     * given current on-chain conditions.\n     *\n     * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\n     *   in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\n     *   same transaction.\n     * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\n     *   redemption would be accepted, regardless if the user has enough shares, etc.\n     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n     * - MUST NOT revert.\n     *\n     * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\n     * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\n     */\n    function previewRedeem(uint256 shares) external view returns (uint256 assets);\n\n    /**\n     * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n     *\n     * - MUST emit the Withdraw event.\n     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n     *   redeem execution, and are accounted for during redeem.\n     * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\n     *   not having enough shares, etc).\n     *\n     * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n     * Those methods should be performed separately.\n     */\n    function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/math/SafeCast.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeCast {\n    /**\n     * @dev Value doesn't fit in an uint of `bits` size.\n     */\n    error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);\n\n    /**\n     * @dev An int value doesn't fit in an uint of `bits` size.\n     */\n    error SafeCastOverflowedIntToUint(int256 value);\n\n    /**\n     * @dev Value doesn't fit in an int of `bits` size.\n     */\n    error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);\n\n    /**\n     * @dev An uint value doesn't fit in an int of `bits` size.\n     */\n    error SafeCastOverflowedUintToInt(uint256 value);\n\n    /**\n     * @dev Returns the downcasted uint248 from uint256, reverting on\n     * overflow (when the input is greater than largest uint248).\n     *\n     * Counterpart to Solidity's `uint248` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 248 bits\n     */\n    function toUint248(uint256 value) internal pure returns (uint248) {\n        if (value > type(uint248).max) {\n            revert SafeCastOverflowedUintDowncast(248, value);\n        }\n        return uint248(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint240 from uint256, reverting on\n     * overflow (when the input is greater than largest uint240).\n     *\n     * Counterpart to Solidity's `uint240` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 240 bits\n     */\n    function toUint240(uint256 value) internal pure returns (uint240) {\n        if (value > type(uint240).max) {\n            revert SafeCastOverflowedUintDowncast(240, value);\n        }\n        return uint240(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint232 from uint256, reverting on\n     * overflow (when the input is greater than largest uint232).\n     *\n     * Counterpart to Solidity's `uint232` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 232 bits\n     */\n    function toUint232(uint256 value) internal pure returns (uint232) {\n        if (value > type(uint232).max) {\n            revert SafeCastOverflowedUintDowncast(232, value);\n        }\n        return uint232(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint224 from uint256, reverting on\n     * overflow (when the input is greater than largest uint224).\n     *\n     * Counterpart to Solidity's `uint224` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 224 bits\n     */\n    function toUint224(uint256 value) internal pure returns (uint224) {\n        if (value > type(uint224).max) {\n            revert SafeCastOverflowedUintDowncast(224, value);\n        }\n        return uint224(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint216 from uint256, reverting on\n     * overflow (when the input is greater than largest uint216).\n     *\n     * Counterpart to Solidity's `uint216` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 216 bits\n     */\n    function toUint216(uint256 value) internal pure returns (uint216) {\n        if (value > type(uint216).max) {\n            revert SafeCastOverflowedUintDowncast(216, value);\n        }\n        return uint216(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint208 from uint256, reverting on\n     * overflow (when the input is greater than largest uint208).\n     *\n     * Counterpart to Solidity's `uint208` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 208 bits\n     */\n    function toUint208(uint256 value) internal pure returns (uint208) {\n        if (value > type(uint208).max) {\n            revert SafeCastOverflowedUintDowncast(208, value);\n        }\n        return uint208(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint200 from uint256, reverting on\n     * overflow (when the input is greater than largest uint200).\n     *\n     * Counterpart to Solidity's `uint200` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 200 bits\n     */\n    function toUint200(uint256 value) internal pure returns (uint200) {\n        if (value > type(uint200).max) {\n            revert SafeCastOverflowedUintDowncast(200, value);\n        }\n        return uint200(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint192 from uint256, reverting on\n     * overflow (when the input is greater than largest uint192).\n     *\n     * Counterpart to Solidity's `uint192` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 192 bits\n     */\n    function toUint192(uint256 value) internal pure returns (uint192) {\n        if (value > type(uint192).max) {\n            revert SafeCastOverflowedUintDowncast(192, value);\n        }\n        return uint192(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint184 from uint256, reverting on\n     * overflow (when the input is greater than largest uint184).\n     *\n     * Counterpart to Solidity's `uint184` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 184 bits\n     */\n    function toUint184(uint256 value) internal pure returns (uint184) {\n        if (value > type(uint184).max) {\n            revert SafeCastOverflowedUintDowncast(184, value);\n        }\n        return uint184(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint176 from uint256, reverting on\n     * overflow (when the input is greater than largest uint176).\n     *\n     * Counterpart to Solidity's `uint176` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 176 bits\n     */\n    function toUint176(uint256 value) internal pure returns (uint176) {\n        if (value > type(uint176).max) {\n            revert SafeCastOverflowedUintDowncast(176, value);\n        }\n        return uint176(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint168 from uint256, reverting on\n     * overflow (when the input is greater than largest uint168).\n     *\n     * Counterpart to Solidity's `uint168` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 168 bits\n     */\n    function toUint168(uint256 value) internal pure returns (uint168) {\n        if (value > type(uint168).max) {\n            revert SafeCastOverflowedUintDowncast(168, value);\n        }\n        return uint168(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint160 from uint256, reverting on\n     * overflow (when the input is greater than largest uint160).\n     *\n     * Counterpart to Solidity's `uint160` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 160 bits\n     */\n    function toUint160(uint256 value) internal pure returns (uint160) {\n        if (value > type(uint160).max) {\n            revert SafeCastOverflowedUintDowncast(160, value);\n        }\n        return uint160(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint152 from uint256, reverting on\n     * overflow (when the input is greater than largest uint152).\n     *\n     * Counterpart to Solidity's `uint152` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 152 bits\n     */\n    function toUint152(uint256 value) internal pure returns (uint152) {\n        if (value > type(uint152).max) {\n            revert SafeCastOverflowedUintDowncast(152, value);\n        }\n        return uint152(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint144 from uint256, reverting on\n     * overflow (when the input is greater than largest uint144).\n     *\n     * Counterpart to Solidity's `uint144` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 144 bits\n     */\n    function toUint144(uint256 value) internal pure returns (uint144) {\n        if (value > type(uint144).max) {\n            revert SafeCastOverflowedUintDowncast(144, value);\n        }\n        return uint144(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint136 from uint256, reverting on\n     * overflow (when the input is greater than largest uint136).\n     *\n     * Counterpart to Solidity's `uint136` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 136 bits\n     */\n    function toUint136(uint256 value) internal pure returns (uint136) {\n        if (value > type(uint136).max) {\n            revert SafeCastOverflowedUintDowncast(136, value);\n        }\n        return uint136(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint128 from uint256, reverting on\n     * overflow (when the input is greater than largest uint128).\n     *\n     * Counterpart to Solidity's `uint128` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 128 bits\n     */\n    function toUint128(uint256 value) internal pure returns (uint128) {\n        if (value > type(uint128).max) {\n            revert SafeCastOverflowedUintDowncast(128, value);\n        }\n        return uint128(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint120 from uint256, reverting on\n     * overflow (when the input is greater than largest uint120).\n     *\n     * Counterpart to Solidity's `uint120` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 120 bits\n     */\n    function toUint120(uint256 value) internal pure returns (uint120) {\n        if (value > type(uint120).max) {\n            revert SafeCastOverflowedUintDowncast(120, value);\n        }\n        return uint120(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint112 from uint256, reverting on\n     * overflow (when the input is greater than largest uint112).\n     *\n     * Counterpart to Solidity's `uint112` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 112 bits\n     */\n    function toUint112(uint256 value) internal pure returns (uint112) {\n        if (value > type(uint112).max) {\n            revert SafeCastOverflowedUintDowncast(112, value);\n        }\n        return uint112(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint104 from uint256, reverting on\n     * overflow (when the input is greater than largest uint104).\n     *\n     * Counterpart to Solidity's `uint104` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 104 bits\n     */\n    function toUint104(uint256 value) internal pure returns (uint104) {\n        if (value > type(uint104).max) {\n            revert SafeCastOverflowedUintDowncast(104, value);\n        }\n        return uint104(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint96 from uint256, reverting on\n     * overflow (when the input is greater than largest uint96).\n     *\n     * Counterpart to Solidity's `uint96` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 96 bits\n     */\n    function toUint96(uint256 value) internal pure returns (uint96) {\n        if (value > type(uint96).max) {\n            revert SafeCastOverflowedUintDowncast(96, value);\n        }\n        return uint96(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint88 from uint256, reverting on\n     * overflow (when the input is greater than largest uint88).\n     *\n     * Counterpart to Solidity's `uint88` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 88 bits\n     */\n    function toUint88(uint256 value) internal pure returns (uint88) {\n        if (value > type(uint88).max) {\n            revert SafeCastOverflowedUintDowncast(88, value);\n        }\n        return uint88(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint80 from uint256, reverting on\n     * overflow (when the input is greater than largest uint80).\n     *\n     * Counterpart to Solidity's `uint80` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 80 bits\n     */\n    function toUint80(uint256 value) internal pure returns (uint80) {\n        if (value > type(uint80).max) {\n            revert SafeCastOverflowedUintDowncast(80, value);\n        }\n        return uint80(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint72 from uint256, reverting on\n     * overflow (when the input is greater than largest uint72).\n     *\n     * Counterpart to Solidity's `uint72` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 72 bits\n     */\n    function toUint72(uint256 value) internal pure returns (uint72) {\n        if (value > type(uint72).max) {\n            revert SafeCastOverflowedUintDowncast(72, value);\n        }\n        return uint72(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint64 from uint256, reverting on\n     * overflow (when the input is greater than largest uint64).\n     *\n     * Counterpart to Solidity's `uint64` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 64 bits\n     */\n    function toUint64(uint256 value) internal pure returns (uint64) {\n        if (value > type(uint64).max) {\n            revert SafeCastOverflowedUintDowncast(64, value);\n        }\n        return uint64(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint56 from uint256, reverting on\n     * overflow (when the input is greater than largest uint56).\n     *\n     * Counterpart to Solidity's `uint56` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 56 bits\n     */\n    function toUint56(uint256 value) internal pure returns (uint56) {\n        if (value > type(uint56).max) {\n            revert SafeCastOverflowedUintDowncast(56, value);\n        }\n        return uint56(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint48 from uint256, reverting on\n     * overflow (when the input is greater than largest uint48).\n     *\n     * Counterpart to Solidity's `uint48` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 48 bits\n     */\n    function toUint48(uint256 value) internal pure returns (uint48) {\n        if (value > type(uint48).max) {\n            revert SafeCastOverflowedUintDowncast(48, value);\n        }\n        return uint48(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint40 from uint256, reverting on\n     * overflow (when the input is greater than largest uint40).\n     *\n     * Counterpart to Solidity's `uint40` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 40 bits\n     */\n    function toUint40(uint256 value) internal pure returns (uint40) {\n        if (value > type(uint40).max) {\n            revert SafeCastOverflowedUintDowncast(40, value);\n        }\n        return uint40(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint32 from uint256, reverting on\n     * overflow (when the input is greater than largest uint32).\n     *\n     * Counterpart to Solidity's `uint32` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 32 bits\n     */\n    function toUint32(uint256 value) internal pure returns (uint32) {\n        if (value > type(uint32).max) {\n            revert SafeCastOverflowedUintDowncast(32, value);\n        }\n        return uint32(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint24 from uint256, reverting on\n     * overflow (when the input is greater than largest uint24).\n     *\n     * Counterpart to Solidity's `uint24` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 24 bits\n     */\n    function toUint24(uint256 value) internal pure returns (uint24) {\n        if (value > type(uint24).max) {\n            revert SafeCastOverflowedUintDowncast(24, value);\n        }\n        return uint24(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint16 from uint256, reverting on\n     * overflow (when the input is greater than largest uint16).\n     *\n     * Counterpart to Solidity's `uint16` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 16 bits\n     */\n    function toUint16(uint256 value) internal pure returns (uint16) {\n        if (value > type(uint16).max) {\n            revert SafeCastOverflowedUintDowncast(16, value);\n        }\n        return uint16(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint8 from uint256, reverting on\n     * overflow (when the input is greater than largest uint8).\n     *\n     * Counterpart to Solidity's `uint8` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 8 bits\n     */\n    function toUint8(uint256 value) internal pure returns (uint8) {\n        if (value > type(uint8).max) {\n            revert SafeCastOverflowedUintDowncast(8, value);\n        }\n        return uint8(value);\n    }\n\n    /**\n     * @dev Converts a signed int256 into an unsigned uint256.\n     *\n     * Requirements:\n     *\n     * - input must be greater than or equal to 0.\n     */\n    function toUint256(int256 value) internal pure returns (uint256) {\n        if (value < 0) {\n            revert SafeCastOverflowedIntToUint(value);\n        }\n        return uint256(value);\n    }\n\n    /**\n     * @dev Returns the downcasted int248 from int256, reverting on\n     * overflow (when the input is less than smallest int248 or\n     * greater than largest int248).\n     *\n     * Counterpart to Solidity's `int248` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 248 bits\n     */\n    function toInt248(int256 value) internal pure returns (int248 downcasted) {\n        downcasted = int248(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(248, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int240 from int256, reverting on\n     * overflow (when the input is less than smallest int240 or\n     * greater than largest int240).\n     *\n     * Counterpart to Solidity's `int240` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 240 bits\n     */\n    function toInt240(int256 value) internal pure returns (int240 downcasted) {\n        downcasted = int240(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(240, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int232 from int256, reverting on\n     * overflow (when the input is less than smallest int232 or\n     * greater than largest int232).\n     *\n     * Counterpart to Solidity's `int232` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 232 bits\n     */\n    function toInt232(int256 value) internal pure returns (int232 downcasted) {\n        downcasted = int232(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(232, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int224 from int256, reverting on\n     * overflow (when the input is less than smallest int224 or\n     * greater than largest int224).\n     *\n     * Counterpart to Solidity's `int224` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 224 bits\n     */\n    function toInt224(int256 value) internal pure returns (int224 downcasted) {\n        downcasted = int224(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(224, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int216 from int256, reverting on\n     * overflow (when the input is less than smallest int216 or\n     * greater than largest int216).\n     *\n     * Counterpart to Solidity's `int216` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 216 bits\n     */\n    function toInt216(int256 value) internal pure returns (int216 downcasted) {\n        downcasted = int216(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(216, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int208 from int256, reverting on\n     * overflow (when the input is less than smallest int208 or\n     * greater than largest int208).\n     *\n     * Counterpart to Solidity's `int208` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 208 bits\n     */\n    function toInt208(int256 value) internal pure returns (int208 downcasted) {\n        downcasted = int208(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(208, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int200 from int256, reverting on\n     * overflow (when the input is less than smallest int200 or\n     * greater than largest int200).\n     *\n     * Counterpart to Solidity's `int200` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 200 bits\n     */\n    function toInt200(int256 value) internal pure returns (int200 downcasted) {\n        downcasted = int200(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(200, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int192 from int256, reverting on\n     * overflow (when the input is less than smallest int192 or\n     * greater than largest int192).\n     *\n     * Counterpart to Solidity's `int192` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 192 bits\n     */\n    function toInt192(int256 value) internal pure returns (int192 downcasted) {\n        downcasted = int192(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(192, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int184 from int256, reverting on\n     * overflow (when the input is less than smallest int184 or\n     * greater than largest int184).\n     *\n     * Counterpart to Solidity's `int184` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 184 bits\n     */\n    function toInt184(int256 value) internal pure returns (int184 downcasted) {\n        downcasted = int184(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(184, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int176 from int256, reverting on\n     * overflow (when the input is less than smallest int176 or\n     * greater than largest int176).\n     *\n     * Counterpart to Solidity's `int176` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 176 bits\n     */\n    function toInt176(int256 value) internal pure returns (int176 downcasted) {\n        downcasted = int176(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(176, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int168 from int256, reverting on\n     * overflow (when the input is less than smallest int168 or\n     * greater than largest int168).\n     *\n     * Counterpart to Solidity's `int168` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 168 bits\n     */\n    function toInt168(int256 value) internal pure returns (int168 downcasted) {\n        downcasted = int168(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(168, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int160 from int256, reverting on\n     * overflow (when the input is less than smallest int160 or\n     * greater than largest int160).\n     *\n     * Counterpart to Solidity's `int160` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 160 bits\n     */\n    function toInt160(int256 value) internal pure returns (int160 downcasted) {\n        downcasted = int160(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(160, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int152 from int256, reverting on\n     * overflow (when the input is less than smallest int152 or\n     * greater than largest int152).\n     *\n     * Counterpart to Solidity's `int152` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 152 bits\n     */\n    function toInt152(int256 value) internal pure returns (int152 downcasted) {\n        downcasted = int152(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(152, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int144 from int256, reverting on\n     * overflow (when the input is less than smallest int144 or\n     * greater than largest int144).\n     *\n     * Counterpart to Solidity's `int144` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 144 bits\n     */\n    function toInt144(int256 value) internal pure returns (int144 downcasted) {\n        downcasted = int144(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(144, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int136 from int256, reverting on\n     * overflow (when the input is less than smallest int136 or\n     * greater than largest int136).\n     *\n     * Counterpart to Solidity's `int136` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 136 bits\n     */\n    function toInt136(int256 value) internal pure returns (int136 downcasted) {\n        downcasted = int136(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(136, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int128 from int256, reverting on\n     * overflow (when the input is less than smallest int128 or\n     * greater than largest int128).\n     *\n     * Counterpart to Solidity's `int128` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 128 bits\n     */\n    function toInt128(int256 value) internal pure returns (int128 downcasted) {\n        downcasted = int128(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(128, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int120 from int256, reverting on\n     * overflow (when the input is less than smallest int120 or\n     * greater than largest int120).\n     *\n     * Counterpart to Solidity's `int120` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 120 bits\n     */\n    function toInt120(int256 value) internal pure returns (int120 downcasted) {\n        downcasted = int120(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(120, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int112 from int256, reverting on\n     * overflow (when the input is less than smallest int112 or\n     * greater than largest int112).\n     *\n     * Counterpart to Solidity's `int112` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 112 bits\n     */\n    function toInt112(int256 value) internal pure returns (int112 downcasted) {\n        downcasted = int112(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(112, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int104 from int256, reverting on\n     * overflow (when the input is less than smallest int104 or\n     * greater than largest int104).\n     *\n     * Counterpart to Solidity's `int104` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 104 bits\n     */\n    function toInt104(int256 value) internal pure returns (int104 downcasted) {\n        downcasted = int104(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(104, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int96 from int256, reverting on\n     * overflow (when the input is less than smallest int96 or\n     * greater than largest int96).\n     *\n     * Counterpart to Solidity's `int96` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 96 bits\n     */\n    function toInt96(int256 value) internal pure returns (int96 downcasted) {\n        downcasted = int96(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(96, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int88 from int256, reverting on\n     * overflow (when the input is less than smallest int88 or\n     * greater than largest int88).\n     *\n     * Counterpart to Solidity's `int88` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 88 bits\n     */\n    function toInt88(int256 value) internal pure returns (int88 downcasted) {\n        downcasted = int88(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(88, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int80 from int256, reverting on\n     * overflow (when the input is less than smallest int80 or\n     * greater than largest int80).\n     *\n     * Counterpart to Solidity's `int80` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 80 bits\n     */\n    function toInt80(int256 value) internal pure returns (int80 downcasted) {\n        downcasted = int80(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(80, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int72 from int256, reverting on\n     * overflow (when the input is less than smallest int72 or\n     * greater than largest int72).\n     *\n     * Counterpart to Solidity's `int72` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 72 bits\n     */\n    function toInt72(int256 value) internal pure returns (int72 downcasted) {\n        downcasted = int72(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(72, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int64 from int256, reverting on\n     * overflow (when the input is less than smallest int64 or\n     * greater than largest int64).\n     *\n     * Counterpart to Solidity's `int64` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 64 bits\n     */\n    function toInt64(int256 value) internal pure returns (int64 downcasted) {\n        downcasted = int64(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(64, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int56 from int256, reverting on\n     * overflow (when the input is less than smallest int56 or\n     * greater than largest int56).\n     *\n     * Counterpart to Solidity's `int56` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 56 bits\n     */\n    function toInt56(int256 value) internal pure returns (int56 downcasted) {\n        downcasted = int56(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(56, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int48 from int256, reverting on\n     * overflow (when the input is less than smallest int48 or\n     * greater than largest int48).\n     *\n     * Counterpart to Solidity's `int48` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 48 bits\n     */\n    function toInt48(int256 value) internal pure returns (int48 downcasted) {\n        downcasted = int48(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(48, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int40 from int256, reverting on\n     * overflow (when the input is less than smallest int40 or\n     * greater than largest int40).\n     *\n     * Counterpart to Solidity's `int40` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 40 bits\n     */\n    function toInt40(int256 value) internal pure returns (int40 downcasted) {\n        downcasted = int40(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(40, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int32 from int256, reverting on\n     * overflow (when the input is less than smallest int32 or\n     * greater than largest int32).\n     *\n     * Counterpart to Solidity's `int32` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 32 bits\n     */\n    function toInt32(int256 value) internal pure returns (int32 downcasted) {\n        downcasted = int32(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(32, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int24 from int256, reverting on\n     * overflow (when the input is less than smallest int24 or\n     * greater than largest int24).\n     *\n     * Counterpart to Solidity's `int24` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 24 bits\n     */\n    function toInt24(int256 value) internal pure returns (int24 downcasted) {\n        downcasted = int24(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(24, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int16 from int256, reverting on\n     * overflow (when the input is less than smallest int16 or\n     * greater than largest int16).\n     *\n     * Counterpart to Solidity's `int16` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 16 bits\n     */\n    function toInt16(int256 value) internal pure returns (int16 downcasted) {\n        downcasted = int16(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(16, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int8 from int256, reverting on\n     * overflow (when the input is less than smallest int8 or\n     * greater than largest int8).\n     *\n     * Counterpart to Solidity's `int8` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 8 bits\n     */\n    function toInt8(int256 value) internal pure returns (int8 downcasted) {\n        downcasted = int8(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(8, value);\n        }\n    }\n\n    /**\n     * @dev Converts an unsigned uint256 into a signed int256.\n     *\n     * Requirements:\n     *\n     * - input must be less than or equal to maxInt256.\n     */\n    function toInt256(uint256 value) internal pure returns (int256) {\n        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n        if (value > uint256(type(int256).max)) {\n            revert SafeCastOverflowedUintToInt(value);\n        }\n        return int256(value);\n    }\n\n    /**\n     * @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.\n     */\n    function toUint(bool b) internal pure returns (uint256 u) {\n        assembly (\"memory-safe\") {\n            u := iszero(iszero(b))\n        }\n    }\n}\n"},{"file_path":"node_modules/@layerzerolabs/oapp-evm/contracts/oapp/OAppCore.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport { IOAppCore, ILayerZeroEndpointV2 } from \"./interfaces/IOAppCore.sol\";\n\n/**\n * @title OAppCore\n * @dev Abstract contract implementing the IOAppCore interface with basic OApp configurations.\n */\nabstract contract OAppCore is IOAppCore, Ownable {\n    // The LayerZero endpoint associated with the given OApp\n    ILayerZeroEndpointV2 public immutable endpoint;\n\n    // Mapping to store peers associated with corresponding endpoints\n    mapping(uint32 eid => bytes32 peer) public peers;\n\n    /**\n     * @dev Constructor to initialize the OAppCore with the provided endpoint and delegate.\n     * @param _endpoint The address of the LOCAL Layer Zero endpoint.\n     * @param _delegate The delegate capable of making OApp configurations inside of the endpoint.\n     *\n     * @dev The delegate typically should be set as the owner of the contract.\n     */\n    constructor(address _endpoint, address _delegate) {\n        endpoint = ILayerZeroEndpointV2(_endpoint);\n\n        if (_delegate == address(0)) revert InvalidDelegate();\n        endpoint.setDelegate(_delegate);\n    }\n\n    /**\n     * @notice Sets the peer address (OApp instance) for a corresponding endpoint.\n     * @param _eid The endpoint ID.\n     * @param _peer The address of the peer to be associated with the corresponding endpoint.\n     *\n     * @dev Only the owner/admin of the OApp can call this function.\n     * @dev Indicates that the peer is trusted to send LayerZero messages to this OApp.\n     * @dev Set this to bytes32(0) to remove the peer address.\n     * @dev Peer is a bytes32 to accommodate non-evm chains.\n     */\n    function setPeer(uint32 _eid, bytes32 _peer) public virtual onlyOwner {\n        _setPeer(_eid, _peer);\n    }\n\n    /**\n     * @notice Sets the peer address (OApp instance) for a corresponding endpoint.\n     * @param _eid The endpoint ID.\n     * @param _peer The address of the peer to be associated with the corresponding endpoint.\n     *\n     * @dev Indicates that the peer is trusted to send LayerZero messages to this OApp.\n     * @dev Set this to bytes32(0) to remove the peer address.\n     * @dev Peer is a bytes32 to accommodate non-evm chains.\n     */\n    function _setPeer(uint32 _eid, bytes32 _peer) internal virtual {\n        peers[_eid] = _peer;\n        emit PeerSet(_eid, _peer);\n    }\n\n    /**\n     * @notice Internal function to get the peer address associated with a specific endpoint; reverts if NOT set.\n     * ie. the peer is set to bytes32(0).\n     * @param _eid The endpoint ID.\n     * @return peer The address of the peer associated with the specified endpoint.\n     */\n    function _getPeerOrRevert(uint32 _eid) internal view virtual returns (bytes32) {\n        bytes32 peer = peers[_eid];\n        if (peer == bytes32(0)) revert NoPeer(_eid);\n        return peer;\n    }\n\n    /**\n     * @notice Sets the delegate address for the OApp.\n     * @param _delegate The address of the delegate to be set.\n     *\n     * @dev Only the owner/admin of the OApp can call this function.\n     * @dev Provides the ability for a delegate to set configs, on behalf of the OApp, directly on the Endpoint contract.\n     */\n    function setDelegate(address _delegate) public onlyOwner {\n        endpoint.setDelegate(_delegate);\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-20 standard as defined in the ERC.\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 value of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the value of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens as the allowance of `spender` over the\n     * 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 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the\n     * allowance mechanism. `value` 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 value) external returns (bool);\n}\n"},{"file_path":"contracts/libraries/NestVaultCoreValidationLogic.sol","source_code":"// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.30;\n\nimport {ERC20} from \"@solmate/tokens/ERC20.sol\";\nimport {NestVaultCoreTypes} from \"contracts/types/NestVaultCoreTypes.sol\";\nimport {IERC7540Operator} from \"contracts/interfaces/IERC7540.sol\";\nimport {OperatorRegistry} from \"contracts/operators/OperatorRegistry.sol\";\nimport {NestHubAccountant} from \"contracts/accountant/NestHubAccountant.sol\";\nimport {Errors} from \"contracts/types/Errors.sol\";\n\n/// @title  NestVaultCoreValidationLogic\n/// @notice Library containing validation logic for NestVaultCore operations\n/// @author plumenetwork\nlibrary NestVaultCoreValidationLogic {\n    /// @notice Validates parameters for requestRedeem operation\n    /// @param  $           NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _shares     uint256 The shares to redeem\n    /// @param  _controller address The controller address\n    /// @param  _owner      address The owner address\n    /// @param  _caller     address The caller address\n    function validateRequestRedeem(\n        NestVaultCoreTypes.NestVaultCoreStorage storage $,\n        uint256 _shares,\n        address _controller,\n        address _owner,\n        address _caller,\n        ERC20 /*shareToken*/\n    ) external view {\n        _validateCaller($, _owner, _caller);\n        if (_controller == address(0)) {\n            revert Errors.ZeroAddress();\n        }\n        if (_shares == 0) {\n            revert Errors.ZeroShares();\n        }\n    }\n\n    /// @notice Validates parameters for fulfillRedeem operation\n    /// @param  $           NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _controller address The controller address\n    /// @param  _shares     uint256 The shares to fulfill\n    /// @param  _assets     uint256 The calculated assets\n    function validateFulfillRedeem(\n        NestVaultCoreTypes.NestVaultCoreStorage storage $,\n        address _controller,\n        uint256 _shares,\n        uint256 _assets\n    ) external view {\n        uint256 pendingShares = $.pendingRedeem[_controller].shares;\n        if (pendingShares == 0) {\n            revert Errors.NoPendingRedeem();\n        }\n        if (_shares > pendingShares) {\n            revert Errors.InsufficientBalance();\n        }\n        if (_assets == 0) {\n            revert Errors.ZeroAssets();\n        }\n    }\n\n    /// @notice Validates parameters for instantRedeem operation\n    /// @param  $          NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _shares    uint256 The shares to redeem\n    /// @param  _receiver  address The receiver address\n    /// @param  _owner     address The owner of the shares\n    /// @param  _caller    address The caller address\n    function validateInstantRedeem(\n        NestVaultCoreTypes.NestVaultCoreStorage storage $,\n        uint256 _shares,\n        address _receiver,\n        address _owner,\n        address _caller,\n        ERC20 /*shareToken*/\n    ) external view {\n        _validateCaller($, _owner, _caller);\n        if (_receiver == address(0)) {\n            revert Errors.ZeroAddress();\n        }\n        if (_shares == 0) {\n            revert Errors.ZeroShares();\n        }\n    }\n\n    /// @notice Validates parameters for updateRedeem operation\n    /// @param  $            NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _newShares   uint256 The new shares amount\n    /// @param  _controller  address The controller address\n    /// @param  _receiver    address The receiver address\n    /// @param  _caller      address The caller address\n    /// @param  _oldShares   uint256 The old shares amount\n    function validateUpdateRedeem(\n        NestVaultCoreTypes.NestVaultCoreStorage storage $,\n        uint256 _newShares,\n        address _controller,\n        address _receiver,\n        address _caller,\n        uint256 _oldShares\n    ) external view {\n        _validateCaller($, _controller, _caller);\n        if (_receiver == address(0)) {\n            revert Errors.ZeroAddress();\n        }\n        if (_oldShares == 0) {\n            revert Errors.NoPendingRedeem();\n        }\n        if (_oldShares < _newShares) {\n            revert Errors.InsufficientBalance();\n        }\n    }\n\n    /// @notice Validates parameters for withdraw operation\n    /// @param  $           NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _assets     uint256 The assets to withdraw\n    /// @param  _receiver   address The receiver address\n    /// @param  _controller address The controller address\n    /// @param  _caller     address The caller address\n    function validateWithdraw(\n        NestVaultCoreTypes.NestVaultCoreStorage storage $,\n        uint256 _assets,\n        address _receiver,\n        address _controller,\n        address _caller\n    ) external view {\n        _validateCaller($, _controller, _caller);\n        if (_receiver == address(0)) {\n            revert Errors.ZeroAddress();\n        }\n        if (_assets == 0) {\n            revert Errors.ZeroAssets();\n        }\n        uint256 claimableAssets = $.claimableRedeem[_controller].assets;\n        if (claimableAssets < _assets) {\n            revert Errors.InsufficientClaimable();\n        }\n    }\n\n    /// @notice Validates parameters for redeem operation\n    /// @param  $           NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _shares     uint256 The shares to redeem\n    /// @param  _controller address The controller address\n    /// @param  _receiver   address The receiver address\n    /// @param  _caller     address The caller address\n    function validateRedeem(\n        NestVaultCoreTypes.NestVaultCoreStorage storage $,\n        uint256 _shares,\n        address _controller,\n        address _receiver,\n        address _caller\n    ) external view {\n        _validateCaller($, _controller, _caller);\n        if (_receiver == address(0)) {\n            revert Errors.ZeroAddress();\n        }\n        if (_shares == 0) {\n            revert Errors.ZeroShares();\n        }\n        uint256 claimableShares = $.claimableRedeem[_controller].shares;\n        if (claimableShares < _shares) {\n            revert Errors.InsufficientClaimable();\n        }\n    }\n\n    /// @notice Validates parameters for authorizeOperator operation\n    /// @param  $           NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _controller address The controller address\n    /// @param  _operator   address The operator address\n    /// @param  _nonce      bytes32 The nonce value\n    /// @param  _deadline   uint256 The deadline timestamp\n    function validateAuthorizeOperator(\n        NestVaultCoreTypes.NestVaultCoreStorage storage $,\n        address _controller,\n        address _operator,\n        bytes32 _nonce,\n        uint256 _deadline\n    ) external view {\n        if (_controller == address(0)) revert Errors.ZeroAddress();\n        if (_operator == address(0)) revert Errors.ZeroAddress();\n        if (_controller == _operator) {\n            revert Errors.ERC7540SelfOperatorNotAllowed();\n        }\n        if (block.timestamp > _deadline) {\n            revert Errors.ERC7540Expired();\n        }\n        if ($.authorizations[_controller][_nonce]) {\n            revert Errors.ERC7540UsedAuthorization();\n        }\n    }\n\n    /// @notice Validates parameters for setOperator operation\n    /// @dev    $         NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _operator address The operator address\n    /// @param  _caller   address The caller address\n    function validateSetOperator(\n        NestVaultCoreTypes.NestVaultCoreStorage storage,\n        /*$*/\n        address _operator,\n        address _caller\n    ) external pure {\n        if (_operator == address(0)) {\n            revert Errors.ZeroAddress();\n        }\n        if (_caller == _operator) {\n            revert Errors.ERC7540SelfOperatorNotAllowed();\n        }\n    }\n\n    /// @notice Validates parameters for deposit operation\n    /// @dev    $             NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _isAuthorized bool    Whether the caller is authorized\n    /// @param  _assets       uint256 The assets being deposited\n    /// @param  _shares       uint256 The shares to mint\n    function validateDeposit(\n        NestVaultCoreTypes.NestVaultCoreStorage storage,\n        /*$*/\n        bool _isAuthorized,\n        uint256 _assets,\n        uint256 _shares\n    ) external pure {\n        if (!_isAuthorized) {\n            revert Errors.Unauthorized();\n        }\n        if (_assets > 0 && _shares == 0) {\n            revert Errors.ZeroShares();\n        }\n    }\n\n    /// @notice Validates candidate accountant compatibility\n    /// @dev    Verifies the candidate is a contract and exposes `getRateInQuoteSafe(ERC20)`.\n    ///         A paused NestHubAccountant reverts `getRateInQuoteSafe` with `Errors.Paused()`,\n    ///         which is treated as a valid compatibility signal.\n    /// @param  _accountant address Candidate accountant address\n    /// @param  _asset      ERC20   Vault asset used to probe safe quote rates\n    function validateSetAccountant(\n        NestVaultCoreTypes.NestVaultCoreStorage storage,\n        /*$*/\n        address _accountant,\n        ERC20 _asset\n    ) external view {\n        // Validate that the address is a contract (not an EOA)\n        if (_accountant.code.length == 0) {\n            revert Errors.IncompatibleAccountant();\n        }\n        // Validate that the accountant exposes getRateInQuoteSafe(ERC20).\n        // We verify the call returns at least 32 bytes (a valid uint256) to avoid false positives\n        // from contracts with fallback functions that return empty data.\n        (bool success, bytes memory returnData) =\n            _accountant.staticcall(abi.encodeWithSelector(NestHubAccountant.getRateInQuoteSafe.selector, _asset));\n        bool validResponse = success && returnData.length >= 32;\n        bool revertedPaused = !success && returnData.length >= 4 && bytes4(returnData) == Errors.Paused.selector;\n\n        if (!validResponse && !revertedPaused) {\n            revert Errors.IncompatibleAccountant();\n        }\n    }\n\n    /// @notice Validates fee configuration update for a given fee type\n    /// @param  _f   NestVaultCoreTypes.Fees       Fee type\n    /// @param  _fee NestVaultCoreTypes.Fee   Candidate fee configuration\n    function validateSetFee(\n        NestVaultCoreTypes.NestVaultCoreStorage storage $,\n        NestVaultCoreTypes.Fees _f,\n        NestVaultCoreTypes.Fee calldata _fee\n    ) external view {\n        NestVaultCoreTypes.Fee storage maxFee = $.maxFees[_f];\n        if (_fee.rate > maxFee.rate) revert Errors.InvalidFee();\n        if (_fee.flat > maxFee.flat) revert Errors.InvalidFee();\n    }\n\n    /// @notice Validates max fee configuration update for a given fee type\n    /// @dev    Ensures the new max fee is not below the currently active fee for that type\n    /// @param  $       NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _f      NestVaultCoreTypes.Fees                 Fee type\n    /// @param  _maxFee NestVaultCoreTypes.Fee             Candidate max fee configuration\n    function validateSetMaxFee(\n        NestVaultCoreTypes.NestVaultCoreStorage storage $,\n        NestVaultCoreTypes.Fees _f,\n        NestVaultCoreTypes.Fee calldata _maxFee\n    ) external view {\n        if (_maxFee.rate > NestVaultCoreTypes.FEE_CAP) revert Errors.InvalidFee();\n        NestVaultCoreTypes.Fee storage currentFee = $.fees[_f];\n        if (_maxFee.rate < currentFee.rate) revert Errors.InvalidFee();\n        if (_maxFee.flat < currentFee.flat) revert Errors.InvalidFee();\n    }\n\n    /// @notice Validates fee claim request for a fee type\n    /// @param  _f        NestVaultCoreTypes.Fees                 Fee type to claim\n    /// @param  _receiver address                                 Claim receiver\n    function validateClaimFee(\n        NestVaultCoreTypes.NestVaultCoreStorage storage $,\n        NestVaultCoreTypes.Fees _f,\n        address _receiver\n    ) external view {\n        if (_receiver == address(0)) {\n            revert Errors.ZeroAddress();\n        }\n        if ($.claimableFees[_f] == 0) {\n            revert Errors.ZeroFeesOwed();\n        }\n    }\n\n    /// @notice Validates redeem payout is non-zero\n    /// @dev    $                NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _assets          uint256 The assets to pay out\n    /// @param  _shares          uint256 The shares being redeemed\n    /// @param  _claimableShares uint256 The total claimable shares\n    function validateRedeemPayout(\n        NestVaultCoreTypes.NestVaultCoreStorage storage,\n        /*$*/\n        uint256 _assets,\n        uint256 _shares,\n        uint256 _claimableShares\n    ) external pure {\n        if (_assets == 0 && _shares != _claimableShares) {\n            revert Errors.ERC7540ZeroPayout();\n        }\n    }\n\n    /// @notice Validates operator registry compatibility\n    /// @dev    Allows zero address (registry disabled). For non-zero addresses, probes IERC7540Operator.isOperator via staticcall.\n    /// @param  _operatorRegistry address Candidate operator registry address\n    function validateOperatorRegistry(\n        NestVaultCoreTypes.NestVaultCoreStorage storage,\n        /*$*/\n        address _operatorRegistry\n    )\n        internal\n        view\n    {\n        if (_operatorRegistry == address(0)) return;\n\n        (bool success, bytes memory data) = _operatorRegistry.staticcall(\n            abi.encodeWithSelector(IERC7540Operator.isOperator.selector, address(0), address(0))\n        );\n        if (!success || data.length < 32) {\n            revert Errors.IncompatibleOperatorRegistry();\n        }\n    }\n\n    /// @dev    Internal function to check if an operator is authorized for a given controller\n    /// @param  _controller address The controller whose operator permissions are being queried\n    /// @param  _operator   address The operator being checked\n    /// @return             bool    True if the operator is authorized for the controller\n    function isOperator(NestVaultCoreTypes.NestVaultCoreStorage storage $, address _controller, address _operator)\n        internal\n        view\n        returns (bool)\n    {\n        bool _approved = $.isVaultOperator[_controller][_operator];\n        OperatorRegistry registry = $.operatorRegistry;\n        if (address(registry) == address(0)) return _approved;\n        return _approved || registry.isOperator(_controller, _operator);\n    }\n\n    /// @notice Internal function to validate caller authorization\n    /// @param  $        NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _account address    The account whose authorization is being checked\n    /// @param  _caller  address    The caller address\n    function _validateCaller(NestVaultCoreTypes.NestVaultCoreStorage storage $, address _account, address _caller)\n        private\n        view\n    {\n        if (_account != _caller && !isOperator($, _account, _caller)) {\n            revert Errors.Unauthorized();\n        }\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC-165 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 */\nabstract contract ERC165 is IERC165 {\n    /// @inheritdoc IERC165\n    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n        return interfaceId == type(IERC165).interfaceId;\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n *     doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n *     token.safeTransferFrom(msg.sender, address(this), value);\n *     ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n    /**\n     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n     * given ``owner``'s signed approval.\n     *\n     * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n     * ordering also apply here.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `deadline` must be a timestamp in the future.\n     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n     * over the EIP712-formatted function arguments.\n     * - the signature must use ``owner``'s current nonce (see {nonces}).\n     *\n     * For more information on the signature format, see the\n     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n     * section].\n     *\n     * CAUTION: See Security Considerations above.\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external;\n\n    /**\n     * @dev Returns the current nonce for `owner`. This value must be\n     * included whenever a signature is generated for {permit}.\n     *\n     * Every successful call to {permit} increases ``owner``'s nonce by one. This\n     * prevents a signature from being used multiple times.\n     */\n    function nonces(address owner) external view returns (uint256);\n\n    /**\n     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/interfaces/IERC1363.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC20} from \"./IERC20.sol\";\nimport {IERC165} from \"./IERC165.sol\";\n\n/**\n * @title IERC1363\n * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].\n *\n * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract\n * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.\n */\ninterface IERC1363 is IERC20, IERC165 {\n    /*\n     * Note: the ERC-165 identifier for this interface is 0xb0202a11.\n     * 0xb0202a11 ===\n     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^\n     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^\n     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^\n     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^\n     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^\n     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))\n     */\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferAndCall(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @param data Additional data with no specified format, sent in call to `to`.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param from The address which you want to send tokens from.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param from The address which you want to send tokens from.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @param data Additional data with no specified format, sent in call to `to`.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n     * @param spender The address which will spend the funds.\n     * @param value The amount of tokens to be spent.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function approveAndCall(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n     * @param spender The address which will spend the funds.\n     * @param value The amount of tokens to be spent.\n     * @param data Additional data with no specified format, sent in call to `spender`.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);\n}\n"},{"file_path":"node_modules/solmate/src/utils/SafeTransferLib.sol","source_code":"// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {ERC20} from \"../tokens/ERC20.sol\";\n\n/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)\n/// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.\nlibrary SafeTransferLib {\n    /*//////////////////////////////////////////////////////////////\n                             ETH OPERATIONS\n    //////////////////////////////////////////////////////////////*/\n\n    function safeTransferETH(address to, uint256 amount) internal {\n        bool success;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Transfer the ETH and store if it succeeded or not.\n            success := call(gas(), to, amount, 0, 0, 0, 0)\n        }\n\n        require(success, \"ETH_TRANSFER_FAILED\");\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                            ERC20 OPERATIONS\n    //////////////////////////////////////////////////////////////*/\n\n    function safeTransferFrom(\n        ERC20 token,\n        address from,\n        address to,\n        uint256 amount\n    ) internal {\n        bool success;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Get a pointer to some free memory.\n            let freeMemoryPointer := mload(0x40)\n\n            // Write the abi-encoded calldata into memory, beginning with the function selector.\n            mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)\n            mstore(add(freeMemoryPointer, 4), and(from, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the \"from\" argument.\n            mstore(add(freeMemoryPointer, 36), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the \"to\" argument.\n            mstore(add(freeMemoryPointer, 68), amount) // Append the \"amount\" argument. Masking not required as it's a full 32 byte type.\n\n            // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3.\n            // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\n            success := call(gas(), token, 0, freeMemoryPointer, 100, 0, 32)\n\n            // Set success to whether the call reverted, if not we check it either\n            // returned exactly 1 (can't just be non-zero data), or had no return data and token has code.\n            if and(iszero(and(eq(mload(0), 1), gt(returndatasize(), 31))), success) {\n                success := iszero(or(iszero(extcodesize(token)), returndatasize())) \n            }\n        }\n\n        require(success, \"TRANSFER_FROM_FAILED\");\n    }\n\n    function safeTransfer(\n        ERC20 token,\n        address to,\n        uint256 amount\n    ) internal {\n        bool success;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Get a pointer to some free memory.\n            let freeMemoryPointer := mload(0x40)\n\n            // Write the abi-encoded calldata into memory, beginning with the function selector.\n            mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)\n            mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the \"to\" argument.\n            mstore(add(freeMemoryPointer, 36), amount) // Append the \"amount\" argument. Masking not required as it's a full 32 byte type.\n\n            // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\n            // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\n            success := call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)\n\n            // Set success to whether the call reverted, if not we check it either\n            // returned exactly 1 (can't just be non-zero data), or had no return data and token has code.\n            if and(iszero(and(eq(mload(0), 1), gt(returndatasize(), 31))), success) {\n                success := iszero(or(iszero(extcodesize(token)), returndatasize())) \n            }\n        }\n\n        require(success, \"TRANSFER_FAILED\");\n    }\n\n    function safeApprove(\n        ERC20 token,\n        address to,\n        uint256 amount\n    ) internal {\n        bool success;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Get a pointer to some free memory.\n            let freeMemoryPointer := mload(0x40)\n\n            // Write the abi-encoded calldata into memory, beginning with the function selector.\n            mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000)\n            mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the \"to\" argument.\n            mstore(add(freeMemoryPointer, 36), amount) // Append the \"amount\" argument. Masking not required as it's a full 32 byte type.\n\n            // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\n            // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\n            success := call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)\n\n            // Set success to whether the call reverted, if not we check it either\n            // returned exactly 1 (can't just be non-zero data), or had no return data and token has code.\n            if and(iszero(and(eq(mload(0), 1), gt(returndatasize(), 31))), success) {\n                success := iszero(or(iszero(extcodesize(token)), returndatasize())) \n            }\n        }\n\n        require(success, \"APPROVE_FAILED\");\n    }\n}\n"},{"file_path":"node_modules/@layerzerolabs/oapp-evm/contracts/precrime/interfaces/IPreCrime.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\nstruct PreCrimePeer {\n    uint32 eid;\n    bytes32 preCrime;\n    bytes32 oApp;\n}\n\n// TODO not done yet\ninterface IPreCrime {\n    error OnlyOffChain();\n\n    // for simulate()\n    error PacketOversize(uint256 max, uint256 actual);\n    error PacketUnsorted();\n    error SimulationFailed(bytes reason);\n\n    // for preCrime()\n    error SimulationResultNotFound(uint32 eid);\n    error InvalidSimulationResult(uint32 eid, bytes reason);\n    error CrimeFound(bytes crime);\n\n    function getConfig(bytes[] calldata _packets, uint256[] calldata _packetMsgValues) external returns (bytes memory);\n\n    function simulate(\n        bytes[] calldata _packets,\n        uint256[] calldata _packetMsgValues\n    ) external payable returns (bytes memory);\n\n    function buildSimulationResult() external view returns (bytes memory);\n\n    function preCrime(\n        bytes[] calldata _packets,\n        uint256[] calldata _packetMsgValues,\n        bytes[] calldata _simulations\n    ) external;\n\n    function version() external view returns (uint64 major, uint8 minor);\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/math/SignedMath.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.20;\n\nimport {SafeCast} from \"./SafeCast.sol\";\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n    /**\n     * @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.\n     *\n     * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.\n     * However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute\n     * one branch when needed, making this function more expensive.\n     */\n    function ternary(bool condition, int256 a, int256 b) internal pure returns (int256) {\n        unchecked {\n            // branchless ternary works because:\n            // b ^ (a ^ b) == a\n            // b ^ 0 == b\n            return b ^ ((a ^ b) * int256(SafeCast.toUint(condition)));\n        }\n    }\n\n    /**\n     * @dev Returns the largest of two signed numbers.\n     */\n    function max(int256 a, int256 b) internal pure returns (int256) {\n        return ternary(a > b, a, b);\n    }\n\n    /**\n     * @dev Returns the smallest of two signed numbers.\n     */\n    function min(int256 a, int256 b) internal pure returns (int256) {\n        return ternary(a < b, a, b);\n    }\n\n    /**\n     * @dev Returns the average of two signed numbers without overflow.\n     * The result is rounded towards zero.\n     */\n    function average(int256 a, int256 b) internal pure returns (int256) {\n        // Formula from the book \"Hacker's Delight\"\n        int256 x = (a & b) + ((a ^ b) >> 1);\n        return x + (int256(uint256(x) >> 255) & (a ^ b));\n    }\n\n    /**\n     * @dev Returns the absolute unsigned value of a signed value.\n     */\n    function abs(int256 n) internal pure returns (uint256) {\n        unchecked {\n            // Formula from the \"Bit Twiddling Hacks\" by Sean Eron Anderson.\n            // Since `n` is a signed integer, the generated bytecode will use the SAR opcode to perform the right shift,\n            // taking advantage of the most significant (or \"sign\" bit) in two's complement representation.\n            // This opcode adds new most significant bits set to the value of the previous most significant bit. As a result,\n            // the mask will either be `bytes32(0)` (if n is positive) or `~bytes32(0)` (if n is negative).\n            int256 mask = n >> 255;\n\n            // A `bytes32(0)` mask leaves the input unchanged, while a `~bytes32(0)` mask complements it.\n            return uint256((n + mask) ^ mask);\n        }\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/ERC20Permit.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20Permit} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\";\nimport {ERC20Upgradeable} from \"../ERC20Upgradeable.sol\";\nimport {ECDSA} from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport {EIP712Upgradeable} from \"../../../utils/cryptography/EIP712Upgradeable.sol\";\nimport {NoncesUpgradeable} from \"../../../utils/NoncesUpgradeable.sol\";\nimport {Initializable} from \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\nabstract contract ERC20PermitUpgradeable is Initializable, ERC20Upgradeable, IERC20Permit, EIP712Upgradeable, NoncesUpgradeable {\n    bytes32 private constant PERMIT_TYPEHASH =\n        keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n\n    /**\n     * @dev Permit deadline has expired.\n     */\n    error ERC2612ExpiredSignature(uint256 deadline);\n\n    /**\n     * @dev Mismatched signature.\n     */\n    error ERC2612InvalidSigner(address signer, address owner);\n\n    /**\n     * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n     *\n     * It's a good idea to use the same `name` that is defined as the ERC-20 token name.\n     */\n    function __ERC20Permit_init(string memory name) internal onlyInitializing {\n        __EIP712_init_unchained(name, \"1\");\n    }\n\n    function __ERC20Permit_init_unchained(string memory) internal onlyInitializing {}\n\n    /// @inheritdoc IERC20Permit\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) public virtual {\n        if (block.timestamp > deadline) {\n            revert ERC2612ExpiredSignature(deadline);\n        }\n\n        bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n        bytes32 hash = _hashTypedDataV4(structHash);\n\n        address signer = ECDSA.recover(hash, v, r, s);\n        if (signer != owner) {\n            revert ERC2612InvalidSigner(signer, owner);\n        }\n\n        _approve(owner, spender, value);\n    }\n\n    /// @inheritdoc IERC20Permit\n    function nonces(address owner) public view virtual override(IERC20Permit, NoncesUpgradeable) returns (uint256) {\n        return super.nonces(owner);\n    }\n\n    /// @inheritdoc IERC20Permit\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view virtual returns (bytes32) {\n        return _domainSeparatorV4();\n    }\n}\n"},{"file_path":"contracts/types/NestVaultCoreTypes.sol","source_code":"// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.30;\n\nimport {NestHubAccountant} from \"contracts/accountant/NestHubAccountant.sol\";\nimport {OperatorRegistry} from \"contracts/operators/OperatorRegistry.sol\";\n\n/// @title  NestVaultCoreTypes\n/// @notice Library containing storage struct and type definitions for NestVaultCore\n/// @dev    Extracted to allow sharing between NestVaultCore and its libraries\n/// @author plumenetwork\nlibrary NestVaultCoreTypes {\n    /*//////////////////////////////////////////////////////////////\n                            STORAGE STRUCT\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Storage struct for NestVaultCore\n    /// @dev    Used by library functions that need access to full storage\n    struct NestVaultCoreStorage {\n        // It represents the smallest allowed rate\n        uint256 minRate;\n        // This value is updated whenever a user requests or claims a redeem. It helps track the total shares\n        // that are locked in pending redemptions and not available for new operations\n        uint256 totalPendingShares;\n        // This variable is used to determine the conversion rates between assets and shares, enabling accurate\n        // calculation of deposits, withdrawals, and redemptions.\n        NestHubAccountant accountant;\n        // This mapping stores whether a given operator is authorized for a particular controller. It allows operators\n        // to perform certain actions on behalf of the controller.\n        mapping(address => mapping(address => bool)) isVaultOperator;\n        // This mapping prevents replay attacks by ensuring that authorizations cannot be reused.\n        mapping(address controller => mapping(bytes32 nonce => bool used)) authorizations;\n        // This mapping holds the shares of assets that are currently pending for redemption for a specific controller.\n        mapping(address => PendingRedeem) pendingRedeem;\n        // This mapping tracks the claimable amount of assets and shares for each controller once the redemption request\n        // has been fulfilled.\n        mapping(address => ClaimableRedeem) claimableRedeem;\n        /// Maximum fee configuration per fee type. The `rate` field caps the percentage fee (e.g. 200000 = 20%).\n        /// The `flat` field caps the flat fee (defaults to 0; must be raised before setting a non-zero flat fee).\n        mapping(Fees => Fee) maxFees;\n        /// Active fee configuration per fee type. The total fee charged is `flat + floor(gross * rate / 1e6)`.\n        mapping(Fees => Fee) fees;\n        /// Tracks accrued and claimable assets per fee type (includes both flat and percentage components).\n        mapping(Fees => uint256) claimableFees;\n        // The address of the operator registry contract, which manages operator authorizations\n        OperatorRegistry operatorRegistry;\n    }\n\n    /// @dev   This struct holds the shares of a pending redemption.\n    /// @param shares uint256 The number of shares that are pending redemption.\n    struct PendingRedeem {\n        uint256 shares;\n    }\n\n    /// @dev   This struct holds the assets and shares of a claimable redemption.\n    /// @param assets uint256 The amount of assets that can be redeemed.\n    /// @param shares uint256 The number of shares associated with the claimable redemption.\n    struct ClaimableRedeem {\n        uint256 assets;\n        uint256 shares;\n    }\n\n    // Configurable fees\n    enum Fees {\n        InstantRedemption,\n        Deposit,\n        Redemption\n    }\n\n    /// @notice Fee configuration combining percentage rate and flat fee\n    /// @dev    Total fee for an operation is `flat + floor(gross * rate / 1e6)`.\n    ///         Storage-compatible with the old `uint32` layout: `rate` occupies the same\n    ///         slot position as the former bare uint32 value; `flat` falls into a new slot\n    ///         that defaults to zero.\n    /// @param  rate uint32  Percentage fee rate (1e6 = 100%, e.g. 5000 = 0.5%)\n    /// @param  flat uint256 Flat fee in asset token smallest units (e.g. 100000 = $0.10 for 6-decimal USDC)\n    struct Fee {\n        uint32 rate;\n        uint256 flat;\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                              CONSTANTS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @dev The percentage fee rate cap, denominated in 1e6. Maximum 20%.\n    uint32 internal constant FEE_CAP = 0.2e6;\n\n    /// @dev Maximum exchange rate allowed\n    uint256 internal constant UPPER_BOUND_RATE_CAP = 1e30;\n\n    /*//////////////////////////////////////////////////////////////\n                                EVENTS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @dev   Emitted whenever a vault fee accrues in the asset token\n    /// @param feeType uint8   The `Fees` value (0 = InstantRedemption, 1 = Deposit, 2 = Redemption)\n    /// @param payer   address The address economically bearing the fee (share receiver for `Deposit`, share owner for `Redemption`/`InstantRedemption`)\n    /// @param amount  uint256 The fee amount accrued in asset-token smallest units\n    event FeeAccrued(uint8 indexed feeType, address indexed payer, uint256 amount);\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\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 ContextUpgradeable is Initializable {\n    function __Context_init() internal onlyInitializing {\n    }\n\n    function __Context_init_unchained() internal onlyInitializing {\n    }\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    function _contextSuffixLength() internal view virtual returns (uint256) {\n        return 0;\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.20;\n\nimport {MessageHashUtils} from \"@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol\";\nimport {IERC5267} from \"@openzeppelin/contracts/interfaces/IERC5267.sol\";\nimport {Initializable} from \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP-712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose\n * encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract\n * does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to\n * produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP-712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * NOTE: The upgradeable version of this contract does not use an immutable cache and recomputes the domain separator\n * each time {_domainSeparatorV4} is called. That is cheaper than accessing a cached version in cold storage.\n */\nabstract contract EIP712Upgradeable is Initializable, IERC5267 {\n    bytes32 private constant TYPE_HASH =\n        keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n    /// @custom:storage-location erc7201:openzeppelin.storage.EIP712\n    struct EIP712Storage {\n        /// @custom:oz-renamed-from _HASHED_NAME\n        bytes32 _hashedName;\n        /// @custom:oz-renamed-from _HASHED_VERSION\n        bytes32 _hashedVersion;\n\n        string _name;\n        string _version;\n    }\n\n    // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.EIP712\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant EIP712StorageLocation = 0xa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d100;\n\n    function _getEIP712Storage() private pure returns (EIP712Storage storage $) {\n        assembly {\n            $.slot := EIP712StorageLocation\n        }\n    }\n\n    /**\n     * @dev Initializes the domain separator and parameter caches.\n     *\n     * The meaning of `name` and `version` is specified in\n     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP-712]:\n     *\n     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n     * - `version`: the current major version of the signing domain.\n     *\n     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n     * contract upgrade].\n     */\n    function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\n        __EIP712_init_unchained(name, version);\n    }\n\n    function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\n        EIP712Storage storage $ = _getEIP712Storage();\n        $._name = name;\n        $._version = version;\n\n        // Reset prior values in storage if upgrading\n        $._hashedName = 0;\n        $._hashedVersion = 0;\n    }\n\n    /**\n     * @dev Returns the domain separator for the current chain.\n     */\n    function _domainSeparatorV4() internal view returns (bytes32) {\n        return _buildDomainSeparator();\n    }\n\n    function _buildDomainSeparator() private view returns (bytes32) {\n        return keccak256(abi.encode(TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), block.chainid, address(this)));\n    }\n\n    /**\n     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n     * function returns the hash of the fully encoded EIP712 message for this domain.\n     *\n     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n     *\n     * ```solidity\n     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n     *     keccak256(\"Mail(address to,string contents)\"),\n     *     mailTo,\n     *     keccak256(bytes(mailContents))\n     * )));\n     * address signer = ECDSA.recover(digest, signature);\n     * ```\n     */\n    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n        return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash);\n    }\n\n    /// @inheritdoc IERC5267\n    function eip712Domain()\n        public\n        view\n        virtual\n        returns (\n            bytes1 fields,\n            string memory name,\n            string memory version,\n            uint256 chainId,\n            address verifyingContract,\n            bytes32 salt,\n            uint256[] memory extensions\n        )\n    {\n        EIP712Storage storage $ = _getEIP712Storage();\n        // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized\n        // and the EIP712 domain is not reliable, as it will be missing name and version.\n        require($._hashedName == 0 && $._hashedVersion == 0, \"EIP712: Uninitialized\");\n\n        return (\n            hex\"0f\", // 01111\n            _EIP712Name(),\n            _EIP712Version(),\n            block.chainid,\n            address(this),\n            bytes32(0),\n            new uint256[](0)\n        );\n    }\n\n    /**\n     * @dev The name parameter for the EIP712 domain.\n     *\n     * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n     * are a concern.\n     */\n    function _EIP712Name() internal view virtual returns (string memory) {\n        EIP712Storage storage $ = _getEIP712Storage();\n        return $._name;\n    }\n\n    /**\n     * @dev The version parameter for the EIP712 domain.\n     *\n     * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n     * are a concern.\n     */\n    function _EIP712Version() internal view virtual returns (string memory) {\n        EIP712Storage storage $ = _getEIP712Storage();\n        return $._version;\n    }\n\n    /**\n     * @dev The hash of the name parameter for the EIP712 domain.\n     *\n     * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead.\n     */\n    function _EIP712NameHash() internal view returns (bytes32) {\n        EIP712Storage storage $ = _getEIP712Storage();\n        string memory name = _EIP712Name();\n        if (bytes(name).length > 0) {\n            return keccak256(bytes(name));\n        } else {\n            // If the name is empty, the contract may have been upgraded without initializing the new storage.\n            // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design.\n            bytes32 hashedName = $._hashedName;\n            if (hashedName != 0) {\n                return hashedName;\n            } else {\n                return keccak256(\"\");\n            }\n        }\n    }\n\n    /**\n     * @dev The hash of the version parameter for the EIP712 domain.\n     *\n     * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead.\n     */\n    function _EIP712VersionHash() internal view returns (bytes32) {\n        EIP712Storage storage $ = _getEIP712Storage();\n        string memory version = _EIP712Version();\n        if (bytes(version).length > 0) {\n            return keccak256(bytes(version));\n        } else {\n            // If the version is empty, the contract may have been upgraded without initializing the new storage.\n            // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design.\n            bytes32 hashedVersion = $._hashedVersion;\n            if (hashedVersion != 0) {\n                return hashedVersion;\n            } else {\n                return keccak256(\"\");\n            }\n        }\n    }\n}\n"},{"file_path":"contracts/operators/OperatorRegistry.sol","source_code":"// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.30;\n\nimport {MessageHashUtils} from \"@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol\";\nimport {SignatureChecker} from \"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\";\nimport {EIP712} from \"@openzeppelin/contracts/utils/cryptography/EIP712.sol\";\nimport {Auth, Authority} from \"@solmate/auth/Auth.sol\";\nimport {IERC7540Operator} from \"contracts/interfaces/IERC7540.sol\";\nimport {Errors} from \"contracts/types/Errors.sol\";\n\n/// @title  OperatorRegistry\n/// @notice Global operator registry for ERC7540 operator approvals.\n/// @dev    Stores controller => operator approvals and emits IERC7540 OperatorSet events.\ncontract OperatorRegistry is Auth, EIP712, IERC7540Operator {\n    // This mapping tracks whether an operator is enabled for a given controller.\n    mapping(address controller => mapping(address operator => bool)) internal operatorEnabled;\n    // This mapping prevents replay attacks by ensuring that authorizations cannot be reused.\n    mapping(address controller => mapping(bytes32 nonce => bool used)) authorizations;\n\n    /// @param _owner     Owner address for access-controlled operations\n    /// @param _authority Authority contract used by Solmate Auth\n    constructor(address _owner, Authority _authority) Auth(_owner, _authority) EIP712(\"OperatorRegistry\", \"1\") {\n        if (_owner == address(0)) revert Errors.ZeroAddress();\n    }\n\n    /// @inheritdoc IERC7540Operator\n    function setOperator(address _operator, bool _approved) external override requiresAuth returns (bool _success) {\n        if (_operator == address(0)) {\n            revert Errors.ZeroAddress();\n        }\n        if (msg.sender == _operator) {\n            revert Errors.ERC7540SelfOperatorNotAllowed();\n        }\n\n        operatorEnabled[msg.sender][_operator] = _approved;\n        _success = true;\n\n        emit OperatorSet(msg.sender, _operator, _approved);\n    }\n\n    /// @notice Authorizes an operator for a controller, using a signature to validate\n    /// @dev    The authorization is verified via EIP712 signatures.\n    /// @param  _controller address The controller's address\n    /// @param  _operator   address The operator's address\n    /// @param  _approved   bool    Whether the operator is approved or not\n    /// @param  _nonce      bytes32 A unique identifier for the authorization\n    /// @param  _deadline   uint256 The deadline for the authorization\n    /// @param  _signature  bytes   The signature to validate the authorization\n    /// @return _success   bool    A boolean indicating the success of the operation\n    function authorizeOperator(\n        address _controller,\n        address _operator,\n        bool _approved,\n        bytes32 _nonce,\n        uint256 _deadline,\n        bytes calldata _signature\n    ) external requiresAuth returns (bool _success) {\n        if (_controller == address(0)) revert Errors.ZeroAddress();\n        if (_operator == address(0)) revert Errors.ZeroAddress();\n        if (_controller == _operator) {\n            revert Errors.ERC7540SelfOperatorNotAllowed();\n        }\n        if (block.timestamp > _deadline) {\n            revert Errors.ERC7540Expired();\n        }\n        if (authorizations[_controller][_nonce]) {\n            revert Errors.ERC7540UsedAuthorization();\n        }\n\n        bytes32 _structHash = keccak256(\n            abi.encode(\n                keccak256(\n                    \"AuthorizeOperator(address controller,address operator,bool approved,bytes32 nonce,uint256 deadline)\"\n                ),\n                _controller,\n                _operator,\n                _approved,\n                _nonce,\n                _deadline\n            )\n        );\n\n        bytes32 _hash = MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), _structHash);\n\n        if (!SignatureChecker.isValidSignatureNow(_controller, _hash, _signature)) {\n            revert Errors.ERC7540InvalidSigner();\n        }\n\n        authorizations[_controller][_nonce] = true;\n        operatorEnabled[_controller][_operator] = _approved;\n        emit OperatorSet(_controller, _operator, _approved);\n        return true;\n    }\n\n    /// @inheritdoc IERC7540Operator\n    function isOperator(address _controller, address _operator) external view override returns (bool) {\n        return operatorEnabled[_controller][_operator];\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.3.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n *     function initialize() initializer public {\n *         __ERC20_init(\"MyToken\", \"MTK\");\n *     }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n *     function initializeV2() reinitializer(2) public {\n *         __ERC20Permit_init(\"MyToken\");\n *     }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n *     _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n    /**\n     * @dev Storage of the initializable contract.\n     *\n     * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions\n     * when using with upgradeable contracts.\n     *\n     * @custom:storage-location erc7201:openzeppelin.storage.Initializable\n     */\n    struct InitializableStorage {\n        /**\n         * @dev Indicates that the contract has been initialized.\n         */\n        uint64 _initialized;\n        /**\n         * @dev Indicates that the contract is in the process of being initialized.\n         */\n        bool _initializing;\n    }\n\n    // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.Initializable\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;\n\n    /**\n     * @dev The contract is already initialized.\n     */\n    error InvalidInitialization();\n\n    /**\n     * @dev The contract is not initializing.\n     */\n    error NotInitializing();\n\n    /**\n     * @dev Triggered when the contract has been initialized or reinitialized.\n     */\n    event Initialized(uint64 version);\n\n    /**\n     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n     * `onlyInitializing` functions can be used to initialize parent contracts.\n     *\n     * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any\n     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in\n     * production.\n     *\n     * Emits an {Initialized} event.\n     */\n    modifier initializer() {\n        // solhint-disable-next-line var-name-mixedcase\n        InitializableStorage storage $ = _getInitializableStorage();\n\n        // Cache values to avoid duplicated sloads\n        bool isTopLevelCall = !$._initializing;\n        uint64 initialized = $._initialized;\n\n        // Allowed calls:\n        // - initialSetup: the contract is not in the initializing state and no previous version was\n        //                 initialized\n        // - construction: the contract is initialized at version 1 (no reinitialization) and the\n        //                 current contract is just being deployed\n        bool initialSetup = initialized == 0 && isTopLevelCall;\n        bool construction = initialized == 1 && address(this).code.length == 0;\n\n        if (!initialSetup && !construction) {\n            revert InvalidInitialization();\n        }\n        $._initialized = 1;\n        if (isTopLevelCall) {\n            $._initializing = true;\n        }\n        _;\n        if (isTopLevelCall) {\n            $._initializing = false;\n            emit Initialized(1);\n        }\n    }\n\n    /**\n     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n     * used to initialize parent contracts.\n     *\n     * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n     * are added through upgrades and that require initialization.\n     *\n     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n     * cannot be nested. If one is invoked in the context of another, execution will revert.\n     *\n     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n     * a contract, executing them in the right order is up to the developer or operator.\n     *\n     * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.\n     *\n     * Emits an {Initialized} event.\n     */\n    modifier reinitializer(uint64 version) {\n        // solhint-disable-next-line var-name-mixedcase\n        InitializableStorage storage $ = _getInitializableStorage();\n\n        if ($._initializing || $._initialized >= version) {\n            revert InvalidInitialization();\n        }\n        $._initialized = version;\n        $._initializing = true;\n        _;\n        $._initializing = false;\n        emit Initialized(version);\n    }\n\n    /**\n     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n     * {initializer} and {reinitializer} modifiers, directly or indirectly.\n     */\n    modifier onlyInitializing() {\n        _checkInitializing();\n        _;\n    }\n\n    /**\n     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.\n     */\n    function _checkInitializing() internal view virtual {\n        if (!_isInitializing()) {\n            revert NotInitializing();\n        }\n    }\n\n    /**\n     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n     * through proxies.\n     *\n     * Emits an {Initialized} event the first time it is successfully executed.\n     */\n    function _disableInitializers() internal virtual {\n        // solhint-disable-next-line var-name-mixedcase\n        InitializableStorage storage $ = _getInitializableStorage();\n\n        if ($._initializing) {\n            revert InvalidInitialization();\n        }\n        if ($._initialized != type(uint64).max) {\n            $._initialized = type(uint64).max;\n            emit Initialized(type(uint64).max);\n        }\n    }\n\n    /**\n     * @dev Returns the highest version that has been initialized. See {reinitializer}.\n     */\n    function _getInitializedVersion() internal view returns (uint64) {\n        return _getInitializableStorage()._initialized;\n    }\n\n    /**\n     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n     */\n    function _isInitializing() internal view returns (bool) {\n        return _getInitializableStorage()._initializing;\n    }\n\n    /**\n     * @dev Pointer to storage slot. Allows integrators to override it with a custom storage location.\n     *\n     * NOTE: Consider following the ERC-7201 formula to derive storage locations.\n     */\n    function _initializableStorageSlot() internal pure virtual returns (bytes32) {\n        return INITIALIZABLE_STORAGE;\n    }\n\n    /**\n     * @dev Returns a pointer to the storage namespace.\n     */\n    // solhint-disable-next-line var-name-mixedcase\n    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {\n        bytes32 slot = _initializableStorageSlot();\n        assembly {\n            $.slot := slot\n        }\n    }\n}\n"},{"file_path":"contracts/auth/AuthUpgradeable.sol","source_code":"// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n// contracts\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {ContextUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\nimport {Authority} from \"@solmate/auth/Auth.sol\";\n\n/// @title AuthUpgradeable Contract\n/// @notice This contract provides a flexible and updatable authentication pattern\n///         that is entirely separate from the application logic. The original\n///         implementation has been modified to support upgradeable proxies,\n///         using OpenZeppelin's Initializable contract for initialization.\n///\n/// @dev This contract is an upgradeable version of the `Auth` contract from Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol).\n///      It has been modified to include the `Initializable` and `ContextUpgradeable` contracts from OpenZeppelin to support the use of upgradeable proxies.\n///      This ensures that the contract logic can be updated in the future while maintaining its state and existing data.\n///      The contract is designed to be used in proxy-based patterns (such as UUPS or Transparent proxies).\n///      Ensure that the initialization is done properly in the proxy's constructor to avoid any issues.\n/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\n/// @author Further modified by plumenetwork to support upgradeable proxies\nabstract contract AuthUpgradeable is Initializable, ContextUpgradeable {\n    /// @notice Emitted when ownership is transferred to a new address\n    /// @param previousOwner The address of the current owner before the transfer\n    /// @param newOwner The address of the new owner.\n    event AUTH_OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /// @notice Emitted when the authority is updated\n    /// @param user address of the user updating the authority\n    /// @param newAuthority address of the new authority\n    event AUTH_AuthorityUpdated(address indexed user, Authority indexed newAuthority);\n\n    /// @notice Emitted when ownership transfer is started\n    /// @param previousOwner The address of current owner\n    /// @param newOwner The address of new owner\n    event AUTH_OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n    /// @dev The caller account is not authorized to perform an operation\n    error AUTH_UNAUTHORIZED();\n\n    /// @dev The address(0) is not allowed\n    error AUTH_ZERO_ADDRESS();\n\n    /// @dev This struct stores the current owner's address and the contract's authority\n    /// @param _owner The address of the current contract owner\n    /// @param _authority The address of the current authority\n    /// @param _pendingOwner The address of the pending owner\n    /// @custom:storage-location erc7201:plumenetwork.storage.Auth\n    struct AuthStorage {\n        address _owner;\n        Authority _authority;\n        address _pendingOwner;\n    }\n\n    // keccak256(abi.encode(uint256(keccak256(\"plumenetwork.storage.Auth\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant AuthStorageLocation = 0x341f7c713c76cb881fd7047f7cccebe3fe10eddfc5e20fe83ee7e0b505e8ea00;\n\n    /// @dev Internal function to access the contract's AuthStorage slot\n    /// @return $ A reference to the AuthStorage struct for reading/writing authentication data\n    function _getAuthStorage() private pure returns (AuthStorage storage $) {\n        assembly {\n            $.slot := AuthStorageLocation\n        }\n    }\n\n    /// @notice Initializes the contract with the owner's address and the authority\n    /// @param _owner The address to set as the owner of the contract\n    /// @param _authority The address of the initial authority responsible for managing permissions\n    function __Auth_init(address _owner, Authority _authority) internal onlyInitializing {\n        __Auth_init_unchained(_owner, _authority);\n    }\n\n    /// @dev Internal function to initialize the contract's state\n    /// @param _owner The address to set as the owner of the contract\n    /// @param _authority The address of the initial authority\n    function __Auth_init_unchained(address _owner, Authority _authority) internal onlyInitializing {\n        AuthStorage storage $ = _getAuthStorage();\n        $._owner = _owner;\n        emit AUTH_OwnershipTransferred(address(0), _owner);\n        $._authority = _authority;\n        emit AUTH_AuthorityUpdated(_msgSender(), _authority);\n    }\n\n    /// @notice Modifier that ensures the caller is authorized to perform the action\n    /// @dev This modifier checks whether the caller is authorized based on the current\n    ///      authority or is the owner of the contract\n    modifier requiresAuth() virtual {\n        _checkAuth();\n        _;\n    }\n\n    /// @dev Internal function to check authorization\n    /// @dev Reverts with UNAUTHORIZED if msg.sender is not authorized for msg.sig\n    function _checkAuth() internal view virtual {\n        if (!isAuthorized(_msgSender(), msg.sig)) {\n            revert AUTH_UNAUTHORIZED();\n        }\n    }\n\n    /// @notice Retrieves the current owner of the contract\n    /// @return The address of the current owner\n    function owner() public view virtual returns (address) {\n        AuthStorage storage $ = _getAuthStorage();\n        return $._owner;\n    }\n\n    /// @notice Retrieves the current authority of the contract\n    /// @return The address of the current authority\n    function authority() public view virtual returns (Authority) {\n        AuthStorage storage $ = _getAuthStorage();\n        return $._authority;\n    }\n\n    /// @notice Checks if a user is authorized to call a specific function in the contract\n    /// @param user The address of the user requesting access\n    /// @param functionSig The signature of the function being called\n    /// @return A boolean indicating whether the user is authorized\n    function isAuthorized(address user, bytes4 functionSig) internal view virtual returns (bool) {\n        Authority auth = authority(); // Memoizing authority saves us a warm SLOAD, around 100 gas.\n\n        // Checking if the caller is the owner only after calling the authority saves gas in most cases, but be\n        // aware that this makes protected functions uncallable even to the owner if the authority is out of order.\n        return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner();\n    }\n\n    /// @notice Allows the owner to set a new authority for the contract\n    /// @param newAuthority The address of the new authority\n    function setAuthority(Authority newAuthority) public virtual {\n        AuthStorage storage $ = _getAuthStorage();\n        // We check if the caller is the owner first because we want to ensure they can\n        // always swap out the authority even if it's reverting or using up a lot of gas.\n        require(_msgSender() == owner() || $._authority.canCall(_msgSender(), address(this), msg.sig));\n\n        $._authority = newAuthority;\n\n        emit AUTH_AuthorityUpdated(_msgSender(), newAuthority);\n    }\n\n    /// @notice Initiates ownership transfer to a new address (step 1 of 2)\n    /// @param newOwner The address of the proposed new owner\n    function transferOwnership(address newOwner) public virtual requiresAuth {\n        if (newOwner == address(0)) revert AUTH_ZERO_ADDRESS();\n\n        AuthStorage storage $ = _getAuthStorage();\n        $._pendingOwner = newOwner;\n\n        emit AUTH_OwnershipTransferStarted(_msgSender(), newOwner);\n    }\n\n    /// @notice Accepts ownership transfer (step 2 of 2)\n    /// @dev Must be called by the pending owner to complete the transfer\n    function acceptOwnership() public virtual {\n        AuthStorage storage $ = _getAuthStorage();\n\n        if (_msgSender() != $._pendingOwner) revert AUTH_UNAUTHORIZED();\n\n        address oldOwner = $._owner;\n        $._owner = $._pendingOwner;\n        $._pendingOwner = address(0);\n\n        emit AUTH_OwnershipTransferred(oldOwner, $._owner);\n    }\n\n    /// @notice Returns the pending owner address\n    /// @return The address of the pending owner (if any)\n    function pendingOwner() public view virtual returns (address) {\n        AuthStorage storage $ = _getAuthStorage();\n        return $._pendingOwner;\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/cryptography/EIP712.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.20;\n\nimport {MessageHashUtils} from \"./MessageHashUtils.sol\";\nimport {ShortStrings, ShortString} from \"../ShortStrings.sol\";\nimport {IERC5267} from \"../../interfaces/IERC5267.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP-712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose\n * encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract\n * does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to\n * produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP-712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\n * separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\n *\n * @custom:oz-upgrades-unsafe-allow state-variable-immutable\n */\nabstract contract EIP712 is IERC5267 {\n    using ShortStrings for *;\n\n    bytes32 private constant TYPE_HASH =\n        keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n    // invalidate the cached domain separator if the chain id changes.\n    bytes32 private immutable _cachedDomainSeparator;\n    uint256 private immutable _cachedChainId;\n    address private immutable _cachedThis;\n\n    bytes32 private immutable _hashedName;\n    bytes32 private immutable _hashedVersion;\n\n    ShortString private immutable _name;\n    ShortString private immutable _version;\n    // slither-disable-next-line constable-states\n    string private _nameFallback;\n    // slither-disable-next-line constable-states\n    string private _versionFallback;\n\n    /**\n     * @dev Initializes the domain separator and parameter caches.\n     *\n     * The meaning of `name` and `version` is specified in\n     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP-712]:\n     *\n     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n     * - `version`: the current major version of the signing domain.\n     *\n     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n     * contract upgrade].\n     */\n    constructor(string memory name, string memory version) {\n        _name = name.toShortStringWithFallback(_nameFallback);\n        _version = version.toShortStringWithFallback(_versionFallback);\n        _hashedName = keccak256(bytes(name));\n        _hashedVersion = keccak256(bytes(version));\n\n        _cachedChainId = block.chainid;\n        _cachedDomainSeparator = _buildDomainSeparator();\n        _cachedThis = address(this);\n    }\n\n    /**\n     * @dev Returns the domain separator for the current chain.\n     */\n    function _domainSeparatorV4() internal view returns (bytes32) {\n        if (address(this) == _cachedThis && block.chainid == _cachedChainId) {\n            return _cachedDomainSeparator;\n        } else {\n            return _buildDomainSeparator();\n        }\n    }\n\n    function _buildDomainSeparator() private view returns (bytes32) {\n        return keccak256(abi.encode(TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));\n    }\n\n    /**\n     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n     * function returns the hash of the fully encoded EIP712 message for this domain.\n     *\n     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n     *\n     * ```solidity\n     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n     *     keccak256(\"Mail(address to,string contents)\"),\n     *     mailTo,\n     *     keccak256(bytes(mailContents))\n     * )));\n     * address signer = ECDSA.recover(digest, signature);\n     * ```\n     */\n    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n        return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash);\n    }\n\n    /// @inheritdoc IERC5267\n    function eip712Domain()\n        public\n        view\n        virtual\n        returns (\n            bytes1 fields,\n            string memory name,\n            string memory version,\n            uint256 chainId,\n            address verifyingContract,\n            bytes32 salt,\n            uint256[] memory extensions\n        )\n    {\n        return (\n            hex\"0f\", // 01111\n            _EIP712Name(),\n            _EIP712Version(),\n            block.chainid,\n            address(this),\n            bytes32(0),\n            new uint256[](0)\n        );\n    }\n\n    /**\n     * @dev The name parameter for the EIP712 domain.\n     *\n     * NOTE: By default this function reads _name which is an immutable value.\n     * It only reads from storage if necessary (in case the value is too large to fit in a ShortString).\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function _EIP712Name() internal view returns (string memory) {\n        return _name.toStringWithFallback(_nameFallback);\n    }\n\n    /**\n     * @dev The version parameter for the EIP712 domain.\n     *\n     * NOTE: By default this function reads _version which is an immutable value.\n     * It only reads from storage if necessary (in case the value is too large to fit in a ShortString).\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function _EIP712Version() internal view returns (string memory) {\n        return _version.toStringWithFallback(_versionFallback);\n    }\n}\n"},{"file_path":"contracts/interfaces/IERC7540.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2;\n\nimport {IERC7575} from \"forge-std/interfaces/IERC7575.sol\";\n\n/// @dev Interface of the base operator logic of ERC7540, as defined in\n/// https://eips.ethereum.org/EIPS/eip-7540\ninterface IERC7540Operator {\n    /**\n     * @dev The event emitted when an operator is set.\n     *\n     * @param controller The address of the controller.\n     * @param operator The address of the operator.\n     * @param approved The approval status.\n     */\n    event OperatorSet(address indexed controller, address indexed operator, bool approved);\n\n    /**\n     * @dev Sets or removes an operator for the caller.\n     *\n     * @param operator The address of the operator.\n     * @param approved The approval status.\n     * @return Whether the call was executed successfully or not\n     */\n    function setOperator(address operator, bool approved) external returns (bool);\n\n    /**\n     * @dev Returns `true` if the `operator` is approved as an operator for an `controller`.\n     *\n     * @param controller The address of the controller.\n     * @param operator The address of the operator.\n     * @return status The approval status\n     */\n    function isOperator(address controller, address operator) external view returns (bool status);\n}\n\n/// @dev Interface of the asynchronous deposit Vault interface of ERC7540, as defined in\n/// https://eips.ethereum.org/EIPS/eip-7540\ninterface IERC7540Deposit is IERC7540Operator {\n    event DepositRequest(\n        address indexed controller, address indexed owner, uint256 indexed requestId, address sender, uint256 assets\n    );\n    /**\n     * @dev Transfers assets from sender into the Vault and submits a Request for asynchronous deposit.\n     *\n     * - MUST support ERC-20 approve / transferFrom on asset as a deposit Request flow.\n     * - MUST revert if all of assets cannot be requested for deposit.\n     * - owner MUST be msg.sender unless some unspecified explicit approval is given by the caller,\n     *    approval of ERC-20 tokens from owner to sender is NOT enough.\n     *\n     * @param assets the amount of deposit assets to transfer from owner\n     * @param controller the controller of the request who will be able to operate the request\n     * @param owner the source of the deposit assets\n     *\n     * NOTE: most implementations will require pre-approval of the Vault with the Vault's underlying asset token.\n     */\n\n    function requestDeposit(uint256 assets, address controller, address owner) external returns (uint256 requestId);\n\n    /**\n     * @dev Returns the amount of requested assets in Pending state.\n     *\n     * - MUST NOT include any assets in Claimable state for deposit or mint.\n     * - MUST NOT show any variations depending on the caller.\n     * - MUST NOT revert unless due to integer overflow caused by an unreasonably large input.\n     */\n    function pendingDepositRequest(uint256 requestId, address controller) external view returns (uint256 pendingAssets);\n\n    /**\n     * @dev Returns the amount of requested assets in Claimable state for the controller to deposit or mint.\n     *\n     * - MUST NOT include any assets in Pending state.\n     * - MUST NOT show any variations depending on the caller.\n     * - MUST NOT revert unless due to integer overflow caused by an unreasonably large input.\n     */\n    function claimableDepositRequest(uint256 requestId, address controller)\n        external\n        view\n        returns (uint256 claimableAssets);\n\n    /**\n     * @dev Mints shares Vault shares to receiver by claiming the Request of the controller.\n     *\n     * - MUST emit the Deposit event.\n     * - controller MUST equal msg.sender unless the controller has approved the msg.sender as an operator.\n     */\n    function deposit(uint256 assets, address receiver, address controller) external returns (uint256 shares);\n\n    /**\n     * @dev Mints exactly shares Vault shares to receiver by claiming the Request of the controller.\n     *\n     * - MUST emit the Deposit event.\n     * - controller MUST equal msg.sender unless the controller has approved the msg.sender as an operator.\n     */\n    function mint(uint256 shares, address receiver, address controller) external returns (uint256 assets);\n}\n\n/// @dev Interface of the asynchronous deposit Vault interface of ERC7540, as defined in\n/// https://eips.ethereum.org/EIPS/eip-7540\ninterface IERC7540Redeem is IERC7540Operator {\n    event RedeemRequest(\n        address indexed controller, address indexed owner, uint256 indexed requestId, address sender, uint256 shares\n    );\n\n    /**\n     * @dev Assumes control of shares from sender into the Vault and submits a Request for asynchronous redeem.\n     *\n     * - MUST support a redeem Request flow where the control of shares is taken from sender directly\n     *   where msg.sender has ERC-20 approval over the shares of owner.\n     * - MUST revert if all of shares cannot be requested for redeem.\n     *\n     * @param shares the amount of shares to be redeemed to transfer from owner\n     * @param controller the controller of the request who will be able to operate the request\n     * @param owner the source of the shares to be redeemed\n     *\n     * NOTE: most implementations will require pre-approval of the Vault with the Vault's share token.\n     */\n    function requestRedeem(uint256 shares, address controller, address owner) external returns (uint256 requestId);\n\n    /**\n     * @dev Returns the amount of requested shares in Pending state.\n     *\n     * - MUST NOT include any shares in Claimable state for redeem or withdraw.\n     * - MUST NOT show any variations depending on the caller.\n     * - MUST NOT revert unless due to integer overflow caused by an unreasonably large input.\n     */\n    function pendingRedeemRequest(uint256 requestId, address controller) external view returns (uint256 pendingShares);\n\n    /**\n     * @dev Returns the amount of requested shares in Claimable state for the controller to redeem or withdraw.\n     *\n     * - MUST NOT include any shares in Pending state for redeem or withdraw.\n     * - MUST NOT show any variations depending on the caller.\n     * - MUST NOT revert unless due to integer overflow caused by an unreasonably large input.\n     */\n    function claimableRedeemRequest(uint256 requestId, address controller)\n        external\n        view\n        returns (uint256 claimableShares);\n}\n\n/// @dev Interface of the fully asynchronous Vault interface of ERC7540, as defined in\n/// https://eips.ethereum.org/EIPS/eip-7540\ninterface IERC7540 is IERC7540Deposit, IERC7540Redeem, IERC7575 {}\n"},{"file_path":"contracts/types/Errors.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.5.0;\n\n/// @title  Errors Library\n/// @notice This library defines common error messages used throughout the system to ensure\n///         better clarity and standardized error handling.\n/// @dev    Each error represents a specific failure condition, allowing contracts to handle\n///         issues more easily and transparently.\nlibrary Errors {\n    /// @dev Error thrown when a caller is not authorized for an account-scoped action\n    error Unauthorized();\n\n    /// @dev Error thrown when an address is address(0)\n    error ZeroAddress();\n\n    /// @dev Error thrown when the number of shares is zero\n    error ZeroShares();\n\n    /// @dev Error thrown when the number of assets is zero\n    error ZeroAssets();\n\n    /// @dev Error thrown when an amount is zero\n    error ZeroAmount();\n\n    /// @dev Error thrown when a token name or symbol is empty\n    error EmptyNameOrSymbol();\n\n    /// @dev Error thrown when there are no pending redeem shares\n    error NoPendingRedeem();\n\n    /// @dev Error thrown when requested amount exceeds available balance\n    error InsufficientBalance();\n\n    /// @dev Error thrown when requested amount exceeds claimable amount\n    error InsufficientClaimable();\n\n    /// @dev Error thrown when an update/cancel can't be honored because the shares were already fulfilled at the vault\n    error PendingAlreadyFulfilled(uint256 requested, uint256 available);\n\n    /// @dev Error thrown when transfer amount is lower than expected\n    error TransferInsufficient();\n\n    /// @dev Error thrown when trying to use an invalid rate\n    error InvalidRate();\n\n    /// @dev Error thrown when rate is outside accepted bounds\n    error RateOutOfBounds();\n\n    /// @dev Error thrown when fee exceeds configured max fee\n    error InvalidFee();\n\n    /// @dev Error thrown when an operation attempts to modify an account's own operator status\n    error ERC7540SelfOperatorNotAllowed();\n\n    /// @dev Error thrown when an ERC7540 authorization has expired\n    error ERC7540Expired();\n\n    /// @dev Error thrown when an ERC7540 authorization has already been used\n    error ERC7540UsedAuthorization();\n\n    /// @dev Error thrown when an invalid signer is detected for ERC7540 authorization\n    error ERC7540InvalidSigner();\n\n    /// @dev Error thrown when the payout is set to zero in an ERC7540 operation\n    error ERC7540ZeroPayout();\n\n    /// @dev Error thrown when user attempts to call sync preview functions in async ERC7540 flow\n    error ERC7540AsyncFlow();\n\n    /// @dev Error thrown when unauthorized user tries to perform transaction via predicate proxy\n    error NestPredicateProxyPredicateUnauthorizedTransaction();\n\n    /// @dev Error thrown when a Permit2 transfer did not credit the proxy with the full deposit amount\n    error NestPredicateProxyInsufficientPermit2Transfer();\n\n    /// @dev Error thrown when the new upper exchange-rate bound is set below the minimum allowed value\n    error UpperBoundTooSmall();\n\n    /// @dev Error thrown when the new lower exchange-rate bound is set above the maximum allowed value\n    error LowerBoundTooLarge();\n\n    /// @dev Error thrown when attempting to set a management fee greater than the permitted maximum (20%)\n    error ManagementFeeTooLarge();\n\n    /// @dev Error thrown when a function is called while the contract is paused\n    error Paused();\n\n    /// @dev Error thrown when attempting to claim fees but no fees are owed\n    error ZeroFeesOwed();\n\n    /// @dev Error thrown when a function restricted to the NestShare is called by another address\n    error OnlyCallableByNestShare();\n\n    /// @dev Error thrown when the update delay exceeds the maximum allowed duration of 14 days\n    error UpdateDelayTooLarge();\n\n    /// @dev Error thrown when exchange-rate update is attempted before minimumUpdateDelayInSeconds elapses\n    error MinimumUpdateDelayNotPassed();\n\n    /// @dev Error thrown when a message-only compose operation receives non-zero OFT tokens\n    error UnexpectedNonZeroAmount();\n\n    /// @dev Error thrown when an unrecognized redeem type is provided in compose payload\n    error UnknownRedeemType();\n\n    /// @dev Error thrown when the receiver (SendParam.to) is empty/zero on a pair-keyed async redeem flow\n    error InvalidReceiver();\n\n    /// @dev Error thrown when the share OFT is not a valid NestShare\n    error ShareOFTNotNestShare(address shareOFT);\n\n    /// @dev Error thrown when the share token does not match the vault's share token\n    error ShareTokenNotVaultShare(address shareToken, address vault);\n\n    /// @dev Error thrown when a recover call fails\n    error RecoverFailed();\n\n    /// @dev Error thrown when msg.value is non-zero in a local cross-chain operation\n    error NonZeroMsgValueLocal(uint256 msgValue);\n\n    /// @dev Error thrown when attempting to set a performance fee greater than the permitted maximum (50%)\n    error PerformanceFeeTooLarge();\n\n    /// @dev Error thrown when attempting to set a hurdle rate greater than the permitted maximum (30%)\n    error HurdleRateTooLarge();\n\n    /// @dev Error thrown when attempting to set a holdback rate greater than 100%\n    error HoldbackRateTooLarge();\n\n    /// @dev Error thrown when attempting to set a crystallization window greater than the permitted maximum (365 days)\n    error CrystallizationWindowTooLarge();\n\n    /// @dev Error thrown when attempting to set epochs per window greater than the permitted maximum (52)\n    error EpochsPerWindowTooLarge();\n\n    /// @dev Error thrown when an update attempts to reapply the current value\n    error SameValue();\n\n    /// @dev Error thrown when attempting to renounce ownership (disabled for upgradeable flow)\n    error RenounceOwnershipDisabled();\n\n    /// @dev Error thrown when the accountant does not implement the required rate-provider interface.\n    error IncompatibleAccountant();\n\n    /// @dev Error thrown when operator registry does not implement IERC7540Operator.isOperator(address,address)\n    error IncompatibleOperatorRegistry();\n\n    /// @dev Error thrown when keeper-supplied total share supply is below the local chain's totalSupply\n    error TotalSupplyBelowLocal();\n\n    /// @dev Error thrown when a fee-related function is called on a spoke accountant\n    error FeeAccrualDisabled();\n}\n"},{"file_path":"contracts/interfaces/IRateProvider.sol","source_code":"// SPDX-License-Identifier: GPL-3.0-or-later\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this program.  If not, see <http://www.gnu.org/licenses/>.\npragma solidity ^0.8.30;\n\ninterface IRateProvider {\n    function getRate() external view returns (uint256);\n}\n"},{"file_path":"node_modules/@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.0;\n\nimport { IMessageLibManager } from \"./IMessageLibManager.sol\";\nimport { IMessagingComposer } from \"./IMessagingComposer.sol\";\nimport { IMessagingChannel } from \"./IMessagingChannel.sol\";\nimport { IMessagingContext } from \"./IMessagingContext.sol\";\n\nstruct MessagingParams {\n    uint32 dstEid;\n    bytes32 receiver;\n    bytes message;\n    bytes options;\n    bool payInLzToken;\n}\n\nstruct MessagingReceipt {\n    bytes32 guid;\n    uint64 nonce;\n    MessagingFee fee;\n}\n\nstruct MessagingFee {\n    uint256 nativeFee;\n    uint256 lzTokenFee;\n}\n\nstruct Origin {\n    uint32 srcEid;\n    bytes32 sender;\n    uint64 nonce;\n}\n\ninterface ILayerZeroEndpointV2 is IMessageLibManager, IMessagingComposer, IMessagingChannel, IMessagingContext {\n    event PacketSent(bytes encodedPayload, bytes options, address sendLibrary);\n\n    event PacketVerified(Origin origin, address receiver, bytes32 payloadHash);\n\n    event PacketDelivered(Origin origin, address receiver);\n\n    event LzReceiveAlert(\n        address indexed receiver,\n        address indexed executor,\n        Origin origin,\n        bytes32 guid,\n        uint256 gas,\n        uint256 value,\n        bytes message,\n        bytes extraData,\n        bytes reason\n    );\n\n    event LzTokenSet(address token);\n\n    event DelegateSet(address sender, address delegate);\n\n    function quote(MessagingParams calldata _params, address _sender) external view returns (MessagingFee memory);\n\n    function send(\n        MessagingParams calldata _params,\n        address _refundAddress\n    ) external payable returns (MessagingReceipt memory);\n\n    function verify(Origin calldata _origin, address _receiver, bytes32 _payloadHash) external;\n\n    function verifiable(Origin calldata _origin, address _receiver) external view returns (bool);\n\n    function initializable(Origin calldata _origin, address _receiver) external view returns (bool);\n\n    function lzReceive(\n        Origin calldata _origin,\n        address _receiver,\n        bytes32 _guid,\n        bytes calldata _message,\n        bytes calldata _extraData\n    ) external payable;\n\n    // oapp can burn messages partially by calling this function with its own business logic if messages are verified in order\n    function clear(address _oapp, Origin calldata _origin, bytes32 _guid, bytes calldata _message) external;\n\n    function setLzToken(address _lzToken) external;\n\n    function lzToken() external view returns (address);\n\n    function nativeToken() external view returns (address);\n\n    function setDelegate(address _delegate) external;\n}\n"},{"file_path":"node_modules/@layerzerolabs/oapp-evm-upgradeable/contracts/oapp/libs/OAppOptionsType3Upgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\nimport { OwnableUpgradeable } from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport { IOAppOptionsType3, EnforcedOptionParam } from \"@layerzerolabs/oapp-evm/contracts/oapp/interfaces/IOAppOptionsType3.sol\";\n\n/**\n * @title OAppOptionsType3\n * @dev Abstract contract implementing the IOAppOptionsType3 interface with type 3 options.\n */\nabstract contract OAppOptionsType3Upgradeable is IOAppOptionsType3, OwnableUpgradeable {\n    struct OAppOptionsType3Storage {\n        // @dev The \"msgType\" should be defined in the child contract.\n        mapping(uint32 => mapping(uint16 => bytes)) enforcedOptions;\n    }\n\n    // keccak256(abi.encode(uint256(keccak256(\"layerzerov2.storage.oappoptionstype3\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant OAPP_OPTIONS_TYPE_3_STORAGE_LOCATION =\n        0x8d2bda5d9f6ffb5796910376005392955773acee5548d0fcdb10e7c264ea0000;\n\n    uint16 internal constant OPTION_TYPE_3 = 3;\n\n    function _getOAppOptionsType3Storage() internal pure returns (OAppOptionsType3Storage storage $) {\n        assembly {\n            $.slot := OAPP_OPTIONS_TYPE_3_STORAGE_LOCATION\n        }\n    }\n\n    /**\n     * @dev Ownable is not initialized here on purpose. It should be initialized in the child contract to\n     * accommodate the different version of Ownable.\n     */\n    function __OAppOptionsType3_init() internal onlyInitializing {}\n\n    function __OAppOptionsType3_init_unchained() internal onlyInitializing {}\n\n    function enforcedOptions(uint32 _eid, uint16 _msgType) public view returns (bytes memory) {\n        OAppOptionsType3Storage storage $ = _getOAppOptionsType3Storage();\n        return $.enforcedOptions[_eid][_msgType];\n    }\n\n    /**\n     * @dev Sets the enforced options for specific endpoint and message type combinations.\n     * @param _enforcedOptions An array of EnforcedOptionParam structures specifying enforced options.\n     *\n     * @dev Only the owner/admin of the OApp can call this function.\n     * @dev Provides a way for the OApp to enforce things like paying for PreCrime, AND/OR minimum dst lzReceive gas amounts etc.\n     * @dev These enforced options can vary as the potential options/execution on the remote may differ as per the msgType.\n     * eg. Amount of lzReceive() gas necessary to deliver a lzCompose() message adds overhead you dont want to pay\n     * if you are only making a standard LayerZero message ie. lzReceive() WITHOUT sendCompose().\n     */\n    function setEnforcedOptions(EnforcedOptionParam[] calldata _enforcedOptions) public virtual onlyOwner {\n        OAppOptionsType3Storage storage $ = _getOAppOptionsType3Storage();\n        for (uint256 i = 0; i < _enforcedOptions.length; i++) {\n            // @dev Enforced options are only available for optionType 3, as type 1 and 2 dont support combining.\n            _assertOptionsType3(_enforcedOptions[i].options);\n            $.enforcedOptions[_enforcedOptions[i].eid][_enforcedOptions[i].msgType] = _enforcedOptions[i].options;\n        }\n\n        emit EnforcedOptionSet(_enforcedOptions);\n    }\n\n    /**\n     * @notice Combines options for a given endpoint and message type.\n     * @param _eid The endpoint ID.\n     * @param _msgType The OAPP message type.\n     * @param _extraOptions Additional options passed by the caller.\n     * @return options The combination of caller specified options AND enforced options.\n     *\n     * @dev If there is an enforced lzReceive option:\n     * - {gasLimit: 200k, msg.value: 1 ether} AND a caller supplies a lzReceive option: {gasLimit: 100k, msg.value: 0.5 ether}\n     * - The resulting options will be {gasLimit: 300k, msg.value: 1.5 ether} when the message is executed on the remote lzReceive() function.\n     * @dev This presence of duplicated options is handled off-chain in the verifier/executor.\n     */\n    function combineOptions(\n        uint32 _eid,\n        uint16 _msgType,\n        bytes calldata _extraOptions\n    ) public view virtual returns (bytes memory) {\n        OAppOptionsType3Storage storage $ = _getOAppOptionsType3Storage();\n        bytes memory enforced = $.enforcedOptions[_eid][_msgType];\n\n        // No enforced options, pass whatever the caller supplied, even if it's empty or legacy type 1/2 options.\n        if (enforced.length == 0) return _extraOptions;\n\n        // No caller options, return enforced\n        if (_extraOptions.length == 0) return enforced;\n\n        // @dev If caller provided _extraOptions, must be type 3 as its the ONLY type that can be combined.\n        if (_extraOptions.length >= 2) {\n            _assertOptionsType3(_extraOptions);\n            // @dev Remove the first 2 bytes containing the type from the _extraOptions and combine with enforced.\n            return bytes.concat(enforced, _extraOptions[2:]);\n        }\n\n        // No valid set of options was found.\n        revert InvalidOptions(_extraOptions);\n    }\n\n    /**\n     * @dev Internal function to assert that options are of type 3.\n     * @param _options The options to be checked.\n     */\n    function _assertOptionsType3(bytes calldata _options) internal pure virtual {\n        uint16 optionsType = uint16(bytes2(_options[0:2]));\n        if (optionsType != OPTION_TYPE_3) revert InvalidOptions(_options);\n    }\n}\n"},{"file_path":"node_modules/@layerzerolabs/oapp-evm/contracts/oapp/interfaces/IOAppCore.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\nimport { ILayerZeroEndpointV2 } from \"@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol\";\n\n/**\n * @title IOAppCore\n */\ninterface IOAppCore {\n    // Custom error messages\n    error OnlyPeer(uint32 eid, bytes32 sender);\n    error NoPeer(uint32 eid);\n    error InvalidEndpointCall();\n    error InvalidDelegate();\n\n    // Event emitted when a peer (OApp) is set for a corresponding endpoint\n    event PeerSet(uint32 eid, bytes32 peer);\n\n    /**\n     * @notice Retrieves the OApp version information.\n     * @return senderVersion The version of the OAppSender.sol contract.\n     * @return receiverVersion The version of the OAppReceiver.sol contract.\n     */\n    function oAppVersion() external view returns (uint64 senderVersion, uint64 receiverVersion);\n\n    /**\n     * @notice Retrieves the LayerZero endpoint associated with the OApp.\n     * @return iEndpoint The LayerZero endpoint as an interface.\n     */\n    function endpoint() external view returns (ILayerZeroEndpointV2 iEndpoint);\n\n    /**\n     * @notice Retrieves the peer (OApp) associated with a corresponding endpoint.\n     * @param _eid The endpoint ID.\n     * @return peer The peer address (OApp instance) associated with the corresponding endpoint.\n     */\n    function peers(uint32 _eid) external view returns (bytes32 peer);\n\n    /**\n     * @notice Sets the peer address (OApp instance) for a corresponding endpoint.\n     * @param _eid The endpoint ID.\n     * @param _peer The address of the peer to be associated with the corresponding endpoint.\n     */\n    function setPeer(uint32 _eid, bytes32 _peer) external;\n\n    /**\n     * @notice Sets the delegate address for the OApp Core.\n     * @param _delegate The address of the delegate to be set.\n     */\n    function setDelegate(address _delegate) external;\n}\n"},{"file_path":"contracts/libraries/NestVaultRedeemLogic.sol","source_code":"// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.30;\n\nimport {FixedPointMathLib} from \"@solmate/utils/FixedPointMathLib.sol\";\nimport {ERC20} from \"@solmate/tokens/ERC20.sol\";\nimport {NestShareOFT} from \"contracts/NestShareOFT.sol\";\nimport {Errors} from \"contracts/types/Errors.sol\";\nimport {NestVaultCoreValidationLogic} from \"contracts/libraries/NestVaultCoreValidationLogic.sol\";\nimport {NestVaultAccountingLogic} from \"contracts/libraries/NestVaultAccountingLogic.sol\";\nimport {NestVaultCoreTypes} from \"contracts/types/NestVaultCoreTypes.sol\";\nimport {NestVaultTransferLogic} from \"contracts/libraries/NestVaultTransferLogic.sol\";\nimport {Math} from \"@openzeppelin/contracts/utils/math/Math.sol\";\nimport {NestHubAccountant} from \"contracts/accountant/NestHubAccountant.sol\";\n\n/// @title  NestVaultRedeemLogic\n/// @notice Library containing redeem-related logic for NestVaultCore\n/// @author plumenetwork\n/// @custom:oz-upgrades-unsafe-allow external-library-linking\nlibrary NestVaultRedeemLogic {\n    using FixedPointMathLib for uint256;\n    using NestVaultCoreValidationLogic for NestVaultCoreTypes.NestVaultCoreStorage;\n    using NestVaultAccountingLogic for uint256;\n    using NestVaultTransferLogic for ERC20;\n    using NestVaultTransferLogic for NestShareOFT;\n\n    /*//////////////////////////////////////////////////////////////\n                                EVENTS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @dev   Emitted when a redeem request is fulfilled\n    /// @param controller   address indexed The controller address\n    /// @param shares       uint256         The number of shares fulfilled\n    /// @param assets       uint256         The amount of assets calculated for the fulfilled shares\n    /// @param actualAssets uint256         The actual amount of assets received and credited as claimable assets\n    event RedeemFulfilled(address indexed controller, uint256 shares, uint256 assets, uint256 actualAssets);\n\n    /// @dev   Emitted when a redemption request is updated\n    /// @param controller  address  The vault or controller managing the redemption\n    /// @param receiver    address  The receiver of the returned shares\n    /// @param caller      address  The address initiating the update\n    /// @param oldShares   uint256  Number of shares before the update\n    /// @param newShares   uint256  Number of shares after the update\n    event RedeemUpdated(address controller, address receiver, address caller, uint256 oldShares, uint256 newShares);\n\n    /// @dev   Emitted when an instant redemption is performed\n    /// @param shares        uint256  Number of shares redeemed\n    /// @param assets        uint256  Total asset value of the redeemed shares before fees\n    /// @param postFeeAmount uint256  Asset amount received by the user after deducting fees\n    /// @param receiver      address  Address receiving the redeemed assets\n    event InstantRedeem(uint256 shares, uint256 assets, uint256 postFeeAmount, address receiver);\n\n    /// @dev   Emitted when a withdrawal is made\n    /// @param caller     address The caller making the withdrawal\n    /// @param receiver   address The receiver of the assets\n    /// @param controller address The controller requesting the withdrawal\n    /// @param assets     uint256 The assets withdrawn\n    /// @param shares     uint256 The shares burned\n    event Withdraw(\n        address indexed caller, address indexed receiver, address indexed controller, uint256 assets, uint256 shares\n    );\n\n    /// @dev   Emitted when a redeem request is made\n    /// @param controller address The controller address\n    /// @param owner      address The owner of the shares\n    /// @param requestId  uint256 The request ID\n    /// @param sender     address The sender making the request\n    /// @param shares     uint256 The shares requested for redemption\n    event RedeemRequest(\n        address indexed controller, address indexed owner, uint256 indexed requestId, address sender, uint256 shares\n    );\n\n    /*//////////////////////////////////////////////////////////////\n                          EXECUTE FUNCTIONS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Executes the request redeem logic\n    /// @param  $           NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _shares     uint256                                 Shares to request\n    /// @param  _controller address                                 Controller address\n    /// @param  _owner      address                                 Owner address\n    /// @param  _caller     address                                 Caller address (msg.sender)\n    /// @return requestId   uint256                                 The request ID (always 0)\n    function executeRequestRedeem(\n        NestVaultCoreTypes.NestVaultCoreStorage storage $,\n        uint256 _shares,\n        address _controller,\n        address _owner,\n        address _caller,\n        ERC20 shareToken\n    ) external returns (uint256 requestId) {\n        $.validateRequestRedeem(_shares, _controller, _owner, _caller, shareToken);\n\n        // Update pending redeem state\n        uint256 _currentPendingShares = $.pendingRedeem[_controller].shares;\n        $.pendingRedeem[_controller].shares = _shares + _currentPendingShares;\n        $.totalPendingShares = $.totalPendingShares + _shares;\n        _tryUpdateTotalPendingShares($.accountant, NestHubAccountant.increaseTotalPendingShares.selector, _shares);\n\n        emit RedeemRequest(_controller, _owner, 0, _caller, _shares);\n\n        return 0;\n    }\n\n    /// @notice Executes the fulfill redeem logic including validation, asset calculation, and exit\n    /// @param  $           NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _controller address                                 The controller address\n    /// @param  _shares     uint256                                 The shares to fulfill\n    /// @param  shareToken  NestShareOFT                            The share token for exit\n    /// @param  assetToken  ERC20                                   The asset token\n    /// @param  _rate       uint256                                 The exchange rate\n    /// @return _assets     uint256                                 The assets calculated for shares\n    function executeFulfillRedeem(\n        NestVaultCoreTypes.NestVaultCoreStorage storage $,\n        address _controller,\n        uint256 _shares,\n        NestShareOFT shareToken,\n        ERC20 assetToken,\n        uint256 _rate\n    ) external returns (uint256 _assets) {\n        // Calculate assets\n        uint256 _grossAssets = _shares.convertToAssets(_rate, shareToken, Math.Rounding.Floor);\n\n        // Validate\n        $.validateFulfillRedeem(_controller, _shares, _grossAssets);\n\n        // Execute exit and get actual transfer amount\n        uint256 _amountReceived = shareToken.safeExit(assetToken, address(this), _grossAssets, _shares);\n\n        // Apply redemption fee (flat + percentage)\n        NestVaultCoreTypes.Fee storage _feeConfig = $.fees[NestVaultCoreTypes.Fees.Redemption];\n        (uint256 _netReceived, uint256 _feeAmount) =\n            _amountReceived.calculatePostFeeAmounts(_feeConfig.rate, _feeConfig.flat);\n        if (_netReceived == 0) revert Errors.ZeroAssets();\n        if (\n            _feeConfig.flat > 0\n                && _feeConfig.flat.mulDivDown(NestVaultAccountingLogic.FEE_DENOMINATOR, _amountReceived)\n                    > NestVaultCoreTypes.FEE_CAP\n        ) {\n            revert Errors.InvalidFee();\n        }\n        if (_feeAmount > 0) {\n            $.claimableFees[NestVaultCoreTypes.Fees.Redemption] += _feeAmount;\n            emit NestVaultCoreTypes.FeeAccrued(uint8(NestVaultCoreTypes.Fees.Redemption), _controller, _feeAmount);\n        }\n\n        // Update state\n        $.pendingRedeem[_controller].shares -= _shares;\n        $.totalPendingShares = $.totalPendingShares - _shares;\n        $.claimableRedeem[_controller].assets += _netReceived;\n        $.claimableRedeem[_controller].shares += _shares;\n        _tryUpdateTotalPendingShares($.accountant, NestHubAccountant.decreaseTotalPendingShares.selector, _shares);\n\n        emit RedeemFulfilled(_controller, _shares, _grossAssets, _netReceived);\n\n        _assets = _netReceived;\n    }\n\n    /// @notice Executes the instant redeem logic including validation, share transfer, and exit\n    /// @param  $           NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _shares     uint256                                 Shares being redeemed\n    /// @param  _receiver   address                                 Receiver address\n    /// @param  _owner      address                                 Owner of the shares\n    /// @param  _caller     address                                 The caller (msg.sender)\n    /// @param  shareToken  NestShareOFT                            The share token for exit\n    /// @param  assetToken  ERC20                                   The asset token\n    /// @param  _rate       uint256                                 The exchange rate\n    /// @return _postFeeAmount   uint256                            Amount after fees\n    /// @return _feeAmount       uint256                            Fee amount\n    function executeInstantRedeem(\n        NestVaultCoreTypes.NestVaultCoreStorage storage $,\n        uint256 _shares,\n        address _receiver,\n        address _owner,\n        address _caller,\n        NestShareOFT shareToken,\n        ERC20 assetToken,\n        uint256 _rate\n    ) external returns (uint256 _postFeeAmount, uint256 _feeAmount) {\n        // Validate authorization and shares\n        $.validateInstantRedeem(_shares, _receiver, _owner, _caller, ERC20(address(shareToken)));\n\n        // Calculate assets and fees (flat + percentage)\n        uint256 _assets = _shares.convertToAssets(_rate, shareToken, Math.Rounding.Floor);\n        NestVaultCoreTypes.Fee storage _feeConfig = $.fees[NestVaultCoreTypes.Fees.InstantRedemption];\n        (uint256 expectedPostFeeAmount,) = _assets.calculatePostFeeAmounts(_feeConfig.rate, _feeConfig.flat);\n\n        if (expectedPostFeeAmount == 0) revert Errors.ZeroAssets();\n        uint256 amountReceived = shareToken.safeExit(assetToken, address(this), _assets, _shares);\n\n        _postFeeAmount = assetToken.safeTransferFrom(address(this), _receiver, expectedPostFeeAmount);\n\n        _feeAmount = amountReceived - _postFeeAmount;\n\n        // Transfer instant redemption fees directly to the share token (benefits holders via exchange rate)\n        if (_feeAmount > 0) {\n            assetToken.safeTransferFrom(address(this), address(shareToken), _feeAmount);\n            emit NestVaultCoreTypes.FeeAccrued(uint8(NestVaultCoreTypes.Fees.InstantRedemption), _owner, _feeAmount);\n        }\n\n        emit InstantRedeem(_shares, _assets, _postFeeAmount, _receiver);\n\n        return (_postFeeAmount, _feeAmount);\n    }\n\n    /// @notice Executes the update redeem logic including authorization checks\n    /// @param  $           NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _newShares  uint256                                 The new share amount\n    /// @param  _controller address                                 The controller address\n    /// @param  _receiver   address                                 The receiver address\n    /// @param  _caller     address                                 The caller address\n    /// @param  shareToken  ERC20                                   The share token\n    function executeUpdateRedeem(\n        NestVaultCoreTypes.NestVaultCoreStorage storage $,\n        uint256 _newShares,\n        address _controller,\n        address _receiver,\n        address _caller,\n        ERC20 shareToken\n    ) external {\n        uint256 _oldShares = $.pendingRedeem[_controller].shares;\n\n        // All validation in one call\n        $.validateUpdateRedeem(_newShares, _controller, _receiver, _caller, _oldShares);\n\n        if (_newShares == _oldShares) {\n            return;\n        }\n\n        uint256 _returnAmount = _oldShares - _newShares;\n        $.totalPendingShares = $.totalPendingShares - _returnAmount;\n        $.pendingRedeem[_controller].shares = _newShares;\n        _tryUpdateTotalPendingShares($.accountant, NestHubAccountant.decreaseTotalPendingShares.selector, _returnAmount);\n\n        shareToken.safeTransferFrom(address(this), _receiver, _returnAmount);\n\n        emit RedeemUpdated(_controller, _receiver, _caller, _oldShares, _newShares);\n    }\n\n    /// @notice Executes the withdraw logic including authorization check\n    /// @param  $           NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _assets     uint256                                 The assets to withdraw\n    /// @param  _receiver   address                                 The receiver address\n    /// @param  _controller address                                 The controller address\n    /// @param  _caller     address                                 The caller (msg.sender)\n    /// @param  assetToken  ERC20                                   The asset token\n    /// @return _shares     uint256                                 The shares burned\n    function executeWithdraw(\n        NestVaultCoreTypes.NestVaultCoreStorage storage $,\n        uint256 _assets,\n        address _receiver,\n        address _controller,\n        address _caller,\n        ERC20 assetToken\n    ) external returns (uint256 _shares) {\n        // All validation in one call\n        $.validateWithdraw(_assets, _receiver, _controller, _caller);\n\n        NestVaultCoreTypes.ClaimableRedeem storage claimableRedeem = $.claimableRedeem[_controller];\n        _shares = _assets.mulDivDown($.claimableRedeem[_controller].shares, $.claimableRedeem[_controller].assets);\n\n        if (_assets == claimableRedeem.assets) {\n            claimableRedeem.assets = 0;\n            claimableRedeem.shares = 0;\n        } else {\n            if (_shares == 0) revert Errors.ERC7540ZeroPayout();\n            claimableRedeem.assets -= _assets;\n            claimableRedeem.shares -= _shares;\n        }\n\n        assetToken.safeTransferFrom(address(this), _receiver, _assets);\n\n        emit Withdraw(_caller, _receiver, _controller, _assets, _shares);\n    }\n\n    /// @notice Executes the redeem logic including authorization check\n    /// @param  $           NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _shares     uint256                                 The shares to redeem\n    /// @param  _receiver   address                                 The receiver address\n    /// @param  _controller address                                 The controller address\n    /// @param  _caller     address                                 The caller (msg.sender)\n    /// @param  assetToken  ERC20                                   The asset token\n    /// @return _assets     uint256                                 The assets redeemed\n    function executeRedeem(\n        NestVaultCoreTypes.NestVaultCoreStorage storage $,\n        uint256 _shares,\n        address _receiver,\n        address _controller,\n        address _caller,\n        ERC20 assetToken\n    ) external returns (uint256 _assets) {\n        // All validation in one call\n        $.validateRedeem(_shares, _controller, _receiver, _caller);\n\n        NestVaultCoreTypes.ClaimableRedeem storage claimableRedeem = $.claimableRedeem[_controller];\n\n        if (_shares == claimableRedeem.shares) {\n            _assets = claimableRedeem.assets;\n            claimableRedeem.assets = 0;\n            claimableRedeem.shares = 0;\n        } else {\n            _assets = _shares.mulDivDown(claimableRedeem.assets, claimableRedeem.shares);\n            if (_assets == 0) revert Errors.ERC7540ZeroPayout();\n            claimableRedeem.assets -= _assets;\n            claimableRedeem.shares -= _shares;\n        }\n\n        assetToken.safeTransferFrom(address(this), _receiver, _assets);\n\n        emit Withdraw(_caller, _receiver, _controller, _assets, _shares);\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                        INTERNAL FUNCTIONS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @dev Sync global pending shares while preserving legacy compatibility.\n    ///      If selector is missing (legacy accountant), revert data is empty and sync is skipped.\n    ///      If selector exists and call reverts with data, revert is bubbled.\n    /// @param accountant NestHubAccountant Accountant instance to notify\n    /// @param _selector  bytes4         Selector for pending-share sync method\n    /// @param _amount    uint256        Pending share delta to apply\n    function _tryUpdateTotalPendingShares(NestHubAccountant accountant, bytes4 _selector, uint256 _amount) internal {\n        (bool _success, bytes memory _reason) = address(accountant).call(abi.encodeWithSelector(_selector, _amount));\n        if (_success || _reason.length == 0) return;\n\n        assembly (\"memory-safe\") {\n            revert(add(_reason, 32), mload(_reason))\n        }\n    }\n}\n"},{"file_path":"node_modules/forge-std/src/interfaces/IERC165.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2;\n\ninterface IERC165 {\n    /// @notice Query if a contract implements an interface\n    /// @param interfaceID The interface identifier, as specified in ERC-165\n    /// @dev Interface identification is specified in ERC-165. This function\n    /// uses less than 30,000 gas.\n    /// @return `true` if the contract implements `interfaceID` and\n    /// `interfaceID` is not 0xffffffff, `false` otherwise\n    function supportsInterface(bytes4 interfaceID) external view returns (bool);\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (utils/cryptography/SignatureChecker.sol)\n\npragma solidity ^0.8.24;\n\nimport {ECDSA} from \"./ECDSA.sol\";\nimport {IERC1271} from \"../../interfaces/IERC1271.sol\";\nimport {IERC7913SignatureVerifier} from \"../../interfaces/IERC7913.sol\";\nimport {Bytes} from \"../../utils/Bytes.sol\";\n\n/**\n * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support:\n *\n * * ECDSA signatures from externally owned accounts (EOAs)\n * * ERC-1271 signatures from smart contract wallets like Argent and Safe Wallet (previously Gnosis Safe)\n * * ERC-7913 signatures from keys that do not have an Ethereum address of their own\n *\n * See https://eips.ethereum.org/EIPS/eip-1271[ERC-1271] and https://eips.ethereum.org/EIPS/eip-7913[ERC-7913].\n */\nlibrary SignatureChecker {\n    using Bytes for bytes;\n\n    /**\n     * @dev Checks if a signature is valid for a given signer and data hash. If the signer has code, the\n     * signature is validated against it using ERC-1271, otherwise it's validated using `ECDSA.recover`.\n     *\n     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus\n     * change through time. It could return true at block N and false at block N+1 (or the opposite).\n     *\n     * NOTE: For an extended version of this function that supports ERC-7913 signatures, see {isValidSignatureNow-bytes-bytes32-bytes-}.\n     */\n    function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) internal view returns (bool) {\n        if (signer.code.length == 0) {\n            (address recovered, ECDSA.RecoverError err, ) = ECDSA.tryRecover(hash, signature);\n            return err == ECDSA.RecoverError.NoError && recovered == signer;\n        } else {\n            return isValidERC1271SignatureNow(signer, hash, signature);\n        }\n    }\n\n    /**\n     * @dev Checks if a signature is valid for a given signer and data hash. The signature is validated\n     * against the signer smart contract using ERC-1271.\n     *\n     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus\n     * change through time. It could return true at block N and false at block N+1 (or the opposite).\n     */\n    function isValidERC1271SignatureNow(\n        address signer,\n        bytes32 hash,\n        bytes memory signature\n    ) internal view returns (bool) {\n        (bool success, bytes memory result) = signer.staticcall(\n            abi.encodeCall(IERC1271.isValidSignature, (hash, signature))\n        );\n        return (success &&\n            result.length >= 32 &&\n            abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector));\n    }\n\n    /**\n     * @dev Verifies a signature for a given ERC-7913 signer and hash.\n     *\n     * The signer is a `bytes` object that is the concatenation of an address and optionally a key:\n     * `verifier || key`. A signer must be at least 20 bytes long.\n     *\n     * Verification is done as follows:\n     *\n     * * If `signer.length < 20`: verification fails\n     * * If `signer.length == 20`: verification is done using {isValidSignatureNow}\n     * * Otherwise: verification is done using {IERC7913SignatureVerifier}\n     *\n     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus\n     * change through time. It could return true at block N and false at block N+1 (or the opposite).\n     */\n    function isValidSignatureNow(\n        bytes memory signer,\n        bytes32 hash,\n        bytes memory signature\n    ) internal view returns (bool) {\n        if (signer.length < 20) {\n            return false;\n        } else if (signer.length == 20) {\n            return isValidSignatureNow(address(bytes20(signer)), hash, signature);\n        } else {\n            (bool success, bytes memory result) = address(bytes20(signer)).staticcall(\n                abi.encodeCall(IERC7913SignatureVerifier.verify, (signer.slice(20), hash, signature))\n            );\n            return (success &&\n                result.length >= 32 &&\n                abi.decode(result, (bytes32)) == bytes32(IERC7913SignatureVerifier.verify.selector));\n        }\n    }\n\n    /**\n     * @dev Verifies multiple ERC-7913 `signatures` for a given `hash` using a set of `signers`.\n     * Returns `false` if the number of signers and signatures is not the same.\n     *\n     * The signers should be ordered by their `keccak256` hash to ensure efficient duplication check. Unordered\n     * signers are supported, but the uniqueness check will be more expensive.\n     *\n     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus\n     * change through time. It could return true at block N and false at block N+1 (or the opposite).\n     */\n    function areValidSignaturesNow(\n        bytes32 hash,\n        bytes[] memory signers,\n        bytes[] memory signatures\n    ) internal view returns (bool) {\n        if (signers.length != signatures.length) return false;\n\n        bytes32 lastId = bytes32(0);\n\n        for (uint256 i = 0; i < signers.length; ++i) {\n            bytes memory signer = signers[i];\n\n            // If one of the signatures is invalid, reject the batch\n            if (!isValidSignatureNow(signer, hash, signatures[i])) return false;\n\n            bytes32 id = keccak256(signer);\n            // If the current signer ID is greater than all previous IDs, then this is a new signer.\n            if (lastId < id) {\n                lastId = id;\n            } else {\n                // If this signer id is not greater than all the previous ones, verify that it is not a duplicate of a previous one\n                // This loop is never executed if the signers are ordered by id.\n                for (uint256 j = 0; j < i; ++j) {\n                    if (id == keccak256(signers[j])) return false;\n                }\n            }\n        }\n\n        return true;\n    }\n}\n"},{"file_path":"node_modules/@layerzerolabs/oapp-evm-upgradeable/contracts/oapp/OAppCoreUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\nimport { OwnableUpgradeable } from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport { IOAppCore, ILayerZeroEndpointV2 } from \"@layerzerolabs/oapp-evm/contracts/oapp/interfaces/IOAppCore.sol\";\n\n/**\n * @title OAppCore\n * @dev Abstract contract implementing the IOAppCore interface with basic OApp configurations.\n */\nabstract contract OAppCoreUpgradeable is IOAppCore, OwnableUpgradeable {\n    struct OAppCoreStorage {\n        mapping(uint32 => bytes32) peers;\n    }\n\n    // keccak256(abi.encode(uint256(keccak256(\"layerzerov2.storage.oappcore\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant OAPP_CORE_STORAGE_LOCATION =\n        0x72ab1bc1039b79dc4724ffca13de82c96834302d3c7e0d4252232d4b2dd8f900;\n\n    function _getOAppCoreStorage() internal pure returns (OAppCoreStorage storage $) {\n        assembly {\n            $.slot := OAPP_CORE_STORAGE_LOCATION\n        }\n    }\n\n    // The LayerZero endpoint associated with the given OApp\n    ILayerZeroEndpointV2 public immutable endpoint;\n\n    /**\n     * @dev Constructor to initialize the OAppCore with the provided endpoint and delegate.\n     * @param _endpoint The address of the LOCAL Layer Zero endpoint.\n     */\n    constructor(address _endpoint) {\n        endpoint = ILayerZeroEndpointV2(_endpoint);\n    }\n\n    /**\n     * @dev Initializes the OAppCore with the provided delegate.\n     * @param _delegate The delegate capable of making OApp configurations inside of the endpoint.\n     *\n     * @dev The delegate typically should be set as the owner of the contract.\n     * @dev Ownable is not initialized here on purpose. It should be initialized in the child contract to\n     * accommodate the different version of Ownable.\n     */\n    function __OAppCore_init(address _delegate) internal onlyInitializing {\n        __OAppCore_init_unchained(_delegate);\n    }\n\n    function __OAppCore_init_unchained(address _delegate) internal onlyInitializing {\n        if (_delegate == address(0)) revert InvalidDelegate();\n        endpoint.setDelegate(_delegate);\n    }\n\n    /**\n     * @notice Returns the peer address (OApp instance) associated with a specific endpoint.\n     * @param _eid The endpoint ID.\n     * @return peer The address of the peer associated with the specified endpoint.\n     */\n    function peers(uint32 _eid) public view override returns (bytes32) {\n        OAppCoreStorage storage $ = _getOAppCoreStorage();\n        return $.peers[_eid];\n    }\n\n    /**\n     * @notice Sets the peer address (OApp instance) for a corresponding endpoint.\n     * @param _eid The endpoint ID.\n     * @param _peer The address of the peer to be associated with the corresponding endpoint.\n     *\n     * @dev Only the owner/admin of the OApp can call this function.\n     * @dev Indicates that the peer is trusted to send LayerZero messages to this OApp.\n     * @dev Set this to bytes32(0) to remove the peer address.\n     * @dev Peer is a bytes32 to accommodate non-evm chains.\n     */\n    function setPeer(uint32 _eid, bytes32 _peer) public virtual onlyOwner {\n        OAppCoreStorage storage $ = _getOAppCoreStorage();\n        $.peers[_eid] = _peer;\n        emit PeerSet(_eid, _peer);\n    }\n\n    /**\n     * @notice Internal function to get the peer address associated with a specific endpoint; reverts if NOT set.\n     * ie. the peer is set to bytes32(0).\n     * @param _eid The endpoint ID.\n     * @return peer The address of the peer associated with the specified endpoint.\n     */\n    function _getPeerOrRevert(uint32 _eid) internal view virtual returns (bytes32) {\n        OAppCoreStorage storage $ = _getOAppCoreStorage();\n        bytes32 peer = $.peers[_eid];\n        if (peer == bytes32(0)) revert NoPeer(_eid);\n        return peer;\n    }\n\n    /**\n     * @notice Sets the delegate address for the OApp.\n     * @param _delegate The address of the delegate to be set.\n     *\n     * @dev Only the owner/admin of the OApp can call this function.\n     * @dev Provides the ability for a delegate to set configs, on behalf of the OApp, directly on the Endpoint contract.\n     */\n    function setDelegate(address _delegate) public onlyOwner {\n        endpoint.setDelegate(_delegate);\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC20} from \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC-20 standard.\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":"node_modules/@openzeppelin/contracts/interfaces/IERC7913.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC7913.sol)\n\npragma solidity >=0.5.0;\n\n/**\n * @dev Signature verifier interface.\n */\ninterface IERC7913SignatureVerifier {\n    /**\n     * @dev Verifies `signature` as a valid signature of `hash` by `key`.\n     *\n     * MUST return the bytes4 magic value IERC7913SignatureVerifier.verify.selector if the signature is valid.\n     * SHOULD return 0xffffffff or revert if the signature is not valid.\n     * SHOULD return 0xffffffff or revert if the key is empty\n     */\n    function verify(bytes calldata key, bytes32 hash, bytes calldata signature) external view returns (bytes4);\n}\n"},{"file_path":"node_modules/@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessageLib.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.0;\n\nimport { IERC165 } from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\nimport { SetConfigParam } from \"./IMessageLibManager.sol\";\n\nenum MessageLibType {\n    Send,\n    Receive,\n    SendAndReceive\n}\n\ninterface IMessageLib is IERC165 {\n    function setConfig(address _oapp, SetConfigParam[] calldata _config) external;\n\n    function getConfig(uint32 _eid, address _oapp, uint32 _configType) external view returns (bytes memory config);\n\n    function isSupportedEid(uint32 _eid) external view returns (bool);\n\n    // message libs of same major version are compatible\n    function version() external view returns (uint64 major, uint8 minor, uint8 endpointVersion);\n\n    function messageLibType() external view returns (MessageLibType);\n}\n"},{"file_path":"node_modules/@layerzerolabs/oapp-evm-upgradeable/contracts/oapp/OAppSenderUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\nimport { SafeERC20, IERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { MessagingParams, MessagingFee, MessagingReceipt } from \"@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol\";\nimport { OAppCoreUpgradeable } from \"./OAppCoreUpgradeable.sol\";\n\n/**\n * @title OAppSender\n * @dev Abstract contract implementing the OAppSender functionality for sending messages to a LayerZero endpoint.\n */\nabstract contract OAppSenderUpgradeable is OAppCoreUpgradeable {\n    using SafeERC20 for IERC20;\n\n    // Custom error messages\n    error NotEnoughNative(uint256 msgValue);\n    error LzTokenUnavailable();\n\n    // @dev The version of the OAppSender implementation.\n    // @dev Version is bumped when changes are made to this contract.\n    uint64 internal constant SENDER_VERSION = 1;\n\n    /**\n     * @param _delegate The delegate capable of making OApp configurations inside of the endpoint.\n     * @dev Ownable is not initialized here on purpose. It should be initialized in the child contract to\n     * accommodate the different version of Ownable.\n     */\n    function __OAppSender_init(address _delegate) internal onlyInitializing {\n        __OAppCore_init(_delegate);\n    }\n\n    function __OAppSender_init_unchained() internal onlyInitializing {}\n\n    /**\n     * @notice Retrieves the OApp version information.\n     * @return senderVersion The version of the OAppSender.sol contract.\n     * @return receiverVersion The version of the OAppReceiver.sol contract.\n     *\n     * @dev Providing 0 as the default for OAppReceiver version. Indicates that the OAppReceiver is not implemented.\n     * ie. this is a SEND only OApp.\n     * @dev If the OApp uses both OAppSender and OAppReceiver, then this needs to be override returning the correct versions\n     */\n    function oAppVersion() public view virtual returns (uint64 senderVersion, uint64 receiverVersion) {\n        return (SENDER_VERSION, 0);\n    }\n\n    /**\n     * @dev Internal function to interact with the LayerZero EndpointV2.quote() for fee calculation.\n     * @param _dstEid The destination endpoint ID.\n     * @param _message The message payload.\n     * @param _options Additional options for the message.\n     * @param _payInLzToken Flag indicating whether to pay the fee in LZ tokens.\n     * @return fee The calculated MessagingFee for the message.\n     *      - nativeFee: The native fee for the message.\n     *      - lzTokenFee: The LZ token fee for the message.\n     */\n    function _quote(\n        uint32 _dstEid,\n        bytes memory _message,\n        bytes memory _options,\n        bool _payInLzToken\n    ) internal view virtual returns (MessagingFee memory fee) {\n        return\n            endpoint.quote(\n                MessagingParams(_dstEid, _getPeerOrRevert(_dstEid), _message, _options, _payInLzToken),\n                address(this)\n            );\n    }\n\n    /**\n     * @dev Internal function to interact with the LayerZero EndpointV2.send() for sending a message.\n     * @param _dstEid The destination endpoint ID.\n     * @param _message The message payload.\n     * @param _options Additional options for the message.\n     * @param _fee The calculated LayerZero fee for the message.\n     *      - nativeFee: The native fee.\n     *      - lzTokenFee: The lzToken fee.\n     * @param _refundAddress The address to receive any excess fee values sent to the endpoint.\n     * @return receipt The receipt for the sent message.\n     *      - guid: The unique identifier for the sent message.\n     *      - nonce: The nonce of the sent message.\n     *      - fee: The LayerZero fee incurred for the message.\n     */\n    function _lzSend(\n        uint32 _dstEid,\n        bytes memory _message,\n        bytes memory _options,\n        MessagingFee memory _fee,\n        address _refundAddress\n    ) internal virtual returns (MessagingReceipt memory receipt) {\n        // @dev Push corresponding fees to the endpoint, any excess is sent back to the _refundAddress from the endpoint.\n        uint256 messageValue = _payNative(_fee.nativeFee);\n        if (_fee.lzTokenFee > 0) _payLzToken(_fee.lzTokenFee);\n\n        return\n            // solhint-disable-next-line check-send-result\n            endpoint.send{ value: messageValue }(\n                MessagingParams(_dstEid, _getPeerOrRevert(_dstEid), _message, _options, _fee.lzTokenFee > 0),\n                _refundAddress\n            );\n    }\n\n    /**\n     * @dev Internal function to pay the native fee associated with the message.\n     * @param _nativeFee The native fee to be paid.\n     * @return nativeFee The amount of native currency paid.\n     *\n     * @dev If the OApp needs to initiate MULTIPLE LayerZero messages in a single transaction,\n     * this will need to be overridden because msg.value would contain multiple lzFees.\n     * @dev Should be overridden in the event the LayerZero endpoint requires a different native currency.\n     * @dev Some EVMs use an ERC20 as a method for paying transactions/gasFees.\n     * @dev The endpoint is EITHER/OR, ie. it will NOT support both types of native payment at a time.\n     */\n    function _payNative(uint256 _nativeFee) internal virtual returns (uint256 nativeFee) {\n        if (msg.value != _nativeFee) revert NotEnoughNative(msg.value);\n        return _nativeFee;\n    }\n\n    /**\n     * @dev Internal function to pay the LZ token fee associated with the message.\n     * @param _lzTokenFee The LZ token fee to be paid.\n     *\n     * @dev If the caller is trying to pay in the specified lzToken, then the lzTokenFee is passed to the endpoint.\n     * @dev Any excess sent, is passed back to the specified _refundAddress in the _lzSend().\n     */\n    function _payLzToken(uint256 _lzTokenFee) internal virtual {\n        // @dev Cannot cache the token because it is not immutable in the endpoint.\n        address lzToken = endpoint.lzToken();\n        if (lzToken == address(0)) revert LzTokenUnavailable();\n\n        // Pay LZ token fee by sending tokens to the endpoint.\n        IERC20(lzToken).safeTransferFrom(msg.sender, address(endpoint), _lzTokenFee);\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/ShortStrings.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.3.0) (utils/ShortStrings.sol)\n\npragma solidity ^0.8.20;\n\nimport {StorageSlot} from \"./StorageSlot.sol\";\n\n// | string  | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   |\n// | length  | 0x                                                              BB |\ntype ShortString is bytes32;\n\n/**\n * @dev This library provides functions to convert short memory strings\n * into a `ShortString` type that can be used as an immutable variable.\n *\n * Strings of arbitrary length can be optimized using this library if\n * they are short enough (up to 31 bytes) by packing them with their\n * length (1 byte) in a single EVM word (32 bytes). Additionally, a\n * fallback mechanism can be used for every other case.\n *\n * Usage example:\n *\n * ```solidity\n * contract Named {\n *     using ShortStrings for *;\n *\n *     ShortString private immutable _name;\n *     string private _nameFallback;\n *\n *     constructor(string memory contractName) {\n *         _name = contractName.toShortStringWithFallback(_nameFallback);\n *     }\n *\n *     function name() external view returns (string memory) {\n *         return _name.toStringWithFallback(_nameFallback);\n *     }\n * }\n * ```\n */\nlibrary ShortStrings {\n    // Used as an identifier for strings longer than 31 bytes.\n    bytes32 private constant FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;\n\n    error StringTooLong(string str);\n    error InvalidShortString();\n\n    /**\n     * @dev Encode a string of at most 31 chars into a `ShortString`.\n     *\n     * This will trigger a `StringTooLong` error is the input string is too long.\n     */\n    function toShortString(string memory str) internal pure returns (ShortString) {\n        bytes memory bstr = bytes(str);\n        if (bstr.length > 31) {\n            revert StringTooLong(str);\n        }\n        return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));\n    }\n\n    /**\n     * @dev Decode a `ShortString` back to a \"normal\" string.\n     */\n    function toString(ShortString sstr) internal pure returns (string memory) {\n        uint256 len = byteLength(sstr);\n        // using `new string(len)` would work locally but is not memory safe.\n        string memory str = new string(32);\n        assembly (\"memory-safe\") {\n            mstore(str, len)\n            mstore(add(str, 0x20), sstr)\n        }\n        return str;\n    }\n\n    /**\n     * @dev Return the length of a `ShortString`.\n     */\n    function byteLength(ShortString sstr) internal pure returns (uint256) {\n        uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;\n        if (result > 31) {\n            revert InvalidShortString();\n        }\n        return result;\n    }\n\n    /**\n     * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.\n     */\n    function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {\n        if (bytes(value).length < 32) {\n            return toShortString(value);\n        } else {\n            StorageSlot.getStringSlot(store).value = value;\n            return ShortString.wrap(FALLBACK_SENTINEL);\n        }\n    }\n\n    /**\n     * @dev Decode a string that was encoded to `ShortString` or written to storage using {toShortStringWithFallback}.\n     */\n    function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {\n        if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {\n            return toString(value);\n        } else {\n            return store;\n        }\n    }\n\n    /**\n     * @dev Return the length of a string that was encoded to `ShortString` or written to storage using\n     * {toShortStringWithFallback}.\n     *\n     * WARNING: This will return the \"byte length\" of the string. This may not reflect the actual length in terms of\n     * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.\n     */\n    function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {\n        if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {\n            return byteLength(value);\n        } else {\n            return bytes(store).length;\n        }\n    }\n}\n"},{"file_path":"node_modules/forge-std/src/interfaces/IERC7575.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.6.2;\n\nimport {IERC165} from \"./IERC165.sol\";\n\n/// @dev Interface of the ERC7575 \"Multi-Asset ERC-4626 Vaults\", as defined in\n/// https://eips.ethereum.org/EIPS/eip-7575\ninterface IERC7575 is IERC165 {\n    event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);\n    event Withdraw(\n        address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares\n    );\n\n    /**\n     * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n     *\n     * - MUST be an ERC-20 token contract.\n     * - MUST NOT revert.\n     */\n    function asset() external view returns (address assetTokenAddress);\n\n    /**\n     * @dev Returns the address of the share token\n     *\n     * - MUST be an ERC-20 token contract.\n     * - MUST NOT revert.\n     */\n    function share() external view returns (address shareTokenAddress);\n\n    /**\n     * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\n     * scenario where all the conditions are met.\n     *\n     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n     * - MUST NOT show any variations depending on the caller.\n     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n     * - MUST NOT revert.\n     *\n     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n     * from.\n     */\n    function convertToShares(uint256 assets) external view returns (uint256 shares);\n\n    /**\n     * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\n     * scenario where all the conditions are met.\n     *\n     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n     * - MUST NOT show any variations depending on the caller.\n     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n     * - MUST NOT revert.\n     *\n     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n     * from.\n     */\n    function convertToAssets(uint256 shares) external view returns (uint256 assets);\n\n    /**\n     * @dev Returns the total amount of the underlying asset that is “managed” by Vault.\n     *\n     * - SHOULD include any compounding that occurs from yield.\n     * - MUST be inclusive of any fees that are charged against assets in the Vault.\n     * - MUST NOT revert.\n     */\n    function totalAssets() external view returns (uint256 totalManagedAssets);\n\n    /**\n     * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n     * through a deposit call.\n     *\n     * - MUST return a limited value if receiver is subject to some deposit limit.\n     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n     * - MUST NOT revert.\n     */\n    function maxDeposit(address receiver) external view returns (uint256 maxAssets);\n\n    /**\n     * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\n     * current on-chain conditions.\n     *\n     * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\n     *   call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\n     *   in the same transaction.\n     * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\n     *   deposit would be accepted, regardless if the user has enough tokens approved, etc.\n     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n     * - MUST NOT revert.\n     *\n     * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\n     * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n     */\n    function previewDeposit(uint256 assets) external view returns (uint256 shares);\n\n    /**\n     * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\n     *\n     * - MUST emit the Deposit event.\n     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n     *   deposit execution, and are accounted for during deposit.\n     * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\n     *   approving enough underlying tokens to the Vault contract, etc).\n     *\n     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n     */\n    function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n    /**\n     * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\n     * - MUST return a limited value if receiver is subject to some mint limit.\n     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n     * - MUST NOT revert.\n     */\n    function maxMint(address receiver) external view returns (uint256 maxShares);\n\n    /**\n     * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\n     * current on-chain conditions.\n     *\n     * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\n     *   in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\n     *   same transaction.\n     * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\n     *   would be accepted, regardless if the user has enough tokens approved, etc.\n     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n     * - MUST NOT revert.\n     *\n     * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\n     * share price or some other type of condition, meaning the depositor will lose assets by minting.\n     */\n    function previewMint(uint256 shares) external view returns (uint256 assets);\n\n    /**\n     * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n     *\n     * - MUST emit the Deposit event.\n     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\n     *   execution, and are accounted for during mint.\n     * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\n     *   approving enough underlying tokens to the Vault contract, etc).\n     *\n     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n     */\n    function mint(uint256 shares, address receiver) external returns (uint256 assets);\n\n    /**\n     * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\n     * Vault, through a withdraw call.\n     *\n     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n     * - MUST NOT revert.\n     */\n    function maxWithdraw(address owner) external view returns (uint256 maxAssets);\n\n    /**\n     * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\n     * given current on-chain conditions.\n     *\n     * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\n     *   call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\n     *   called\n     *   in the same transaction.\n     * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\n     *   the withdrawal would be accepted, regardless if the user has enough shares, etc.\n     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n     * - MUST NOT revert.\n     *\n     * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\n     * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n     */\n    function previewWithdraw(uint256 assets) external view returns (uint256 shares);\n\n    /**\n     * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n     *\n     * - MUST emit the Withdraw event.\n     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n     *   withdraw execution, and are accounted for during withdraw.\n     * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\n     *   not having enough shares, etc).\n     *\n     * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n     * Those methods should be performed separately.\n     */\n    function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);\n\n    /**\n     * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n     * through a redeem call.\n     *\n     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n     * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\n     * - MUST NOT revert.\n     */\n    function maxRedeem(address owner) external view returns (uint256 maxShares);\n\n    /**\n     * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\n     * given current on-chain conditions.\n     *\n     * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\n     *   in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\n     *   same transaction.\n     * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\n     *   redemption would be accepted, regardless if the user has enough shares, etc.\n     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n     * - MUST NOT revert.\n     *\n     * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\n     * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\n     */\n    function previewRedeem(uint256 shares) external view returns (uint256 assets);\n\n    /**\n     * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n     *\n     * - MUST emit the Withdraw event.\n     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n     *   redeem execution, and are accounted for during redeem.\n     * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\n     *   not having enough shares, etc).\n     *\n     * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n     * Those methods should be performed separately.\n     */\n    function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);\n}\n\n/// @dev Interface of the ERC20 share token, as defined in\n/// https://eips.ethereum.org/EIPS/eip-7575\ninterface IERC7575Share is IERC165 {\n    event VaultUpdate(address indexed asset, address vault);\n\n    /**\n     * @dev Returns the address of the Vault for the given asset.\n     *\n     * @param asset the ERC-20 token to deposit with into the Vault\n     */\n    function vault(address asset) external view returns (address);\n}\n"},{"file_path":"node_modules/@layerzerolabs/oft-evm/contracts/libs/OFTMsgCodec.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\nlibrary OFTMsgCodec {\n    // Offset constants for encoding and decoding OFT messages\n    uint8 private constant SEND_TO_OFFSET = 32;\n    uint8 private constant SEND_AMOUNT_SD_OFFSET = 40;\n\n    /**\n     * @dev Encodes an OFT LayerZero message.\n     * @param _sendTo The recipient address.\n     * @param _amountShared The amount in shared decimals.\n     * @param _composeMsg The composed message.\n     * @return _msg The encoded message.\n     * @return hasCompose A boolean indicating whether the message has a composed payload.\n     */\n    function encode(\n        bytes32 _sendTo,\n        uint64 _amountShared,\n        bytes memory _composeMsg\n    ) internal view returns (bytes memory _msg, bool hasCompose) {\n        hasCompose = _composeMsg.length > 0;\n        // @dev Remote chains will want to know the composed function caller ie. msg.sender on the src.\n        _msg = hasCompose\n            ? abi.encodePacked(_sendTo, _amountShared, addressToBytes32(msg.sender), _composeMsg)\n            : abi.encodePacked(_sendTo, _amountShared);\n    }\n\n    /**\n     * @dev Checks if the OFT message is composed.\n     * @param _msg The OFT message.\n     * @return A boolean indicating whether the message is composed.\n     */\n    function isComposed(bytes calldata _msg) internal pure returns (bool) {\n        return _msg.length > SEND_AMOUNT_SD_OFFSET;\n    }\n\n    /**\n     * @dev Retrieves the recipient address from the OFT message.\n     * @param _msg The OFT message.\n     * @return The recipient address.\n     */\n    function sendTo(bytes calldata _msg) internal pure returns (bytes32) {\n        return bytes32(_msg[:SEND_TO_OFFSET]);\n    }\n\n    /**\n     * @dev Retrieves the amount in shared decimals from the OFT message.\n     * @param _msg The OFT message.\n     * @return The amount in shared decimals.\n     */\n    function amountSD(bytes calldata _msg) internal pure returns (uint64) {\n        return uint64(bytes8(_msg[SEND_TO_OFFSET:SEND_AMOUNT_SD_OFFSET]));\n    }\n\n    /**\n     * @dev Retrieves the composed message from the OFT message.\n     * @param _msg The OFT message.\n     * @return The composed message.\n     */\n    function composeMsg(bytes calldata _msg) internal pure returns (bytes memory) {\n        return _msg[SEND_AMOUNT_SD_OFFSET:];\n    }\n\n    /**\n     * @dev Converts an address to bytes32.\n     * @param _addr The address to convert.\n     * @return The bytes32 representation of the address.\n     */\n    function addressToBytes32(address _addr) internal pure returns (bytes32) {\n        return bytes32(uint256(uint160(_addr)));\n    }\n\n    /**\n     * @dev Converts bytes32 to an address.\n     * @param _b The bytes32 value to convert.\n     * @return The address representation of bytes32.\n     */\n    function bytes32ToAddress(bytes32 _b) internal pure returns (address) {\n        return address(uint160(uint256(_b)));\n    }\n}\n"},{"file_path":"node_modules/@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessagingComposer.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.0;\n\ninterface IMessagingComposer {\n    event ComposeSent(address from, address to, bytes32 guid, uint16 index, bytes message);\n    event ComposeDelivered(address from, address to, bytes32 guid, uint16 index);\n    event LzComposeAlert(\n        address indexed from,\n        address indexed to,\n        address indexed executor,\n        bytes32 guid,\n        uint16 index,\n        uint256 gas,\n        uint256 value,\n        bytes message,\n        bytes extraData,\n        bytes reason\n    );\n\n    function composeQueue(\n        address _from,\n        address _to,\n        bytes32 _guid,\n        uint16 _index\n    ) external view returns (bytes32 messageHash);\n\n    function sendCompose(address _to, bytes32 _guid, uint16 _index, bytes calldata _message) external;\n\n    function lzCompose(\n        address _from,\n        address _to,\n        bytes32 _guid,\n        uint16 _index,\n        bytes calldata _message,\n        bytes calldata _extraData\n    ) external payable;\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.3.0) (utils/cryptography/MessageHashUtils.sol)\n\npragma solidity ^0.8.20;\n\nimport {Strings} from \"../Strings.sol\";\n\n/**\n * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.\n *\n * The library provides methods for generating a hash of a message that conforms to the\n * https://eips.ethereum.org/EIPS/eip-191[ERC-191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]\n * specifications.\n */\nlibrary MessageHashUtils {\n    /**\n     * @dev Returns the keccak256 digest of an ERC-191 signed data with version\n     * `0x45` (`personal_sign` messages).\n     *\n     * The digest is calculated by prefixing a bytes32 `messageHash` with\n     * `\"\\x19Ethereum Signed Message:\\n32\"` and hashing the result. It corresponds with the\n     * hash signed when using the https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign[`eth_sign`] JSON-RPC method.\n     *\n     * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with\n     * keccak256, although any bytes32 value can be safely used because the final digest will\n     * be re-hashed.\n     *\n     * See {ECDSA-recover}.\n     */\n    function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) {\n        assembly (\"memory-safe\") {\n            mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\") // 32 is the bytes-length of messageHash\n            mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix\n            digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20)\n        }\n    }\n\n    /**\n     * @dev Returns the keccak256 digest of an ERC-191 signed data with version\n     * `0x45` (`personal_sign` messages).\n     *\n     * The digest is calculated by prefixing an arbitrary `message` with\n     * `\"\\x19Ethereum Signed Message:\\n\" + len(message)` and hashing the result. It corresponds with the\n     * hash signed when using the https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign[`eth_sign`] JSON-RPC method.\n     *\n     * See {ECDSA-recover}.\n     */\n    function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) {\n        return\n            keccak256(bytes.concat(\"\\x19Ethereum Signed Message:\\n\", bytes(Strings.toString(message.length)), message));\n    }\n\n    /**\n     * @dev Returns the keccak256 digest of an ERC-191 signed data with version\n     * `0x00` (data with intended validator).\n     *\n     * The digest is calculated by prefixing an arbitrary `data` with `\"\\x19\\x00\"` and the intended\n     * `validator` address. Then hashing the result.\n     *\n     * See {ECDSA-recover}.\n     */\n    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n        return keccak256(abi.encodePacked(hex\"19_00\", validator, data));\n    }\n\n    /**\n     * @dev Variant of {toDataWithIntendedValidatorHash-address-bytes} optimized for cases where `data` is a bytes32.\n     */\n    function toDataWithIntendedValidatorHash(\n        address validator,\n        bytes32 messageHash\n    ) internal pure returns (bytes32 digest) {\n        assembly (\"memory-safe\") {\n            mstore(0x00, hex\"19_00\")\n            mstore(0x02, shl(96, validator))\n            mstore(0x16, messageHash)\n            digest := keccak256(0x00, 0x36)\n        }\n    }\n\n    /**\n     * @dev Returns the keccak256 digest of an EIP-712 typed data (ERC-191 version `0x01`).\n     *\n     * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with\n     * `\\x19\\x01` and hashing the result. It corresponds to the hash signed by the\n     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.\n     *\n     * See {ECDSA-recover}.\n     */\n    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) {\n        assembly (\"memory-safe\") {\n            let ptr := mload(0x40)\n            mstore(ptr, hex\"19_01\")\n            mstore(add(ptr, 0x02), domainSeparator)\n            mstore(add(ptr, 0x22), structHash)\n            digest := keccak256(ptr, 0x42)\n        }\n    }\n}\n"},{"file_path":"contracts/libraries/NestVaultOperatorLogic.sol","source_code":"// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.30;\n\nimport {MessageHashUtils} from \"@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol\";\nimport {SignatureChecker} from \"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\";\nimport {Errors} from \"contracts/types/Errors.sol\";\nimport {NestVaultCoreTypes} from \"contracts/types/NestVaultCoreTypes.sol\";\nimport {NestVaultCoreValidationLogic} from \"contracts/libraries/NestVaultCoreValidationLogic.sol\";\n\n/// @title  NestVaultOperatorLogic\n/// @notice Library containing operator-related logic for NestVaultCore\n/// @author plumenetwork\n/// @custom:oz-upgrades-unsafe-allow external-library-linking\nlibrary NestVaultOperatorLogic {\n    using NestVaultCoreValidationLogic for NestVaultCoreTypes.NestVaultCoreStorage;\n    /*//////////////////////////////////////////////////////////////\n                                EVENTS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @dev   Emitted when an operator is set or revoked\n    /// @param controller address The controller setting the operator\n    /// @param operator   address The operator being set\n    /// @param approved   bool    Whether the operator is approved\n    event OperatorSet(address indexed controller, address indexed operator, bool approved);\n\n    /*//////////////////////////////////////////////////////////////\n                          EXECUTE FUNCTIONS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Executes the setOperator logic\n    /// @param  $         NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _operator address The operator address\n    /// @param  _approved bool    Whether to approve or revoke\n    /// @param  _caller   address The caller (msg.sender)\n    /// @return _success  bool    Always returns true on success\n    function executeSetOperator(\n        NestVaultCoreTypes.NestVaultCoreStorage storage $,\n        address _operator,\n        bool _approved,\n        address _caller\n    ) external returns (bool _success) {\n        $.validateSetOperator(_operator, _caller);\n        $.isVaultOperator[_caller][_operator] = _approved;\n        emit OperatorSet(_caller, _operator, _approved);\n        return true;\n    }\n\n    /// @notice Validates and executes an operator authorization\n    /// @dev    Validates inputs, verifies via EIP712 signatures, and updates state\n    /// @param  $                NestVaultCoreTypes.NestVaultCoreStorage The full storage struct\n    /// @param  _controller       address The controller's address\n    /// @param  _operator         address The operator's address\n    /// @param  _approved         bool    Whether the operator is approved or not\n    /// @param  _nonce            bytes32 A unique identifier for the authorization\n    /// @param  _deadline         uint256 The deadline for the authorization\n    /// @param  _signature        bytes   The signature to validate the authorization\n    /// @param  _domainSeparator  bytes32 The EIP712 domain separator\n    /// @return _success          bool    Always returns true on success\n    function executeAuthorizeOperator(\n        NestVaultCoreTypes.NestVaultCoreStorage storage $,\n        address _controller,\n        address _operator,\n        bool _approved,\n        bytes32 _nonce,\n        uint256 _deadline,\n        bytes memory _signature,\n        bytes32 _domainSeparator\n    ) external returns (bool _success) {\n        $.validateAuthorizeOperator(_controller, _operator, _nonce, _deadline);\n\n        bytes32 _structHash = keccak256(\n            abi.encode(\n                keccak256(\n                    \"AuthorizeOperator(address controller,address operator,bool approved,bytes32 nonce,uint256 deadline)\"\n                ),\n                _controller,\n                _operator,\n                _approved,\n                _nonce,\n                _deadline\n            )\n        );\n\n        bytes32 _hash = MessageHashUtils.toTypedDataHash(_domainSeparator, _structHash);\n\n        if (!SignatureChecker.isValidSignatureNow(_controller, _hash, _signature)) {\n            revert Errors.ERC7540InvalidSigner();\n        }\n\n        $.authorizations[_controller][_nonce] = true;\n        $.isVaultOperator[_controller][_operator] = _approved;\n        emit OperatorSet(_controller, _operator, _approved);\n        return true;\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\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[ERC 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":"node_modules/@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessagingContext.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.0;\n\ninterface IMessagingContext {\n    function isSendingMessage() external view returns (bool);\n\n    function getSendContext() external view returns (uint32 dstEid, address sender);\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/Errors.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Collection of common custom errors used in multiple contracts\n *\n * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.\n * It is recommended to avoid relying on the error API for critical functionality.\n *\n * _Available since v5.1._\n */\nlibrary Errors {\n    /**\n     * @dev The ETH balance of the account is not enough to perform the operation.\n     */\n    error InsufficientBalance(uint256 balance, uint256 needed);\n\n    /**\n     * @dev A call to an address target failed. The target may have reverted.\n     */\n    error FailedCall();\n\n    /**\n     * @dev The deployment failed.\n     */\n    error FailedDeployment();\n\n    /**\n     * @dev A necessary precompile is missing.\n     */\n    error MissingPrecompile(address);\n}\n"},{"file_path":"node_modules/@layerzerolabs/oft-evm-upgradeable/contracts/oft/OFTUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\nimport { ERC20Upgradeable } from \"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol\";\nimport { IOFT, OFTCoreUpgradeable } from \"./OFTCoreUpgradeable.sol\";\n\n/**\n * @title OFT Contract\n * @dev OFT is an ERC-20 token that extends the functionality of the OFTCore contract.\n */\nabstract contract OFTUpgradeable is OFTCoreUpgradeable, ERC20Upgradeable {\n    /**\n     * @dev Constructor for the OFT contract.\n     * @param _lzEndpoint The LayerZero endpoint address.\n     */\n    constructor(address _lzEndpoint) OFTCoreUpgradeable(decimals(), _lzEndpoint) {}\n\n    /**\n     * @dev Initializes the OFT with the provided name, symbol, and delegate.\n     * @param _name The name of the OFT.\n     * @param _symbol The symbol of the OFT.\n     * @param _delegate The delegate capable of making OApp configurations inside of the endpoint.\n     *\n     * @dev The delegate typically should be set as the owner of the contract.\n     * @dev Ownable is not initialized here on purpose. It should be initialized in the child contract to\n     * accommodate the different version of Ownable.\n     */\n    function __OFT_init(string memory _name, string memory _symbol, address _delegate) internal onlyInitializing {\n        __ERC20_init(_name, _symbol);\n        __OFTCore_init(_delegate);\n    }\n\n    function __OFT_init_unchained() internal onlyInitializing {}\n\n    /**\n     * @dev Retrieves the address of the underlying ERC20 implementation.\n     * @return The address of the OFT token.\n     *\n     * @dev In the case of OFT, address(this) and erc20 are the same contract.\n     */\n    function token() public view returns (address) {\n        return address(this);\n    }\n\n    /**\n     * @notice Indicates whether the OFT contract requires approval of the 'token()' to send.\n     * @return requiresApproval Needs approval of the underlying token implementation.\n     *\n     * @dev In the case of OFT where the contract IS the token, approval is NOT required.\n     */\n    function approvalRequired() external pure virtual returns (bool) {\n        return false;\n    }\n\n    /**\n     * @dev Burns tokens from the sender's specified balance.\n     * @param _from The address to debit the tokens from.\n     * @param _amountLD The amount of tokens to send in local decimals.\n     * @param _minAmountLD The minimum amount to send in local decimals.\n     * @param _dstEid The destination chain ID.\n     * @return amountSentLD The amount sent in local decimals.\n     * @return amountReceivedLD The amount received in local decimals on the remote.\n     */\n    function _debit(\n        address _from,\n        uint256 _amountLD,\n        uint256 _minAmountLD,\n        uint32 _dstEid\n    ) internal virtual override returns (uint256 amountSentLD, uint256 amountReceivedLD) {\n        (amountSentLD, amountReceivedLD) = _debitView(_amountLD, _minAmountLD, _dstEid);\n\n        // @dev In NON-default OFT, amountSentLD could be 100, with a 10% fee, the amountReceivedLD amount is 90,\n        // therefore amountSentLD CAN differ from amountReceivedLD.\n\n        // @dev Default OFT burns on src.\n        _burn(_from, amountSentLD);\n    }\n\n    /**\n     * @dev Credits tokens to the specified address.\n     * @param _to The address to credit the tokens to.\n     * @param _amountLD The amount of tokens to credit in local decimals.\n     * @dev _srcEid The source chain ID.\n     * @return amountReceivedLD The amount of tokens ACTUALLY received in local decimals.\n     */\n    function _credit(\n        address _to,\n        uint256 _amountLD,\n        uint32 /*_srcEid*/\n    ) internal virtual override returns (uint256 amountReceivedLD) {\n        if (_to == address(0x0)) _to = address(0xdead); // _mint(...) does not support address(0x0)\n        // @dev Default OFT mints on dst.\n        _mint(_to, _amountLD);\n        // @dev In the case of NON-default OFT, the _amountLD MIGHT not be == amountReceivedLD.\n        return _amountLD;\n    }\n}\n"},{"file_path":"node_modules/@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessagingChannel.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.0;\n\ninterface IMessagingChannel {\n    event InboundNonceSkipped(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce);\n    event PacketNilified(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash);\n    event PacketBurnt(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash);\n\n    function eid() external view returns (uint32);\n\n    // this is an emergency function if a message cannot be verified for some reasons\n    // required to provide _nextNonce to avoid race condition\n    function skip(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce) external;\n\n    function nilify(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external;\n\n    function burn(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external;\n\n    function nextGuid(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (bytes32);\n\n    function inboundNonce(address _receiver, uint32 _srcEid, bytes32 _sender) external view returns (uint64);\n\n    function outboundNonce(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (uint64);\n\n    function inboundPayloadHash(\n        address _receiver,\n        uint32 _srcEid,\n        bytes32 _sender,\n        uint64 _nonce\n    ) external view returns (bytes32);\n\n    function lazyInboundNonce(address _receiver, uint32 _srcEid, bytes32 _sender) external view returns (uint64);\n}\n"},{"file_path":"contracts/accountant/NestHubAccountant.sol","source_code":"// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.30;\n\n// contracts\nimport {ERC20} from \"@solmate/tokens/ERC20.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {AuthUpgradeable} from \"contracts/auth/AuthUpgradeable.sol\";\nimport {Authority} from \"@solmate/auth/Auth.sol\";\nimport {NestShareOFT} from \"contracts/NestShareOFT.sol\";\n\n// interfaces\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IRateProvider} from \"contracts/interfaces/IRateProvider.sol\";\n\n// libraries\nimport {NestVaultAccountingLogic} from \"contracts/libraries/NestVaultAccountingLogic.sol\";\nimport {Errors} from \"contracts/types/Errors.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport {FixedPointMathLib} from \"@solmate/utils/FixedPointMathLib.sol\";\nimport {Math} from \"@openzeppelin/contracts/utils/math/Math.sol\";\nimport {SafeCast} from \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\n\n/// @title  NestHubAccountant\n/// @author plumenetwork\n/// @notice Provides exchange-rate tracking, fee accounting (management + performance), and rate-provider integration for NestVault.\n/// @dev    Handles exchange-rate updates with safety bounds, HWM-based performance fees with optional\n///         hurdle rate and holdback/clawback reserve, pausing logic, and cross-asset rate conversions\ncontract NestHubAccountant is Initializable, AuthUpgradeable {\n    using NestVaultAccountingLogic for uint256;\n    using FixedPointMathLib for uint256;\n    using SafeCast for uint256;\n\n    /*//////////////////////////////////////////////////////////////\n                            STORAGE STRUCTS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @param payoutAddress                  address the address `claimFees` sends fees to\n    /// @param feesOwedInBase                 uint128 total pending fees owed in terms of base\n    /// @param totalSharesLastUpdate          uint128 total amount of shares the last exchange rate update\n    /// @param exchangeRate                   uint96  the current net exchange rate in terms of base\n    /// @param allowedExchangeRateChangeUpper uint32  the max allowed change to exchange rate from an update\n    /// @param allowedExchangeRateChangeLower uint32  the min allowed change to exchange rate from an update\n    /// @param lastUpdateTimestamp            uint64  the block timestamp of the last exchange rate update\n    /// @param isPaused                       bool    whether or not this contract is paused\n    /// @param minimumUpdateDelayInSeconds    uint32  the minimum amount of time that must pass between exchange rate updates\n    /// @param managementFee                  uint32  annualized management fee (1e6 = 100%)\n    /// @param lastGrossRate                  uint96  posted rate from the most recent update, net of fee liabilities; used as the management-fee and performance-fee discount basis\n    struct AccountantState {\n        address payoutAddress;\n        uint128 feesOwedInBase;\n        uint128 totalSharesLastUpdate;\n        uint96 exchangeRate;\n        uint32 allowedExchangeRateChangeUpper;\n        uint32 allowedExchangeRateChangeLower;\n        uint64 lastUpdateTimestamp;\n        bool isPaused;\n        uint32 minimumUpdateDelayInSeconds;\n        uint32 managementFee;\n        uint96 lastGrossRate;\n    }\n\n    /// @param highWaterMark          uint96 highest gross rate ever recorded\n    /// @param clawbackReferenceRate  uint96 clawback baseline checkpoint; seeded from the stored post-fee rate on gains and recoveries, and checkpointed to the current gross rate after clawbacks\n    /// @param hwmLastUpdateTimestamp uint64 timestamp when the high-water mark was last set or reset\n    struct PerformanceFeeCheckpoint {\n        uint96 highWaterMark;\n        uint96 clawbackReferenceRate;\n        uint64 hwmLastUpdateTimestamp;\n    }\n\n    /// @param performanceFee         uint32  performance fee on gains above HWM (1e6 = 100%)\n    /// @param hurdleRate             uint32  annualized minimum return before perf fee applies (0 = disabled)\n    /// @param holdbackRate           uint32  fraction of perf fee held in reserve (0 = disabled, 1e6 = 100%)\n    /// @param crystallizationWindow  uint32  seconds before holdback reserve becomes claimable (0 = immediate)\n    /// @param epochsPerWindow        uint32  number of epochs per crystallization window for reserve batching (0 = single epoch per window)\n    struct PerformanceFeeConfig {\n        uint32 performanceFee;\n        uint32 hurdleRate;\n        uint32 holdbackRate;\n        uint32 crystallizationWindow;\n        uint32 epochsPerWindow;\n    }\n\n    /// @param isPeggedToBase   bool            whether or not the asset is 1:1 with the base asset\n    /// @param rateProvider     IRateProvider   the rate provider for this asset if `isPeggedToBase` is false\n    struct RateProviderData {\n        bool isPeggedToBase;\n        IRateProvider rateProvider;\n    }\n\n    /// @param amount    uint128 holdback fee amount in base terms\n    /// @param timestamp uint64  when this batch was created\n    struct ReserveBatch {\n        uint128 amount;\n        uint64 timestamp;\n    }\n\n    /// @param batches      mapping  epoch-indexed reserve batches\n    /// @param batchHead    uint64   index of the oldest active batch\n    /// @param batchTail    uint64   index of the next batch to write\n    /// @param totalReserve uint128  sum of all active batch amounts (cache)\n    struct PerformanceFeeReserve {\n        mapping(uint256 => ReserveBatch) batches;\n        uint64 batchHead;\n        uint64 batchTail;\n        uint128 totalReserve;\n    }\n\n    /// @notice Bundle of all performance-fee related state (config + checkpoint + reserve)\n    /// @param  config     PerformanceFeeConfig     performance-fee parameters\n    /// @param  checkpoint PerformanceFeeCheckpoint HWM, clawback reference, and HWM-update timestamp\n    /// @param  reserve    PerformanceFeeReserve    aggregate reserve state for holdback batching/clawback\n    struct PerformanceFeeState {\n        PerformanceFeeConfig config;\n        PerformanceFeeCheckpoint checkpoint;\n        PerformanceFeeReserve reserve;\n    }\n\n    /// @notice Root storage struct for NestHubAccountant (ERC-7201 namespaced)\n    /// @param  accountantState     AccountantState     core rate, fee, and checkpoint state\n    /// @param  rateProviderData    mapping             per-asset rate provider configuration for quote conversions\n    /// @param  totalPendingShares  uint256             global shares awaiting redemption across all vaults sharing this accountant\n    /// @param  performanceFeeState PerformanceFeeState performance-fee config, HWM checkpoint, and holdback reserve\n    /// @param  managementFeeCarry  uint256             accrued management fee not yet realized, in base terms scaled by DENOMINATOR * ONE_YEAR\n    struct NestAccountantStorage {\n        AccountantState accountantState;\n        mapping(ERC20 => RateProviderData) rateProviderData;\n        uint256 totalPendingShares;\n        PerformanceFeeState performanceFeeState;\n        uint256 managementFeeCarry;\n    }\n\n    /// @notice Categorizes a `FeeAccrued` event by origin\n    /// @dev    Crystallization only ever releases performance-fee holdback, so matured batches map to `Performance`.\n    enum FeeType {\n        Management,\n        Performance\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                        CONSTANTS AND IMMUTABLES\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice The address of the base deposit asset used for rate calculations\n    /// @dev    This is an immutable variable that stores the address of the base asset\n    ERC20 public immutable base;\n\n    /// @notice The decimals rates are provided in\n    /// @dev    Specifies the reference decimal precision used internally to scale and normalize rate values\n    uint8 public immutable baseDecimals;\n\n    /// @dev    This is an immutable variable that stores the address of the share token to honour ERC7575 specs\n    address internal immutable SHARE;\n\n    /// @dev This constant is used as a divisor in various mathematical calculations\n    ///      throughout the contract to achieve precise percentages and ratios\n    uint256 internal constant DENOMINATOR = 1e6;\n\n    /// @dev This constant is maximum cap on management fee\n    uint256 internal constant MANAGEMENT_FEE_CAP = 0.2e6; // 20%\n\n    /// @dev Maximum cap on performance fee\n    uint256 internal constant PERFORMANCE_FEE_CAP = 0.5e6; // 50%\n\n    /// @dev Maximum cap on hurdle rate\n    uint256 internal constant HURDLE_RATE_CAP = 0.3e6; // 30% annualized\n\n    /// @dev Maximum cap on crystallization window\n    uint256 internal constant CRYSTALLIZATION_WINDOW_CAP = 365 days;\n\n    /// @dev Maximum cap on epochs per window\n    uint256 internal constant EPOCHS_PER_WINDOW_CAP = 52;\n\n    /// @dev This constant stores the duration of 1 year in seconds\n    uint256 internal constant ONE_YEAR = 365 days;\n\n    /// @dev This constant stores maximum allowed update delay\n    uint256 internal constant UPDATE_DELAY_CAP = 14 days;\n\n    // keccak256(abi.encode(uint256(keccak256(\"plumenetwork.storage.NestAccountant\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant NestAccountantStorageLocation =\n        0xb378036f9633fc394c3579301b38ac88997c2589544525e367cd650f76eaa300;\n\n    /*//////////////////////////////////////////////////////////////\n                                EVENTS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Emitted when protocol fees are claimed\n    /// @param  feeAsset address The asset in which the fees were denominated\n    /// @param  amount   uint256 The amount of fees claimed\n    event FeesClaimed(address indexed feeAsset, uint256 amount);\n\n    /// @notice Emitted whenever `feesOwedInBase` increases\n    /// @param  feeType uint8   The `FeeType` (0 = Management, 1 = Performance) that triggered the accrual\n    /// @param  amount  uint256 The base-denominated amount added to `feesOwedInBase`\n    event FeeAccrued(uint8 indexed feeType, uint256 amount);\n\n    /// @notice Emitted when accrued fees are waived back to shareholders\n    /// @param  amount        uint256 The base-denominated amount of fees waived\n    /// @param  remainingOwed uint256 The total accrued liability remaining after the waiver\n    ///                                (feesOwedInBase + managementFeeCarry / (DENOMINATOR * ONE_YEAR))\n    event FeesWaived(uint256 amount, uint256 remainingOwed);\n\n    /// @notice Emitted when reserved holdback is waived back to shareholders\n    /// @param  amount           uint256 The base-denominated reserve amount waived\n    /// @param  remainingReserve uint256 The `totalReserve` remaining after the waiver\n    event ReserveWaived(uint256 amount, uint256 remainingReserve);\n\n    /// @notice Emitted when global pending shares are updated\n    /// @param  oldPendingShares uint256 The previous total pending shares\n    /// @param  newPendingShares uint256 The new total pending shares\n    event TotalPendingSharesUpdated(uint256 oldPendingShares, uint256 newPendingShares);\n\n    /// @notice Emitted when the contract is paused\n    event Paused();\n\n    /// @notice Emitted when the contract is unpaused\n    event Unpaused();\n\n    /// @notice Emitted when the global execution delay is updated\n    /// @param  oldDelay uint32 The previous delay value\n    /// @param  newDelay uint32 The newly set delay value\n    event DelayInSecondsUpdated(uint32 oldDelay, uint32 newDelay);\n\n    /// @notice Emitted when the upper price/rate bound is updated\n    /// @param  oldBound uint32 The previous upper bound value\n    /// @param  newBound uint32 The newly set upper bound value\n    event UpperBoundUpdated(uint32 oldBound, uint32 newBound);\n\n    /// @notice Emitted when the lower price/rate bound is updated\n    /// @param  oldBound uint32 The previous lower bound value\n    /// @param  newBound uint32 The newly set lower bound value\n    event LowerBoundUpdated(uint32 oldBound, uint32 newBound);\n\n    /// @notice Emitted when the management fee rate is updated\n    /// @param  oldFee uint32 The previous management fee\n    /// @param  newFee uint32 The newly set management fee\n    event ManagementFeeUpdated(uint32 oldFee, uint32 newFee);\n\n    /// @notice Emitted when the performance fee rate is updated\n    /// @param  oldFee uint32 The previous performance fee\n    /// @param  newFee uint32 The newly set performance fee\n    event PerformanceFeeUpdated(uint32 oldFee, uint32 newFee);\n\n    /// @notice Emitted when the high-water mark is updated\n    /// @param  oldHWM uint96 The previous high-water mark\n    /// @param  newHWM uint96 The newly set high-water mark\n    event HighWaterMarkUpdated(uint96 oldHWM, uint96 newHWM);\n\n    /// @notice Emitted when the hurdle rate is updated\n    /// @param  oldRate uint32 The previous hurdle rate\n    /// @param  newRate uint32 The newly set hurdle rate\n    event HurdleRateUpdated(uint32 oldRate, uint32 newRate);\n\n    /// @notice Emitted when the performance-fee holdback rate is updated\n    /// @param  oldRate uint32 The previous holdback rate\n    /// @param  newRate uint32 The newly set holdback rate\n    event HoldbackRateUpdated(uint32 oldRate, uint32 newRate);\n\n    /// @notice Emitted when the crystallization window is updated\n    /// @param  oldWindow uint32 The previous crystallization window\n    /// @param  newWindow uint32 The newly set crystallization window\n    event CrystallizationWindowUpdated(uint32 oldWindow, uint32 newWindow);\n\n    /// @notice Emitted when the number of reserve epochs per window is updated\n    /// @param  oldEpochs uint32 The previous epochs-per-window value\n    /// @param  newEpochs uint32 The newly set epochs-per-window value\n    event EpochsPerWindowUpdated(uint32 oldEpochs, uint32 newEpochs);\n\n    /// @notice Emitted when the payout address is changed\n    /// @param  oldPayout address The previous payout address\n    /// @param  newPayout address The new payout address\n    event PayoutAddressUpdated(address oldPayout, address newPayout);\n\n    /// @notice Emitted when the rate provider for an asset is updated\n    /// @param  asset        address The asset for which the rate provider is updated\n    /// @param  isPegged     bool    Whether the asset is treated as pegged (uses fixed rate)\n    /// @param  rateProvider address The newly assigned rate provider address\n    event RateProviderUpdated(address asset, bool isPegged, address rateProvider);\n\n    /// @notice Emitted when the exchange rate is updated\n    /// @param  oldRate     uint96 The previous exchange rate\n    /// @param  newRate     uint96 The newly set exchange rate\n    /// @param  currentTime uint64 The timestamp when the update occurred\n    event ExchangeRateUpdated(uint96 oldRate, uint96 newRate, uint64 currentTime);\n\n    /*//////////////////////////////////////////////////////////////\n                            INITIALIZATION\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Initializes the contract with the given base asset\n    /// @param  _base  address The address of the base asset used for rate calculations\n    /// @param  _share address The address of the share token associated with this accountant\n    constructor(address _base, address _share) {\n        if (_base == address(0) || _share == address(0)) revert Errors.ZeroAddress();\n        base = ERC20(_base);\n        baseDecimals = ERC20(_base).decimals();\n        SHARE = _share;\n        _disableInitializers();\n    }\n\n    /// @dev    Internal function to access the contract's NestHubAccountant slot\n    /// @return $ NestAccountantStorage A reference to the NestAccountantStorage struct for reading/writing exchange rate\n    function _getNestAccountantStorage() private pure returns (NestAccountantStorage storage $) {\n        assembly {\n            $.slot := NestAccountantStorageLocation\n        }\n    }\n\n    /// @notice Sets up the initial state of the NestHubAccountant contract\n    /// @dev    This function is called only during contract initialization\n    /// @param  _totalSharesLastUpdate          uint256 The last recorded total shares at initialization\n    /// @param  _payoutAddress                  address The address to which management fees and payouts will be sent\n    /// @param  _startingExchangeRate           uint96  The initial exchange rate used for share-to-asset conversions\n    /// @param  _allowedExchangeRateChangeUpper uint32  The maximum allowed increase in exchange rate per update (in basis points where 1e6 = 100%)\n    /// @param  _allowedExchangeRateChangeLower uint32  The maximum allowed decrease in exchange rate per update (in basis points where 1e6 = 100%)\n    /// @param  _minimumUpdateDelayInSeconds    uint32  Minimum delay between successive exchange rate updates\n    /// @param  _managementFee                  uint32  The management fee percentage applied to the total assets (in basis points where 1e6 = 100%)\n    /// @param  _performanceFee                 uint32  Performance fee on gains above HWM (1e6 = 100%, 0 = disabled)\n    /// @param  _hurdleRate                     uint32  Annualized hurdle rate (1e6 = 100%, 0 = disabled)\n    /// @param  _holdbackRate                   uint32  Fraction of perf fee held in reserve (1e6 = 100%, 0 = disabled)\n    /// @param  _crystallizationWindow          uint32  Seconds before holdback becomes claimable (0 = immediate)\n    /// @param  _epochsPerWindow                uint32  Number of reserve epochs per crystallization window (0 = single epoch per window)\n    /// @param  _owner                          address The address of the owner of the accountant\n    function initialize(\n        uint256 _totalSharesLastUpdate,\n        address _payoutAddress,\n        uint96 _startingExchangeRate,\n        uint32 _allowedExchangeRateChangeUpper,\n        uint32 _allowedExchangeRateChangeLower,\n        uint32 _minimumUpdateDelayInSeconds,\n        uint32 _managementFee,\n        uint32 _performanceFee,\n        uint32 _hurdleRate,\n        uint32 _holdbackRate,\n        uint32 _crystallizationWindow,\n        uint32 _epochsPerWindow,\n        address _owner\n    ) external virtual initializer {\n        if (_startingExchangeRate == 0) revert Errors.InvalidRate();\n        if (_owner == address(0)) revert Errors.ZeroAddress();\n\n        NestAccountantStorage storage $ = _getNestAccountantStorage();\n        AccountantState storage state = $.accountantState;\n        PerformanceFeeCheckpoint storage checkpoint = $.performanceFeeState.checkpoint;\n        state.lastUpdateTimestamp = uint64(block.timestamp);\n        state.totalSharesLastUpdate = _totalSharesLastUpdate.toUint128();\n        state.exchangeRate = _startingExchangeRate;\n        state.lastGrossRate = _startingExchangeRate;\n        checkpoint.highWaterMark = _startingExchangeRate;\n        checkpoint.hwmLastUpdateTimestamp = uint64(block.timestamp);\n        checkpoint.clawbackReferenceRate = _startingExchangeRate;\n\n        _setPayoutAddress(_payoutAddress);\n        _setAllowedExchangeRateChangeUpper(_allowedExchangeRateChangeUpper);\n        _setAllowedExchangeRateChangeLower(_allowedExchangeRateChangeLower);\n        _setMinimumUpdateDelayInSeconds(_minimumUpdateDelayInSeconds);\n\n        _setManagementFee(_managementFee);\n        _setPerformanceFee(_performanceFee);\n        _setHurdleRate(_hurdleRate);\n        _setHoldbackRate(_holdbackRate);\n        _setCrystallizationWindow(_crystallizationWindow);\n        _setEpochsPerWindow(_epochsPerWindow);\n\n        __Auth_init(_owner, Authority(address(0)));\n    }\n\n    /// @notice Returns the version of the NestHubAccountant contract.\n    /// @dev    This version is used to track contract upgrades.\n    /// @return string A string representing the version of the contract.\n    function version() public pure returns (string memory) {\n        return \"1.1.0\";\n    }\n\n    /// @notice Updates the exchange rate from the per-share NAV of the underlying investment strategy\n    /// @dev    Invalid updates revert if too early or outside the configured bounds. Successful updates\n    ///         accrue elapsed management and performance fees, then store the post-fee net exchange rate.\n    ///         Callable by authorized accounts. The posted rate must be net of `feesOwedInBase` and the\n    ///         holdback reserve.\n    /// @param  _newExchangeRate   uint96  Strategy NAV per share, net of accrued fee liabilities\n    /// @param  _totalShareSupply  uint128 The global total share supply across all chains\n    function updateExchangeRate(uint96 _newExchangeRate, uint128 _totalShareSupply) external requiresAuth {\n        NestAccountantStorage storage $ = _getNestAccountantStorage();\n        AccountantState storage state = $.accountantState;\n        uint64 _currentTime = uint64(block.timestamp);\n        uint256 _currentExchangeRate = state.exchangeRate;\n        uint256 _totalShares = uint256(_totalShareSupply);\n        if (_totalShareSupply < IERC20(SHARE).totalSupply()) revert Errors.TotalSupplyBelowLocal();\n        uint256 _oneShare = 10 ** ERC20(SHARE).decimals();\n\n        if (_currentTime < state.lastUpdateTimestamp + state.minimumUpdateDelayInSeconds) {\n            revert Errors.MinimumUpdateDelayNotPassed();\n        }\n\n        _crystallizeReserve(true);\n\n        uint256 _postManagementFeeRate = _accrueManagementFees(_newExchangeRate, _totalShares, _oneShare);\n\n        uint256 _postFeeRate =\n            _accruePerformanceFees(_newExchangeRate, _postManagementFeeRate, _totalShares, _oneShare, _currentTime);\n\n        if (\n            _postFeeRate > _currentExchangeRate.mulDivDown(state.allowedExchangeRateChangeUpper, DENOMINATOR)\n                || _postFeeRate < _currentExchangeRate.mulDivDown(state.allowedExchangeRateChangeLower, DENOMINATOR)\n        ) {\n            revert Errors.RateOutOfBounds();\n        }\n\n        state.lastUpdateTimestamp = _currentTime;\n        state.totalSharesLastUpdate = _totalShares.toUint128();\n        state.lastGrossRate = uint96(_newExchangeRate);\n        state.exchangeRate = _postFeeRate.toUint96();\n\n        emit ExchangeRateUpdated(uint96(_currentExchangeRate), _postFeeRate.toUint96(), _currentTime);\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                            ADMIN FUNCTIONS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Claims accrued management fees owed to the vault\n    /// @dev    This function must be called by the NestShare. Fees are accrued in the base asset\n    ///         whenever the exchange rate is updated and can optionally be claimed in a different\n    ///         ERC20 token. Precision may be lost if the fee asset has fewer decimals than the base\n    /// @param  _feeAsset ERC20 The ERC20 token in which pending fees should be claimed\n    function claimFees(ERC20 _feeAsset) external {\n        if (msg.sender != SHARE) revert Errors.OnlyCallableByNestShare();\n\n        NestAccountantStorage storage $ = _getNestAccountantStorage();\n        AccountantState storage state = $.accountantState;\n\n        if (state.isPaused) revert Errors.Paused();\n\n        _crystallizeReserve(true);\n\n        if (state.feesOwedInBase == 0) revert Errors.ZeroFeesOwed();\n\n        uint256 _feesOwedInFeeAsset;\n        uint256 _remainder;\n        if (address(_feeAsset) == address(base)) {\n            _feesOwedInFeeAsset = state.feesOwedInBase;\n        } else {\n            RateProviderData memory _data = $.rateProviderData[_feeAsset];\n            uint8 _feeAssetDecimals = ERC20(_feeAsset).decimals();\n            (uint256 _feesOwedInBaseUsingFeeAssetDecimals, uint256 remainder_) =\n                _changeDecimals(state.feesOwedInBase, baseDecimals, _feeAssetDecimals);\n            _remainder = remainder_;\n            if (_data.isPeggedToBase) {\n                _feesOwedInFeeAsset = _feesOwedInBaseUsingFeeAssetDecimals;\n            } else {\n                uint256 _rate = _data.rateProvider.getRate();\n                _feesOwedInFeeAsset = _feesOwedInBaseUsingFeeAssetDecimals.mulDivDown(10 ** _feeAssetDecimals, _rate);\n            }\n        }\n\n        state.feesOwedInBase = _remainder.toUint128();\n        SafeERC20.safeTransferFrom(IERC20(address(_feeAsset)), SHARE, state.payoutAddress, _feesOwedInFeeAsset);\n\n        emit FeesClaimed(address(_feeAsset), _feesOwedInFeeAsset);\n    }\n\n    /// @notice Waives accrued fees, forfeiting them back to vault shareholders\n    /// @dev    Liability = `feesOwedInBase` plus `managementFeeCarry / (DENOMINATOR * ONE_YEAR)`.\n    ///         Draws from the unrealized carry first; the stored exchange rate is NOT retroactively adjusted.\n    ///         The holdback reserve is separate — use `waiveReserve`.\n    /// @param  _amount uint128 The amount of fees to waive, denominated in base\n    function waiveFees(uint128 _amount) external requiresAuth {\n        if (_amount == 0) revert Errors.ZeroAmount();\n\n        NestAccountantStorage storage $ = _getNestAccountantStorage();\n        AccountantState storage state = $.accountantState;\n\n        uint256 _scale = DENOMINATOR * ONE_YEAR;\n        uint256 _carry = $.managementFeeCarry;\n        uint256 _carryBase = _carry / _scale;\n        uint256 _owed = uint256(state.feesOwedInBase) + _carryBase;\n        if (_amount > _owed) revert Errors.InsufficientBalance();\n\n        if (_amount <= _carryBase) {\n            $.managementFeeCarry = _carry - uint256(_amount) * _scale;\n        } else {\n            $.managementFeeCarry = _carry % _scale;\n            state.feesOwedInBase = uint128(uint256(state.feesOwedInBase) - (_amount - _carryBase));\n        }\n\n        emit FeesWaived(_amount, _owed - _amount);\n    }\n\n    /// @notice Waives reserved performance-fee holdback, forfeiting it back to shareholders\n    /// @dev    Removes `_amount` from `totalReserve` newest-batch-first (reuses clawback removal)\n    ///         WITHOUT crediting the rate. Does not crystallize; the exchange rate is NOT retroactively adjusted.\n    /// @param  _amount uint128 The reserve amount to waive, denominated in base\n    function waiveReserve(uint128 _amount) external requiresAuth {\n        if (_amount == 0) revert Errors.ZeroAmount();\n\n        PerformanceFeeReserve storage rs = _getNestAccountantStorage().performanceFeeState.reserve;\n        uint128 _reserve = rs.totalReserve;\n\n        if (_amount > _reserve) revert Errors.InsufficientBalance();\n        if (_amount > 0) _clawbackReserve(_amount);\n\n        emit ReserveWaived(_amount, _reserve - _amount);\n    }\n\n    /// @notice Pause this contract, which causes safe rate calls and fee claims to revert\n    /// @dev    Callable by MULTISIG_ROLE\n    function pause() external requiresAuth {\n        _getNestAccountantStorage().accountantState.isPaused = true;\n        emit Paused();\n    }\n\n    /// @notice Unpause this contract, which allows safe rate calls and fee claims to resume\n    /// @dev    Callable by MULTISIG_ROLE\n    function unpause() external requiresAuth {\n        _getNestAccountantStorage().accountantState.isPaused = false;\n        emit Unpaused();\n    }\n\n    /// @notice Update the minimum time delay between `updateExchangeRate` calls\n    /// @dev    There are no input requirements, as it is possible the admin would want\n    ///         the exchange rate updated as frequently as needed\n    ///         Callable by OWNER_ROLE\n    /// @param  _minimumUpdateDelayInSeconds uint32 The new minimum delay (in seconds) required between successive exchange rate updates\n    function updateDelay(uint32 _minimumUpdateDelayInSeconds) external requiresAuth {\n        uint32 _oldDelay = _getNestAccountantStorage().accountantState.minimumUpdateDelayInSeconds;\n        _setMinimumUpdateDelayInSeconds(_minimumUpdateDelayInSeconds);\n        emit DelayInSecondsUpdated(_oldDelay, _minimumUpdateDelayInSeconds);\n    }\n\n    /// @notice Update the allowed upper bound change of exchange rate between `updateExchangeRateCalls`.\n    /// @dev    Callable by OWNER_ROLE\n    /// @param  _allowedExchangeRateChangeUpper uint32 The new upper bound for allowed exchange rate changes expressed in basis points where 1e6 = 100%\n    function updateUpper(uint32 _allowedExchangeRateChangeUpper) external requiresAuth {\n        uint32 _oldBound = _getNestAccountantStorage().accountantState.allowedExchangeRateChangeUpper;\n        _setAllowedExchangeRateChangeUpper(_allowedExchangeRateChangeUpper);\n        emit UpperBoundUpdated(_oldBound, _allowedExchangeRateChangeUpper);\n    }\n\n    /// @notice Update the allowed lower bound change of exchange rate between `updateExchangeRateCalls`.\n    /// @dev    Callable by OWNER_ROLE\n    /// @param  _allowedExchangeRateChangeLower uint32 The new lower bound for allowed exchange rate changes, expressed in basis points where 1e6 = 100%\n    function updateLower(uint32 _allowedExchangeRateChangeLower) external requiresAuth {\n        uint32 _oldBound = _getNestAccountantStorage().accountantState.allowedExchangeRateChangeLower;\n        _setAllowedExchangeRateChangeLower(_allowedExchangeRateChangeLower);\n        emit LowerBoundUpdated(_oldBound, _allowedExchangeRateChangeLower);\n    }\n\n    /// @notice Update the management fee to a new value\n    /// @dev    Does not accrue management fees. Any fees between `lastUpdateTimestamp` and the current timestamp\n    ///         are forfeited when the timestamp is advanced. Reverts if the checkpoint is older than\n    ///         `UPDATE_DELAY_CAP`. Operators should call `updateExchangeRate` immediately before changing the\n    ///         management fee to minimize forfeited fees.\n    /// @param  _managementFee uint32 The new management fee, expressed in basis points where 1e6 = 100%\n    function updateManagementFee(uint32 _managementFee) external virtual requiresAuth {\n        AccountantState storage state = _getNestAccountantStorage().accountantState;\n        uint32 _oldFee = state.managementFee;\n        if (_managementFee == _oldFee) revert Errors.SameValue();\n        if (block.timestamp > uint256(state.lastUpdateTimestamp) + UPDATE_DELAY_CAP) {\n            revert Errors.UpdateDelayTooLarge();\n        }\n        state.lastUpdateTimestamp = uint64(block.timestamp);\n        _setManagementFee(_managementFee);\n        emit ManagementFeeUpdated(_oldFee, _managementFee);\n    }\n\n    /// @notice Update the performance fee to a new value\n    /// @dev    Seeds the high-water mark from the current exchange rate when enabling performance fees.\n    ///         Callable by authorized accounts.\n    ///\n    ///         IMPORTANT: Call `updateExchangeRate` before changing the performance fee. The new fee\n    ///         applies to all gains since the last rate checkpoint, so stale checkpoints cause the\n    ///         new fee to be charged on gains that accrued under the old fee.\n    /// @param  _performanceFee uint32 The new performance fee, expressed where 1e6 = 100%\n    function updatePerformanceFee(uint32 _performanceFee) external requiresAuth {\n        NestAccountantStorage storage $ = _getNestAccountantStorage();\n        PerformanceFeeConfig storage feeConfig = $.performanceFeeState.config;\n        PerformanceFeeCheckpoint storage checkpoint = $.performanceFeeState.checkpoint;\n        AccountantState storage state = $.accountantState;\n        uint32 _oldFee = feeConfig.performanceFee;\n        _setPerformanceFee(_performanceFee);\n\n        if (_oldFee == 0 && _performanceFee > 0) {\n            if (state.lastGrossRate == 0) revert Errors.InvalidRate();\n            // Enabling perf fees (0 -> >0) re-anchors the baseline. Ratchet the HWM up only:\n            // never down on a depressed lastGrossRate, and up to capture gains accrued while fees were disabled.\n            if (state.lastGrossRate > checkpoint.highWaterMark) {\n                checkpoint.highWaterMark = state.lastGrossRate;\n            }\n            // Preserve the clawback reference while reserve is outstanding.\n            if ($.performanceFeeState.reserve.totalReserve == 0) {\n                checkpoint.clawbackReferenceRate = state.lastGrossRate;\n            }\n            // Reset the hurdle clock so it accrues only from re-enable, not over the disabled window.\n            checkpoint.hwmLastUpdateTimestamp = uint64(block.timestamp);\n        }\n\n        emit PerformanceFeeUpdated(_oldFee, _performanceFee);\n    }\n\n    /// @notice Reset the high-water mark\n    /// @dev    `_newHighWaterMark` must be non-zero. Callable by authorized accounts.\n    /// @param  _newHighWaterMark uint96 The new high-water mark in base terms\n    function resetHighWaterMark(uint96 _newHighWaterMark) external requiresAuth {\n        if (_newHighWaterMark == 0) revert Errors.InvalidRate();\n        PerformanceFeeCheckpoint storage checkpoint = _getNestAccountantStorage().performanceFeeState.checkpoint;\n        uint96 _oldHWM = checkpoint.highWaterMark;\n        checkpoint.highWaterMark = _newHighWaterMark;\n        checkpoint.hwmLastUpdateTimestamp = uint64(block.timestamp);\n        checkpoint.clawbackReferenceRate = _newHighWaterMark;\n        emit HighWaterMarkUpdated(_oldHWM, _newHighWaterMark);\n    }\n\n    /// @notice Update the hurdle rate used for performance-fee accrual\n    /// @dev    Crystallizes hurdle accrued under the old rate into the HWM before updating\n    ///         Callable by authorized accounts.\n    /// @param  _hurdleRate uint32 The new annualized hurdle rate, expressed where 1e6 = 100%\n    function updateHurdleRate(uint32 _hurdleRate) external requiresAuth {\n        NestAccountantStorage storage $ = _getNestAccountantStorage();\n        PerformanceFeeCheckpoint storage checkpoint = $.performanceFeeState.checkpoint;\n        uint32 _oldRate = $.performanceFeeState.config.hurdleRate;\n        if (_oldRate == _hurdleRate) revert Errors.SameValue();\n        uint64 _currentTime = uint64(block.timestamp);\n\n        // Accrue elapsed hurdle rate into the HWM\n        if (_oldRate > 0) {\n            uint256 _timeDelta = _currentTime - checkpoint.hwmLastUpdateTimestamp;\n            if (_timeDelta > 0) {\n                uint256 _hwm = uint256(checkpoint.highWaterMark);\n                checkpoint.highWaterMark = (_hwm + _annualize(_oldRate * _hwm, _timeDelta)).toUint96();\n            }\n        }\n\n        // new rate only accrues prospectively from the reset timestamp.\n        checkpoint.hwmLastUpdateTimestamp = _currentTime;\n\n        _setHurdleRate(_hurdleRate);\n        emit HurdleRateUpdated(_oldRate, _hurdleRate);\n    }\n\n    /// @notice Update the fraction of performance fees held back in reserve\n    /// @dev    Callable by authorized accounts.\n    /// @param  _holdbackRate uint32 The new holdback rate, expressed where 1e6 = 100%\n    function updateHoldbackRate(uint32 _holdbackRate) external requiresAuth {\n        uint32 _oldRate = _getNestAccountantStorage().performanceFeeState.config.holdbackRate;\n        _setHoldbackRate(_holdbackRate);\n        emit HoldbackRateUpdated(_oldRate, _holdbackRate);\n    }\n\n    /// @notice Update the reserve crystallization window\n    /// @dev    Callable by authorized accounts.\n    /// @param  _crystallizationWindow uint32 The new reserve crystallization window in seconds\n    function updateCrystallizationWindow(uint32 _crystallizationWindow) external requiresAuth {\n        uint32 _oldWindow = _getNestAccountantStorage().performanceFeeState.config.crystallizationWindow;\n        _setCrystallizationWindow(_crystallizationWindow);\n        if (_crystallizationWindow == 0 && _oldWindow > 0) _crystallizeReserve(true);\n        emit CrystallizationWindowUpdated(_oldWindow, _crystallizationWindow);\n    }\n\n    /// @notice Update how many reserve epochs are grouped into each crystallization window\n    /// @dev    Callable by authorized accounts.\n    /// @param  _epochsPerWindow uint32 The new number of epochs per crystallization window\n    function updateEpochsPerWindow(uint32 _epochsPerWindow) external requiresAuth {\n        uint32 _oldEpochs = _getNestAccountantStorage().performanceFeeState.config.epochsPerWindow;\n        _setEpochsPerWindow(_epochsPerWindow);\n        emit EpochsPerWindowUpdated(_oldEpochs, _epochsPerWindow);\n    }\n\n    /// @notice Update the payout address fees are sent to\n    /// @dev    Callable by OWNER_ROLE\n    /// @param  _payoutAddress address The new address where accrued fees will be sent\n    function updatePayoutAddress(address _payoutAddress) external requiresAuth {\n        address _oldPayout = _getNestAccountantStorage().accountantState.payoutAddress;\n        _setPayoutAddress(_payoutAddress);\n        emit PayoutAddressUpdated(_oldPayout, _payoutAddress);\n    }\n\n    /// @notice Update the rate provider data for a specific `asset`\n    /// @dev    Rate providers must return rates in terms of `base` or\n    ///         an asset pegged to base and they must use the same decimals\n    ///         as `asset`. Callable by OWNER_ROLE\n    /// @param  asset          ERC20   The ERC20 token for which the rate provider data is being set\n    /// @param  isPeggedToBase bool    Boolean indicating if the asset is pegged to the base asset\n    /// @param  rateProvider   address The address of the rate provider contract for the asset\n    function setRateProviderData(ERC20 asset, bool isPeggedToBase, address rateProvider) external requiresAuth {\n        if (!isPeggedToBase && rateProvider == address(0)) revert Errors.ZeroAddress();\n        _getNestAccountantStorage().rateProviderData[asset] =\n            RateProviderData({isPeggedToBase: isPeggedToBase, rateProvider: IRateProvider(rateProvider)});\n        emit RateProviderUpdated(address(asset), isPeggedToBase, rateProvider);\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                            RATE FUNCTIONS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Get this NestShare's current rate in the base.\n    function getRate() public view returns (uint256 rate) {\n        rate = _getNestAccountantStorage().accountantState.exchangeRate;\n    }\n\n    /// @notice Get this NestShare's current rate in the base.\n    /// @dev    Revert if paused.\n    function getRateSafe() external view returns (uint256 rate) {\n        AccountantState storage state = _getNestAccountantStorage().accountantState;\n        if (state.isPaused) revert Errors.Paused();\n        rate = state.exchangeRate;\n    }\n\n    /// @notice Get this NestShare's current rate in the provided quote\n    /// @dev    `quote` must have its RateProviderData set, else this will revert\n    ///         This function will lose precision if the exchange rate\n    ///         decimals is greater than the quote's decimals\n    /// @param  _quote        ERC20  The ERC20 token in which to express the exchange rate\n    /// @return _rateInQuote uint256 The current exchange rate expressed in units of `_quote`\n    function getRateInQuote(ERC20 _quote) public view returns (uint256 _rateInQuote) {\n        NestAccountantStorage storage $ = _getNestAccountantStorage();\n        if (address(_quote) == address(base)) {\n            _rateInQuote = $.accountantState.exchangeRate;\n        } else {\n            RateProviderData memory _data = $.rateProviderData[_quote];\n            uint8 _quoteDecimals = ERC20(_quote).decimals();\n            (uint256 _exchangeRateInQuoteDecimals,) =\n                _changeDecimals($.accountantState.exchangeRate, baseDecimals, _quoteDecimals);\n            if (_data.isPeggedToBase) {\n                _rateInQuote = _exchangeRateInQuoteDecimals;\n            } else {\n                uint256 _quoteRate = _data.rateProvider.getRate();\n                uint256 _oneQuote = 10 ** _quoteDecimals;\n                _rateInQuote = _oneQuote.mulDivDown(_exchangeRateInQuoteDecimals, _quoteRate);\n            }\n        }\n    }\n\n    /// @notice Get this NestShare's current rate in the provided quote\n    /// @dev    `quote` must have its RateProviderData set, else this will revert\n    ///         Revert if paused\n    /// @param  _quote        ERC20   The ERC20 token in which to express the exchange rate\n    /// @return _rateInQuote  uint256 The current exchange rate expressed in units of `_quote`\n    function getRateInQuoteSafe(ERC20 _quote) public view returns (uint256 _rateInQuote) {\n        if (_getNestAccountantStorage().accountantState.isPaused) revert Errors.Paused();\n        _rateInQuote = getRateInQuote(_quote);\n    }\n\n    /// @notice Get the rate provider data configured for an asset\n    /// @dev    Returns the zero-valued struct (isPeggedToBase false, rateProvider address(0)) if unset\n    /// @param  asset The ERC20 token to look up\n    /// @return The `RateProviderData` for `asset`\n    function getRateProviderData(ERC20 asset) external view returns (RateProviderData memory) {\n        return _getNestAccountantStorage().rateProviderData[asset];\n    }\n\n    /// @notice Get the complete current state of the accountant\n    /// @dev    Returns the full AccountantState struct containing all configuration and tracking parameters\n    /// @return The current AccountantState including exchange rate, fees, bounds, timestamps, and pause status\n    function getAccountantState() public view virtual returns (AccountantState memory) {\n        return _getNestAccountantStorage().accountantState;\n    }\n\n    /// @notice Returns the share token associated with this accountant\n    /// @return The share token address\n    function share() external view returns (address) {\n        return SHARE;\n    }\n\n    /// @notice Get the current performance-fee configuration\n    /// @return The current `PerformanceFeeConfig`\n    function getPerformanceFeeConfig() public view returns (PerformanceFeeConfig memory) {\n        return _getNestAccountantStorage().performanceFeeState.config;\n    }\n\n    /// @notice Get the current fee checkpoint\n    /// @return The current `PerformanceFeeCheckpoint` including HWM, clawback reference, and HWM timestamp\n    function getPerformanceFeeCheckpoint() public view returns (PerformanceFeeCheckpoint memory) {\n        return _getNestAccountantStorage().performanceFeeState.checkpoint;\n    }\n\n    /// @notice Get aggregate reserve accounting state\n    /// @return totalReserve_ uint128 The total holdback reserve currently tracked\n    /// @return batchHead_    uint64  The index of the oldest active reserve batch\n    /// @return batchTail_    uint64  The index of the next reserve batch slot to write\n    function getPerformanceFeeReserve()\n        public\n        view\n        returns (uint128 totalReserve_, uint64 batchHead_, uint64 batchTail_)\n    {\n        PerformanceFeeReserve storage rs = _getNestAccountantStorage().performanceFeeState.reserve;\n        totalReserve_ = rs.totalReserve;\n        batchHead_ = rs.batchHead;\n        batchTail_ = rs.batchTail;\n    }\n\n    /// @notice Outstanding fee liabilities the posted rate is net of, by bucket\n    /// @return feesOwed_ uint256 Realized fees awaiting claim, in base\n    /// @return carry_    uint256 Unrealized management-fee carry in base (managementFeeCarry / (DENOMINATOR * ONE_YEAR))\n    /// @return reserve_  uint256 Performance-fee holdback reserve, in base\n    function feeLiabilities() external view returns (uint256 feesOwed_, uint256 carry_, uint256 reserve_) {\n        NestAccountantStorage storage $ = _getNestAccountantStorage();\n        feesOwed_ = $.accountantState.feesOwedInBase;\n        carry_ = $.managementFeeCarry / (DENOMINATOR * ONE_YEAR);\n        reserve_ = $.performanceFeeState.reserve.totalReserve;\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                        PENDING SHARES FUNCTIONS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Returns the global total pending shares across all vaults sharing this accountant\n    /// @dev    This value is used in `totalAssets()` calculations to properly report total assets\n    /// @return uint256 The total pending shares awaiting redemption\n    function totalPendingShares() external view returns (uint256) {\n        return _getNestAccountantStorage().totalPendingShares;\n    }\n\n    /// @notice Increases the global total pending shares\n    /// @dev    Called when a redeem request is made. Callable by authorized accounts.\n    /// @param  _amount uint256 The amount of shares to add to pending\n    function increaseTotalPendingShares(uint256 _amount) external requiresAuth {\n        NestAccountantStorage storage $ = _getNestAccountantStorage();\n        uint256 _oldPendingShares = $.totalPendingShares;\n        $.totalPendingShares = _oldPendingShares + _amount;\n        emit TotalPendingSharesUpdated(_oldPendingShares, $.totalPendingShares);\n    }\n\n    /// @notice Decreases the global total pending shares\n    /// @dev    Called when a redeem request is fulfilled or cancelled. Callable by authorized accounts.\n    /// @param  _amount uint256 The amount of shares to remove from pending\n    function decreaseTotalPendingShares(uint256 _amount) external requiresAuth {\n        NestAccountantStorage storage $ = _getNestAccountantStorage();\n        uint256 _oldPendingShares = $.totalPendingShares;\n        if (_amount > _oldPendingShares) revert Errors.InsufficientBalance();\n        $.totalPendingShares = _oldPendingShares - _amount;\n        emit TotalPendingSharesUpdated(_oldPendingShares, $.totalPendingShares);\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                            INTERNAL FUNCTIONS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @dev    Deducts annualized management fee from the posted rate and accrues the fee in base terms.\n    ///         Uses min(lastGrossRate, _newExchangeRate) as the discount basis to avoid retroactive\n    ///         overcharging when the rate rises during the interval.\n    /// @param  _newExchangeRate       uint256 Posted rate the fee is charged on and deducted from\n    /// @param  _totalShares           uint256 Current total share supply\n    /// @param  _oneShare              uint256 Share-scaling factor based on share decimals\n    /// @return _postManagementFeeRate uint256 The rate after management-fee deduction\n    function _accrueManagementFees(uint256 _newExchangeRate, uint256 _totalShares, uint256 _oneShare)\n        internal\n        returns (uint256 _postManagementFeeRate)\n    {\n        _postManagementFeeRate = _newExchangeRate;\n\n        if (_totalShares > 0) {\n            NestAccountantStorage storage $ = _getNestAccountantStorage();\n            AccountantState storage state = $.accountantState;\n\n            if (state.managementFee == 0) return _postManagementFeeRate;\n\n            uint256 _rateBasis = Math.min(uint256(state.lastGrossRate), _newExchangeRate);\n            uint256 _shareSupplyBasis = Math.min(uint256(state.totalSharesLastUpdate), _totalShares);\n\n            uint256 _timeDelta = block.timestamp - state.lastUpdateTimestamp;\n            // Share-scaled management fee accrual\n            uint256 _perShareFeeAccrual = _rateBasis * uint256(state.managementFee) * _timeDelta;\n            // Accrue in base terms, carrying the sub-unit remainder (denominator DENOMINATOR * ONE_YEAR)\n            uint256 _feeAccrued = $.managementFeeCarry + Math.mulDiv(_perShareFeeAccrual, _shareSupplyBasis, _oneShare);\n            // Per-share rate deduction equivalent to the whole base-fee units accrued so far.\n            uint256 _rateHaircut = (_feeAccrued / (DENOMINATOR * ONE_YEAR)).mulDivDown(_oneShare, _totalShares);\n            // Management fee amount re-derived from the haircut so the booked amount matches the rate drop exactly.\n            uint256 _mgmtFeeBase = _rateHaircut.mulDivDown(_totalShares, _oneShare);\n\n            // Realize only when the fee is representable in base units, so rate, reserve, and fee move together.\n            if (_mgmtFeeBase > 0) {\n                _postManagementFeeRate = Math.saturatingSub(_newExchangeRate, _rateHaircut);\n                state.feesOwedInBase = (uint256(state.feesOwedInBase) + _mgmtFeeBase).toUint128();\n                emit FeeAccrued(uint8(FeeType.Management), _mgmtFeeBase);\n                // Carry forward the remainder to avoid losing precision on small fees.\n                $.managementFeeCarry = _feeAccrued - _mgmtFeeBase * (DENOMINATOR * ONE_YEAR);\n            } else {\n                $.managementFeeCarry = _feeAccrued;\n            }\n        }\n    }\n\n    /// @dev    Computes performance fee on gains above the hurdle-adjusted HWM, updates the HWM,\n    ///         handles holdback reserve splits, and clawback on drawdowns. HWM is tracked in\n    ///         posted-rate terms; clawback credits reserve on top (posted rate is net of it).\n    /// @param  _newExchangeRate       uint256 Posted rate: strategy NAV per share net of prior fee liabilities\n    /// @param  _postManagementFeeRate uint256 Exchange rate after management-fee accrual\n    /// @param  _totalShares           uint256 Current total share supply\n    /// @param  _oneShare              uint256 Share-scaling factor based on share decimals\n    /// @param  _currentTime           uint64  The timestamp for the current update\n    /// @return _postFeeRate       uint256 The exchange rate after performance-fee logic\n    function _accruePerformanceFees(\n        uint256 _newExchangeRate,\n        uint256 _postManagementFeeRate,\n        uint256 _totalShares,\n        uint256 _oneShare,\n        uint64 _currentTime\n    ) internal returns (uint256 _postFeeRate) {\n        NestAccountantStorage storage $ = _getNestAccountantStorage();\n        PerformanceFeeConfig storage feeConfig = $.performanceFeeState.config;\n        AccountantState storage state = $.accountantState;\n        PerformanceFeeCheckpoint storage checkpoint = $.performanceFeeState.checkpoint;\n        uint256 _hwm = uint256(checkpoint.highWaterMark);\n        uint256 _totalReserve = uint256($.performanceFeeState.reserve.totalReserve);\n        _postFeeRate = _postManagementFeeRate;\n\n        // Apply hurdle rate to HWM\n        uint256 _postHurdleHWM =\n            _hwm + _annualize(uint256(feeConfig.hurdleRate) * _hwm, _currentTime - checkpoint.hwmLastUpdateTimestamp);\n\n        // Zero supply: crystallize any reserve to the manager.\n        // Prevents stale clawback state or pre-supply gains from affecting the next cohort.\n        if (_totalShares == 0) {\n            _crystallizeReserve(false);\n            checkpoint.highWaterMark = _newExchangeRate.toUint96();\n            checkpoint.hwmLastUpdateTimestamp = _currentTime;\n            checkpoint.clawbackReferenceRate = _postFeeRate.toUint96();\n            return _postFeeRate;\n        }\n\n        if (feeConfig.performanceFee == 0 || _newExchangeRate <= _postHurdleHWM) {\n            uint256 _clawbackRef = uint256(checkpoint.clawbackReferenceRate);\n\n            // Recovery: ratchet reference back up\n            if (_newExchangeRate >= _hwm && _clawbackRef < _postFeeRate) {\n                checkpoint.clawbackReferenceRate = _postFeeRate.toUint96();\n                return _postFeeRate;\n            }\n\n            // Clawback shortfall from reserve (supply is non-zero here; zero supply returns above)\n            if (_newExchangeRate < _clawbackRef && _totalReserve > 0) {\n                uint256 _shortfallBase = (_clawbackRef - _newExchangeRate).mulDivDown(_totalShares, _oneShare);\n                uint256 _clawback = Math.min(_shortfallBase, _totalReserve);\n                uint256 _clawbackRate = _clawback.mulDivDown(_oneShare, _totalShares);\n                if (_clawbackRate > 0) {\n                    _clawbackReserve(_clawbackRate.mulDivUp(_totalShares, _oneShare));\n                    _postFeeRate += _clawbackRate;\n                    checkpoint.clawbackReferenceRate = _newExchangeRate.toUint96();\n                }\n            }\n            return _postFeeRate;\n        }\n\n        // Performance fee on gains above hurdle-adjusted HWM\n        uint256 _gain = _newExchangeRate - _postHurdleHWM;\n        uint256 _gainBase = _gain.mulDivDown(_totalShares, _oneShare);\n        uint256 _perfFeeBase = _gainBase.mulDivDown(feeConfig.performanceFee, DENOMINATOR);\n\n        // A dust gain whose fee rounds away must not update the HWM/clawback baseline (stays captured for later).\n        if (_perfFeeBase == 0) return _postFeeRate;\n\n        // Derive per-share fee from aggregate, then re-derive the fee from the floored haircut so the\n        // booked amount matches what holders lose; the sub-rate-unit residue stays with holders.\n        uint256 _perfFeePerShare = _perfFeeBase.mulDivDown(_oneShare, _totalShares);\n        if (_perfFeePerShare == 0) return _postFeeRate;\n        _perfFeeBase = _perfFeePerShare.mulDivDown(_totalShares, _oneShare);\n        _postFeeRate = Math.saturatingSub(_postManagementFeeRate, _perfFeePerShare);\n\n        // A fee is actually charged this update: ratchet the HWM and seed the clawback reference.\n        checkpoint.highWaterMark = _newExchangeRate.toUint96();\n        checkpoint.hwmLastUpdateTimestamp = _currentTime;\n        checkpoint.clawbackReferenceRate = _postFeeRate.toUint96();\n\n        // Accrue performance fee with optional holdback\n        if (feeConfig.holdbackRate > 0 && feeConfig.crystallizationWindow > 0) {\n            uint256 _holdbackBase = _perfFeeBase.mulDivDown(feeConfig.holdbackRate, DENOMINATOR);\n            uint256 _credited = _perfFeeBase - _holdbackBase;\n            if (_credited > 0) {\n                state.feesOwedInBase = (uint256(state.feesOwedInBase) + _credited).toUint128();\n                emit FeeAccrued(uint8(FeeType.Performance), _credited);\n            }\n            _holdbackReserve(_holdbackBase, _currentTime);\n        } else if (_perfFeeBase > 0) {\n            state.feesOwedInBase = (uint256(state.feesOwedInBase) + _perfFeeBase).toUint128();\n            emit FeeAccrued(uint8(FeeType.Performance), _perfFeeBase);\n        }\n    }\n\n    /// @dev    Pro-rates `_value` over the elapsed time since `_fromTimestamp`.\n    /// @param  _value       uint256 The annualised basis (e.g. rateBasis * fee)\n    /// @param  _timeElapsed uint256 Seconds elapsed over which to pro-rate the value\n    /// @return uint256 The pro-rated portion for the elapsed period\n    function _annualize(uint256 _value, uint256 _timeElapsed) internal pure returns (uint256) {\n        return _value.mulDivDown(_timeElapsed, DENOMINATOR * ONE_YEAR);\n    }\n\n    /// @dev Crystallizes reserve batches into `feesOwedInBase` in FIFO order.\n    ///      If `_maturedOnly`, stops at the first unmatured batch (window 0 = immediate).\n    ///      Otherwise crystallizes all batches, used when supply is zero since no holders remain.\n    /// @param _maturedOnly Whether to crystallize only matured batches.\n    function _crystallizeReserve(bool _maturedOnly) internal {\n        NestAccountantStorage storage $ = _getNestAccountantStorage();\n        PerformanceFeeReserve storage rs = $.performanceFeeState.reserve;\n\n        if (rs.batchHead == rs.batchTail) return;\n\n        uint64 _head = rs.batchHead;\n        uint64 _tail = rs.batchTail;\n        uint64 _startHead = _head;\n        uint32 _window = $.performanceFeeState.config.crystallizationWindow;\n        uint256 _crystallized = 0;\n\n        while (_head < _tail) {\n            ReserveBatch storage _batch = rs.batches[_head];\n            if (_maturedOnly && _window > 0 && uint256(_batch.timestamp) + uint256(_window) > block.timestamp) break;\n            _crystallized += _batch.amount;\n            delete rs.batches[_head];\n            _head++;\n        }\n\n        if (_head != _startHead) rs.batchHead = _head;\n\n        if (_crystallized > 0) {\n            rs.totalReserve -= _crystallized.toUint128();\n            $.accountantState.feesOwedInBase = (uint256($.accountantState.feesOwedInBase) + _crystallized).toUint128();\n            emit FeeAccrued(uint8(FeeType.Performance), _crystallized);\n        }\n    }\n\n    /// @dev    Adds holdback amount to the reserve, grouping into epoch-based batches.\n    /// @param  _amount      uint256 The holdback amount to reserve in base terms\n    /// @param  _currentTime uint64  The timestamp assigned to the reserve batch\n    function _holdbackReserve(uint256 _amount, uint64 _currentTime) internal {\n        if (_amount == 0) return;\n\n        NestAccountantStorage storage $ = _getNestAccountantStorage();\n        PerformanceFeeReserve storage rs = $.performanceFeeState.reserve;\n        uint256 _epochDuration = _getEpochDuration();\n        uint64 _tail = rs.batchTail;\n\n        // Try to append to last batch if same epoch\n        if (_tail > rs.batchHead) {\n            ReserveBatch storage _lastBatch = rs.batches[_tail - 1];\n            if (_epochDuration > 0 && _currentTime / _epochDuration == _lastBatch.timestamp / _epochDuration) {\n                _lastBatch.amount += _amount.toUint128();\n                _lastBatch.timestamp = _currentTime;\n                rs.totalReserve += _amount.toUint128();\n                return;\n            }\n        }\n\n        // Create new batch\n        rs.batches[_tail].amount = _amount.toUint128();\n        rs.batches[_tail].timestamp = _currentTime;\n        rs.batchTail = _tail + 1;\n        rs.totalReserve += _amount.toUint128();\n    }\n\n    /// @dev    Claws back reserve in LIFO order (newest batches first).\n    /// @param  _amount uint256 The reserve amount to return to investors\n    function _clawbackReserve(uint256 _amount) internal {\n        PerformanceFeeReserve storage rs = _getNestAccountantStorage().performanceFeeState.reserve;\n        uint64 _tail = rs.batchTail;\n        uint64 _head = rs.batchHead;\n        uint256 _remaining = _amount;\n\n        while (_remaining > 0 && _tail > _head) {\n            _tail--;\n            ReserveBatch storage _batch = rs.batches[_tail];\n            if (_batch.amount <= _remaining) {\n                _remaining -= _batch.amount;\n                delete rs.batches[_tail];\n            } else {\n                _batch.amount -= uint128(_remaining);\n                _remaining = 0;\n                _tail++; // keep this batch\n            }\n        }\n\n        rs.batchTail = _tail;\n        rs.totalReserve -= _amount.toUint128();\n    }\n\n    /// @dev    Returns the epoch duration for reserve batching.\n    /// @return uint256 The duration of each reserve epoch in seconds\n    function _getEpochDuration() internal view returns (uint256) {\n        PerformanceFeeConfig storage feeConfig = _getNestAccountantStorage().performanceFeeState.config;\n        if (feeConfig.crystallizationWindow == 0) return 0;\n        // epochsPerWindow == 0 collapses to one epoch so batches merge across the whole window.\n        uint256 _epochs = feeConfig.epochsPerWindow == 0 ? 1 : uint256(feeConfig.epochsPerWindow);\n        uint256 _duration = uint256(feeConfig.crystallizationWindow) / _epochs;\n        return _duration > 1 days ? _duration : 1 days;\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                            INTERNAL SETTERS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @dev    Internal setter that validates and stores minimum update delay.\n    /// @param  _minimumUpdateDelayInSeconds uint32 The new minimum update delay in seconds\n    function _setMinimumUpdateDelayInSeconds(uint32 _minimumUpdateDelayInSeconds) internal {\n        if (_minimumUpdateDelayInSeconds > UPDATE_DELAY_CAP) revert Errors.UpdateDelayTooLarge();\n        _getNestAccountantStorage().accountantState.minimumUpdateDelayInSeconds = _minimumUpdateDelayInSeconds;\n    }\n\n    /// @dev    Internal setter that validates and stores allowed upper exchange-rate change.\n    /// @param  _allowedExchangeRateChangeUpper uint32 The new upper bound where 1e6 = 100%\n    function _setAllowedExchangeRateChangeUpper(uint32 _allowedExchangeRateChangeUpper) internal {\n        if (_allowedExchangeRateChangeUpper < DENOMINATOR) revert Errors.UpperBoundTooSmall();\n        _getNestAccountantStorage().accountantState.allowedExchangeRateChangeUpper = _allowedExchangeRateChangeUpper;\n    }\n\n    /// @dev    Internal setter that validates and stores allowed lower exchange-rate change.\n    /// @param  _allowedExchangeRateChangeLower uint32 The new lower bound where 1e6 = 100%\n    function _setAllowedExchangeRateChangeLower(uint32 _allowedExchangeRateChangeLower) internal {\n        if (_allowedExchangeRateChangeLower > DENOMINATOR) revert Errors.LowerBoundTooLarge();\n        _getNestAccountantStorage().accountantState.allowedExchangeRateChangeLower = _allowedExchangeRateChangeLower;\n    }\n\n    /// @dev    Internal setter that validates and stores management fee.\n    /// @param  _managementFee uint32 The new management fee where 1e6 = 100%\n    function _setManagementFee(uint32 _managementFee) internal {\n        if (_managementFee > MANAGEMENT_FEE_CAP) revert Errors.ManagementFeeTooLarge();\n        _getNestAccountantStorage().accountantState.managementFee = _managementFee;\n    }\n\n    /// @dev    Internal setter that validates and stores performance fee.\n    /// @param  _performanceFee uint32 The new performance fee where 1e6 = 100%\n    function _setPerformanceFee(uint32 _performanceFee) internal {\n        if (_performanceFee > PERFORMANCE_FEE_CAP) revert Errors.PerformanceFeeTooLarge();\n        _getNestAccountantStorage().performanceFeeState.config.performanceFee = _performanceFee;\n    }\n\n    /// @dev    Internal setter that validates and stores hurdle rate.\n    /// @param  _hurdleRate uint32 The new hurdle rate where 1e6 = 100%\n    function _setHurdleRate(uint32 _hurdleRate) internal {\n        if (_hurdleRate > HURDLE_RATE_CAP) revert Errors.HurdleRateTooLarge();\n        _getNestAccountantStorage().performanceFeeState.config.hurdleRate = _hurdleRate;\n    }\n\n    /// @dev    Internal setter that validates and stores holdback rate.\n    /// @param  _holdbackRate uint32 The new holdback rate where 1e6 = 100%\n    function _setHoldbackRate(uint32 _holdbackRate) internal {\n        if (_holdbackRate > DENOMINATOR) revert Errors.HoldbackRateTooLarge();\n        _getNestAccountantStorage().performanceFeeState.config.holdbackRate = _holdbackRate;\n    }\n\n    /// @dev    Internal setter that validates and stores crystallization window.\n    /// @param  _crystallizationWindow uint32 The new crystallization window in seconds\n    function _setCrystallizationWindow(uint32 _crystallizationWindow) internal {\n        if (_crystallizationWindow > CRYSTALLIZATION_WINDOW_CAP) revert Errors.CrystallizationWindowTooLarge();\n        _getNestAccountantStorage().performanceFeeState.config.crystallizationWindow = _crystallizationWindow;\n    }\n\n    /// @dev    Internal setter that validates and stores epochs per window.\n    /// @param  _epochsPerWindow uint32 The new number of epochs per crystallization window\n    function _setEpochsPerWindow(uint32 _epochsPerWindow) internal {\n        if (_epochsPerWindow > EPOCHS_PER_WINDOW_CAP) revert Errors.EpochsPerWindowTooLarge();\n        _getNestAccountantStorage().performanceFeeState.config.epochsPerWindow = _epochsPerWindow;\n    }\n\n    /// @dev    Internal setter that stores payout address.\n    /// @param  _payoutAddress address The new payout address\n    function _setPayoutAddress(address _payoutAddress) internal {\n        if (_payoutAddress == address(0)) revert Errors.ZeroAddress();\n        _getNestAccountantStorage().accountantState.payoutAddress = _payoutAddress;\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                            INTERNAL HELPERS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Convert an amount from one decimal precision to another\n    /// @dev    If `_fromDecimals` is equal to `_toDecimals`, the original amount is returned\n    ///         If `_fromDecimals` is less than `_toDecimals`, the amount is scaled up\n    ///         If `_fromDecimals` is greater than `_toDecimals`, the amount is scaled down (integer division)\n    /// @param  _amount          uint256 The numeric value to convert\n    /// @param  _fromDecimals    uint8   The current number of decimals of `_amount`\n    /// @param  _toDecimals      uint8   The target number of decimals to convert `_amount` to\n    /// @return _amountAdjusted  uint256 The amount adjusted to the target decimal precision\n    /// @return _remainder       uint256 The remainder to be carry forwarded\n    function _changeDecimals(uint256 _amount, uint8 _fromDecimals, uint8 _toDecimals)\n        internal\n        pure\n        returns (uint256 _amountAdjusted, uint256 _remainder)\n    {\n        if (_fromDecimals == _toDecimals) {\n            _amountAdjusted = _amount;\n        } else if (_fromDecimals < _toDecimals) {\n            _amountAdjusted = _amount * 10 ** (_toDecimals - _fromDecimals);\n        } else {\n            _amountAdjusted = _amount / 10 ** (_fromDecimals - _toDecimals);\n            _remainder = _amount % 10 ** (_fromDecimals - _toDecimals);\n        }\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/interfaces/IERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)\n\npragma solidity >=0.4.16;\n\nimport {IERC20} from \"../token/ERC20/IERC20.sol\";\n"},{"file_path":"contracts/NestVaultCore.sol","source_code":"// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.30;\n\n// contracts\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {ERC4626Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC4626Upgradeable.sol\";\nimport {ERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol\";\nimport {ERC20} from \"@solmate/tokens/ERC20.sol\";\nimport {AuthUpgradeable} from \"contracts/auth/AuthUpgradeable.sol\";\nimport {Authority} from \"@solmate/auth/Auth.sol\";\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {\n    ReentrancyGuardTransientUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardTransientUpgradeable.sol\";\nimport {EIP712Upgradeable} from \"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\";\nimport {NestHubAccountant} from \"contracts/accountant/NestHubAccountant.sol\";\nimport {NestShareOFT} from \"contracts/NestShareOFT.sol\";\nimport {OperatorRegistry} from \"contracts/operators/OperatorRegistry.sol\";\n\n// interfaces\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC20Metadata} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {IERC7540Redeem, IERC7540Operator} from \"contracts/interfaces/IERC7540.sol\";\nimport {IERC7575} from \"forge-std/interfaces/IERC7575.sol\";\n\n// libraries\nimport {FixedPointMathLib} from \"@solmate/utils/FixedPointMathLib.sol\";\nimport {Errors} from \"contracts/types/Errors.sol\";\nimport {Math} from \"@openzeppelin/contracts/utils/math/Math.sol\";\nimport {NestVaultOperatorLogic} from \"contracts/libraries/NestVaultOperatorLogic.sol\";\nimport {NestVaultRedeemLogic} from \"contracts/libraries/NestVaultRedeemLogic.sol\";\nimport {NestVaultDepositLogic} from \"contracts/libraries/NestVaultDepositLogic.sol\";\nimport {NestVaultAdminLogic} from \"contracts/libraries/NestVaultAdminLogic.sol\";\nimport {NestVaultAccountingLogic} from \"contracts/libraries/NestVaultAccountingLogic.sol\";\nimport {NestVaultCoreTypes} from \"contracts/types/NestVaultCoreTypes.sol\";\nimport {NestVaultCoreValidationLogic} from \"contracts/libraries/NestVaultCoreValidationLogic.sol\";\nimport {NestVaultTransferLogic} from \"contracts/libraries/NestVaultTransferLogic.sol\";\n\n/// @title  NestVaultCore\n/// @notice NestVaultCore is an IERC7575 & IERC7540Redeem-compatible vault.\n///         It allows users to deposit assets and mint shares, redeem shares for assets, and interact with operators\n///         via the ERC7540 standard.\n/// @dev    This contract delegates deposit and redeem operations to external logic libraries:\n///         - NestVaultDepositLogic: handles deposits via NestShareOFT.enter()\n///         - NestVaultRedeemLogic: handles redemptions via NestShareOFT.exit()\n///         Asset movement is managed entirely by these libraries calling the share token directly.\n///         Inheriting contracts should NOT attempt to override asset movement behavior - customization\n///         should be done by modifying the logic libraries or the NestShareOFT implementation.\n///         This contract is upgradeable using OpenZeppelin's Initializable pattern and provides\n///         ERC4626-compatible accounting with ERC7540 operator/redeem extensions.\n/// @author plumenetwork\nabstract contract NestVaultCore is\n    Initializable,\n    ERC4626Upgradeable,\n    AuthUpgradeable,\n    EIP712Upgradeable,\n    IERC7540Operator,\n    IERC7540Redeem,\n    ERC165,\n    ReentrancyGuardTransientUpgradeable\n{\n    using NestVaultOperatorLogic for NestVaultCoreTypes.NestVaultCoreStorage;\n    using NestVaultRedeemLogic for NestVaultCoreTypes.NestVaultCoreStorage;\n    using NestVaultDepositLogic for NestVaultCoreTypes.NestVaultCoreStorage;\n    using NestVaultAdminLogic for NestVaultCoreTypes.NestVaultCoreStorage;\n    using NestVaultCoreValidationLogic for NestVaultCoreTypes.NestVaultCoreStorage;\n    using NestVaultAccountingLogic for uint256;\n    using NestVaultTransferLogic for ERC20;\n\n    /// @dev This is used to track the redemption request ID, which is initialized to 0 for the contract.\n    uint256 internal constant REQUEST_ID = 0;\n\n    /// @dev This is an immutable variable that stores the address of the share token to honour ERC7575 specs\n    NestShareOFT internal immutable SHARE;\n\n    // keccak256(abi.encode(uint256(keccak256(\"plumenetwork.storage.NestVaultCore\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant NestVaultCoreStorageLocation =\n        0x8d327cc9157d67bbcdfb7458a8210f70aaa0f2cbd2dc6f3d23140e557560c200;\n\n    /// @notice Initializes the contract with the address of the SHARE token.\n    /// @dev The constructor initializes the SHARE address.\n    /// @param _share The address of the share token\n    constructor(address payable _share) {\n        if (_share == address(0)) revert Errors.ZeroAddress();\n\n        SHARE = NestShareOFT(_share);\n        _disableInitializers();\n    }\n\n    /// @dev Internal function to access the contract's NestHubAccountant slot\n    /// @return $ A reference to the NestVaultCoreTypes.NestVaultCoreStorage struct\n    function _getNestVaultCoreStorage() internal pure returns (NestVaultCoreTypes.NestVaultCoreStorage storage $) {\n        assembly {\n            $.slot := NestVaultCoreStorageLocation\n        }\n    }\n\n    /// @notice Initializes the vault with the necessary configurations.\n    /// @dev    Initializes key components such as the accountant, asset, owner, and operator registry.\n    /// @param  _accountant       address The address of the NestHubAccountant contract\n    /// @param  _asset            address The underlying asset that users deposit (e.g., ERC20 token)\n    /// @param  _owner            address The address of the owner of the vault\n    /// @param  _minRate          uint256 The minimum rate allowed for the vault\n    /// @param  _operatorRegistry address The operator registry (zero disables registry)\n    function __NestVaultCore_init(\n        address _accountant,\n        address _asset,\n        address _owner,\n        uint256 _minRate,\n        address _operatorRegistry,\n        string memory _version\n    ) internal onlyInitializing {\n        __NestVaultCore_init_unchained(_accountant, _asset, _owner, _minRate, _operatorRegistry);\n        __EIP712_init(SHARE.name(), _version);\n        __ERC4626_init(IERC20(_asset));\n        __Auth_init(_owner, Authority(address(0)));\n    }\n\n    /// @dev Internal function to initialize the contract's state\n    /// @param  _accountant       address The address of the NestHubAccountant contract\n    /// @param  _asset            address The underlying asset that users deposit (e.g., ERC20 token)\n    /// @param  _owner            address The address of the owner of the vault\n    /// @param  _minRate          uint256 The minimum rate allowed for the vault\n    /// @param  _operatorRegistry address The operator registry (zero disables registry)\n    function __NestVaultCore_init_unchained(\n        address _accountant,\n        address _asset,\n        address _owner,\n        uint256 _minRate,\n        address _operatorRegistry\n    ) internal onlyInitializing {\n        if (_accountant == address(0)) {\n            revert Errors.ZeroAddress();\n        }\n        if (_asset == address(0)) {\n            revert Errors.ZeroAddress();\n        }\n        if (_owner == address(0)) {\n            revert Errors.ZeroAddress();\n        }\n        NestVaultCoreTypes.NestVaultCoreStorage storage $ = _getNestVaultCoreStorage();\n\n        if (_minRate >= 10 ** IERC20Metadata(_asset).decimals()) {\n            revert Errors.InvalidRate();\n        }\n        $.accountant = NestHubAccountant(_accountant);\n        $.maxFees[NestVaultCoreTypes.Fees.InstantRedemption].rate = NestVaultCoreTypes.FEE_CAP;\n        $.maxFees[NestVaultCoreTypes.Fees.Deposit].rate = NestVaultCoreTypes.FEE_CAP;\n        $.maxFees[NestVaultCoreTypes.Fees.Redemption].rate = NestVaultCoreTypes.FEE_CAP;\n        $.minRate = _minRate;\n        $.executeSetOperatorRegistry(_operatorRegistry);\n    }\n\n    /// @notice Returns the `SHARE` address\n    /// @dev    ERC-7575 compliant view\n    /// @return address Address of the share\n    function share() external view virtual returns (address) {\n        return address(SHARE);\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                        ERC20 OVERRIDDEN LOGIC\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Returns the decimals of the token, sourced from the SHARE\n    /// @dev    The decimals are inherited from the share token\n    /// @return uint8 The number of decimals used by the token\n    function decimals() public view override returns (uint8) {\n        return SHARE.decimals();\n    }\n\n    /// @notice Returns the name of the token, sourced from the SHARE\n    /// @dev    The name is inherited from the share token\n    /// @return string The name of the token\n    function name() public view override(ERC20Upgradeable, IERC20Metadata) returns (string memory) {\n        return SHARE.name();\n    }\n\n    /// @notice Returns the symbol of the token, sourced from the SHARE.\n    /// @dev    The symbol is inherited from the share token.\n    /// @return string The symbol of the token.\n    function symbol() public view override(ERC20Upgradeable, IERC20Metadata) returns (string memory) {\n        return SHARE.symbol();\n    }\n\n    /// @notice Returns the total supply of the token, sourced from the SHARE.\n    /// @dev    The total supply is inherited from the share token.\n    /// @return uint256 The total supply of the token.\n    function totalSupply() public view override(ERC20Upgradeable, IERC20) returns (uint256) {\n        return SHARE.totalSupply();\n    }\n\n    /// @notice Returns the balance of a specific account, sourced from the SHARE.\n    /// @dev    The balance is inherited from the share token.\n    /// @param  _account address The address of the account to query.\n    /// @return uint256 The balance of the specified account.\n    function balanceOf(address _account) public view override(ERC20Upgradeable, IERC20) returns (uint256) {\n        return SHARE.balanceOf(_account);\n    }\n\n    /// @notice Returns the allowance of a spender for a specific owner, sourced from the SHARE.\n    /// @dev    The allowance is inherited from the share token.\n    /// @param  _owner   address The address of the token owner.\n    /// @param  _spender address The address of the spender.\n    /// @return uint256 The remaining allowance for the spender on behalf of the owner.\n    function allowance(address _owner, address _spender)\n        public\n        view\n        override(ERC20Upgradeable, IERC20)\n        returns (uint256)\n    {\n        return SHARE.allowance(_owner, _spender);\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                        ERC7540 OVERRIDDEN LOGIC\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Sets an operator for a given controller\n    /// @dev    Allows controllers to set approved operators. Operators can perform actions on behalf of the controller\n    /// @param  _operator  address The address of the operator\n    /// @param  _approved  bool    Whether the operator is approved or not\n    /// @return _success   bool    A boolean indicating the success of the operation\n    function setOperator(address _operator, bool _approved) public override returns (bool _success) {\n        return _getNestVaultCoreStorage().executeSetOperator(_operator, _approved, msg.sender);\n    }\n\n    /// @notice Checks whether an operator is authorized for a given controller.\n    /// @dev    The mapping tracks which operators have permission to act on behalf of each controller.\n    /// @param  _controller  address The address of the controller whose operator permissions are being queried.\n    /// @param  _operator    address The address of the operator being checked.\n    /// @return              bool    True if the operator is authorized for the controller, otherwise false.\n    function isOperator(address _controller, address _operator) external view override returns (bool) {\n        return _getNestVaultCoreStorage().isOperator(_controller, _operator);\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                        EIP-7441 LOGIC\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Authorizes an operator for a controller, using a signature to validate\n    /// @dev    The authorization is verified via EIP712 signatures.\n    /// @param  _controller address The controller's address\n    /// @param  _operator   address The operator's address\n    /// @param  _approved   bool    Whether the operator is approved or not\n    /// @param  _nonce      bytes32 A unique identifier for the authorization\n    /// @param  _deadline   uint256 The deadline for the authorization\n    /// @param  _signature  bytes   The signature to validate the authorization\n    /// @return _success   bool    A boolean indicating the success of the operation\n    function authorizeOperator(\n        address _controller,\n        address _operator,\n        bool _approved,\n        bytes32 _nonce,\n        uint256 _deadline,\n        bytes memory _signature\n    ) public returns (bool _success) {\n        return _getNestVaultCoreStorage()\n            .executeAuthorizeOperator(\n                _controller, _operator, _approved, _nonce, _deadline, _signature, EIP712Upgradeable._domainSeparatorV4()\n            );\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                        ERC165 LOGIC\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Checks if the contract supports a given interface\n    /// @dev    Supports IERC165, IERC7540Operator, IERC7575, IERC7540Redeem, IERC20, IERC20Metadata\n    ///         and ERC7540Redeem interfaces\n    /// @param  _interfaceId bytes4 The interface ID to check for support\n    /// @return              bool   true if the contract supports the given interface ID, false otherwise\n    function supportsInterface(bytes4 _interfaceId) public pure override returns (bool) {\n        return _interfaceId == type(IERC7540Operator).interfaceId || _interfaceId == type(IERC165).interfaceId\n            || _interfaceId == type(IERC7540Redeem).interfaceId || _interfaceId == type(IERC7575).interfaceId\n            || _interfaceId == type(IERC20).interfaceId || _interfaceId == type(IERC20Metadata).interfaceId;\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                        ERC7540Redeem OVERRIDDEN LOGIC\n    //////////////////////////////////////////////////////////////*/\n\n    /// @inheritdoc IERC7540Redeem\n    function requestRedeem(uint256 _shares, address _controller, address _owner)\n        external\n        override\n        requiresAuth\n        returns (uint256 _requestId)\n    {\n        ERC20(address(SHARE)).safeTransferFrom(_owner, address(this), _shares);\n        _requestId = _getNestVaultCoreStorage()\n            .executeRequestRedeem(_shares, _controller, _owner, msg.sender, ERC20(address(SHARE)));\n    }\n\n    /// @inheritdoc IERC7540Redeem\n    function pendingRedeemRequest(uint256, address _controller) public view override returns (uint256 _pendingShares) {\n        _pendingShares = _getNestVaultCoreStorage().pendingRedeem[_controller].shares;\n    }\n\n    /// @inheritdoc IERC7540Redeem\n    function claimableRedeemRequest(uint256, address _controller)\n        public\n        view\n        override\n        returns (uint256 _claimableShares)\n    {\n        _claimableShares = _getNestVaultCoreStorage().claimableRedeem[_controller].shares;\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                        REDEMPTION LOGIC\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Fulfills pending redeem shares and credits claimable balances for a controller\n    /// @dev    Validates pending state, converts shares to assets at the current rate, exits through `NestShareOFT`,\n    ///         and updates pending/claimable redeem state. Restricted to authorized callers.\n    /// @param  _controller address The controller address requesting the redeem\n    /// @param  _shares     uint256 The number of shares being redeemed\n    /// @return  _assets    uint256 The asset amount computed from `_shares` at the current rate\n    function fulfillRedeem(address _controller, uint256 _shares)\n        public\n        requiresAuth\n        nonReentrant\n        returns (uint256 _assets)\n    {\n        _assets = _getNestVaultCoreStorage()\n            .executeFulfillRedeem(_controller, _shares, SHARE, ERC20(asset()), _getValidatedRate());\n    }\n\n    /// @notice Redeems shares instantly by transferring assets directly to a specified receiver and deducting applicable fees\n    /// @dev    This function is used for immediate redemption of shares and ensures that the fees are deducted from the amount\n    ///         transferred to the receiver. The function requires approval from the share owner, and the share balance must be\n    ///         sufficient for the redemption. It also calculates and applies the necessary fee deductions before transferring\n    ///         the assets.InstantRedeem Emitted after the instant redemption is completed, with details about the shares redeemed,\n    ///         the total post-fee amount, the fee amount deducted, and the receiver address\n    /// @param  _shares         uint256 The number of shares to redeem instantly\n    /// @param  _receiver       address The address to which the assets will be sent\n    /// @param  _owner          address The owner of the shares being redeemed\n    /// @return _postFeeAmount  uint256 The amount of assets received by the receiver after fees\n    /// @return _feeAmount      uint256 The fee deducted from the total redemption amount\n    function instantRedeem(uint256 _shares, address _receiver, address _owner)\n        public\n        requiresAuth\n        nonReentrant\n        returns (uint256 _postFeeAmount, uint256 _feeAmount)\n    {\n        ERC20(address(SHARE)).safeTransferFrom(_owner, address(this), _shares);\n        (_postFeeAmount, _feeAmount) = _getNestVaultCoreStorage()\n            .executeInstantRedeem(_shares, _receiver, _owner, msg.sender, SHARE, ERC20(asset()), _getValidatedRate());\n    }\n\n    /// @notice Update the number of shares in an existing redeem request\n    /// @dev    Allows the controller or an authorized operator to reduce a pending redeem amount.\n    ///         - If `_newShares` is lower, the difference in shares is returned to `_receiver`\n    ///         - If `_newShares` equals the current pending shares, this is a no-op\n    ///         - `_newShares` cannot exceed the current pending shares\n    ///         - Redeem requests must already exist; otherwise this reverts\n    /// @param  _newShares  uint256  The new amount of shares to set for the redeem request\n    /// @param  _controller address  The controller address associated with this redeem request\n    /// @param  _receiver   address  The address receiving the returned shares\n    function updateRedeem(uint256 _newShares, address _controller, address _receiver) external requiresAuth {\n        _getNestVaultCoreStorage()\n            .executeUpdateRedeem(_newShares, _controller, _receiver, msg.sender, ERC20(address(SHARE)));\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                        ERC4626 OVERRIDDEN LOGIC\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Withdraws a specified amount of assets from the vault, transferring them to the receiver\n    /// @dev    This function reduces the claimable assets for the controller and calculates the corresponding shares\n    /// @param  _assets     uint256 The number of assets to withdraw\n    /// @param  _receiver   address The address of the receiver\n    /// @param  _controller address The controller address requesting the withdrawal\n    /// @return  _shares    uint256 The number of shares burned for the withdrawal\n    function withdraw(uint256 _assets, address _receiver, address _controller)\n        public\n        override\n        requiresAuth\n        returns (uint256 _shares)\n    {\n        _shares = _getNestVaultCoreStorage()\n            .executeWithdraw(_assets, _receiver, _controller, msg.sender, ERC20(asset()));\n    }\n\n    /// @notice Redeems a specified number of shares for assets\n    /// @dev    This function performs the redemption, reducing the claimable assets and shares, and transferring the\n    ///         appropriate amount of assets to the receiver\n    /// @param  _shares     uint256 The number of shares to redeem\n    /// @param  _receiver   address The address of the receiver\n    /// @param  _controller address The controller address requesting the redeem\n    /// @return  _assets    uint256 The amount of assets redeemed for the shares\n    function redeem(uint256 _shares, address _receiver, address _controller)\n        public\n        override\n        requiresAuth\n        returns (uint256 _assets)\n    {\n        _assets = _getNestVaultCoreStorage().executeRedeem(_shares, _receiver, _controller, msg.sender, ERC20(asset()));\n    }\n\n    /// @dev   This function performs the asset transfer from the caller, enters the nest share, and mints the appropriate number of shares\n    /// @param _receiver address The address receiving the minted shares\n    /// @param _assets   uint256 The amount of assets being deposited\n    /// @param _shares   uint256 The number of shares being minted\n    function _deposit(address _caller, address _receiver, uint256 _assets, uint256 _shares) internal virtual override {\n        _getNestVaultCoreStorage()\n            .executeDeposit(\n                _caller, _receiver, _assets, _shares, SHARE, ERC20(asset()), isAuthorized(_msgSender(), msg.sig)\n            );\n    }\n\n    /// @dev   Internal helper to validate rate from external rate provider\n    /// @param _rate uint256 The validated rate obtained from the rate provider\n    function _getValidatedRate() internal view returns (uint256 _rate) {\n        NestVaultCoreTypes.NestVaultCoreStorage storage $ = _getNestVaultCoreStorage();\n\n        _rate = $.accountant.getRateInQuoteSafe(ERC20(asset()));\n\n        // prevent division by zero\n        if (_rate == 0) revert Errors.InvalidRate();\n\n        // prevent extreme values\n        if (_rate < $.minRate || _rate > NestVaultCoreTypes.UPPER_BOUND_RATE_CAP) {\n            revert Errors.RateOutOfBounds();\n        }\n    }\n\n    /// @inheritdoc ERC4626Upgradeable\n    function _convertToShares(uint256 _assets, Math.Rounding _rounding) internal view override returns (uint256) {\n        return _assets.convertToShares(_getValidatedRate(), SHARE, _rounding);\n    }\n\n    /// @inheritdoc ERC4626Upgradeable\n    function _convertToAssets(uint256 _shares, Math.Rounding _rounding) internal view override returns (uint256) {\n        return _shares.convertToAssets(_getValidatedRate(), SHARE, _rounding);\n    }\n\n    /// @dev     This function calculates the post-fee asset amount and instant fee amount based on the shares redeemed.\n    /// @param   _shares         uint256        Amount of nTokens to redeem.\n    /// @return  _postFeeAmount  uint256         Post-fee asset amount\n    /// @return  _feeAmount      uint256         Fee amount\n    function _convertToAssetsForInstantRedeem(uint256 _shares)\n        internal\n        view\n        returns (uint256 _postFeeAmount, uint256 _feeAmount)\n    {\n        NestVaultCoreTypes.Fee storage fee = _getNestVaultCoreStorage().fees[NestVaultCoreTypes.Fees.InstantRedemption];\n        uint256 _assets = _convertToAssets(_shares, Math.Rounding.Floor);\n        (_postFeeAmount, _feeAmount) = _assets.calculatePostFeeAmounts(fee.rate, fee.flat);\n    }\n\n    /// @inheritdoc ERC4626Upgradeable\n    function previewDeposit(uint256 _assets) public view virtual override returns (uint256) {\n        NestVaultCoreTypes.Fee storage fee = _getNestVaultCoreStorage().fees[NestVaultCoreTypes.Fees.Deposit];\n        (uint256 _postFeeAssets,) = _assets.calculatePostFeeAmounts(fee.rate, fee.flat);\n        return _convertToShares(_postFeeAssets, Math.Rounding.Floor);\n    }\n\n    /// @inheritdoc ERC4626Upgradeable\n    function previewMint(uint256 _shares) public view virtual override returns (uint256) {\n        NestVaultCoreTypes.Fee storage fee = _getNestVaultCoreStorage().fees[NestVaultCoreTypes.Fees.Deposit];\n        uint256 _postFeeAssets = _convertToAssets(_shares, Math.Rounding.Ceil);\n        return _postFeeAssets.calculatePreFeeAmount(fee.rate, fee.flat);\n    }\n\n    /// @inheritdoc ERC4626Upgradeable\n    function totalAssets() public view override returns (uint256) {\n        return totalSupply().convertToAssets(_getValidatedRate(), SHARE, Math.Rounding.Floor);\n    }\n\n    /// @inheritdoc ERC4626Upgradeable\n    function maxWithdraw(address _controller) public view virtual override returns (uint256) {\n        return _getNestVaultCoreStorage().claimableRedeem[_controller].assets;\n    }\n\n    /// @inheritdoc ERC4626Upgradeable\n    function maxRedeem(address _controller) public view virtual override returns (uint256) {\n        return _getNestVaultCoreStorage().claimableRedeem[_controller].shares;\n    }\n\n    /// @inheritdoc ERC4626Upgradeable\n    function previewWithdraw(uint256) public pure virtual override returns (uint256) {\n        revert Errors.ERC7540AsyncFlow();\n    }\n\n    /// @inheritdoc ERC4626Upgradeable\n    function previewRedeem(uint256) public pure virtual override returns (uint256) {\n        revert Errors.ERC7540AsyncFlow();\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                            ADMIN FUNCTIONS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Updates accountant with rate provider\n    /// @dev    Only authorized entity can update rate provider.\n    ///         Compatibility note:\n    ///         - Legacy AccountantWithRateProviders is supported.\n    ///         - Global pending-share methods are treated as optional and handled best-effort.\n    /// @param _accountant address rate provider address\n    function setAccountant(address _accountant) external requiresAuth {\n        _getNestVaultCoreStorage().executeSetAccountant(_accountant, ERC20(asset()));\n    }\n\n    /// @notice Set fee configuration (percentage rate + flat fee) for a fee type\n    /// @dev    Both rate and flat components are validated against their respective maxFees caps.\n    /// @param  _f   NestVaultCoreTypes.Fees  Fee type\n    /// @param  _fee NestVaultCoreTypes.Fee   Fee configuration (rate in 1e6, flat in asset units)\n    function setFee(NestVaultCoreTypes.Fees _f, NestVaultCoreTypes.Fee calldata _fee) external requiresAuth {\n        _getNestVaultCoreStorage().executeSetFee(_f, _fee);\n    }\n\n    /// @notice Set maximum fee cap configuration for a fee type\n    /// @dev    The new caps must not be below the currently active fee for that type.\n    /// @param  _f      NestVaultCoreTypes.Fees  Fee type\n    /// @param  _maxFee NestVaultCoreTypes.Fee   Max fee configuration\n    function setMaxFee(NestVaultCoreTypes.Fees _f, NestVaultCoreTypes.Fee calldata _maxFee) external requiresAuth {\n        _getNestVaultCoreStorage().executeSetMaxFee(_f, _maxFee);\n    }\n\n    /// @notice Sets the operator registry used for global operator approvals\n    /// @param _operatorRegistry address The operator registry (zero disables registry)\n    function setOperatorRegistry(address _operatorRegistry) external requiresAuth {\n        _getNestVaultCoreStorage().executeSetOperatorRegistry(_operatorRegistry);\n    }\n\n    /// @notice Claims accrued fees for a fee type to a receiver\n    /// @dev    Only callable by the SHARE token (manager controls claims via manage())\n    /// @param  _f          NestVaultCoreTypes.Fees The fee type being claimed\n    /// @param  _receiver   address                 The address receiving claimed fees\n    /// @return _feeAmount  uint256                 The amount of fees claimed\n    function claimFee(NestVaultCoreTypes.Fees _f, address _receiver)\n        external\n        nonReentrant\n        returns (uint256 _feeAmount)\n    {\n        if (msg.sender != address(SHARE)) revert Errors.OnlyCallableByNestShare();\n        _feeAmount = _getNestVaultCoreStorage().executeClaimFee(_f, _receiver, ERC20(asset()));\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                        VIEW FUNCTIONS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Preview the result of a fulfillRedeem operation\n    /// @dev    Allows simulation of the effects of an async redemption fulfillment at the current block\n    /// @param  _shares         uint256 The number of shares to be fulfilled\n    /// @return _postFeeAmount  uint256 The amount of assets that would be credited after fees\n    /// @return _feeAmount      uint256 The fee amount that would be deducted\n    function previewFulfillRedeem(uint256 _shares) public view returns (uint256 _postFeeAmount, uint256 _feeAmount) {\n        NestVaultCoreTypes.Fee storage fee = _getNestVaultCoreStorage().fees[NestVaultCoreTypes.Fees.Redemption];\n        uint256 _assets = _convertToAssets(_shares, Math.Rounding.Floor);\n        (_postFeeAmount, _feeAmount) = _assets.calculatePostFeeAmounts(fee.rate, fee.flat);\n    }\n\n    /// @notice Preview the result of an instant redeem operation\n    /// @dev    Allows an on-chain or off-chain user to simulate the effects of their instant redemption at the current block, given\n    ///         current on-chain conditions.\n    /// @param  _shares         uint256 The number of shares to be redeemed instantly\n    /// @return _postFeeAmount  uint256 The amount of assets that would be received after fees\n    /// @return _feeAmount      uint256 The fee amount that would be deducted\n    function previewInstantRedeem(uint256 _shares) public view returns (uint256 _postFeeAmount, uint256 _feeAmount) {\n        (_postFeeAmount, _feeAmount) = _convertToAssetsForInstantRedeem(_shares);\n    }\n\n    /// @notice Returns the fee configuration for a given fee type\n    /// @dev    The total fee for an operation is `flat + floor(gross * rate / 1e6)`.\n    /// @param  _f    NestVaultCoreTypes.Fees  The fee type\n    /// @return _rate uint32  Percentage fee rate (denominated in 1e6)\n    /// @return _flat uint256 Flat fee in asset token smallest units\n    function fees(NestVaultCoreTypes.Fees _f) external view returns (uint32 _rate, uint256 _flat) {\n        NestVaultCoreTypes.Fee storage fee = _getNestVaultCoreStorage().fees[_f];\n        return (fee.rate, fee.flat);\n    }\n\n    /// @notice Returns the configured maximum fee for a fee type\n    /// @param  _f NestVaultCoreTypes.Fees the type of fee\n    /// @return _rate uint32  Max percentage fee rate\n    /// @return _flat uint256 Max flat fee amount\n    function maxFees(NestVaultCoreTypes.Fees _f) external view returns (uint32 _rate, uint256 _flat) {\n        NestVaultCoreTypes.Fee storage maxFee = _getNestVaultCoreStorage().maxFees[_f];\n        return (maxFee.rate, maxFee.flat);\n    }\n\n    /// @notice The minimum rate allowed for exchange rate calculations\n    /// @dev    It represents the smallest allowed rate\n    /// @return uint256 min rate\n    function minRate() external view returns (uint256) {\n        return _getNestVaultCoreStorage().minRate;\n    }\n\n    /// @notice The total number of pending shares for redemption\n    /// @dev    This value represents the total shares that are currently pending redemption across all controllers\n    /// @return uint256 total pending shares\n    function totalPendingShares() external view returns (uint256) {\n        return _getNestVaultCoreStorage().totalPendingShares;\n    }\n\n    /// @notice Total unclaimed fees for a given fee type denominated in vault assets\n    /// @param  _f NestVaultCoreTypes.Fees The fee type to query\n    /// @return uint256 The total unclaimed fee amount for the fee type\n    function claimableFees(NestVaultCoreTypes.Fees _f) external view returns (uint256) {\n        return _getNestVaultCoreStorage().claimableFees[_f];\n    }\n\n    /// @notice Mapping to track whether a particular authorization has been used for a specific controller address\n    /// @dev    This mapping prevents replay attacks by ensuring that authorizations cannot be reused\n    /// @param  _controller  address The address of the controller whose authorization is being checked\n    /// @param  _nonce       bytes32 The unique bytes32 nonce representing a specific authorization attempt\n    /// @return              bool     whether controller has been authorized or not\n    function authorizations(address _controller, bytes32 _nonce) external view returns (bool) {\n        return _getNestVaultCoreStorage().authorizations[_controller][_nonce];\n    }\n\n    /// @notice Returns the accountant with rate providers used to obtain asset conversion rates\n    /// @dev    The accountant is responsible for providing up-to-date conversion rates between assets and shares,\n    ///         enabling accurate calculations for deposits, withdrawals, and redemptions\n    /// @return NestHubAccountant The NestHubAccountant contract associated with the vault\n    function accountant() external view returns (NestHubAccountant) {\n        return _getNestVaultCoreStorage().accountant;\n    }\n\n    /// @notice Returns the configured operator registry\n    /// @return OperatorRegistry The operator registry contract (zero if disabled)\n    function operatorRegistry() external view returns (OperatorRegistry) {\n        return _getNestVaultCoreStorage().operatorRegistry;\n    }\n}\n"},{"file_path":"node_modules/@uniswap/permit2/src/interfaces/IEIP712.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IEIP712 {\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"},{"file_path":"node_modules/@layerzerolabs/oft-evm/contracts/interfaces/IOFT.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\nimport { MessagingReceipt, MessagingFee } from \"@layerzerolabs/oapp-evm/contracts/oapp/OAppSender.sol\";\n\n/**\n * @dev Struct representing token parameters for the OFT send() operation.\n */\nstruct SendParam {\n    uint32 dstEid; // Destination endpoint ID.\n    bytes32 to; // Recipient address.\n    uint256 amountLD; // Amount to send in local decimals.\n    uint256 minAmountLD; // Minimum amount to send in local decimals.\n    bytes extraOptions; // Additional options supplied by the caller to be used in the LayerZero message.\n    bytes composeMsg; // The composed message for the send() operation.\n    bytes oftCmd; // The OFT command to be executed, unused in default OFT implementations.\n}\n\n/**\n * @dev Struct representing OFT limit information.\n * @dev These amounts can change dynamically and are up the specific oft implementation.\n */\nstruct OFTLimit {\n    uint256 minAmountLD; // Minimum amount in local decimals that can be sent to the recipient.\n    uint256 maxAmountLD; // Maximum amount in local decimals that can be sent to the recipient.\n}\n\n/**\n * @dev Struct representing OFT receipt information.\n */\nstruct OFTReceipt {\n    uint256 amountSentLD; // Amount of tokens ACTUALLY debited from the sender in local decimals.\n    // @dev In non-default implementations, the amountReceivedLD COULD differ from this value.\n    uint256 amountReceivedLD; // Amount of tokens to be received on the remote side.\n}\n\n/**\n * @dev Struct representing OFT fee details.\n * @dev Future proof mechanism to provide a standardized way to communicate fees to things like a UI.\n */\nstruct OFTFeeDetail {\n    int256 feeAmountLD; // Amount of the fee in local decimals.\n    string description; // Description of the fee.\n}\n\n/**\n * @title IOFT\n * @dev Interface for the OftChain (OFT) token.\n * @dev Does not inherit ERC20 to accommodate usage by OFTAdapter as well.\n * @dev This specific interface ID is '0x02e49c2c'.\n */\ninterface IOFT {\n    // Custom error messages\n    error InvalidLocalDecimals();\n    error SlippageExceeded(uint256 amountLD, uint256 minAmountLD);\n    error AmountSDOverflowed(uint256 amountSD);\n\n    // Events\n    event OFTSent(\n        bytes32 indexed guid, // GUID of the OFT message.\n        uint32 dstEid, // Destination Endpoint ID.\n        address indexed fromAddress, // Address of the sender on the src chain.\n        uint256 amountSentLD, // Amount of tokens sent in local decimals.\n        uint256 amountReceivedLD // Amount of tokens received in local decimals.\n    );\n    event OFTReceived(\n        bytes32 indexed guid, // GUID of the OFT message.\n        uint32 srcEid, // Source Endpoint ID.\n        address indexed toAddress, // Address of the recipient on the dst chain.\n        uint256 amountReceivedLD // Amount of tokens received in local decimals.\n    );\n\n    /**\n     * @notice Retrieves interfaceID and the version of the OFT.\n     * @return interfaceId The interface ID.\n     * @return version The version.\n     *\n     * @dev interfaceId: This specific interface ID is '0x02e49c2c'.\n     * @dev version: Indicates a cross-chain compatible msg encoding with other OFTs.\n     * @dev If a new feature is added to the OFT cross-chain msg encoding, the version will be incremented.\n     * ie. localOFT version(x,1) CAN send messages to remoteOFT version(x,1)\n     */\n    function oftVersion() external view returns (bytes4 interfaceId, uint64 version);\n\n    /**\n     * @notice Retrieves the address of the token associated with the OFT.\n     * @return token The address of the ERC20 token implementation.\n     */\n    function token() external view returns (address);\n\n    /**\n     * @notice Indicates whether the OFT contract requires approval of the 'token()' to send.\n     * @return requiresApproval Needs approval of the underlying token implementation.\n     *\n     * @dev Allows things like wallet implementers to determine integration requirements,\n     * without understanding the underlying token implementation.\n     */\n    function approvalRequired() external view returns (bool);\n\n    /**\n     * @notice Retrieves the shared decimals of the OFT.\n     * @return sharedDecimals The shared decimals of the OFT.\n     */\n    function sharedDecimals() external view returns (uint8);\n\n    /**\n     * @notice Provides the fee breakdown and settings data for an OFT. Unused in the default implementation.\n     * @param _sendParam The parameters for the send operation.\n     * @return limit The OFT limit information.\n     * @return oftFeeDetails The details of OFT fees.\n     * @return receipt The OFT receipt information.\n     */\n    function quoteOFT(\n        SendParam calldata _sendParam\n    ) external view returns (OFTLimit memory, OFTFeeDetail[] memory oftFeeDetails, OFTReceipt memory);\n\n    /**\n     * @notice Provides a quote for the send() operation.\n     * @param _sendParam The parameters for the send() operation.\n     * @param _payInLzToken Flag indicating whether the caller is paying in the LZ token.\n     * @return fee The calculated LayerZero messaging fee from the send() operation.\n     *\n     * @dev MessagingFee: LayerZero msg fee\n     *  - nativeFee: The native fee.\n     *  - lzTokenFee: The lzToken fee.\n     */\n    function quoteSend(SendParam calldata _sendParam, bool _payInLzToken) external view returns (MessagingFee memory);\n\n    /**\n     * @notice Executes the send() operation.\n     * @param _sendParam The parameters for the send operation.\n     * @param _fee The fee information supplied by the caller.\n     *      - nativeFee: The native fee.\n     *      - lzTokenFee: The lzToken fee.\n     * @param _refundAddress The address to receive any excess funds from fees etc. on the src.\n     * @return receipt The LayerZero messaging receipt from the send() operation.\n     * @return oftReceipt The OFT receipt information.\n     *\n     * @dev MessagingReceipt: LayerZero msg receipt\n     *  - guid: The unique identifier for the sent message.\n     *  - nonce: The nonce of the sent message.\n     *  - fee: The LayerZero fee incurred for the message.\n     */\n    function send(\n        SendParam calldata _sendParam,\n        MessagingFee calldata _fee,\n        address _refundAddress\n    ) external payable returns (MessagingReceipt memory, OFTReceipt memory);\n}\n"},{"file_path":"node_modules/solmate/src/utils/FixedPointMathLib.sol","source_code":"// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Arithmetic library with operations for fixed-point numbers.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/FixedPointMathLib.sol)\n/// @author Inspired by USM (https://github.com/usmfum/USM/blob/master/contracts/WadMath.sol)\nlibrary FixedPointMathLib {\n    /*//////////////////////////////////////////////////////////////\n                    SIMPLIFIED FIXED POINT OPERATIONS\n    //////////////////////////////////////////////////////////////*/\n\n    uint256 internal constant MAX_UINT256 = 2**256 - 1;\n\n    uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.\n\n    function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n        return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.\n    }\n\n    function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n        return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.\n    }\n\n    function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n        return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.\n    }\n\n    function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n        return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                    LOW LEVEL FIXED POINT OPERATIONS\n    //////////////////////////////////////////////////////////////*/\n\n    function mulDivDown(\n        uint256 x,\n        uint256 y,\n        uint256 denominator\n    ) internal pure returns (uint256 z) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Equivalent to require(denominator != 0 && (y == 0 || x <= type(uint256).max / y))\n            if iszero(mul(denominator, iszero(mul(y, gt(x, div(MAX_UINT256, y)))))) {\n                revert(0, 0)\n            }\n\n            // Divide x * y by the denominator.\n            z := div(mul(x, y), denominator)\n        }\n    }\n\n    function mulDivUp(\n        uint256 x,\n        uint256 y,\n        uint256 denominator\n    ) internal pure returns (uint256 z) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Equivalent to require(denominator != 0 && (y == 0 || x <= type(uint256).max / y))\n            if iszero(mul(denominator, iszero(mul(y, gt(x, div(MAX_UINT256, y)))))) {\n                revert(0, 0)\n            }\n\n            // If x * y modulo the denominator is strictly greater than 0,\n            // 1 is added to round up the division of x * y by the denominator.\n            z := add(gt(mod(mul(x, y), denominator), 0), div(mul(x, y), denominator))\n        }\n    }\n\n    function rpow(\n        uint256 x,\n        uint256 n,\n        uint256 scalar\n    ) internal pure returns (uint256 z) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            switch x\n            case 0 {\n                switch n\n                case 0 {\n                    // 0 ** 0 = 1\n                    z := scalar\n                }\n                default {\n                    // 0 ** n = 0\n                    z := 0\n                }\n            }\n            default {\n                switch mod(n, 2)\n                case 0 {\n                    // If n is even, store scalar in z for now.\n                    z := scalar\n                }\n                default {\n                    // If n is odd, store x in z for now.\n                    z := x\n                }\n\n                // Shifting right by 1 is like dividing by 2.\n                let half := shr(1, scalar)\n\n                for {\n                    // Shift n right by 1 before looping to halve it.\n                    n := shr(1, n)\n                } n {\n                    // Shift n right by 1 each iteration to halve it.\n                    n := shr(1, n)\n                } {\n                    // Revert immediately if x ** 2 would overflow.\n                    // Equivalent to iszero(eq(div(xx, x), x)) here.\n                    if shr(128, x) {\n                        revert(0, 0)\n                    }\n\n                    // Store x squared.\n                    let xx := mul(x, x)\n\n                    // Round to the nearest number.\n                    let xxRound := add(xx, half)\n\n                    // Revert if xx + half overflowed.\n                    if lt(xxRound, xx) {\n                        revert(0, 0)\n                    }\n\n                    // Set x to scaled xxRound.\n                    x := div(xxRound, scalar)\n\n                    // If n is even:\n                    if mod(n, 2) {\n                        // Compute z * x.\n                        let zx := mul(z, x)\n\n                        // If z * x overflowed:\n                        if iszero(eq(div(zx, x), z)) {\n                            // Revert if x is non-zero.\n                            if iszero(iszero(x)) {\n                                revert(0, 0)\n                            }\n                        }\n\n                        // Round to the nearest number.\n                        let zxRound := add(zx, half)\n\n                        // Revert if zx + half overflowed.\n                        if lt(zxRound, zx) {\n                            revert(0, 0)\n                        }\n\n                        // Return properly scaled zxRound.\n                        z := div(zxRound, scalar)\n                    }\n                }\n            }\n        }\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                        GENERAL NUMBER UTILITIES\n    //////////////////////////////////////////////////////////////*/\n\n    function sqrt(uint256 x) internal pure returns (uint256 z) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            let y := x // We start y at x, which will help us make our initial estimate.\n\n            z := 181 // The \"correct\" value is 1, but this saves a multiplication later.\n\n            // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad\n            // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.\n\n            // We check y >= 2^(k + 8) but shift right by k bits\n            // each branch to ensure that if x >= 256, then y >= 256.\n            if iszero(lt(y, 0x10000000000000000000000000000000000)) {\n                y := shr(128, y)\n                z := shl(64, z)\n            }\n            if iszero(lt(y, 0x1000000000000000000)) {\n                y := shr(64, y)\n                z := shl(32, z)\n            }\n            if iszero(lt(y, 0x10000000000)) {\n                y := shr(32, y)\n                z := shl(16, z)\n            }\n            if iszero(lt(y, 0x1000000)) {\n                y := shr(16, y)\n                z := shl(8, z)\n            }\n\n            // Goal was to get z*z*y within a small factor of x. More iterations could\n            // get y in a tighter range. Currently, we will have y in [256, 256*2^16).\n            // We ensured y >= 256 so that the relative difference between y and y+1 is small.\n            // That's not possible if x < 256 but we can just verify those cases exhaustively.\n\n            // Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256.\n            // Correctness can be checked exhaustively for x < 256, so we assume y >= 256.\n            // Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps.\n\n            // For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range\n            // (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256.\n\n            // Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate\n            // sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18.\n\n            // There is no overflow risk here since y < 2^136 after the first branch above.\n            z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181.\n\n            // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.\n            z := shr(1, add(z, div(x, z)))\n            z := shr(1, add(z, div(x, z)))\n            z := shr(1, add(z, div(x, z)))\n            z := shr(1, add(z, div(x, z)))\n            z := shr(1, add(z, div(x, z)))\n            z := shr(1, add(z, div(x, z)))\n            z := shr(1, add(z, div(x, z)))\n\n            // If x+1 is a perfect square, the Babylonian method cycles between\n            // floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor.\n            // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division\n            // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.\n            // If you don't care whether the floor or ceil square root is returned, you can remove this statement.\n            z := sub(z, lt(div(x, z), z))\n        }\n    }\n\n    function unsafeMod(uint256 x, uint256 y) internal pure returns (uint256 z) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Mod x by y. Note this will return\n            // 0 instead of reverting if y is zero.\n            z := mod(x, y)\n        }\n    }\n\n    function unsafeDiv(uint256 x, uint256 y) internal pure returns (uint256 r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Divide x by y. Note this will return\n            // 0 instead of reverting if y is zero.\n            r := div(x, y)\n        }\n    }\n\n    function unsafeDivUp(uint256 x, uint256 y) internal pure returns (uint256 z) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Add 1 to x * y if x % y > 0. Note this will\n            // return 0 instead of reverting if y is zero.\n            z := add(gt(mod(x, y), 0), div(x, y))\n        }\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/access/Ownable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\n\npragma solidity ^0.8.20;\n\nimport {Context} from \"../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 * The initial owner is set to the address provided by the deployer. This can\n * 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    /**\n     * @dev The caller account is not authorized to perform an operation.\n     */\n    error OwnableUnauthorizedAccount(address account);\n\n    /**\n     * @dev The owner is not a valid owner account. (eg. `address(0)`)\n     */\n    error OwnableInvalidOwner(address owner);\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\n     */\n    constructor(address initialOwner) {\n        if (initialOwner == address(0)) {\n            revert OwnableInvalidOwner(address(0));\n        }\n        _transferOwnership(initialOwner);\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        if (owner() != _msgSender()) {\n            revert OwnableUnauthorizedAccount(_msgSender());\n        }\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        if (newOwner == address(0)) {\n            revert OwnableInvalidOwner(address(0));\n        }\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":"node_modules/@layerzerolabs/oapp-evm-upgradeable/contracts/precrime/OAppPreCrimeSimulatorUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\nimport { OwnableUpgradeable } from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport { IPreCrime } from \"@layerzerolabs/oapp-evm/contracts/precrime/interfaces/IPreCrime.sol\";\nimport { IOAppPreCrimeSimulator, InboundPacket, Origin } from \"@layerzerolabs/oapp-evm/contracts/precrime/interfaces/IOAppPreCrimeSimulator.sol\";\n\n/**\n * @title OAppPreCrimeSimulator\n * @dev Abstract contract serving as the base for preCrime simulation functionality in an OApp.\n */\nabstract contract OAppPreCrimeSimulatorUpgradeable is IOAppPreCrimeSimulator, OwnableUpgradeable {\n    struct OAppPreCrimeSimulatorStorage {\n        // The address of the preCrime implementation.\n        address preCrime;\n    }\n\n    // keccak256(abi.encode(uint256(keccak256(\"layerzerov2.storage.oappprecrimesimulator\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant OAPP_PRE_CRIME_SIMULATOR_STORAGE_LOCATION =\n        0xefb041d771d6daaa55702fff6eb740d63ba559a75d2d1d3e151c78ff2480b600;\n\n    function _getOAppPreCrimeSimulatorStorage() internal pure returns (OAppPreCrimeSimulatorStorage storage $) {\n        assembly {\n            $.slot := OAPP_PRE_CRIME_SIMULATOR_STORAGE_LOCATION\n        }\n    }\n\n    /**\n     * @dev Ownable is not initialized here on purpose. It should be initialized in the child contract to\n     * accommodate the different version of Ownable.\n     */\n    function __OAppPreCrimeSimulator_init() internal onlyInitializing {}\n\n    function __OAppPreCrimeSimulator_init_unchained() internal onlyInitializing {}\n\n    function preCrime() external view override returns (address) {\n        OAppPreCrimeSimulatorStorage storage $ = _getOAppPreCrimeSimulatorStorage();\n        return $.preCrime;\n    }\n\n    /**\n     * @dev Retrieves the address of the OApp contract.\n     * @return The address of the OApp contract.\n     *\n     * @dev The simulator contract is the base contract for the OApp by default.\n     * @dev If the simulator is a separate contract, override this function.\n     */\n    function oApp() external view virtual returns (address) {\n        return address(this);\n    }\n\n    /**\n     * @dev Sets the preCrime contract address.\n     * @param _preCrime The address of the preCrime contract.\n     */\n    function setPreCrime(address _preCrime) public virtual onlyOwner {\n        OAppPreCrimeSimulatorStorage storage $ = _getOAppPreCrimeSimulatorStorage();\n        $.preCrime = _preCrime;\n        emit PreCrimeSet(_preCrime);\n    }\n\n    /**\n     * @dev Interface for pre-crime simulations. Always reverts at the end with the simulation results.\n     * @param _packets An array of InboundPacket objects representing received packets to be delivered.\n     *\n     * @dev WARNING: MUST revert at the end with the simulation results.\n     * @dev Gives the preCrime implementation the ability to mock sending packets to the lzReceive function,\n     * WITHOUT actually executing them.\n     */\n    function lzReceiveAndRevert(InboundPacket[] calldata _packets) public payable virtual {\n        for (uint256 i = 0; i < _packets.length; i++) {\n            InboundPacket calldata packet = _packets[i];\n\n            // Ignore packets that are not from trusted peers.\n            if (!isPeer(packet.origin.srcEid, packet.origin.sender)) continue;\n\n            // @dev Because a verifier is calling this function, it doesnt have access to executor params:\n            //  - address _executor\n            //  - bytes calldata _extraData\n            // preCrime will NOT work for OApps that rely on these two parameters inside of their _lzReceive().\n            // They are instead stubbed to default values, address(0) and bytes(\"\")\n            // @dev Calling this.lzReceiveSimulate removes ability for assembly return 0 callstack exit,\n            // which would cause the revert to be ignored.\n            this.lzReceiveSimulate{ value: packet.value }(\n                packet.origin,\n                packet.guid,\n                packet.message,\n                packet.executor,\n                packet.extraData\n            );\n        }\n\n        // @dev Revert with the simulation results. msg.sender must implement IPreCrime.buildSimulationResult().\n        revert SimulationResult(IPreCrime(msg.sender).buildSimulationResult());\n    }\n\n    /**\n     * @dev Is effectively an internal function because msg.sender must be address(this).\n     * Allows resetting the call stack for 'internal' calls.\n     * @param _origin The origin information containing the source endpoint and sender address.\n     *  - srcEid: The source chain endpoint ID.\n     *  - sender: The sender address on the src chain.\n     *  - nonce: The nonce of the message.\n     * @param _guid The unique identifier of the packet.\n     * @param _message The message payload of the packet.\n     * @param _executor The executor address for the packet.\n     * @param _extraData Additional data for the packet.\n     */\n    function lzReceiveSimulate(\n        Origin calldata _origin,\n        bytes32 _guid,\n        bytes calldata _message,\n        address _executor,\n        bytes calldata _extraData\n    ) external payable virtual {\n        // @dev Ensure ONLY can be called 'internally'.\n        if (msg.sender != address(this)) revert OnlySelf();\n        _lzReceiveSimulate(_origin, _guid, _message, _executor, _extraData);\n    }\n\n    /**\n     * @dev Internal function to handle the OAppPreCrimeSimulator simulated receive.\n     * @param _origin The origin information.\n     *  - srcEid: The source chain endpoint ID.\n     *  - sender: The sender address from the src chain.\n     *  - nonce: The nonce of the LayerZero message.\n     * @param _guid The GUID of the LayerZero message.\n     * @param _message The LayerZero message.\n     * @param _executor The address of the off-chain executor.\n     * @param _extraData Arbitrary data passed by the msg executor.\n     *\n     * @dev Enables the preCrime simulator to mock sending lzReceive() messages,\n     * routes the msg down from the OAppPreCrimeSimulator, and back up to the OAppReceiver.\n     */\n    function _lzReceiveSimulate(\n        Origin calldata _origin,\n        bytes32 _guid,\n        bytes calldata _message,\n        address _executor,\n        bytes calldata _extraData\n    ) internal virtual;\n\n    /**\n     * @dev checks if the specified peer is considered 'trusted' by the OApp.\n     * @param _eid The endpoint Id to check.\n     * @param _peer The peer to check.\n     * @return Whether the peer passed is considered 'trusted' by the OApp.\n     */\n    function isPeer(uint32 _eid, bytes32 _peer) public view virtual returns (bool);\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/interfaces/IERC5267.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC5267.sol)\n\npragma solidity >=0.4.16;\n\ninterface IERC5267 {\n    /**\n     * @dev MAY be emitted to signal that the domain could have changed.\n     */\n    event EIP712DomainChanged();\n\n    /**\n     * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\n     * signature.\n     */\n    function eip712Domain()\n        external\n        view\n        returns (\n            bytes1 fields,\n            string memory name,\n            string memory version,\n            uint256 chainId,\n            address verifyingContract,\n            bytes32 salt,\n            uint256[] memory extensions\n        );\n}\n"},{"file_path":"node_modules/@layerzerolabs/oapp-evm/contracts/oapp/OAppSender.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\nimport { SafeERC20, IERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { MessagingParams, MessagingFee, MessagingReceipt } from \"@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol\";\nimport { OAppCore } from \"./OAppCore.sol\";\n\n/**\n * @title OAppSender\n * @dev Abstract contract implementing the OAppSender functionality for sending messages to a LayerZero endpoint.\n */\nabstract contract OAppSender is OAppCore {\n    using SafeERC20 for IERC20;\n\n    // Custom error messages\n    error NotEnoughNative(uint256 msgValue);\n    error LzTokenUnavailable();\n\n    // @dev The version of the OAppSender implementation.\n    // @dev Version is bumped when changes are made to this contract.\n    uint64 internal constant SENDER_VERSION = 1;\n\n    /**\n     * @notice Retrieves the OApp version information.\n     * @return senderVersion The version of the OAppSender.sol contract.\n     * @return receiverVersion The version of the OAppReceiver.sol contract.\n     *\n     * @dev Providing 0 as the default for OAppReceiver version. Indicates that the OAppReceiver is not implemented.\n     * ie. this is a SEND only OApp.\n     * @dev If the OApp uses both OAppSender and OAppReceiver, then this needs to be override returning the correct versions\n     */\n    function oAppVersion() public view virtual returns (uint64 senderVersion, uint64 receiverVersion) {\n        return (SENDER_VERSION, 0);\n    }\n\n    /**\n     * @dev Internal function to interact with the LayerZero EndpointV2.quote() for fee calculation.\n     * @param _dstEid The destination endpoint ID.\n     * @param _message The message payload.\n     * @param _options Additional options for the message.\n     * @param _payInLzToken Flag indicating whether to pay the fee in LZ tokens.\n     * @return fee The calculated MessagingFee for the message.\n     *      - nativeFee: The native fee for the message.\n     *      - lzTokenFee: The LZ token fee for the message.\n     */\n    function _quote(\n        uint32 _dstEid,\n        bytes memory _message,\n        bytes memory _options,\n        bool _payInLzToken\n    ) internal view virtual returns (MessagingFee memory fee) {\n        return\n            endpoint.quote(\n                MessagingParams(_dstEid, _getPeerOrRevert(_dstEid), _message, _options, _payInLzToken),\n                address(this)\n            );\n    }\n\n    /**\n     * @dev Internal function to interact with the LayerZero EndpointV2.send() for sending a message.\n     * @param _dstEid The destination endpoint ID.\n     * @param _message The message payload.\n     * @param _options Additional options for the message.\n     * @param _fee The calculated LayerZero fee for the message.\n     *      - nativeFee: The native fee.\n     *      - lzTokenFee: The lzToken fee.\n     * @param _refundAddress The address to receive any excess fee values sent to the endpoint.\n     * @return receipt The receipt for the sent message.\n     *      - guid: The unique identifier for the sent message.\n     *      - nonce: The nonce of the sent message.\n     *      - fee: The LayerZero fee incurred for the message.\n     */\n    function _lzSend(\n        uint32 _dstEid,\n        bytes memory _message,\n        bytes memory _options,\n        MessagingFee memory _fee,\n        address _refundAddress\n    ) internal virtual returns (MessagingReceipt memory receipt) {\n        // @dev Push corresponding fees to the endpoint, any excess is sent back to the _refundAddress from the endpoint.\n        uint256 messageValue = _payNative(_fee.nativeFee);\n        if (_fee.lzTokenFee > 0) _payLzToken(_fee.lzTokenFee);\n\n        return\n            // solhint-disable-next-line check-send-result\n            endpoint.send{ value: messageValue }(\n                MessagingParams(_dstEid, _getPeerOrRevert(_dstEid), _message, _options, _fee.lzTokenFee > 0),\n                _refundAddress\n            );\n    }\n\n    /**\n     * @dev Internal function to pay the native fee associated with the message.\n     * @param _nativeFee The native fee to be paid.\n     * @return nativeFee The amount of native currency paid.\n     *\n     * @dev If the OApp needs to initiate MULTIPLE LayerZero messages in a single transaction,\n     * this will need to be overridden because msg.value would contain multiple lzFees.\n     * @dev Should be overridden in the event the LayerZero endpoint requires a different native currency.\n     * @dev Some EVMs use an ERC20 as a method for paying transactions/gasFees.\n     * @dev The endpoint is EITHER/OR, ie. it will NOT support both types of native payment at a time.\n     */\n    function _payNative(uint256 _nativeFee) internal virtual returns (uint256 nativeFee) {\n        if (msg.value != _nativeFee) revert NotEnoughNative(msg.value);\n        return _nativeFee;\n    }\n\n    /**\n     * @dev Internal function to pay the LZ token fee associated with the message.\n     * @param _lzTokenFee The LZ token fee to be paid.\n     *\n     * @dev If the caller is trying to pay in the specified lzToken, then the lzTokenFee is passed to the endpoint.\n     * @dev Any excess sent, is passed back to the specified _refundAddress in the _lzSend().\n     */\n    function _payLzToken(uint256 _lzTokenFee) internal virtual {\n        // @dev Cannot cache the token because it is not immutable in the endpoint.\n        address lzToken = endpoint.lzToken();\n        if (lzToken == address(0)) revert LzTokenUnavailable();\n\n        // Pay LZ token fee by sending tokens to the endpoint.\n        IERC20(lzToken).safeTransferFrom(msg.sender, address(endpoint), _lzTokenFee);\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/interfaces/IERC165.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)\n\npragma solidity >=0.4.16;\n\nimport {IERC165} from \"../utils/introspection/IERC165.sol\";\n"},{"file_path":"contracts/NestVaultPermit2.sol","source_code":"// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.30;\n\n// contracts\nimport {NestVaultCore} from \"contracts/NestVaultCore.sol\";\nimport {ERC20} from \"@solmate/tokens/ERC20.sol\";\n\n// interfaces\nimport {ISignatureTransfer} from \"@uniswap/permit2/interfaces/ISignatureTransfer.sol\";\n\n// libraries\nimport {Errors} from \"contracts/types/Errors.sol\";\nimport {NestVaultCoreTypes} from \"contracts/types/NestVaultCoreTypes.sol\";\nimport {NestVaultRedeemLogic} from \"contracts/libraries/NestVaultRedeemLogic.sol\";\nimport {NestVaultTransferLogic} from \"contracts/libraries/NestVaultTransferLogic.sol\";\n\n/// @title  NestVaultPermit2\n/// @notice Optional Permit2 extension for NestVault implementations\n/// @author plumenetwork\nabstract contract NestVaultPermit2 is NestVaultCore {\n    using NestVaultRedeemLogic for NestVaultCoreTypes.NestVaultCoreStorage;\n    using NestVaultTransferLogic for ERC20;\n\n    /// @dev Canonical Permit2 contract used for signature-based share transfers.\n    ISignatureTransfer public immutable PERMIT2;\n\n    /// @param _share The address of the share token\n    constructor(address payable _share, address _permit2) NestVaultCore(_share) {\n        if (_permit2 == address(0)) revert Errors.ZeroAddress();\n\n        PERMIT2 = ISignatureTransfer(_permit2);\n    }\n\n    /// @notice Requests a redeem of shares using Permit2 signature-based transfer\n    /// @dev    Allows users to request redemption using Permit2 SignatureTransfer for gasless token approvals.\n    /// @param  _shares     uint256            The number of shares to redeem\n    /// @param  _controller address            The address of the controller managing the redemption\n    /// @param  _owner      address            The owner of the shares being redeemed\n    /// @param  _nonce      uint256            Unique nonce for Permit2 signature\n    /// @param  _deadline   uint256            Expiration timestamp for the permit\n    /// @param  _signature  bytes              Permit2 signature from the token owner\n    /// @return _requestId  uint256            The request ID for the redemption\n    function requestRedeemWithPermit2(\n        uint256 _shares,\n        address _controller,\n        address _owner,\n        uint256 _nonce,\n        uint256 _deadline,\n        bytes calldata _signature\n    ) external virtual requiresAuth returns (uint256 _requestId) {\n        uint256 _sharesReceived = ERC20(address(SHARE))\n            .safePermit2TransferFrom(PERMIT2, _owner, address(this), _shares, _nonce, _deadline, _signature);\n\n        _requestId = _getNestVaultCoreStorage()\n            .executeRequestRedeem(_sharesReceived, _controller, _owner, msg.sender, ERC20(address(SHARE)));\n    }\n\n    /// @notice Redeems shares instantly using Permit2 signature-based transfer\n    /// @dev    This function allows immediate redemption of shares using Permit2 SignatureTransfer for gasless token approvals.\n    /// @param  _shares         uint256            The number of shares to redeem instantly\n    /// @param  _receiver       address            The address to which the assets will be sent\n    /// @param  _owner          address            The owner of the shares being redeemed\n    /// @param  _nonce          uint256            Unique nonce for Permit2 signature\n    /// @param  _deadline       uint256            Expiration timestamp for the permit\n    /// @param  _signature      bytes              Permit2 signature from the token owner\n    /// @return _postFeeAmount  uint256            The amount of assets received by the receiver after fees\n    /// @return _feeAmount      uint256            The fee deducted from the total redemption amount\n    function instantRedeemWithPermit2(\n        uint256 _shares,\n        address _receiver,\n        address _owner,\n        uint256 _nonce,\n        uint256 _deadline,\n        bytes calldata _signature\n    ) external virtual requiresAuth nonReentrant returns (uint256 _postFeeAmount, uint256 _feeAmount) {\n        uint256 _sharesReceived = ERC20(address(SHARE))\n            .safePermit2TransferFrom(PERMIT2, _owner, address(this), _shares, _nonce, _deadline, _signature);\n\n        (_postFeeAmount, _feeAmount) = _getNestVaultCoreStorage()\n            .executeInstantRedeem(\n                _sharesReceived, _receiver, _owner, msg.sender, SHARE, ERC20(asset()), _getValidatedRate()\n            );\n    }\n}\n"},{"file_path":"node_modules/@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ISendLib.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.0;\n\nimport { MessagingFee } from \"./ILayerZeroEndpointV2.sol\";\nimport { IMessageLib } from \"./IMessageLib.sol\";\n\nstruct Packet {\n    uint64 nonce;\n    uint32 srcEid;\n    address sender;\n    uint32 dstEid;\n    bytes32 receiver;\n    bytes32 guid;\n    bytes message;\n}\n\ninterface ISendLib is IMessageLib {\n    function send(\n        Packet calldata _packet,\n        bytes calldata _options,\n        bool _payInLzToken\n    ) external returns (MessagingFee memory, bytes memory encodedPacket);\n\n    function quote(\n        Packet calldata _packet,\n        bytes calldata _options,\n        bool _payInLzToken\n    ) external view returns (MessagingFee memory);\n\n    function setTreasury(address _treasury) external;\n\n    function withdrawFee(address _to, uint256 _amount) external;\n\n    function withdrawLzTokenFee(address _lzToken, address _to, uint256 _amount) external;\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\nimport {IERC1363} from \"../../../interfaces/IERC1363.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n    /**\n     * @dev An operation with an ERC-20 token failed.\n     */\n    error SafeERC20FailedOperation(address token);\n\n    /**\n     * @dev Indicates a failed `decreaseAllowance` request.\n     */\n    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n    /**\n     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeTransfer(IERC20 token, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\n    }\n\n    /**\n     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n     */\n    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\n    }\n\n    /**\n     * @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.\n     */\n    function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {\n        return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));\n    }\n\n    /**\n     * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.\n     */\n    function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {\n        return _callOptionalReturnBool(token, abi.encodeCall(token.transferFrom, (from, to, value)));\n    }\n\n    /**\n     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     *\n     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n     * smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.\n     */\n    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n        uint256 oldAllowance = token.allowance(address(this), spender);\n        forceApprove(token, spender, oldAllowance + value);\n    }\n\n    /**\n     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\n     * value, non-reverting calls are assumed to be successful.\n     *\n     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n     * smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.\n     */\n    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n        unchecked {\n            uint256 currentAllowance = token.allowance(address(this), spender);\n            if (currentAllowance < requestedDecrease) {\n                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);\n            }\n            forceApprove(token, spender, currentAllowance - requestedDecrease);\n        }\n    }\n\n    /**\n     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n     * to be set to zero before setting it to a non-zero value, such as USDT.\n     *\n     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function\n     * only sets the \"standard\" allowance. Any temporary allowance will remain active, in addition to the value being\n     * set here.\n     */\n    function forceApprove(IERC20 token, address spender, uint256 value) internal {\n        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n        if (!_callOptionalReturnBool(token, approvalCall)) {\n            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n            _callOptionalReturn(token, approvalCall);\n        }\n    }\n\n    /**\n     * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no\n     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n     * targeting contracts.\n     *\n     * Reverts if the returned value is other than `true`.\n     */\n    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\n        if (to.code.length == 0) {\n            safeTransfer(token, to, value);\n        } else if (!token.transferAndCall(to, value, data)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target\n     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n     * targeting contracts.\n     *\n     * Reverts if the returned value is other than `true`.\n     */\n    function transferFromAndCallRelaxed(\n        IERC1363 token,\n        address from,\n        address to,\n        uint256 value,\n        bytes memory data\n    ) internal {\n        if (to.code.length == 0) {\n            safeTransferFrom(token, from, to, value);\n        } else if (!token.transferFromAndCall(from, to, value, data)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no\n     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n     * targeting contracts.\n     *\n     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.\n     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}\n     * once without retrying, and relies on the returned value to be true.\n     *\n     * Reverts if the returned value is other than `true`.\n     */\n    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\n        if (to.code.length == 0) {\n            forceApprove(token, to, value);\n        } else if (!token.approveAndCall(to, value, data)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     *\n     * This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.\n     */\n    function _callOptionalReturn(IERC20 token, bytes memory data) private {\n        uint256 returnSize;\n        uint256 returnValue;\n        assembly (\"memory-safe\") {\n            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)\n            // bubble errors\n            if iszero(success) {\n                let ptr := mload(0x40)\n                returndatacopy(ptr, 0, returndatasize())\n                revert(ptr, returndatasize())\n            }\n            returnSize := returndatasize()\n            returnValue := mload(0)\n        }\n\n        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     *\n     * This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.\n     */\n    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n        bool success;\n        uint256 returnSize;\n        uint256 returnValue;\n        assembly (\"memory-safe\") {\n            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)\n            returnSize := returndatasize()\n            returnValue := mload(0)\n        }\n        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/Panic.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/Panic.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Helper library for emitting standardized panic codes.\n *\n * ```solidity\n * contract Example {\n *      using Panic for uint256;\n *\n *      // Use any of the declared internal constants\n *      function foo() { Panic.GENERIC.panic(); }\n *\n *      // Alternatively\n *      function foo() { Panic.panic(Panic.GENERIC); }\n * }\n * ```\n *\n * Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].\n *\n * _Available since v5.1._\n */\n// slither-disable-next-line unused-state\nlibrary Panic {\n    /// @dev generic / unspecified error\n    uint256 internal constant GENERIC = 0x00;\n    /// @dev used by the assert() builtin\n    uint256 internal constant ASSERT = 0x01;\n    /// @dev arithmetic underflow or overflow\n    uint256 internal constant UNDER_OVERFLOW = 0x11;\n    /// @dev division or modulo by zero\n    uint256 internal constant DIVISION_BY_ZERO = 0x12;\n    /// @dev enum conversion error\n    uint256 internal constant ENUM_CONVERSION_ERROR = 0x21;\n    /// @dev invalid encoding in storage\n    uint256 internal constant STORAGE_ENCODING_ERROR = 0x22;\n    /// @dev empty array pop\n    uint256 internal constant EMPTY_ARRAY_POP = 0x31;\n    /// @dev array out of bounds access\n    uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32;\n    /// @dev resource error (too large allocation or too large array)\n    uint256 internal constant RESOURCE_ERROR = 0x41;\n    /// @dev calling invalid internal function\n    uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51;\n\n    /// @dev Reverts with a panic code. Recommended to use with\n    /// the internal constants with predefined codes.\n    function panic(uint256 code) internal pure {\n        assembly (\"memory-safe\") {\n            mstore(0x00, 0x4e487b71)\n            mstore(0x20, code)\n            revert(0x1c, 0x24)\n        }\n    }\n}\n"},{"file_path":"contracts/interfaces/ITransferHook.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.30;\n\n/// @title  ITransferHook\n/// @notice Interface for pre-transfer validation hooks.\n/// @dev    Implementations should revert when a transfer should be blocked.\ninterface ITransferHook {\n    /// @notice Runs validation before a transfer executes.\n    /// @param from address The address sending tokens.\n    function beforeTransfer(address from) external view;\n}\n"},{"file_path":"node_modules/@layerzerolabs/oapp-evm/contracts/oapp/interfaces/IOAppOptionsType3.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Struct representing enforced option parameters.\n */\nstruct EnforcedOptionParam {\n    uint32 eid; // Endpoint ID\n    uint16 msgType; // Message Type\n    bytes options; // Additional options\n}\n\n/**\n * @title IOAppOptionsType3\n * @dev Interface for the OApp with Type 3 Options, allowing the setting and combining of enforced options.\n */\ninterface IOAppOptionsType3 {\n    // Custom error message for invalid options\n    error InvalidOptions(bytes options);\n\n    // Event emitted when enforced options are set\n    event EnforcedOptionSet(EnforcedOptionParam[] _enforcedOptions);\n\n    /**\n     * @notice Sets enforced options for specific endpoint and message type combinations.\n     * @param _enforcedOptions An array of EnforcedOptionParam structures specifying enforced options.\n     */\n    function setEnforcedOptions(EnforcedOptionParam[] calldata _enforcedOptions) external;\n\n    /**\n     * @notice Combines options for a given endpoint and message type.\n     * @param _eid The endpoint ID.\n     * @param _msgType The OApp message type.\n     * @param _extraOptions Additional options passed by the caller.\n     * @return options The combination of caller specified options AND enforced options.\n     */\n    function combineOptions(\n        uint32 _eid,\n        uint16 _msgType,\n        bytes calldata _extraOptions\n    ) external view returns (bytes memory options);\n}\n"},{"file_path":"node_modules/@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessageLibManager.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.0;\n\nstruct SetConfigParam {\n    uint32 eid;\n    uint32 configType;\n    bytes config;\n}\n\ninterface IMessageLibManager {\n    struct Timeout {\n        address lib;\n        uint256 expiry;\n    }\n\n    event LibraryRegistered(address newLib);\n    event DefaultSendLibrarySet(uint32 eid, address newLib);\n    event DefaultReceiveLibrarySet(uint32 eid, address newLib);\n    event DefaultReceiveLibraryTimeoutSet(uint32 eid, address oldLib, uint256 expiry);\n    event SendLibrarySet(address sender, uint32 eid, address newLib);\n    event ReceiveLibrarySet(address receiver, uint32 eid, address newLib);\n    event ReceiveLibraryTimeoutSet(address receiver, uint32 eid, address oldLib, uint256 timeout);\n\n    function registerLibrary(address _lib) external;\n\n    function isRegisteredLibrary(address _lib) external view returns (bool);\n\n    function getRegisteredLibraries() external view returns (address[] memory);\n\n    function setDefaultSendLibrary(uint32 _eid, address _newLib) external;\n\n    function defaultSendLibrary(uint32 _eid) external view returns (address);\n\n    function setDefaultReceiveLibrary(uint32 _eid, address _newLib, uint256 _gracePeriod) external;\n\n    function defaultReceiveLibrary(uint32 _eid) external view returns (address);\n\n    function setDefaultReceiveLibraryTimeout(uint32 _eid, address _lib, uint256 _expiry) external;\n\n    function defaultReceiveLibraryTimeout(uint32 _eid) external view returns (address lib, uint256 expiry);\n\n    function isSupportedEid(uint32 _eid) external view returns (bool);\n\n    function isValidReceiveLibrary(address _receiver, uint32 _eid, address _lib) external view returns (bool);\n\n    /// ------------------- OApp interfaces -------------------\n    function setSendLibrary(address _oapp, uint32 _eid, address _newLib) external;\n\n    function getSendLibrary(address _sender, uint32 _eid) external view returns (address lib);\n\n    function isDefaultSendLibrary(address _sender, uint32 _eid) external view returns (bool);\n\n    function setReceiveLibrary(address _oapp, uint32 _eid, address _newLib, uint256 _gracePeriod) external;\n\n    function getReceiveLibrary(address _receiver, uint32 _eid) external view returns (address lib, bool isDefault);\n\n    function setReceiveLibraryTimeout(address _oapp, uint32 _eid, address _lib, uint256 _expiry) external;\n\n    function receiveLibraryTimeout(address _receiver, uint32 _eid) external view returns (address lib, uint256 expiry);\n\n    function setConfig(address _oapp, address _lib, SetConfigParam[] calldata _params) external;\n\n    function getConfig(\n        address _oapp,\n        address _lib,\n        uint32 _eid,\n        uint32 _configType\n    ) external view returns (bytes memory config);\n}\n"},{"file_path":"contracts/libraries/NestVaultTransferLogic.sol","source_code":"// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.30;\n\nimport {ERC20} from \"@solmate/tokens/ERC20.sol\";\nimport {SafeTransferLib} from \"@solmate/utils/SafeTransferLib.sol\";\nimport {ISignatureTransfer} from \"@uniswap/permit2/interfaces/ISignatureTransfer.sol\";\nimport {NestShareOFT} from \"contracts/NestShareOFT.sol\";\nimport {Errors} from \"contracts/types/Errors.sol\";\n\n/// @title  NestVaultTransferLogic\n/// @notice Library containing transfer helpers with receipt validation\n/// @author plumenetwork\n/// @custom:oz-upgrades-unsafe-allow external-library-linking\nlibrary NestVaultTransferLogic {\n    using SafeTransferLib for ERC20;\n\n    /// @notice Executes transferFrom and validates receiver balance increase\n    /// @param  token         ERC20    The token to transfer\n    /// @param  _owner        address  Owner/source address\n    /// @param  _receiver     address  Receiver address\n    /// @param  _amount       uint256  Requested transfer amount\n    /// @return _amountReceived uint256 Actual amount received by `_receiver`\n    function safeTransferFrom(ERC20 token, address _owner, address _receiver, uint256 _amount)\n        external\n        returns (uint256 _amountReceived)\n    {\n        if (_owner == _receiver) return _amount;\n\n        uint256 _balanceBefore = token.balanceOf(_receiver);\n        // avoid relying on self allowance when transferring from this contract\n        if (_owner == address(this)) {\n            token.safeTransfer(_receiver, _amount);\n        } else {\n            token.safeTransferFrom(_owner, _receiver, _amount);\n        }\n        uint256 _balanceAfter = token.balanceOf(_receiver);\n\n        if (_balanceAfter < _balanceBefore + _amount) revert Errors.TransferInsufficient();\n        _amountReceived = _balanceAfter - _balanceBefore;\n    }\n\n    /// @notice Executes Permit2 transferFrom and validates receiver balance increase\n    /// @param  token         ERC20               The token to transfer\n    /// @param  permit2       ISignatureTransfer  The Permit2 contract\n    /// @param  _owner        address             Owner/source address\n    /// @param  _receiver     address             Receiver address\n    /// @param  _amount       uint256             Requested transfer amount\n    /// @param  _nonce        uint256             Permit2 nonce\n    /// @param  _deadline     uint256             Permit2 deadline\n    /// @param  _signature    bytes               Permit2 signature\n    /// @return _amountReceived uint256           Actual amount received by `_receiver`\n    function safePermit2TransferFrom(\n        ERC20 token,\n        ISignatureTransfer permit2,\n        address _owner,\n        address _receiver,\n        uint256 _amount,\n        uint256 _nonce,\n        uint256 _deadline,\n        bytes memory _signature\n    ) external returns (uint256 _amountReceived) {\n        uint256 _balanceBefore = token.balanceOf(_receiver);\n        permit2.permitTransferFrom(\n            ISignatureTransfer.PermitTransferFrom({\n                permitted: ISignatureTransfer.TokenPermissions({token: address(token), amount: _amount}),\n                nonce: _nonce,\n                deadline: _deadline\n            }),\n            ISignatureTransfer.SignatureTransferDetails({to: _receiver, requestedAmount: _amount}),\n            _owner,\n            _signature\n        );\n        uint256 _balanceAfter = token.balanceOf(_receiver);\n\n        if (_balanceAfter < _balanceBefore + _amount) revert Errors.TransferInsufficient();\n        _amountReceived = _balanceAfter - _balanceBefore;\n    }\n\n    /// @notice Executes share enter and validates receiver share balance increase\n    /// @param  shareToken      NestShareOFT  Share token\n    /// @param  assetToken      ERC20         Asset token\n    /// @param  _assets         uint256       Asset amount to enter\n    /// @param  _receiver       address       Receiver of minted shares\n    /// @param  _shares         uint256       Expected shares to mint\n    function safeEnter(NestShareOFT shareToken, ERC20 assetToken, uint256 _assets, address _receiver, uint256 _shares)\n        external\n    {\n        uint256 _balanceBefore = shareToken.balanceOf(_receiver);\n        shareToken.enter(address(this), assetToken, _assets, _receiver, _shares);\n        uint256 _balanceAfter = shareToken.balanceOf(_receiver);\n\n        if (_balanceAfter < _balanceBefore + _shares) revert Errors.TransferInsufficient();\n    }\n\n    /// @notice Executes share exit and validates receiver asset balance increase\n    /// @param  shareToken      NestShareOFT  Share token\n    /// @param  assetToken      ERC20         Asset token\n    /// @param  _receiver       address       Receiver of assets\n    /// @param  _assets         uint256       Expected asset amount\n    /// @param  _shares         uint256       Shares to burn\n    /// @return _amountReceived uint256       Actual assets received by `_receiver`\n    function safeExit(NestShareOFT shareToken, ERC20 assetToken, address _receiver, uint256 _assets, uint256 _shares)\n        external\n        returns (uint256 _amountReceived)\n    {\n        uint256 _balanceBefore = assetToken.balanceOf(_receiver);\n        shareToken.exit(_receiver, assetToken, _assets, address(this), _shares);\n        uint256 _balanceAfter = assetToken.balanceOf(_receiver);\n\n        if (_balanceAfter < _balanceBefore + _assets) revert Errors.TransferInsufficient();\n        _amountReceived = _balanceAfter - _balanceBefore;\n    }\n}\n"},{"file_path":"node_modules/solmate/src/tokens/ERC20.sol","source_code":"// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)\n/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)\n/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.\nabstract contract ERC20 {\n    /*//////////////////////////////////////////////////////////////\n                                 EVENTS\n    //////////////////////////////////////////////////////////////*/\n\n    event Transfer(address indexed from, address indexed to, uint256 amount);\n\n    event Approval(address indexed owner, address indexed spender, uint256 amount);\n\n    /*//////////////////////////////////////////////////////////////\n                            METADATA STORAGE\n    //////////////////////////////////////////////////////////////*/\n\n    string public name;\n\n    string public symbol;\n\n    uint8 public immutable decimals;\n\n    /*//////////////////////////////////////////////////////////////\n                              ERC20 STORAGE\n    //////////////////////////////////////////////////////////////*/\n\n    uint256 public totalSupply;\n\n    mapping(address => uint256) public balanceOf;\n\n    mapping(address => mapping(address => uint256)) public allowance;\n\n    /*//////////////////////////////////////////////////////////////\n                            EIP-2612 STORAGE\n    //////////////////////////////////////////////////////////////*/\n\n    uint256 internal immutable INITIAL_CHAIN_ID;\n\n    bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;\n\n    mapping(address => uint256) public nonces;\n\n    /*//////////////////////////////////////////////////////////////\n                               CONSTRUCTOR\n    //////////////////////////////////////////////////////////////*/\n\n    constructor(\n        string memory _name,\n        string memory _symbol,\n        uint8 _decimals\n    ) {\n        name = _name;\n        symbol = _symbol;\n        decimals = _decimals;\n\n        INITIAL_CHAIN_ID = block.chainid;\n        INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                               ERC20 LOGIC\n    //////////////////////////////////////////////////////////////*/\n\n    function approve(address spender, uint256 amount) public virtual returns (bool) {\n        allowance[msg.sender][spender] = amount;\n\n        emit Approval(msg.sender, spender, amount);\n\n        return true;\n    }\n\n    function transfer(address to, uint256 amount) public virtual returns (bool) {\n        balanceOf[msg.sender] -= amount;\n\n        // Cannot overflow because the sum of all user\n        // balances can't exceed the max uint256 value.\n        unchecked {\n            balanceOf[to] += amount;\n        }\n\n        emit Transfer(msg.sender, to, amount);\n\n        return true;\n    }\n\n    function transferFrom(\n        address from,\n        address to,\n        uint256 amount\n    ) public virtual returns (bool) {\n        uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.\n\n        if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;\n\n        balanceOf[from] -= amount;\n\n        // Cannot overflow because the sum of all user\n        // balances can't exceed the max uint256 value.\n        unchecked {\n            balanceOf[to] += amount;\n        }\n\n        emit Transfer(from, to, amount);\n\n        return true;\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                             EIP-2612 LOGIC\n    //////////////////////////////////////////////////////////////*/\n\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) public virtual {\n        require(deadline >= block.timestamp, \"PERMIT_DEADLINE_EXPIRED\");\n\n        // Unchecked because the only math done is incrementing\n        // the owner's nonce which cannot realistically overflow.\n        unchecked {\n            address recoveredAddress = ecrecover(\n                keccak256(\n                    abi.encodePacked(\n                        \"\\x19\\x01\",\n                        DOMAIN_SEPARATOR(),\n                        keccak256(\n                            abi.encode(\n                                keccak256(\n                                    \"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\"\n                                ),\n                                owner,\n                                spender,\n                                value,\n                                nonces[owner]++,\n                                deadline\n                            )\n                        )\n                    )\n                ),\n                v,\n                r,\n                s\n            );\n\n            require(recoveredAddress != address(0) && recoveredAddress == owner, \"INVALID_SIGNER\");\n\n            allowance[recoveredAddress][spender] = value;\n        }\n\n        emit Approval(owner, spender, value);\n    }\n\n    function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {\n        return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();\n    }\n\n    function computeDomainSeparator() internal view virtual returns (bytes32) {\n        return\n            keccak256(\n                abi.encode(\n                    keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"),\n                    keccak256(bytes(name)),\n                    keccak256(\"1\"),\n                    block.chainid,\n                    address(this)\n                )\n            );\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                        INTERNAL MINT/BURN LOGIC\n    //////////////////////////////////////////////////////////////*/\n\n    function _mint(address to, uint256 amount) internal virtual {\n        totalSupply += amount;\n\n        // Cannot overflow because the sum of all user\n        // balances can't exceed the max uint256 value.\n        unchecked {\n            balanceOf[to] += amount;\n        }\n\n        emit Transfer(address(0), to, amount);\n    }\n\n    function _burn(address from, uint256 amount) internal virtual {\n        balanceOf[from] -= amount;\n\n        // Cannot underflow because a user's balance\n        // will never be larger than the total supply.\n        unchecked {\n            totalSupply -= amount;\n        }\n\n        emit Transfer(from, address(0), amount);\n    }\n}\n"},{"file_path":"node_modules/@layerzerolabs/oapp-evm-upgradeable/contracts/oapp/OAppUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\n// @dev Import the 'MessagingFee' and 'MessagingReceipt' so it's exposed to OApp implementers\n// solhint-disable-next-line no-unused-import\nimport { OAppSenderUpgradeable, MessagingFee, MessagingReceipt } from \"./OAppSenderUpgradeable.sol\";\n// @dev Import the 'Origin' so it's exposed to OApp implementers\n// solhint-disable-next-line no-unused-import\nimport { OAppReceiverUpgradeable, Origin } from \"./OAppReceiverUpgradeable.sol\";\nimport { OAppCoreUpgradeable } from \"./OAppCoreUpgradeable.sol\";\n\n/**\n * @title OApp\n * @dev Abstract contract serving as the base for OApp implementation, combining OAppSender and OAppReceiver functionality.\n */\nabstract contract OAppUpgradeable is OAppSenderUpgradeable, OAppReceiverUpgradeable {\n    /**\n     * @dev Constructor to initialize the OApp with the provided endpoint and owner.\n     * @param _endpoint The address of the LOCAL LayerZero endpoint.\n     */\n    constructor(address _endpoint) OAppCoreUpgradeable(_endpoint) {}\n\n    /**\n     * @dev Initializes the OApp with the provided delegate.\n     * @param _delegate The delegate capable of making OApp configurations inside of the endpoint.\n     *\n     * @dev The delegate typically should be set as the owner of the contract.\n     * @dev Ownable is not initialized here on purpose. It should be initialized in the child contract to\n     * accommodate the different version of Ownable.\n     */\n    function __OApp_init(address _delegate) internal onlyInitializing {\n        __OAppCore_init(_delegate);\n        __OAppReceiver_init_unchained();\n        __OAppSender_init_unchained();\n    }\n\n    function __OApp_init_unchained() internal onlyInitializing {}\n\n    /**\n     * @notice Retrieves the OApp version information.\n     * @return senderVersion The version of the OAppSender.sol implementation.\n     * @return receiverVersion The version of the OAppReceiver.sol implementation.\n     */\n    function oAppVersion()\n        public\n        pure\n        virtual\n        override(OAppSenderUpgradeable, OAppReceiverUpgradeable)\n        returns (uint64 senderVersion, uint64 receiverVersion)\n    {\n        return (SENDER_VERSION, RECEIVER_VERSION);\n    }\n}\n"},{"file_path":"node_modules/@layerzerolabs/oapp-evm/contracts/oapp/interfaces/IOAppReceiver.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nimport { ILayerZeroReceiver, Origin } from \"@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroReceiver.sol\";\n\ninterface IOAppReceiver is ILayerZeroReceiver {\n    /**\n     * @notice Indicates whether an address is an approved composeMsg sender to the Endpoint.\n     * @param _origin The origin information containing the source endpoint and sender address.\n     *  - srcEid: The source chain endpoint ID.\n     *  - sender: The sender address on the src chain.\n     *  - nonce: The nonce of the message.\n     * @param _message The lzReceive payload.\n     * @param _sender The sender address.\n     * @return isSender Is a valid sender.\n     *\n     * @dev Applications can optionally choose to implement a separate composeMsg sender that is NOT the bridging layer.\n     * @dev The default sender IS the OAppReceiver implementer.\n     */\n    function isComposeMsgSender(\n        Origin calldata _origin,\n        bytes calldata _message,\n        address _sender\n    ) external view returns (bool isSender);\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/Context.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\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    function _contextSuffixLength() internal view virtual returns (uint256) {\n        return 0;\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts-upgradeable/utils/NoncesUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Nonces.sol)\npragma solidity ^0.8.20;\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides tracking nonces for addresses. Nonces will only increment.\n */\nabstract contract NoncesUpgradeable is Initializable {\n    /**\n     * @dev The nonce used for an `account` is not the expected current nonce.\n     */\n    error InvalidAccountNonce(address account, uint256 currentNonce);\n\n    /// @custom:storage-location erc7201:openzeppelin.storage.Nonces\n    struct NoncesStorage {\n        mapping(address account => uint256) _nonces;\n    }\n\n    // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.Nonces\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant NoncesStorageLocation = 0x5ab42ced628888259c08ac98db1eb0cf702fc1501344311d8b100cd1bfe4bb00;\n\n    function _getNoncesStorage() private pure returns (NoncesStorage storage $) {\n        assembly {\n            $.slot := NoncesStorageLocation\n        }\n    }\n\n    function __Nonces_init() internal onlyInitializing {\n    }\n\n    function __Nonces_init_unchained() internal onlyInitializing {\n    }\n    /**\n     * @dev Returns the next unused nonce for an address.\n     */\n    function nonces(address owner) public view virtual returns (uint256) {\n        NoncesStorage storage $ = _getNoncesStorage();\n        return $._nonces[owner];\n    }\n\n    /**\n     * @dev Consumes a nonce.\n     *\n     * Returns the current value and increments nonce.\n     */\n    function _useNonce(address owner) internal virtual returns (uint256) {\n        NoncesStorage storage $ = _getNoncesStorage();\n        // For each account, the nonce has an initial value of 0, can only be incremented by one, and cannot be\n        // decremented or reset. This guarantees that the nonce never overflows.\n        unchecked {\n            // It is important to do x++ and not ++x here.\n            return $._nonces[owner]++;\n        }\n    }\n\n    /**\n     * @dev Same as {_useNonce} but checking that `nonce` is the next valid for `owner`.\n     */\n    function _useCheckedNonce(address owner, uint256 nonce) internal virtual {\n        uint256 current = _useNonce(owner);\n        if (nonce != current) {\n            revert InvalidAccountNonce(owner, current);\n        }\n    }\n}\n"},{"file_path":"node_modules/@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroReceiver.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.0;\n\nimport { Origin } from \"./ILayerZeroEndpointV2.sol\";\n\ninterface ILayerZeroReceiver {\n    function allowInitializePath(Origin calldata _origin) external view returns (bool);\n\n    function nextNonce(uint32 _eid, bytes32 _sender) external view returns (uint64);\n\n    function lzReceive(\n        Origin calldata _origin,\n        bytes32 _guid,\n        bytes calldata _message,\n        address _executor,\n        bytes calldata _extraData\n    ) external payable;\n}\n"},{"file_path":"node_modules/solmate/src/auth/Auth.sol","source_code":"// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Provides a flexible and updatable auth pattern which is completely separate from application logic.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\nabstract contract Auth {\n    event OwnershipTransferred(address indexed user, address indexed newOwner);\n\n    event AuthorityUpdated(address indexed user, Authority indexed newAuthority);\n\n    address public owner;\n\n    Authority public authority;\n\n    constructor(address _owner, Authority _authority) {\n        owner = _owner;\n        authority = _authority;\n\n        emit OwnershipTransferred(msg.sender, _owner);\n        emit AuthorityUpdated(msg.sender, _authority);\n    }\n\n    modifier requiresAuth() virtual {\n        require(isAuthorized(msg.sender, msg.sig), \"UNAUTHORIZED\");\n\n        _;\n    }\n\n    function isAuthorized(address user, bytes4 functionSig) internal view virtual returns (bool) {\n        Authority auth = authority; // Memoizing authority saves us a warm SLOAD, around 100 gas.\n\n        // Checking if the caller is the owner only after calling the authority saves gas in most cases, but be\n        // aware that this makes protected functions uncallable even to the owner if the authority is out of order.\n        return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner;\n    }\n\n    function setAuthority(Authority newAuthority) public virtual {\n        // We check if the caller is the owner first because we want to ensure they can\n        // always swap out the authority even if it's reverting or using up a lot of gas.\n        require(msg.sender == owner || authority.canCall(msg.sender, address(this), msg.sig));\n\n        authority = newAuthority;\n\n        emit AuthorityUpdated(msg.sender, newAuthority);\n    }\n\n    function transferOwnership(address newOwner) public virtual requiresAuth {\n        owner = newOwner;\n\n        emit OwnershipTransferred(msg.sender, newOwner);\n    }\n}\n\n/// @notice A generic interface for a contract which provides authorization data to an Auth instance.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\ninterface Authority {\n    function canCall(\n        address user,\n        address target,\n        bytes4 functionSig\n    ) external view returns (bool);\n}\n"},{"file_path":"node_modules/@layerzerolabs/oapp-evm/contracts/precrime/libs/Packet.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\nimport { Origin } from \"@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol\";\nimport { PacketV1Codec } from \"@layerzerolabs/lz-evm-protocol-v2/contracts/messagelib/libs/PacketV1Codec.sol\";\n\n/**\n * @title InboundPacket\n * @dev Structure representing an inbound packet received by the contract.\n */\nstruct InboundPacket {\n    Origin origin; // Origin information of the packet.\n    uint32 dstEid; // Destination endpointId of the packet.\n    address receiver; // Receiver address for the packet.\n    bytes32 guid; // Unique identifier of the packet.\n    uint256 value; // msg.value of the packet.\n    address executor; // Executor address for the packet.\n    bytes message; // Message payload of the packet.\n    bytes extraData; // Additional arbitrary data for the packet.\n}\n\n/**\n * @title PacketDecoder\n * @dev Library for decoding LayerZero packets.\n */\nlibrary PacketDecoder {\n    using PacketV1Codec for bytes;\n\n    /**\n     * @dev Decode an inbound packet from the given packet data.\n     * @param _packet The packet data to decode.\n     * @return packet An InboundPacket struct representing the decoded packet.\n     */\n    function decode(bytes calldata _packet) internal pure returns (InboundPacket memory packet) {\n        packet.origin = Origin(_packet.srcEid(), _packet.sender(), _packet.nonce());\n        packet.dstEid = _packet.dstEid();\n        packet.receiver = _packet.receiverB20();\n        packet.guid = _packet.guid();\n        packet.message = _packet.message();\n    }\n\n    /**\n     * @dev Decode multiple inbound packets from the given packet data and associated message values.\n     * @param _packets An array of packet data to decode.\n     * @param _packetMsgValues An array of associated message values for each packet.\n     * @return packets An array of InboundPacket structs representing the decoded packets.\n     */\n    function decode(\n        bytes[] calldata _packets,\n        uint256[] memory _packetMsgValues\n    ) internal pure returns (InboundPacket[] memory packets) {\n        packets = new InboundPacket[](_packets.length);\n        for (uint256 i = 0; i < _packets.length; i++) {\n            bytes calldata packet = _packets[i];\n            packets[i] = PacketDecoder.decode(packet);\n            // @dev Allows the verifier to specify the msg.value that gets passed in lzReceive.\n            packets[i].value = _packetMsgValues[i];\n        }\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/interfaces/IERC1271.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1271.sol)\n\npragma solidity >=0.5.0;\n\n/**\n * @dev Interface of the ERC-1271 standard signature validation method for\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\n */\ninterface IERC1271 {\n    /**\n     * @dev Should return whether the signature provided is valid for the provided data\n     * @param hash      Hash of the data to be signed\n     * @param signature Signature byte array associated with `hash`\n     */\n    function isValidSignature(bytes32 hash, bytes calldata signature) external view returns (bytes4 magicValue);\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/TransientSlot.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.3.0) (utils/TransientSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/TransientSlot.js.\n\npragma solidity ^0.8.24;\n\n/**\n * @dev Library for reading and writing value-types to specific transient storage slots.\n *\n * Transient slots are often used to store temporary values that are removed after the current transaction.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n *  * Example reading and writing values using transient storage:\n * ```solidity\n * contract Lock {\n *     using TransientSlot for *;\n *\n *     // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.\n *     bytes32 internal constant _LOCK_SLOT = 0xf4678858b2b588224636b8522b729e7722d32fc491da849ed75b3fdf3c84f542;\n *\n *     modifier locked() {\n *         require(!_LOCK_SLOT.asBoolean().tload());\n *\n *         _LOCK_SLOT.asBoolean().tstore(true);\n *         _;\n *         _LOCK_SLOT.asBoolean().tstore(false);\n *     }\n * }\n * ```\n *\n * TIP: Consider using this library along with {SlotDerivation}.\n */\nlibrary TransientSlot {\n    /**\n     * @dev UDVT that represents a slot holding an address.\n     */\n    type AddressSlot is bytes32;\n\n    /**\n     * @dev Cast an arbitrary slot to a AddressSlot.\n     */\n    function asAddress(bytes32 slot) internal pure returns (AddressSlot) {\n        return AddressSlot.wrap(slot);\n    }\n\n    /**\n     * @dev UDVT that represents a slot holding a bool.\n     */\n    type BooleanSlot is bytes32;\n\n    /**\n     * @dev Cast an arbitrary slot to a BooleanSlot.\n     */\n    function asBoolean(bytes32 slot) internal pure returns (BooleanSlot) {\n        return BooleanSlot.wrap(slot);\n    }\n\n    /**\n     * @dev UDVT that represents a slot holding a bytes32.\n     */\n    type Bytes32Slot is bytes32;\n\n    /**\n     * @dev Cast an arbitrary slot to a Bytes32Slot.\n     */\n    function asBytes32(bytes32 slot) internal pure returns (Bytes32Slot) {\n        return Bytes32Slot.wrap(slot);\n    }\n\n    /**\n     * @dev UDVT that represents a slot holding a uint256.\n     */\n    type Uint256Slot is bytes32;\n\n    /**\n     * @dev Cast an arbitrary slot to a Uint256Slot.\n     */\n    function asUint256(bytes32 slot) internal pure returns (Uint256Slot) {\n        return Uint256Slot.wrap(slot);\n    }\n\n    /**\n     * @dev UDVT that represents a slot holding a int256.\n     */\n    type Int256Slot is bytes32;\n\n    /**\n     * @dev Cast an arbitrary slot to a Int256Slot.\n     */\n    function asInt256(bytes32 slot) internal pure returns (Int256Slot) {\n        return Int256Slot.wrap(slot);\n    }\n\n    /**\n     * @dev Load the value held at location `slot` in transient storage.\n     */\n    function tload(AddressSlot slot) internal view returns (address value) {\n        assembly (\"memory-safe\") {\n            value := tload(slot)\n        }\n    }\n\n    /**\n     * @dev Store `value` at location `slot` in transient storage.\n     */\n    function tstore(AddressSlot slot, address value) internal {\n        assembly (\"memory-safe\") {\n            tstore(slot, value)\n        }\n    }\n\n    /**\n     * @dev Load the value held at location `slot` in transient storage.\n     */\n    function tload(BooleanSlot slot) internal view returns (bool value) {\n        assembly (\"memory-safe\") {\n            value := tload(slot)\n        }\n    }\n\n    /**\n     * @dev Store `value` at location `slot` in transient storage.\n     */\n    function tstore(BooleanSlot slot, bool value) internal {\n        assembly (\"memory-safe\") {\n            tstore(slot, value)\n        }\n    }\n\n    /**\n     * @dev Load the value held at location `slot` in transient storage.\n     */\n    function tload(Bytes32Slot slot) internal view returns (bytes32 value) {\n        assembly (\"memory-safe\") {\n            value := tload(slot)\n        }\n    }\n\n    /**\n     * @dev Store `value` at location `slot` in transient storage.\n     */\n    function tstore(Bytes32Slot slot, bytes32 value) internal {\n        assembly (\"memory-safe\") {\n            tstore(slot, value)\n        }\n    }\n\n    /**\n     * @dev Load the value held at location `slot` in transient storage.\n     */\n    function tload(Uint256Slot slot) internal view returns (uint256 value) {\n        assembly (\"memory-safe\") {\n            value := tload(slot)\n        }\n    }\n\n    /**\n     * @dev Store `value` at location `slot` in transient storage.\n     */\n    function tstore(Uint256Slot slot, uint256 value) internal {\n        assembly (\"memory-safe\") {\n            tstore(slot, value)\n        }\n    }\n\n    /**\n     * @dev Load the value held at location `slot` in transient storage.\n     */\n    function tload(Int256Slot slot) internal view returns (int256 value) {\n        assembly (\"memory-safe\") {\n            value := tload(slot)\n        }\n    }\n\n    /**\n     * @dev Store `value` at location `slot` in transient storage.\n     */\n    function tstore(Int256Slot slot, int256 value) internal {\n        assembly (\"memory-safe\") {\n            tstore(slot, value)\n        }\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/Address.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (utils/Address.sol)\n\npragma solidity ^0.8.20;\n\nimport {Errors} from \"./Errors.sol\";\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev There's no code at `target` (it is not a contract).\n     */\n    error AddressEmptyCode(address target);\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        if (address(this).balance < amount) {\n            revert Errors.InsufficientBalance(address(this).balance, amount);\n        }\n\n        (bool success, bytes memory returndata) = recipient.call{value: amount}(\"\");\n        if (!success) {\n            _revert(returndata);\n        }\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason or custom error, it is bubbled\n     * up by this function (like regular Solidity function calls). However, if\n     * the call reverted with no returned reason, this function reverts with a\n     * {Errors.FailedCall} error.\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n        if (address(this).balance < value) {\n            revert Errors.InsufficientBalance(address(this).balance, value);\n        }\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n     * was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case\n     * of an unsuccessful call.\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata\n    ) internal view returns (bytes memory) {\n        if (!success) {\n            _revert(returndata);\n        } else {\n            // only check if target is a contract if the call was successful and the return data is empty\n            // otherwise we already know that it was a contract\n            if (returndata.length == 0 && target.code.length == 0) {\n                revert AddressEmptyCode(target);\n            }\n            return returndata;\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n     * revert reason or with a default {Errors.FailedCall} error.\n     */\n    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n        if (!success) {\n            _revert(returndata);\n        } else {\n            return returndata;\n        }\n    }\n\n    /**\n     * @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}.\n     */\n    function _revert(bytes memory returndata) private pure {\n        // Look for revert reason and bubble it up if present\n        if (returndata.length > 0) {\n            // The easiest way to bubble the revert reason is using memory via assembly\n            assembly (\"memory-safe\") {\n                revert(add(returndata, 0x20), mload(returndata))\n            }\n        } else {\n            revert Errors.FailedCall();\n        }\n    }\n}\n"},{"file_path":"node_modules/@layerzerolabs/oapp-evm-upgradeable/contracts/oapp/OAppReceiverUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\nimport { IOAppReceiver, Origin } from \"@layerzerolabs/oapp-evm/contracts/oapp/interfaces/IOAppReceiver.sol\";\nimport { OAppCoreUpgradeable } from \"./OAppCoreUpgradeable.sol\";\n\n/**\n * @title OAppReceiver\n * @dev Abstract contract implementing the ILayerZeroReceiver interface and extending OAppCore for OApp receivers.\n */\nabstract contract OAppReceiverUpgradeable is IOAppReceiver, OAppCoreUpgradeable {\n    // Custom error message for when the caller is not the registered endpoint/\n    error OnlyEndpoint(address addr);\n\n    // @dev The version of the OAppReceiver implementation.\n    // @dev Version is bumped when changes are made to this contract.\n    uint64 internal constant RECEIVER_VERSION = 2;\n\n    /**\n     * @param _delegate The delegate capable of making OApp configurations inside of the endpoint.\n     * @dev Ownable is not initialized here on purpose. It should be initialized in the child contract to\n     * accommodate the different version of Ownable.\n     */\n    function __OAppReceiver_init(address _delegate) internal onlyInitializing {\n        __OAppCore_init(_delegate);\n    }\n\n    function __OAppReceiver_init_unchained() internal onlyInitializing {}\n\n    /**\n     * @notice Retrieves the OApp version information.\n     * @return senderVersion The version of the OAppSender.sol contract.\n     * @return receiverVersion The version of the OAppReceiver.sol contract.\n     *\n     * @dev Providing 0 as the default for OAppSender version. Indicates that the OAppSender is not implemented.\n     * ie. this is a RECEIVE only OApp.\n     * @dev If the OApp uses both OAppSender and OAppReceiver, then this needs to be override returning the correct versions.\n     */\n    function oAppVersion() public view virtual returns (uint64 senderVersion, uint64 receiverVersion) {\n        return (0, RECEIVER_VERSION);\n    }\n\n    /**\n     * @notice Indicates whether an address is an approved composeMsg sender to the Endpoint.\n     * @dev _origin The origin information containing the source endpoint and sender address.\n     *  - srcEid: The source chain endpoint ID.\n     *  - sender: The sender address on the src chain.\n     *  - nonce: The nonce of the message.\n     * @dev _message The lzReceive payload.\n     * @param _sender The sender address.\n     * @return isSender Is a valid sender.\n     *\n     * @dev Applications can optionally choose to implement separate composeMsg senders that are NOT the bridging layer.\n     * @dev The default sender IS the OAppReceiver implementer.\n     */\n    function isComposeMsgSender(\n        Origin calldata /*_origin*/,\n        bytes calldata /*_message*/,\n        address _sender\n    ) public view virtual returns (bool) {\n        return _sender == address(this);\n    }\n\n    /**\n     * @notice Checks if the path initialization is allowed based on the provided origin.\n     * @param origin The origin information containing the source endpoint and sender address.\n     * @return Whether the path has been initialized.\n     *\n     * @dev This indicates to the endpoint that the OApp has enabled msgs for this particular path to be received.\n     * @dev This defaults to assuming if a peer has been set, its initialized.\n     * Can be overridden by the OApp if there is other logic to determine this.\n     */\n    function allowInitializePath(Origin calldata origin) public view virtual returns (bool) {\n        return peers(origin.srcEid) == origin.sender;\n    }\n\n    /**\n     * @notice Retrieves the next nonce for a given source endpoint and sender address.\n     * @dev _srcEid The source endpoint ID.\n     * @dev _sender The sender address.\n     * @return nonce The next nonce.\n     *\n     * @dev The path nonce starts from 1. If 0 is returned it means that there is NO nonce ordered enforcement.\n     * @dev Is required by the off-chain executor to determine the OApp expects msg execution is ordered.\n     * @dev This is also enforced by the OApp.\n     * @dev By default this is NOT enabled. ie. nextNonce is hardcoded to return 0.\n     */\n    function nextNonce(uint32, /*_srcEid*/ bytes32 /*_sender*/) public view virtual returns (uint64 nonce) {\n        return 0;\n    }\n\n    /**\n     * @dev Entry point for receiving messages or packets from the endpoint.\n     * @param _origin The origin information containing the source endpoint and sender address.\n     *  - srcEid: The source chain endpoint ID.\n     *  - sender: The sender address on the src chain.\n     *  - nonce: The nonce of the message.\n     * @param _guid The unique identifier for the received LayerZero message.\n     * @param _message The payload of the received message.\n     * @param _executor The address of the executor for the received message.\n     * @param _extraData Additional arbitrary data provided by the corresponding executor.\n     *\n     * @dev Entry point for receiving msg/packet from the LayerZero endpoint.\n     */\n    function lzReceive(\n        Origin calldata _origin,\n        bytes32 _guid,\n        bytes calldata _message,\n        address _executor,\n        bytes calldata _extraData\n    ) public payable virtual {\n        // Ensures that only the endpoint can attempt to lzReceive() messages to this OApp.\n        if (address(endpoint) != msg.sender) revert OnlyEndpoint(msg.sender);\n\n        // Ensure that the sender matches the expected peer for the source endpoint.\n        if (_getPeerOrRevert(_origin.srcEid) != _origin.sender) revert OnlyPeer(_origin.srcEid, _origin.sender);\n\n        // Call the internal OApp implementation of lzReceive.\n        _lzReceive(_origin, _guid, _message, _executor, _extraData);\n    }\n\n    /**\n     * @dev Internal function to implement lzReceive logic without needing to copy the basic parameter validation.\n     */\n    function _lzReceive(\n        Origin calldata _origin,\n        bytes32 _guid,\n        bytes calldata _message,\n        address _executor,\n        bytes calldata _extraData\n    ) internal virtual;\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardTransientUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.3.0) (utils/ReentrancyGuardTransient.sol)\n\npragma solidity ^0.8.24;\n\nimport {TransientSlot} from \"@openzeppelin/contracts/utils/TransientSlot.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Variant of {ReentrancyGuard} that uses transient storage.\n *\n * NOTE: This variant only works on networks where EIP-1153 is available.\n *\n * _Available since v5.1._\n */\nabstract contract ReentrancyGuardTransientUpgradeable is Initializable {\n    using TransientSlot for *;\n\n    // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.ReentrancyGuard\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant REENTRANCY_GUARD_STORAGE =\n        0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;\n\n    /**\n     * @dev Unauthorized reentrant call.\n     */\n    error ReentrancyGuardReentrantCall();\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 __ReentrancyGuardTransient_init() internal onlyInitializing {\n    }\n\n    function __ReentrancyGuardTransient_init_unchained() internal onlyInitializing {\n    }\n    function _nonReentrantBefore() private {\n        // On the first call to nonReentrant, REENTRANCY_GUARD_STORAGE.asBoolean().tload() will be false\n        if (_reentrancyGuardEntered()) {\n            revert ReentrancyGuardReentrantCall();\n        }\n\n        // Any calls to nonReentrant after this point will fail\n        REENTRANCY_GUARD_STORAGE.asBoolean().tstore(true);\n    }\n\n    function _nonReentrantAfter() private {\n        REENTRANCY_GUARD_STORAGE.asBoolean().tstore(false);\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 REENTRANCY_GUARD_STORAGE.asBoolean().tload();\n    }\n}\n"},{"file_path":"node_modules/@layerzerolabs/oft-evm-upgradeable/contracts/oft/OFTCoreUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\nimport { OAppUpgradeable, Origin } from \"@layerzerolabs/oapp-evm-upgradeable/contracts/oapp/OAppUpgradeable.sol\";\nimport { OAppOptionsType3Upgradeable } from \"@layerzerolabs/oapp-evm-upgradeable/contracts/oapp/libs/OAppOptionsType3Upgradeable.sol\";\nimport { IOAppMsgInspector } from \"@layerzerolabs/oapp-evm/contracts/oapp/interfaces/IOAppMsgInspector.sol\";\n\nimport { OAppPreCrimeSimulatorUpgradeable } from \"@layerzerolabs/oapp-evm-upgradeable/contracts/precrime/OAppPreCrimeSimulatorUpgradeable.sol\";\n\nimport { IOFT, SendParam, OFTLimit, OFTReceipt, OFTFeeDetail, MessagingReceipt, MessagingFee } from \"@layerzerolabs/oft-evm/contracts/interfaces/IOFT.sol\";\nimport { OFTMsgCodec } from \"@layerzerolabs/oft-evm/contracts/libs/OFTMsgCodec.sol\";\nimport { OFTComposeMsgCodec } from \"@layerzerolabs/oft-evm/contracts/libs/OFTComposeMsgCodec.sol\";\n\n/**\n * @title OFTCore\n * @dev Abstract contract for the OftChain (OFT) token.\n */\nabstract contract OFTCoreUpgradeable is\n    IOFT,\n    OAppUpgradeable,\n    OAppPreCrimeSimulatorUpgradeable,\n    OAppOptionsType3Upgradeable\n{\n    using OFTMsgCodec for bytes;\n    using OFTMsgCodec for bytes32;\n\n    struct OFTCoreStorage {\n        // Address of an optional contract to inspect both 'message' and 'options'\n        address msgInspector;\n    }\n\n    // keccak256(abi.encode(uint256(keccak256(\"layerzerov2.storage.oftcore\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant OFT_CORE_STORAGE_LOCATION =\n        0x41db8a78b0206aba5c54bcbfc2bda0d84082a84eb88e680379a57b9e9f653c00;\n\n    // @notice Provides a conversion rate when swapping between denominations of SD and LD\n    //      - shareDecimals == SD == shared Decimals\n    //      - localDecimals == LD == local decimals\n    // @dev Considers that tokens have different decimal amounts on various chains.\n    // @dev eg.\n    //  For a token\n    //      - locally with 4 decimals --> 1.2345 => uint(12345)\n    //      - remotely with 2 decimals --> 1.23 => uint(123)\n    //      - The conversion rate would be 10 ** (4 - 2) = 100\n    //  @dev If you want to send 1.2345 -> (uint 12345), you CANNOT represent that value on the remote,\n    //  you can only display 1.23 -> uint(123).\n    //  @dev To preserve the dust that would otherwise be lost on that conversion,\n    //  we need to unify a denomination that can be represented on ALL chains inside of the OFT mesh\n    uint256 public immutable decimalConversionRate;\n\n    // @notice Msg types that are used to identify the various OFT operations.\n    // @dev This can be extended in child contracts for non-default oft operations\n    // @dev These values are used in things like combineOptions() in OAppOptionsType3.sol.\n    uint16 public constant SEND = 1;\n    uint16 public constant SEND_AND_CALL = 2;\n\n    event MsgInspectorSet(address inspector);\n\n    function _getOFTCoreStorage() internal pure returns (OFTCoreStorage storage $) {\n        assembly {\n            $.slot := OFT_CORE_STORAGE_LOCATION\n        }\n    }\n\n    /**\n     * @dev Constructor.\n     * @param _localDecimals The decimals of the token on the local chain (this chain).\n     * @param _endpoint The address of the LayerZero endpoint.\n     */\n    constructor(uint8 _localDecimals, address _endpoint) OAppUpgradeable(_endpoint) {\n        if (_localDecimals < sharedDecimals()) revert InvalidLocalDecimals();\n        decimalConversionRate = 10 ** (_localDecimals - sharedDecimals());\n    }\n\n    /**\n     * @notice Retrieves interfaceID and the version of the OFT.\n     * @return interfaceId The interface ID.\n     * @return version The version.\n     *\n     * @dev interfaceId: This specific interface ID is '0x02e49c2c'.\n     * @dev version: Indicates a cross-chain compatible msg encoding with other OFTs.\n     * @dev If a new feature is added to the OFT cross-chain msg encoding, the version will be incremented.\n     * ie. localOFT version(x,1) CAN send messages to remoteOFT version(x,1)\n     */\n    function oftVersion() external pure virtual returns (bytes4 interfaceId, uint64 version) {\n        return (type(IOFT).interfaceId, 1);\n    }\n\n    /**\n     * @dev Initializes the OFTCore contract.\n     * @param _delegate The delegate capable of making OApp configurations inside of the endpoint.\n     *\n     * @dev The delegate typically should be set as the owner of the contract.\n     * @dev Ownable is not initialized here on purpose. It should be initialized in the child contract to\n     * accommodate the different version of Ownable.\n     */\n    function __OFTCore_init(address _delegate) internal onlyInitializing {\n        __OApp_init(_delegate);\n        __OAppPreCrimeSimulator_init();\n        __OAppOptionsType3_init();\n    }\n\n    function __OFTCore_init_unchained() internal onlyInitializing {}\n\n    function msgInspector() public view returns (address) {\n        OFTCoreStorage storage $ = _getOFTCoreStorage();\n        return $.msgInspector;\n    }\n\n    /**\n     * @dev Retrieves the shared decimals of the OFT.\n     * @return The shared decimals of the OFT.\n     *\n     * @dev Sets an implicit cap on the amount of tokens, over uint64.max() will need some sort of outbound cap / totalSupply cap\n     * Lowest common decimal denominator between chains.\n     * Defaults to 6 decimal places to provide up to 18,446,744,073,709.551615 units (max uint64).\n     * For tokens exceeding this totalSupply(), they will need to override the sharedDecimals function with something smaller.\n     * ie. 4 sharedDecimals would be 1,844,674,407,370,955.1615\n     */\n    function sharedDecimals() public pure virtual returns (uint8) {\n        return 6;\n    }\n\n    /**\n     * @dev Sets the message inspector address for the OFT.\n     * @param _msgInspector The address of the message inspector.\n     *\n     * @dev This is an optional contract that can be used to inspect both 'message' and 'options'.\n     * @dev Set it to address(0) to disable it, or set it to a contract address to enable it.\n     */\n    function setMsgInspector(address _msgInspector) public virtual onlyOwner {\n        OFTCoreStorage storage $ = _getOFTCoreStorage();\n        $.msgInspector = _msgInspector;\n        emit MsgInspectorSet(_msgInspector);\n    }\n\n    /**\n     * @notice Provides a quote for OFT-related operations.\n     * @param _sendParam The parameters for the send operation.\n     * @return oftLimit The OFT limit information.\n     * @return oftFeeDetails The details of OFT fees.\n     * @return oftReceipt The OFT receipt information.\n     */\n    function quoteOFT(\n        SendParam calldata _sendParam\n    )\n        external\n        view\n        virtual\n        returns (OFTLimit memory oftLimit, OFTFeeDetail[] memory oftFeeDetails, OFTReceipt memory oftReceipt)\n    {\n        uint256 minAmountLD = 0; // Unused in the default implementation.\n        uint256 maxAmountLD = type(uint256).max; // Unused in the default implementation.\n        oftLimit = OFTLimit(minAmountLD, maxAmountLD);\n\n        // Unused in the default implementation; reserved for future complex fee details.\n        oftFeeDetails = new OFTFeeDetail[](0);\n\n        // @dev This is the same as the send() operation, but without the actual send.\n        // - amountSentLD is the amount in local decimals that would be sent from the sender.\n        // - amountReceivedLD is the amount in local decimals that will be credited to the recipient on the remote OFT instance.\n        // @dev The amountSentLD MIGHT not equal the amount the user actually receives. HOWEVER, the default does.\n        (uint256 amountSentLD, uint256 amountReceivedLD) = _debitView(\n            _sendParam.amountLD,\n            _sendParam.minAmountLD,\n            _sendParam.dstEid\n        );\n        oftReceipt = OFTReceipt(amountSentLD, amountReceivedLD);\n    }\n\n    /**\n     * @notice Provides a quote for the send() operation.\n     * @param _sendParam The parameters for the send() operation.\n     * @param _payInLzToken Flag indicating whether the caller is paying in the LZ token.\n     * @return msgFee The calculated LayerZero messaging fee from the send() operation.\n     *\n     * @dev MessagingFee: LayerZero msg fee\n     *  - nativeFee: The native fee.\n     *  - lzTokenFee: The lzToken fee.\n     */\n    function quoteSend(\n        SendParam calldata _sendParam,\n        bool _payInLzToken\n    ) external view virtual returns (MessagingFee memory msgFee) {\n        // @dev mock the amount to receive, this is the same operation used in the send().\n        // The quote is as similar as possible to the actual send() operation.\n        (, uint256 amountReceivedLD) = _debitView(_sendParam.amountLD, _sendParam.minAmountLD, _sendParam.dstEid);\n\n        // @dev Builds the options and OFT message to quote in the endpoint.\n        (bytes memory message, bytes memory options) = _buildMsgAndOptions(_sendParam, amountReceivedLD);\n\n        // @dev Calculates the LayerZero fee for the send() operation.\n        return _quote(_sendParam.dstEid, message, options, _payInLzToken);\n    }\n\n    /**\n     * @dev Executes the send operation.\n     * @param _sendParam The parameters for the send operation.\n     * @param _fee The calculated fee for the send() operation.\n     *      - nativeFee: The native fee.\n     *      - lzTokenFee: The lzToken fee.\n     * @param _refundAddress The address to receive any excess funds.\n     * @return msgReceipt The receipt for the send operation.\n     * @return oftReceipt The OFT receipt information.\n     *\n     * @dev MessagingReceipt: LayerZero msg receipt\n     *  - guid: The unique identifier for the sent message.\n     *  - nonce: The nonce of the sent message.\n     *  - fee: The LayerZero fee incurred for the message.\n     */\n    function send(\n        SendParam calldata _sendParam,\n        MessagingFee calldata _fee,\n        address _refundAddress\n    ) external payable virtual returns (MessagingReceipt memory msgReceipt, OFTReceipt memory oftReceipt) {\n        return _send(_sendParam, _fee, _refundAddress);\n    }\n\n    /**\n     * @dev Internal function to execute send operations.\n     * @param _sendParam The parameters for the send operation.\n     * @param _fee The calculated LayerZero messaging fee from the send() operation.\n     * @param _refundAddress The address to receive any excess funds from LayerZero fees.\n     * @return msgReceipt The receipt from the LayerZero messaging library.\n     * @return oftReceipt The OFT receipt information.\n     */\n    function _send(\n        SendParam calldata _sendParam,\n        MessagingFee calldata _fee,\n        address _refundAddress\n    ) internal virtual returns (MessagingReceipt memory msgReceipt, OFTReceipt memory oftReceipt) {\n        // @dev Applies the token transfers regarding this send() operation.\n        // - amountSentLD is the amount in local decimals that was ACTUALLY sent/debited from the sender.\n        // - amountReceivedLD is the amount in local decimals that will be received/credited to the recipient on the remote OFT instance.\n        (uint256 amountSentLD, uint256 amountReceivedLD) = _debit(\n            msg.sender,\n            _sendParam.amountLD,\n            _sendParam.minAmountLD,\n            _sendParam.dstEid\n        );\n\n        // @dev Builds the options and OFT message to quote in the endpoint.\n        (bytes memory message, bytes memory options) = _buildMsgAndOptions(_sendParam, amountReceivedLD);\n\n        // @dev Sends the message to the LayerZero endpoint and returns the LayerZero msg receipt.\n        msgReceipt = _lzSend(_sendParam.dstEid, message, options, _fee, _refundAddress);\n        // @dev Formulate the OFT receipt.\n        oftReceipt = OFTReceipt(amountSentLD, amountReceivedLD);\n\n        emit OFTSent(msgReceipt.guid, _sendParam.dstEid, msg.sender, amountSentLD, amountReceivedLD);\n    }\n\n    /**\n     * @dev Internal function to build the message and options.\n     * @param _sendParam The parameters for the send() operation.\n     * @param _amountLD The amount in local decimals.\n     * @return message The encoded message.\n     * @return options The encoded options.\n     */\n    function _buildMsgAndOptions(\n        SendParam calldata _sendParam,\n        uint256 _amountLD\n    ) internal view virtual returns (bytes memory message, bytes memory options) {\n        bool hasCompose;\n        // @dev This generated message has the msg.sender encoded into the payload so the remote knows who the caller is.\n        (message, hasCompose) = OFTMsgCodec.encode(\n            _sendParam.to,\n            _toSD(_amountLD),\n            // @dev Must be include a non empty bytes if you want to compose, EVEN if you dont need it on the remote.\n            // EVEN if you dont require an arbitrary payload to be sent... eg. '0x01'\n            _sendParam.composeMsg\n        );\n        // @dev Change the msg type depending if its composed or not.\n        uint16 msgType = hasCompose ? SEND_AND_CALL : SEND;\n        // @dev Combine the callers _extraOptions with the enforced options via the OAppOptionsType3.\n        options = combineOptions(_sendParam.dstEid, msgType, _sendParam.extraOptions);\n\n        OFTCoreStorage storage $ = _getOFTCoreStorage();\n\n        // @dev Optionally inspect the message and options depending if the OApp owner has set a msg inspector.\n        // @dev If it fails inspection, needs to revert in the implementation. ie. does not rely on return boolean\n        address inspector = $.msgInspector; // caches the msgInspector to avoid potential double storage read\n        if (inspector != address(0)) IOAppMsgInspector(inspector).inspect(message, options);\n    }\n\n    /**\n     * @dev Internal function to handle the receive on the LayerZero endpoint.\n     * @param _origin The origin information.\n     *  - srcEid: The source chain endpoint ID.\n     *  - sender: The sender address from the src chain.\n     *  - nonce: The nonce of the LayerZero message.\n     * @param _guid The unique identifier for the received LayerZero message.\n     * @param _message The encoded message.\n     * @dev _executor The address of the executor.\n     * @dev _extraData Additional data.\n     */\n    function _lzReceive(\n        Origin calldata _origin,\n        bytes32 _guid,\n        bytes calldata _message,\n        address /*_executor*/, // @dev unused in the default implementation.\n        bytes calldata /*_extraData*/ // @dev unused in the default implementation.\n    ) internal virtual override {\n        // @dev The src sending chain doesnt know the address length on this chain (potentially non-evm)\n        // Thus everything is bytes32() encoded in flight.\n        address toAddress = _message.sendTo().bytes32ToAddress();\n        // @dev Credit the amountLD to the recipient and return the ACTUAL amount the recipient received in local decimals\n        uint256 amountReceivedLD = _credit(toAddress, _toLD(_message.amountSD()), _origin.srcEid);\n\n        if (_message.isComposed()) {\n            // @dev Proprietary composeMsg format for the OFT.\n            bytes memory composeMsg = OFTComposeMsgCodec.encode(\n                _origin.nonce,\n                _origin.srcEid,\n                amountReceivedLD,\n                _message.composeMsg()\n            );\n\n            // @dev Stores the lzCompose payload that will be executed in a separate tx.\n            // Standardizes functionality for executing arbitrary contract invocation on some non-evm chains.\n            // @dev The off-chain executor will listen and process the msg based on the src-chain-callers compose options passed.\n            // @dev The index is used when a OApp needs to compose multiple msgs on lzReceive.\n            // For default OFT implementation there is only 1 compose msg per lzReceive, thus its always 0.\n            endpoint.sendCompose(toAddress, _guid, 0 /* the index of the composed message*/, composeMsg);\n        }\n\n        emit OFTReceived(_guid, _origin.srcEid, toAddress, amountReceivedLD);\n    }\n\n    /**\n     * @dev Internal function to handle the OAppPreCrimeSimulator simulated receive.\n     * @param _origin The origin information.\n     *  - srcEid: The source chain endpoint ID.\n     *  - sender: The sender address from the src chain.\n     *  - nonce: The nonce of the LayerZero message.\n     * @param _guid The unique identifier for the received LayerZero message.\n     * @param _message The LayerZero message.\n     * @param _executor The address of the off-chain executor.\n     * @param _extraData Arbitrary data passed by the msg executor.\n     *\n     * @dev Enables the preCrime simulator to mock sending lzReceive() messages,\n     * routes the msg down from the OAppPreCrimeSimulator, and back up to the OAppReceiver.\n     */\n    function _lzReceiveSimulate(\n        Origin calldata _origin,\n        bytes32 _guid,\n        bytes calldata _message,\n        address _executor,\n        bytes calldata _extraData\n    ) internal virtual override {\n        _lzReceive(_origin, _guid, _message, _executor, _extraData);\n    }\n\n    /**\n     * @dev Check if the peer is considered 'trusted' by the OApp.\n     * @param _eid The endpoint ID to check.\n     * @param _peer The peer to check.\n     * @return Whether the peer passed is considered 'trusted' by the OApp.\n     *\n     * @dev Enables OAppPreCrimeSimulator to check whether a potential Inbound Packet is from a trusted source.\n     */\n    function isPeer(uint32 _eid, bytes32 _peer) public view virtual override returns (bool) {\n        return peers(_eid) == _peer;\n    }\n\n    /**\n     * @dev Internal function to remove dust from the given local decimal amount.\n     * @param _amountLD The amount in local decimals.\n     * @return amountLD The amount after removing dust.\n     *\n     * @dev Prevents the loss of dust when moving amounts between chains with different decimals.\n     * @dev eg. uint(123) with a conversion rate of 100 becomes uint(100).\n     */\n    function _removeDust(uint256 _amountLD) internal view virtual returns (uint256 amountLD) {\n        return (_amountLD / decimalConversionRate) * decimalConversionRate;\n    }\n\n    /**\n     * @dev Internal function to convert an amount from shared decimals into local decimals.\n     * @param _amountSD The amount in shared decimals.\n     * @return amountLD The amount in local decimals.\n     */\n    function _toLD(uint64 _amountSD) internal view virtual returns (uint256 amountLD) {\n        return _amountSD * decimalConversionRate;\n    }\n\n    /**\n     * @dev Internal function to convert an amount from local decimals into shared decimals.\n     * @param _amountLD The amount in local decimals.\n     * @return amountSD The amount in shared decimals.\n     *\n     * @dev Reverts if the _amountLD in shared decimals overflows uint64.\n     * @dev eg. uint(2**64 + 123) with a conversion rate of 1 wraps around 2**64 to uint(123).\n     */\n    function _toSD(uint256 _amountLD) internal view virtual returns (uint64 amountSD) {\n        uint256 _amountSD = _amountLD / decimalConversionRate;\n        if (_amountSD > type(uint64).max) revert AmountSDOverflowed(_amountSD);\n        return uint64(_amountSD);\n    }\n\n    /**\n     * @dev Internal function to mock the amount mutation from a OFT debit() operation.\n     * @param _amountLD The amount to send in local decimals.\n     * @param _minAmountLD The minimum amount to send in local decimals.\n     * @dev _dstEid The destination endpoint ID.\n     * @return amountSentLD The amount sent, in local decimals.\n     * @return amountReceivedLD The amount to be received on the remote chain, in local decimals.\n     *\n     * @dev This is where things like fees would be calculated and deducted from the amount to be received on the remote.\n     */\n    function _debitView(\n        uint256 _amountLD,\n        uint256 _minAmountLD,\n        uint32 /*_dstEid*/\n    ) internal view virtual returns (uint256 amountSentLD, uint256 amountReceivedLD) {\n        // @dev Remove the dust so nothing is lost on the conversion between chains with different decimals for the token.\n        amountSentLD = _removeDust(_amountLD);\n        // @dev The amount to send is the same as amount received in the default implementation.\n        amountReceivedLD = amountSentLD;\n\n        // @dev Check for slippage.\n        if (amountReceivedLD < _minAmountLD) {\n            revert SlippageExceeded(amountReceivedLD, _minAmountLD);\n        }\n    }\n\n    /**\n     * @dev Internal function to perform a debit operation.\n     * @param _from The address to debit from.\n     * @param _amountLD The amount to send in local decimals.\n     * @param _minAmountLD The minimum amount to send in local decimals.\n     * @param _dstEid The destination endpoint ID.\n     * @return amountSentLD The amount sent in local decimals.\n     * @return amountReceivedLD The amount received in local decimals on the remote.\n     *\n     * @dev Defined here but are intended to be overriden depending on the OFT implementation.\n     * @dev Depending on OFT implementation the _amountLD could differ from the amountReceivedLD.\n     */\n    function _debit(\n        address _from,\n        uint256 _amountLD,\n        uint256 _minAmountLD,\n        uint32 _dstEid\n    ) internal virtual returns (uint256 amountSentLD, uint256 amountReceivedLD);\n\n    /**\n     * @dev Internal function to perform a credit operation.\n     * @param _to The address to credit.\n     * @param _amountLD The amount to credit in local decimals.\n     * @param _srcEid The source endpoint ID.\n     * @return amountReceivedLD The amount ACTUALLY received in local decimals.\n     *\n     * @dev Defined here but are intended to be overriden depending on the OFT implementation.\n     * @dev Depending on OFT implementation the _amountLD could differ from the amountReceivedLD.\n     */\n    function _credit(\n        address _to,\n        uint256 _amountLD,\n        uint32 _srcEid\n    ) internal virtual returns (uint256 amountReceivedLD);\n}\n"}],"certified":false,"conflicting_implementations":null,"abi":[{"inputs":[{"internalType":"address payable","name":"_share","type":"address"},{"internalType":"address","name":"_lzEndpoint","type":"address"},{"internalType":"address","name":"_permit2","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AUTH_UNAUTHORIZED","type":"error"},{"inputs":[],"name":"AUTH_ZERO_ADDRESS","type":"error"},{"inputs":[{"internalType":"uint256","name":"amountSD","type":"uint256"}],"name":"AmountSDOverflowed","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"ERC4626ExceededMaxDeposit","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"ERC4626ExceededMaxMint","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"ERC4626ExceededMaxRedeem","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"ERC4626ExceededMaxWithdraw","type":"error"},{"inputs":[],"name":"ERC7540AsyncFlow","type":"error"},{"inputs":[],"name":"InvalidDelegate","type":"error"},{"inputs":[],"name":"InvalidEndpointCall","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"InvalidLocalDecimals","type":"error"},{"inputs":[{"internalType":"bytes","name":"options","type":"bytes"}],"name":"InvalidOptions","type":"error"},{"inputs":[],"name":"InvalidRate","type":"error"},{"inputs":[],"name":"LzTokenUnavailable","type":"error"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"}],"name":"NoPeer","type":"error"},{"inputs":[{"internalType":"uint256","name":"msgValue","type":"uint256"}],"name":"NotEnoughNative","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"OnlyCallableByNestShare","type":"error"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"OnlyEndpoint","type":"error"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"}],"name":"OnlyPeer","type":"error"},{"inputs":[],"name":"OnlySelf","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"RateOutOfBounds","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"RenounceOwnershipDisabled","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[{"internalType":"bytes","name":"result","type":"bytes"}],"name":"SimulationResult","type":"error"},{"inputs":[{"internalType":"uint256","name":"amountLD","type":"uint256"},{"internalType":"uint256","name":"minAmountLD","type":"uint256"}],"name":"SlippageExceeded","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"contract Authority","name":"newAuthority","type":"address"}],"name":"AUTH_AuthorityUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"AUTH_OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"AUTH_OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint32","name":"eid","type":"uint32"},{"internalType":"uint16","name":"msgType","type":"uint16"},{"internalType":"bytes","name":"options","type":"bytes"}],"indexed":false,"internalType":"struct EnforcedOptionParam[]","name":"_enforcedOptions","type":"tuple[]"}],"name":"EnforcedOptionSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"inspector","type":"address"}],"name":"MsgInspectorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"guid","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"srcEid","type":"uint32"},{"indexed":true,"internalType":"address","name":"toAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountReceivedLD","type":"uint256"}],"name":"OFTReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"guid","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"dstEid","type":"uint32"},{"indexed":true,"internalType":"address","name":"fromAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountSentLD","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountReceivedLD","type":"uint256"}],"name":"OFTSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"controller","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"OperatorSet","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":"uint32","name":"eid","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"peer","type":"bytes32"}],"name":"PeerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"preCrimeAddress","type":"address"}],"name":"PreCrimeSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"controller","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"RedeemRequest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"PERMIT2","outputs":[{"internalType":"contract ISignatureTransfer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SEND","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SEND_AND_CALL","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"accountant","outputs":[{"internalType":"contract NestHubAccountant","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"srcEid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"internalType":"struct Origin","name":"origin","type":"tuple"}],"name":"allowInitializePath","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"approvalRequired","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"asset","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"authority","outputs":[{"internalType":"contract Authority","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_controller","type":"address"},{"internalType":"bytes32","name":"_nonce","type":"bytes32"}],"name":"authorizations","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_controller","type":"address"},{"internalType":"address","name":"_operator","type":"address"},{"internalType":"bool","name":"_approved","type":"bool"},{"internalType":"bytes32","name":"_nonce","type":"bytes32"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"authorizeOperator","outputs":[{"internalType":"bool","name":"_success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum NestVaultCoreTypes.Fees","name":"_f","type":"uint8"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"claimFee","outputs":[{"internalType":"uint256","name":"_feeAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum NestVaultCoreTypes.Fees","name":"_f","type":"uint8"}],"name":"claimableFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"_controller","type":"address"}],"name":"claimableRedeemRequest","outputs":[{"internalType":"uint256","name":"_claimableShares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_eid","type":"uint32"},{"internalType":"uint16","name":"_msgType","type":"uint16"},{"internalType":"bytes","name":"_extraOptions","type":"bytes"}],"name":"combineOptions","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"convertToAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"convertToShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimalConversionRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endpoint","outputs":[{"internalType":"contract ILayerZeroEndpointV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_eid","type":"uint32"},{"internalType":"uint16","name":"_msgType","type":"uint16"}],"name":"enforcedOptions","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum NestVaultCoreTypes.Fees","name":"_f","type":"uint8"}],"name":"fees","outputs":[{"internalType":"uint32","name":"_rate","type":"uint32"},{"internalType":"uint256","name":"_flat","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_controller","type":"address"},{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"fulfillRedeem","outputs":[{"internalType":"uint256","name":"_assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_accountant","type":"address"},{"internalType":"address","name":"_asset","type":"address"},{"internalType":"address","name":"_delegate","type":"address"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_minRate","type":"uint256"},{"internalType":"address","name":"_operatorRegistry","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"address","name":"_owner","type":"address"}],"name":"instantRedeem","outputs":[{"internalType":"uint256","name":"_postFeeAmount","type":"uint256"},{"internalType":"uint256","name":"_feeAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_nonce","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"instantRedeemWithPermit2","outputs":[{"internalType":"uint256","name":"_postFeeAmount","type":"uint256"},{"internalType":"uint256","name":"_feeAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"srcEid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"internalType":"struct Origin","name":"","type":"tuple"},{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"address","name":"_sender","type":"address"}],"name":"isComposeMsgSender","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_controller","type":"address"},{"internalType":"address","name":"_operator","type":"address"}],"name":"isOperator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_eid","type":"uint32"},{"internalType":"bytes32","name":"_peer","type":"bytes32"}],"name":"isPeer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"srcEid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"internalType":"struct Origin","name":"_origin","type":"tuple"},{"internalType":"bytes32","name":"_guid","type":"bytes32"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address","name":"_executor","type":"address"},{"internalType":"bytes","name":"_extraData","type":"bytes"}],"name":"lzReceive","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"uint32","name":"srcEid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"internalType":"struct Origin","name":"origin","type":"tuple"},{"internalType":"uint32","name":"dstEid","type":"uint32"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"bytes32","name":"guid","type":"bytes32"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"executor","type":"address"},{"internalType":"bytes","name":"message","type":"bytes"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct InboundPacket[]","name":"_packets","type":"tuple[]"}],"name":"lzReceiveAndRevert","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"srcEid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"internalType":"struct Origin","name":"_origin","type":"tuple"},{"internalType":"bytes32","name":"_guid","type":"bytes32"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address","name":"_executor","type":"address"},{"internalType":"bytes","name":"_extraData","type":"bytes"}],"name":"lzReceiveSimulate","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum NestVaultCoreTypes.Fees","name":"_f","type":"uint8"}],"name":"maxFees","outputs":[{"internalType":"uint32","name":"_rate","type":"uint32"},{"internalType":"uint256","name":"_flat","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_controller","type":"address"}],"name":"maxRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_controller","type":"address"}],"name":"maxWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"msgInspector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"nextNonce","outputs":[{"internalType":"uint64","name":"nonce","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oApp","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oAppVersion","outputs":[{"internalType":"uint64","name":"senderVersion","type":"uint64"},{"internalType":"uint64","name":"receiverVersion","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"oftVersion","outputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"},{"internalType":"uint64","name":"version","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"operatorRegistry","outputs":[{"internalType":"contract OperatorRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_eid","type":"uint32"}],"name":"peers","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"_controller","type":"address"}],"name":"pendingRedeemRequest","outputs":[{"internalType":"uint256","name":"_pendingShares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"preCrime","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_assets","type":"uint256"}],"name":"previewDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"previewFulfillRedeem","outputs":[{"internalType":"uint256","name":"_postFeeAmount","type":"uint256"},{"internalType":"uint256","name":"_feeAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"previewInstantRedeem","outputs":[{"internalType":"uint256","name":"_postFeeAmount","type":"uint256"},{"internalType":"uint256","name":"_feeAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"previewMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"previewRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"previewWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"dstEid","type":"uint32"},{"internalType":"bytes32","name":"to","type":"bytes32"},{"internalType":"uint256","name":"amountLD","type":"uint256"},{"internalType":"uint256","name":"minAmountLD","type":"uint256"},{"internalType":"bytes","name":"extraOptions","type":"bytes"},{"internalType":"bytes","name":"composeMsg","type":"bytes"},{"internalType":"bytes","name":"oftCmd","type":"bytes"}],"internalType":"struct SendParam","name":"_sendParam","type":"tuple"}],"name":"quoteOFT","outputs":[{"components":[{"internalType":"uint256","name":"minAmountLD","type":"uint256"},{"internalType":"uint256","name":"maxAmountLD","type":"uint256"}],"internalType":"struct OFTLimit","name":"oftLimit","type":"tuple"},{"components":[{"internalType":"int256","name":"feeAmountLD","type":"int256"},{"internalType":"string","name":"description","type":"string"}],"internalType":"struct OFTFeeDetail[]","name":"oftFeeDetails","type":"tuple[]"},{"components":[{"internalType":"uint256","name":"amountSentLD","type":"uint256"},{"internalType":"uint256","name":"amountReceivedLD","type":"uint256"}],"internalType":"struct OFTReceipt","name":"oftReceipt","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"dstEid","type":"uint32"},{"internalType":"bytes32","name":"to","type":"bytes32"},{"internalType":"uint256","name":"amountLD","type":"uint256"},{"internalType":"uint256","name":"minAmountLD","type":"uint256"},{"internalType":"bytes","name":"extraOptions","type":"bytes"},{"internalType":"bytes","name":"composeMsg","type":"bytes"},{"internalType":"bytes","name":"oftCmd","type":"bytes"}],"internalType":"struct SendParam","name":"_sendParam","type":"tuple"},{"internalType":"bool","name":"_payInLzToken","type":"bool"}],"name":"quoteSend","outputs":[{"components":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"lzTokenFee","type":"uint256"}],"internalType":"struct MessagingFee","name":"msgFee","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"address","name":"_controller","type":"address"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"_assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"address","name":"_controller","type":"address"},{"internalType":"address","name":"_owner","type":"address"}],"name":"requestRedeem","outputs":[{"internalType":"uint256","name":"_requestId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"address","name":"_controller","type":"address"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_nonce","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"requestRedeemWithPermit2","outputs":[{"internalType":"uint256","name":"_requestId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"dstEid","type":"uint32"},{"internalType":"bytes32","name":"to","type":"bytes32"},{"internalType":"uint256","name":"amountLD","type":"uint256"},{"internalType":"uint256","name":"minAmountLD","type":"uint256"},{"internalType":"bytes","name":"extraOptions","type":"bytes"},{"internalType":"bytes","name":"composeMsg","type":"bytes"},{"internalType":"bytes","name":"oftCmd","type":"bytes"}],"internalType":"struct SendParam","name":"_sendParam","type":"tuple"},{"components":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"lzTokenFee","type":"uint256"}],"internalType":"struct MessagingFee","name":"_fee","type":"tuple"},{"internalType":"address","name":"_refundAddress","type":"address"}],"name":"send","outputs":[{"components":[{"internalType":"bytes32","name":"guid","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"},{"components":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"lzTokenFee","type":"uint256"}],"internalType":"struct MessagingFee","name":"fee","type":"tuple"}],"internalType":"struct MessagingReceipt","name":"msgReceipt","type":"tuple"},{"components":[{"internalType":"uint256","name":"amountSentLD","type":"uint256"},{"internalType":"uint256","name":"amountReceivedLD","type":"uint256"}],"internalType":"struct OFTReceipt","name":"oftReceipt","type":"tuple"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_accountant","type":"address"}],"name":"setAccountant","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract Authority","name":"newAuthority","type":"address"}],"name":"setAuthority","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_delegate","type":"address"}],"name":"setDelegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"eid","type":"uint32"},{"internalType":"uint16","name":"msgType","type":"uint16"},{"internalType":"bytes","name":"options","type":"bytes"}],"internalType":"struct EnforcedOptionParam[]","name":"_enforcedOptions","type":"tuple[]"}],"name":"setEnforcedOptions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum NestVaultCoreTypes.Fees","name":"_f","type":"uint8"},{"components":[{"internalType":"uint32","name":"rate","type":"uint32"},{"internalType":"uint256","name":"flat","type":"uint256"}],"internalType":"struct NestVaultCoreTypes.Fee","name":"_fee","type":"tuple"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum NestVaultCoreTypes.Fees","name":"_f","type":"uint8"},{"components":[{"internalType":"uint32","name":"rate","type":"uint32"},{"internalType":"uint256","name":"flat","type":"uint256"}],"internalType":"struct NestVaultCoreTypes.Fee","name":"_maxFee","type":"tuple"}],"name":"setMaxFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_msgInspector","type":"address"}],"name":"setMsgInspector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"bool","name":"_approved","type":"bool"}],"name":"setOperator","outputs":[{"internalType":"bool","name":"_success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operatorRegistry","type":"address"}],"name":"setOperatorRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_eid","type":"uint32"},{"internalType":"bytes32","name":"_peer","type":"bytes32"}],"name":"setPeer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_preCrime","type":"address"}],"name":"setPreCrime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"share","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sharedDecimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalPendingShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newShares","type":"uint256"},{"internalType":"address","name":"_controller","type":"address"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"updateRedeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_assets","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"address","name":"_controller","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}],"is_changed_bytecode":false,"is_partially_verified":true,"package_name":null,"constructor_args":"0x000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f000000000000000000000000c1b15d3b262beec0e3565c11c9e0f6134bdacb36000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3"}