{"constructor_args":null,"is_partially_verified":true,"is_changed_bytecode":false,"abi":[{"inputs":[],"name":"AdjustmentExceedsRecordedTotal","type":"error"},{"inputs":[],"name":"CrossChainError","type":"error"},{"inputs":[],"name":"DebitGreaterThanAssets","type":"error"},{"inputs":[],"name":"ExchangeRateInvalid","type":"error"},{"inputs":[],"name":"InvalidAccess","type":"error"},{"inputs":[],"name":"InvalidLoan","type":"error"},{"inputs":[],"name":"InvalidRedemptions","type":"error"},{"inputs":[],"name":"MintingToPool","type":"error"},{"inputs":[],"name":"NoAdjustmentsToZeroBalance","type":"error"},{"inputs":[],"name":"NotBorrowerManager","type":"error"},{"inputs":[],"name":"NotLender","type":"error"},{"inputs":[],"name":"NotPoolAdmin","type":"error"},{"inputs":[],"name":"NotPoolController","type":"error"},{"inputs":[],"name":"PoolInvalidState","type":"error"},{"inputs":[],"name":"PoolNotActive","type":"error"},{"inputs":[],"name":"PoolPaused","type":"error"},{"inputs":[],"name":"RedeemExceedsBalance","type":"error"},{"inputs":[],"name":"RedemptionDoesNotCoverDeposits","type":"error"},{"inputs":[],"name":"RedemptionNotFound","type":"error"},{"inputs":[],"name":"TransferDisabled","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lender","type":"address"},{"indexed":false,"internalType":"uint256","name":"debit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"credit","type":"uint256"},{"indexed":false,"internalType":"enum IPoolDynamicAdjustmentKind","name":"kind","type":"uint8"}],"name":"AccountAdjustment","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"AccountCredit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"AccountDebit","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":false,"internalType":"uint256","name":"_exchangeRate","type":"uint256"},{"indexed":false,"internalType":"int256","name":"interestRate","type":"int256"},{"indexed":false,"internalType":"uint256","name":"typeDependantChangeParam","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"exchangeRateMaturityDay","type":"uint256"}],"name":"ExchangeRateSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[],"name":"PoolCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lender","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"enum IPoolDynamicDepositType","name":"depositType","type":"uint8"},{"indexed":false,"internalType":"bytes32","name":"transferTxHash","type":"bytes32"}],"name":"PoolDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lender","type":"address"},{"indexed":false,"internalType":"string","name":"paymentId","type":"string"}],"name":"PoolDepositPaymentRef","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lender","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"uuid","type":"bytes32"}],"name":"RedeemAccepted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lender","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"uuid","type":"bytes32"},{"indexed":false,"internalType":"address","name":"fundsDestination","type":"address"}],"name":"RedeemDestinationChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lender","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fees","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"uuid","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"expectedAssets","type":"uint256"},{"indexed":false,"internalType":"address","name":"fundsDestination","type":"address"}],"name":"RedeemRepay","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lender","type":"address"},{"indexed":true,"internalType":"bytes32","name":"uuid","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"withdrawnValue","type":"uint256"}],"name":"RedeemRepayRecorded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lender","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"uuid","type":"bytes32"}],"name":"RedeemRequested","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":"fundsDestination","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TransferAssets","type":"event"},{"inputs":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"bytes32","name":"uuid","type":"bytes32"}],"name":"acceptRedemption","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"accountings","outputs":[{"components":[{"internalType":"uint256","name":"totalAssetsDeposited","type":"uint256"},{"internalType":"uint256","name":"totalAssetsWithdrawn","type":"uint256"},{"internalType":"uint256","name":"exchangeRate","type":"uint256"},{"internalType":"uint256","name":"exchangeRateSetDay","type":"uint256"},{"internalType":"uint256","name":"exchangeRateChangeRate","type":"uint256"},{"internalType":"uint256","name":"exchangeRateCompoundingRate","type":"uint256"},{"internalType":"uint256","name":"exchangeRateAtMaturity","type":"uint256"},{"internalType":"uint256","name":"exchangeRateMaturityDay","type":"uint256"},{"internalType":"int256","name":"interestRate","type":"int256"},{"internalType":"int256","name":"indicativeInterestRate","type":"int256"},{"internalType":"uint256","name":"collateralRate","type":"uint256"}],"internalType":"struct IPoolAccountingsDynamic","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"uint256","name":"debit","type":"uint256"},{"internalType":"uint256","name":"credit","type":"uint256"},{"internalType":"enum IPoolDynamicAdjustmentKind","name":"kind","type":"uint8"}],"name":"addAdjustmentAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"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":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","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":[{"internalType":"address","name":"lender","type":"address"}],"name":"assetBalanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"borrowerManagerAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"borrowerWalletAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"bytes32","name":"uuid","type":"bytes32"},{"internalType":"address","name":"fundsDestination","type":"address"}],"name":"changeRedemptionDestination","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"convertToAssets","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"convertToShares","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"lender","type":"address"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"lender","type":"address"},{"internalType":"bytes32","name":"transferTxHash","type":"bytes32"}],"name":"depositFromTransfer","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"lender","type":"address"},{"internalType":"string","name":"paymentId","type":"string"}],"name":"depositOffChain","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"exchangeRate","outputs":[{"internalType":"uint256","name":"_exchangeRate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getActiveWithdraws","outputs":[{"components":[{"internalType":"bytes32","name":"uuid","type":"bytes32"},{"internalType":"address","name":"lender","type":"address"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"enum IPoolDynamicWithdrawStage","name":"stage","type":"uint8"},{"internalType":"address","name":"fundsDestination","type":"address"},{"internalType":"bool","name":"transferRedeem","type":"bool"}],"internalType":"struct IPoolWithdrawDynamic[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"lender","type":"address"}],"name":"getPoolDynamicAccountState","outputs":[{"components":[{"internalType":"address","name":"poolAddr","type":"address"},{"internalType":"address","name":"accountAddr","type":"address"},{"internalType":"address","name":"liquidityAssetAddr","type":"address"},{"internalType":"uint256","name":"tokenBalance","type":"uint256"},{"internalType":"uint256","name":"assetBalance","type":"uint256"},{"internalType":"uint256","name":"maxWithdrawRequest","type":"uint256"},{"internalType":"uint256","name":"maxRedeemRequest","type":"uint256"},{"internalType":"uint256","name":"requestedSharesOf","type":"uint256"},{"internalType":"uint256","name":"requestedAssetsOf","type":"uint256"},{"internalType":"uint256","name":"acceptedShares","type":"uint256"},{"internalType":"uint256","name":"acceptedAssets","type":"uint256"},{"internalType":"uint256","name":"assetsDeposited","type":"uint256"},{"internalType":"uint256","name":"assetsWithdrawn","type":"uint256"}],"internalType":"struct IPoolAccountStateDynamic","name":"_poolAccountState","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPoolDynamicConfigurationState","outputs":[{"components":[{"internalType":"address","name":"poolAddr","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"address","name":"poolAccessControl","type":"address"},{"internalType":"address","name":"poolControllerDynamic","type":"address"},{"internalType":"uint256","name":"activatedAt","type":"uint256"},{"internalType":"address","name":"serviceConfiguration","type":"address"},{"internalType":"address","name":"liquidityAssetAddr","type":"address"},{"internalType":"address","name":"poolAdmin","type":"address"},{"internalType":"address","name":"borrowerManager","type":"address"},{"internalType":"address","name":"borrowerWalletAddr","type":"address"},{"internalType":"address","name":"feeCollectorAddress","type":"address"},{"internalType":"uint256","name":"closeOfDepositTime","type":"uint256"},{"internalType":"uint256","name":"closeOfWithdrawTime","type":"uint256"},{"internalType":"uint256","name":"transferOutDays","type":"uint256"},{"internalType":"enum IPoolDynamicExchangeRateType","name":"exchangeRateType","type":"uint8"},{"internalType":"bool","name":"interestDuringWithdraw","type":"bool"},{"internalType":"uint64","name":"interestDuringWithdrawDays","type":"uint64"}],"internalType":"struct IPoolConfigurationStateDynamic","name":"_poolConfigutationState","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPoolDynamicOverviewState","outputs":[{"components":[{"internalType":"address","name":"poolAddr","type":"address"},{"internalType":"uint256","name":"state","type":"uint256"},{"internalType":"uint256","name":"totalAssetsDeposited","type":"uint256"},{"internalType":"uint256","name":"totalAssetsWithdrawn","type":"uint256"},{"internalType":"uint256","name":"totalAssets","type":"uint256"},{"internalType":"uint256","name":"totalShares","type":"uint256"},{"internalType":"uint256","name":"exchangeRate","type":"uint256"},{"internalType":"uint256","name":"exchangeRateAtSetDay","type":"uint256"},{"internalType":"uint256","name":"exchangeRateSetDay","type":"uint256"},{"internalType":"uint256","name":"exchangeRateChangeRate","type":"uint256"},{"internalType":"uint256","name":"exchangeRateCompoundingRate","type":"uint256"},{"internalType":"uint256","name":"exchangeRateAtMaturity","type":"uint256"},{"internalType":"uint256","name":"exchangeRateMaturityDay","type":"uint256"},{"internalType":"int256","name":"interestRate","type":"int256"},{"internalType":"int256","name":"indicativeInterestRate","type":"int256"},{"internalType":"uint256","name":"collateralRate","type":"uint256"},{"components":[{"internalType":"bytes32","name":"uuid","type":"bytes32"},{"internalType":"address","name":"lender","type":"address"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"enum IPoolDynamicWithdrawStage","name":"stage","type":"uint8"},{"internalType":"address","name":"fundsDestination","type":"address"},{"internalType":"bool","name":"transferRedeem","type":"bool"}],"internalType":"struct IPoolWithdrawDynamic[]","name":"activeWithdraws","type":"tuple[]"}],"internalType":"struct IPoolOverviewStateDynamic","name":"_poolOverviewState","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"liquidityAsset","type":"address"},{"internalType":"address","name":"poolAdmin","type":"address"},{"internalType":"address","name":"serviceConfiguration","type":"address"},{"internalType":"address","name":"poolControllerFactoryDynamic","type":"address"},{"internalType":"address","name":"poolAccessControlFactory","type":"address"}],"internalType":"struct PoolAddressListDynamic","name":"poolAddressList","type":"tuple"},{"components":[{"internalType":"address","name":"borrowerManager","type":"address"},{"internalType":"address","name":"borrowerWalletAddr","type":"address"},{"internalType":"address","name":"feeCollectorAddress","type":"address"},{"internalType":"uint256","name":"closeOfDepositTime","type":"uint256"},{"internalType":"uint256","name":"closeOfWithdrawTime","type":"uint256"},{"internalType":"uint256","name":"transferOutDays","type":"uint256"},{"internalType":"enum IPoolDynamicExchangeRateType","name":"exchangeRateType","type":"uint8"}],"internalType":"struct IPoolConfigurableSettingsDynamic","name":"poolSettings","type":"tuple"},{"internalType":"string","name":"tokenName","type":"string"},{"internalType":"string","name":"tokenSymbol","type":"string"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"isPermittedLender","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidityAssetAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"maxRedeemRequest","outputs":[{"internalType":"uint256","name":"maxShares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"maxWithdrawRequest","outputs":[{"internalType":"uint256","name":"maxAssets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolAccessControl","outputs":[{"internalType":"contract IPoolAccessControl","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolControllerDynamic","outputs":[{"internalType":"contract IPoolControllerDynamic","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolType","outputs":[{"internalType":"enum IPoolType","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"previewRedeemRequest","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"previewWithdrawRequest","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"lender","type":"address"},{"internalType":"uint256","name":"repayment","type":"uint256"},{"internalType":"uint256","name":"fees","type":"uint256"},{"internalType":"bytes32","name":"uuid","type":"bytes32"}],"name":"repayRedemption","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"requestRedeem","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"serviceConfiguration","outputs":[{"internalType":"contract IServiceConfigurationV5","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_exchangeRate","type":"uint256"},{"internalType":"uint256","name":"_typeDependantChangeParam","type":"uint256"},{"internalType":"uint256","name":"_exchangeRateMaturityDay","type":"uint256"},{"internalType":"int256","name":"_interestRate","type":"int256"}],"name":"setExchangeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"_indicativeInterestRate","type":"int256"},{"internalType":"uint256","name":"_collateralRate","type":"uint256"}],"name":"setIndicativeAndCollateralRates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"settings","outputs":[{"components":[{"internalType":"address","name":"borrowerManager","type":"address"},{"internalType":"address","name":"borrowerWalletAddr","type":"address"},{"internalType":"address","name":"feeCollectorAddress","type":"address"},{"internalType":"uint256","name":"closeOfDepositTime","type":"uint256"},{"internalType":"uint256","name":"closeOfWithdrawTime","type":"uint256"},{"internalType":"uint256","name":"transferOutDays","type":"uint256"},{"internalType":"enum IPoolDynamicExchangeRateType","name":"exchangeRateType","type":"uint8"}],"internalType":"struct IPoolConfigurableSettingsDynamic","name":"poolSettings","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"state","outputs":[{"internalType":"enum IPoolLifeCycleStateDynamic","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAvailableAssets","outputs":[{"internalType":"uint256","name":"assets","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":"amount","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":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"transferToBorrowerWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"lender","type":"address"}],"name":"unpaidDirectTransferShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}],"conflicting_implementations":null,"certified":false,"additional_sources":[{"file_path":"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\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 Indicates that the contract has been initialized.\n     * @custom:oz-retyped-from bool\n     */\n    uint8 private _initialized;\n\n    /**\n     * @dev Indicates that the contract is in the process of being initialized.\n     */\n    bool private _initializing;\n\n    /**\n     * @dev Triggered when the contract has been initialized or reinitialized.\n     */\n    event Initialized(uint8 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 functions marked with `initializer` can be nested in the context of a\n     * constructor.\n     *\n     * Emits an {Initialized} event.\n     */\n    modifier initializer() {\n        bool isTopLevelCall = !_initializing;\n        require(\n            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n            \"Initializable: contract is already initialized\"\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 255 will prevent any future reinitialization.\n     *\n     * Emits an {Initialized} event.\n     */\n    modifier reinitializer(uint8 version) {\n        require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\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        require(_initializing, \"Initializable: contract is not initializing\");\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        require(!_initializing, \"Initializable: contract is initializing\");\n        if (_initialized != type(uint8).max) {\n            _initialized = type(uint8).max;\n            emit Initialized(type(uint8).max);\n        }\n    }\n\n    /**\n     * @dev Returns the highest version that has been initialized. See {reinitializer}.\n     */\n    function _getInitializedVersion() internal view returns (uint8) {\n        return _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 _initializing;\n    }\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20Upgradeable.sol\";\nimport \"./extensions/IERC20MetadataUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.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 * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\n    mapping(address => uint256) private _balances;\n\n    mapping(address => mapping(address => uint256)) private _allowances;\n\n    uint256 private _totalSupply;\n\n    string private _name;\n    string private _symbol;\n\n    /**\n     * @dev Sets the values for {name} and {symbol}.\n     *\n     * All two of these values are immutable: they can only be set once during\n     * construction.\n     */\n    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        _name = name_;\n        _symbol = symbol_;\n    }\n\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() public view virtual override returns (string memory) {\n        return _name;\n    }\n\n    /**\n     * @dev Returns the symbol of the token, usually a shorter version of the\n     * name.\n     */\n    function symbol() public view virtual override returns (string memory) {\n        return _symbol;\n    }\n\n    /**\n     * @dev Returns the number of decimals used to get its user representation.\n     * For example, if `decimals` equals `2`, a balance of `505` tokens should\n     * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n     *\n     * Tokens usually opt for a value of 18, imitating the relationship between\n     * Ether and Wei. This is the default value returned by this function, unless\n     * it's overridden.\n     *\n     * NOTE: This information is only used for _display_ purposes: it in\n     * no way affects any of the arithmetic of the contract, including\n     * {IERC20-balanceOf} and {IERC20-transfer}.\n     */\n    function decimals() public view virtual override returns (uint8) {\n        return 18;\n    }\n\n    /**\n     * @dev See {IERC20-totalSupply}.\n     */\n    function totalSupply() public view virtual override returns (uint256) {\n        return _totalSupply;\n    }\n\n    /**\n     * @dev See {IERC20-balanceOf}.\n     */\n    function balanceOf(address account) public view virtual override returns (uint256) {\n        return _balances[account];\n    }\n\n    /**\n     * @dev See {IERC20-transfer}.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - the caller must have a balance of at least `amount`.\n     */\n    function transfer(address to, uint256 amount) public virtual override returns (bool) {\n        address owner = _msgSender();\n        _transfer(owner, to, amount);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-allowance}.\n     */\n    function allowance(address owner, address spender) public view virtual override returns (uint256) {\n        return _allowances[owner][spender];\n    }\n\n    /**\n     * @dev See {IERC20-approve}.\n     *\n     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n     * `transferFrom`. This is semantically equivalent to an infinite approval.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function approve(address spender, uint256 amount) public virtual override returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, amount);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-transferFrom}.\n     *\n     * Emits an {Approval} event indicating the updated allowance. This is not\n     * required by the EIP. See the note at the beginning of {ERC20}.\n     *\n     * NOTE: Does not update the allowance if the current allowance\n     * is the maximum `uint256`.\n     *\n     * Requirements:\n     *\n     * - `from` and `to` cannot be the zero address.\n     * - `from` must have a balance of at least `amount`.\n     * - the caller must have allowance for ``from``'s tokens of at least\n     * `amount`.\n     */\n    function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n        address spender = _msgSender();\n        _spendAllowance(from, spender, amount);\n        _transfer(from, to, amount);\n        return true;\n    }\n\n    /**\n     * @dev Atomically increases the allowance granted to `spender` by the caller.\n     *\n     * This is an alternative to {approve} that can be used as a mitigation for\n     * problems described in {IERC20-approve}.\n     *\n     * Emits an {Approval} event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, allowance(owner, spender) + addedValue);\n        return true;\n    }\n\n    /**\n     * @dev Atomically decreases the allowance granted to `spender` by the caller.\n     *\n     * This is an alternative to {approve} that can be used as a mitigation for\n     * problems described in {IERC20-approve}.\n     *\n     * Emits an {Approval} event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `spender` must have allowance for the caller of at least\n     * `subtractedValue`.\n     */\n    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n        address owner = _msgSender();\n        uint256 currentAllowance = allowance(owner, spender);\n        require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n        unchecked {\n            _approve(owner, spender, currentAllowance - subtractedValue);\n        }\n\n        return true;\n    }\n\n    /**\n     * @dev Moves `amount` of tokens from `from` to `to`.\n     *\n     * This internal function is equivalent to {transfer}, and can be used to\n     * e.g. implement automatic token fees, slashing mechanisms, etc.\n     *\n     * Emits a {Transfer} event.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `from` must have a balance of at least `amount`.\n     */\n    function _transfer(address from, address to, uint256 amount) internal virtual {\n        require(from != address(0), \"ERC20: transfer from the zero address\");\n        require(to != address(0), \"ERC20: transfer to the zero address\");\n\n        _beforeTokenTransfer(from, to, amount);\n\n        uint256 fromBalance = _balances[from];\n        require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n        unchecked {\n            _balances[from] = fromBalance - amount;\n            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n            // decrementing then incrementing.\n            _balances[to] += amount;\n        }\n\n        emit Transfer(from, to, amount);\n\n        _afterTokenTransfer(from, to, amount);\n    }\n\n    /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n     * the total supply.\n     *\n     * Emits a {Transfer} event with `from` set to the zero address.\n     *\n     * Requirements:\n     *\n     * - `account` cannot be the zero address.\n     */\n    function _mint(address account, uint256 amount) internal virtual {\n        require(account != address(0), \"ERC20: mint to the zero address\");\n\n        _beforeTokenTransfer(address(0), account, amount);\n\n        _totalSupply += amount;\n        unchecked {\n            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n            _balances[account] += amount;\n        }\n        emit Transfer(address(0), account, amount);\n\n        _afterTokenTransfer(address(0), account, amount);\n    }\n\n    /**\n     * @dev Destroys `amount` tokens from `account`, reducing the\n     * total supply.\n     *\n     * Emits a {Transfer} event with `to` set to the zero address.\n     *\n     * Requirements:\n     *\n     * - `account` cannot be the zero address.\n     * - `account` must have at least `amount` tokens.\n     */\n    function _burn(address account, uint256 amount) internal virtual {\n        require(account != address(0), \"ERC20: burn from the zero address\");\n\n        _beforeTokenTransfer(account, address(0), amount);\n\n        uint256 accountBalance = _balances[account];\n        require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n        unchecked {\n            _balances[account] = accountBalance - amount;\n            // Overflow not possible: amount <= accountBalance <= totalSupply.\n            _totalSupply -= amount;\n        }\n\n        emit Transfer(account, address(0), amount);\n\n        _afterTokenTransfer(account, address(0), amount);\n    }\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n     *\n     * This internal function is equivalent to `approve`, and can be used to\n     * e.g. set automatic allowances for certain subsystems, etc.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `owner` cannot be the zero address.\n     * - `spender` cannot be the zero address.\n     */\n    function _approve(address owner, address spender, uint256 amount) internal virtual {\n        require(owner != address(0), \"ERC20: approve from the zero address\");\n        require(spender != address(0), \"ERC20: approve to the zero address\");\n\n        _allowances[owner][spender] = amount;\n        emit Approval(owner, spender, amount);\n    }\n\n    /**\n     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n     *\n     * Does not update the allowance amount in case of infinite allowance.\n     * Revert if not enough allowance is available.\n     *\n     * Might emit an {Approval} event.\n     */\n    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n        uint256 currentAllowance = allowance(owner, spender);\n        if (currentAllowance != type(uint256).max) {\n            require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n            unchecked {\n                _approve(owner, spender, currentAllowance - amount);\n            }\n        }\n    }\n\n    /**\n     * @dev Hook that is called before any transfer of tokens. This includes\n     * minting and burning.\n     *\n     * Calling conditions:\n     *\n     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n     * will be transferred to `to`.\n     * - when `from` is zero, `amount` tokens will be minted for `to`.\n     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n     * - `from` and `to` are never both zero.\n     *\n     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n     */\n    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n    /**\n     * @dev Hook that is called after any transfer of tokens. This includes\n     * minting and burning.\n     *\n     * Calling conditions:\n     *\n     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n     * has been transferred to `to`.\n     * - when `from` is zero, `amount` tokens have been minted for `to`.\n     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n     * - `from` and `to` are never both zero.\n     *\n     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n     */\n    function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[45] private __gap;\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `from` to `to` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 IERC20PermitUpgradeable {\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":"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 SafeERC20Upgradeable {\n    using AddressUpgradeable for address;\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(IERC20Upgradeable token, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, 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(IERC20Upgradeable token, address from, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n    }\n\n    /**\n     * @dev Deprecated. This function has issues similar to the ones found in\n     * {IERC20-approve}, and its usage is discouraged.\n     *\n     * Whenever possible, use {safeIncreaseAllowance} and\n     * {safeDecreaseAllowance} instead.\n     */\n    function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n        // safeApprove should only be called when setting an initial allowance,\n        // or when resetting it to zero. To increase and decrease it, use\n        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n        require(\n            (value == 0) || (token.allowance(address(this), spender) == 0),\n            \"SafeERC20: approve from non-zero to non-zero allowance\"\n        );\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 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    function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n        uint256 oldAllowance = token.allowance(address(this), spender);\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n    }\n\n    /**\n     * @dev Decrease 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    function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n        unchecked {\n            uint256 oldAllowance = token.allowance(address(this), spender);\n            require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\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    function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n        if (!_callOptionalReturnBool(token, approvalCall)) {\n            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n            _callOptionalReturn(token, approvalCall);\n        }\n    }\n\n    /**\n     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n     * Revert on invalid signature.\n     */\n    function safePermit(\n        IERC20PermitUpgradeable token,\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal {\n        uint256 nonceBefore = token.nonces(owner);\n        token.permit(owner, spender, value, deadline, v, r, s);\n        uint256 nonceAfter = token.nonces(owner);\n        require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\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    function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n        // the target address contains contract code and also asserts for success in the low-level call.\n\n        bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n        require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\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 silents catches all reverts and returns a bool instead.\n     */\n    function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n        // and not revert is the subcall reverts.\n\n        (bool success, bytes memory returndata) = address(token).call(data);\n        return\n            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\n    }\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     *\n     * Furthermore, `isContract` will also return true if the target contract within\n     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n     * which only has an effect at the end of a transaction.\n     * ====\n     *\n     * [IMPORTANT]\n     * ====\n     * You shouldn't rely on `isContract` to protect against flash loan attacks!\n     *\n     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n     * constructor.\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize/address.code.length, which returns 0\n        // for contracts in construction, since the code is only stored at the end\n        // of the constructor execution.\n\n        return account.code.length > 0;\n    }\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.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\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, it is bubbled up by this\n     * function (like regular Solidity function calls).\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     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, errorMessage);\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     * _Available since v3.1._\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        return functionStaticCall(target, data, \"Address: low-level static call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n     *\n     * _Available since v4.8._\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        if (success) {\n            if (returndata.length == 0) {\n                // only check isContract if the call was successful and the return data is empty\n                // otherwise we already know that it was a contract\n                require(isContract(target), \"Address: call to non-contract\");\n            }\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n     * revert reason or using the provided one.\n     *\n     * _Available since v4.3._\n     */\n    function verifyCallResult(\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal pure returns (bytes memory) {\n        if (success) {\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    function _revert(bytes memory returndata, string memory errorMessage) 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            /// @solidity memory-safe-assembly\n            assembly {\n                let returndata_size := mload(returndata)\n                revert(add(32, returndata), returndata_size)\n            }\n        } else {\n            revert(errorMessage);\n        }\n    }\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\n\npragma solidity ^0.8.0;\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    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[50] private __gap;\n}\n"},{"file_path":"@openzeppelin/contracts/utils/math/SafeCast.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX 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 *\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\n * all math on `uint256` and `int256` and then downcasting.\n */\nlibrary SafeCast {\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     * _Available since v4.7._\n     */\n    function toUint248(uint256 value) internal pure returns (uint248) {\n        require(value <= type(uint248).max, \"SafeCast: value doesn't fit in 248 bits\");\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     * _Available since v4.7._\n     */\n    function toUint240(uint256 value) internal pure returns (uint240) {\n        require(value <= type(uint240).max, \"SafeCast: value doesn't fit in 240 bits\");\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     * _Available since v4.7._\n     */\n    function toUint232(uint256 value) internal pure returns (uint232) {\n        require(value <= type(uint232).max, \"SafeCast: value doesn't fit in 232 bits\");\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     * _Available since v4.2._\n     */\n    function toUint224(uint256 value) internal pure returns (uint224) {\n        require(value <= type(uint224).max, \"SafeCast: value doesn't fit in 224 bits\");\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     * _Available since v4.7._\n     */\n    function toUint216(uint256 value) internal pure returns (uint216) {\n        require(value <= type(uint216).max, \"SafeCast: value doesn't fit in 216 bits\");\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     * _Available since v4.7._\n     */\n    function toUint208(uint256 value) internal pure returns (uint208) {\n        require(value <= type(uint208).max, \"SafeCast: value doesn't fit in 208 bits\");\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     * _Available since v4.7._\n     */\n    function toUint200(uint256 value) internal pure returns (uint200) {\n        require(value <= type(uint200).max, \"SafeCast: value doesn't fit in 200 bits\");\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     * _Available since v4.7._\n     */\n    function toUint192(uint256 value) internal pure returns (uint192) {\n        require(value <= type(uint192).max, \"SafeCast: value doesn't fit in 192 bits\");\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     * _Available since v4.7._\n     */\n    function toUint184(uint256 value) internal pure returns (uint184) {\n        require(value <= type(uint184).max, \"SafeCast: value doesn't fit in 184 bits\");\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     * _Available since v4.7._\n     */\n    function toUint176(uint256 value) internal pure returns (uint176) {\n        require(value <= type(uint176).max, \"SafeCast: value doesn't fit in 176 bits\");\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     * _Available since v4.7._\n     */\n    function toUint168(uint256 value) internal pure returns (uint168) {\n        require(value <= type(uint168).max, \"SafeCast: value doesn't fit in 168 bits\");\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     * _Available since v4.7._\n     */\n    function toUint160(uint256 value) internal pure returns (uint160) {\n        require(value <= type(uint160).max, \"SafeCast: value doesn't fit in 160 bits\");\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     * _Available since v4.7._\n     */\n    function toUint152(uint256 value) internal pure returns (uint152) {\n        require(value <= type(uint152).max, \"SafeCast: value doesn't fit in 152 bits\");\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     * _Available since v4.7._\n     */\n    function toUint144(uint256 value) internal pure returns (uint144) {\n        require(value <= type(uint144).max, \"SafeCast: value doesn't fit in 144 bits\");\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     * _Available since v4.7._\n     */\n    function toUint136(uint256 value) internal pure returns (uint136) {\n        require(value <= type(uint136).max, \"SafeCast: value doesn't fit in 136 bits\");\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     * _Available since v2.5._\n     */\n    function toUint128(uint256 value) internal pure returns (uint128) {\n        require(value <= type(uint128).max, \"SafeCast: value doesn't fit in 128 bits\");\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     * _Available since v4.7._\n     */\n    function toUint120(uint256 value) internal pure returns (uint120) {\n        require(value <= type(uint120).max, \"SafeCast: value doesn't fit in 120 bits\");\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     * _Available since v4.7._\n     */\n    function toUint112(uint256 value) internal pure returns (uint112) {\n        require(value <= type(uint112).max, \"SafeCast: value doesn't fit in 112 bits\");\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     * _Available since v4.7._\n     */\n    function toUint104(uint256 value) internal pure returns (uint104) {\n        require(value <= type(uint104).max, \"SafeCast: value doesn't fit in 104 bits\");\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     * _Available since v4.2._\n     */\n    function toUint96(uint256 value) internal pure returns (uint96) {\n        require(value <= type(uint96).max, \"SafeCast: value doesn't fit in 96 bits\");\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     * _Available since v4.7._\n     */\n    function toUint88(uint256 value) internal pure returns (uint88) {\n        require(value <= type(uint88).max, \"SafeCast: value doesn't fit in 88 bits\");\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     * _Available since v4.7._\n     */\n    function toUint80(uint256 value) internal pure returns (uint80) {\n        require(value <= type(uint80).max, \"SafeCast: value doesn't fit in 80 bits\");\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     * _Available since v4.7._\n     */\n    function toUint72(uint256 value) internal pure returns (uint72) {\n        require(value <= type(uint72).max, \"SafeCast: value doesn't fit in 72 bits\");\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     * _Available since v2.5._\n     */\n    function toUint64(uint256 value) internal pure returns (uint64) {\n        require(value <= type(uint64).max, \"SafeCast: value doesn't fit in 64 bits\");\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     * _Available since v4.7._\n     */\n    function toUint56(uint256 value) internal pure returns (uint56) {\n        require(value <= type(uint56).max, \"SafeCast: value doesn't fit in 56 bits\");\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     * _Available since v4.7._\n     */\n    function toUint48(uint256 value) internal pure returns (uint48) {\n        require(value <= type(uint48).max, \"SafeCast: value doesn't fit in 48 bits\");\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     * _Available since v4.7._\n     */\n    function toUint40(uint256 value) internal pure returns (uint40) {\n        require(value <= type(uint40).max, \"SafeCast: value doesn't fit in 40 bits\");\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     * _Available since v2.5._\n     */\n    function toUint32(uint256 value) internal pure returns (uint32) {\n        require(value <= type(uint32).max, \"SafeCast: value doesn't fit in 32 bits\");\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     * _Available since v4.7._\n     */\n    function toUint24(uint256 value) internal pure returns (uint24) {\n        require(value <= type(uint24).max, \"SafeCast: value doesn't fit in 24 bits\");\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     * _Available since v2.5._\n     */\n    function toUint16(uint256 value) internal pure returns (uint16) {\n        require(value <= type(uint16).max, \"SafeCast: value doesn't fit in 16 bits\");\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     * _Available since v2.5._\n     */\n    function toUint8(uint256 value) internal pure returns (uint8) {\n        require(value <= type(uint8).max, \"SafeCast: value doesn't fit in 8 bits\");\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     * _Available since v3.0._\n     */\n    function toUint256(int256 value) internal pure returns (uint256) {\n        require(value >= 0, \"SafeCast: value must be positive\");\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     * _Available since v4.7._\n     */\n    function toInt248(int256 value) internal pure returns (int248 downcasted) {\n        downcasted = int248(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 248 bits\");\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     * _Available since v4.7._\n     */\n    function toInt240(int256 value) internal pure returns (int240 downcasted) {\n        downcasted = int240(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 240 bits\");\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     * _Available since v4.7._\n     */\n    function toInt232(int256 value) internal pure returns (int232 downcasted) {\n        downcasted = int232(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 232 bits\");\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     * _Available since v4.7._\n     */\n    function toInt224(int256 value) internal pure returns (int224 downcasted) {\n        downcasted = int224(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 224 bits\");\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     * _Available since v4.7._\n     */\n    function toInt216(int256 value) internal pure returns (int216 downcasted) {\n        downcasted = int216(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 216 bits\");\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     * _Available since v4.7._\n     */\n    function toInt208(int256 value) internal pure returns (int208 downcasted) {\n        downcasted = int208(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 208 bits\");\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     * _Available since v4.7._\n     */\n    function toInt200(int256 value) internal pure returns (int200 downcasted) {\n        downcasted = int200(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 200 bits\");\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     * _Available since v4.7._\n     */\n    function toInt192(int256 value) internal pure returns (int192 downcasted) {\n        downcasted = int192(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 192 bits\");\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     * _Available since v4.7._\n     */\n    function toInt184(int256 value) internal pure returns (int184 downcasted) {\n        downcasted = int184(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 184 bits\");\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     * _Available since v4.7._\n     */\n    function toInt176(int256 value) internal pure returns (int176 downcasted) {\n        downcasted = int176(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 176 bits\");\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     * _Available since v4.7._\n     */\n    function toInt168(int256 value) internal pure returns (int168 downcasted) {\n        downcasted = int168(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 168 bits\");\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     * _Available since v4.7._\n     */\n    function toInt160(int256 value) internal pure returns (int160 downcasted) {\n        downcasted = int160(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 160 bits\");\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     * _Available since v4.7._\n     */\n    function toInt152(int256 value) internal pure returns (int152 downcasted) {\n        downcasted = int152(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 152 bits\");\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     * _Available since v4.7._\n     */\n    function toInt144(int256 value) internal pure returns (int144 downcasted) {\n        downcasted = int144(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 144 bits\");\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     * _Available since v4.7._\n     */\n    function toInt136(int256 value) internal pure returns (int136 downcasted) {\n        downcasted = int136(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 136 bits\");\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     * _Available since v3.1._\n     */\n    function toInt128(int256 value) internal pure returns (int128 downcasted) {\n        downcasted = int128(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 128 bits\");\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     * _Available since v4.7._\n     */\n    function toInt120(int256 value) internal pure returns (int120 downcasted) {\n        downcasted = int120(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 120 bits\");\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     * _Available since v4.7._\n     */\n    function toInt112(int256 value) internal pure returns (int112 downcasted) {\n        downcasted = int112(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 112 bits\");\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     * _Available since v4.7._\n     */\n    function toInt104(int256 value) internal pure returns (int104 downcasted) {\n        downcasted = int104(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 104 bits\");\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     * _Available since v4.7._\n     */\n    function toInt96(int256 value) internal pure returns (int96 downcasted) {\n        downcasted = int96(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 96 bits\");\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     * _Available since v4.7._\n     */\n    function toInt88(int256 value) internal pure returns (int88 downcasted) {\n        downcasted = int88(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 88 bits\");\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     * _Available since v4.7._\n     */\n    function toInt80(int256 value) internal pure returns (int80 downcasted) {\n        downcasted = int80(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 80 bits\");\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     * _Available since v4.7._\n     */\n    function toInt72(int256 value) internal pure returns (int72 downcasted) {\n        downcasted = int72(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 72 bits\");\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     * _Available since v3.1._\n     */\n    function toInt64(int256 value) internal pure returns (int64 downcasted) {\n        downcasted = int64(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 64 bits\");\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     * _Available since v4.7._\n     */\n    function toInt56(int256 value) internal pure returns (int56 downcasted) {\n        downcasted = int56(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 56 bits\");\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     * _Available since v4.7._\n     */\n    function toInt48(int256 value) internal pure returns (int48 downcasted) {\n        downcasted = int48(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 48 bits\");\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     * _Available since v4.7._\n     */\n    function toInt40(int256 value) internal pure returns (int40 downcasted) {\n        downcasted = int40(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 40 bits\");\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     * _Available since v3.1._\n     */\n    function toInt32(int256 value) internal pure returns (int32 downcasted) {\n        downcasted = int32(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 32 bits\");\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     * _Available since v4.7._\n     */\n    function toInt24(int256 value) internal pure returns (int24 downcasted) {\n        downcasted = int24(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 24 bits\");\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     * _Available since v3.1._\n     */\n    function toInt16(int256 value) internal pure returns (int16 downcasted) {\n        downcasted = int16(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 16 bits\");\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     * _Available since v3.1._\n     */\n    function toInt8(int256 value) internal pure returns (int8 downcasted) {\n        downcasted = int8(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 8 bits\");\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     * _Available since v3.0._\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        require(value <= uint256(type(int256).max), \"SafeCast: value doesn't fit in an int256\");\n        return int256(value);\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/utils/structs/EnumerableSet.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n *     // Add the library methods\n *     using EnumerableSet for EnumerableSet.AddressSet;\n *\n *     // Declare a set state variable\n *     EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n    // To implement this library for multiple types with as little code\n    // repetition as possible, we write it in terms of a generic Set type with\n    // bytes32 values.\n    // The Set implementation uses private functions, and user-facing\n    // implementations (such as AddressSet) are just wrappers around the\n    // underlying Set.\n    // This means that we can only create new EnumerableSets for types that fit\n    // in bytes32.\n\n    struct Set {\n        // Storage of set values\n        bytes32[] _values;\n        // Position of the value in the `values` array, plus 1 because index 0\n        // means a value is not in the set.\n        mapping(bytes32 => uint256) _indexes;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function _add(Set storage set, bytes32 value) private returns (bool) {\n        if (!_contains(set, value)) {\n            set._values.push(value);\n            // The value is stored at length-1, but we add 1 to all indexes\n            // and use 0 as a sentinel value\n            set._indexes[value] = set._values.length;\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function _remove(Set storage set, bytes32 value) private returns (bool) {\n        // We read and store the value's index to prevent multiple reads from the same storage slot\n        uint256 valueIndex = set._indexes[value];\n\n        if (valueIndex != 0) {\n            // Equivalent to contains(set, value)\n            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n            // the array, and then remove the last element (sometimes called as 'swap and pop').\n            // This modifies the order of the array, as noted in {at}.\n\n            uint256 toDeleteIndex = valueIndex - 1;\n            uint256 lastIndex = set._values.length - 1;\n\n            if (lastIndex != toDeleteIndex) {\n                bytes32 lastValue = set._values[lastIndex];\n\n                // Move the last value to the index where the value to delete is\n                set._values[toDeleteIndex] = lastValue;\n                // Update the index for the moved value\n                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n            }\n\n            // Delete the slot where the moved value was stored\n            set._values.pop();\n\n            // Delete the index for the deleted slot\n            delete set._indexes[value];\n\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function _contains(Set storage set, bytes32 value) private view returns (bool) {\n        return set._indexes[value] != 0;\n    }\n\n    /**\n     * @dev Returns the number of values on the set. O(1).\n     */\n    function _length(Set storage set) private view returns (uint256) {\n        return set._values.length;\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function _at(Set storage set, uint256 index) private view returns (bytes32) {\n        return set._values[index];\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function _values(Set storage set) private view returns (bytes32[] memory) {\n        return set._values;\n    }\n\n    // Bytes32Set\n\n    struct Bytes32Set {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n        return _add(set._inner, value);\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n        return _remove(set._inner, value);\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n        return _contains(set._inner, value);\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(Bytes32Set storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n        return _at(set._inner, index);\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        bytes32[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // AddressSet\n\n    struct AddressSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(AddressSet storage set, address value) internal returns (bool) {\n        return _add(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(AddressSet storage set, address value) internal returns (bool) {\n        return _remove(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(AddressSet storage set, address value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(AddressSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(AddressSet storage set, uint256 index) internal view returns (address) {\n        return address(uint160(uint256(_at(set._inner, index))));\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(AddressSet storage set) internal view returns (address[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        address[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // UintSet\n\n    struct UintSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(UintSet storage set, uint256 value) internal returns (bool) {\n        return _add(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(UintSet storage set, uint256 value) internal returns (bool) {\n        return _remove(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(UintSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n        return uint256(_at(set._inner, index));\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(UintSet storage set) internal view returns (uint256[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        uint256[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n}\n"},{"file_path":"contracts/controllers/interfaces/IPoolControllerDynamic.sol","source_code":"//Copyright Open Trade Technology Ltd. 2023. All rights reserved.\n\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.36;\n\nimport \"../../interfaces/IPoolDynamicStructures.sol\";\n\n/**\n * @title A Pool's Admin controller\n * @dev Pool Admin's interact with the pool via the controller, including funding loans and adjusting\n * settings.\n */\ninterface IPoolControllerDynamic {\n  /**\n   * @dev Emitted when pool settings are updated.\n   */\n  event PoolSettingsUpdated();\n\n  /**\n   * @dev Emitted when the pool transitions a lifecycle state.\n   */\n  event LifeCycleStateTransition(IPoolLifeCycleStateDynamic state);\n  event DepositStateTransition(IPoolDepositActiveStateDynamic state);\n  event WithdrawStateTransition(IPoolWithdrawActiveStateDynamic state);\n  /**\n   * @dev Emitted when a pool is marked as in DisruptionOrDefault.\n   */\n  event DisruptionOrDefault(address indexed pool);\n\n  function serviceConfiguration() external view returns (address);\n\n  /**\n   * @dev The current configurable pool settings.\n   */\n  function settings() external view returns (IPoolConfigurableSettingsDynamic memory);\n  /**\n   * @dev The interest-during-withdrawal flag and its window, which sit outside the\n   * settings struct.\n   */\n  function interestDuringWithdrawSettings()\n    external\n    view\n    returns (bool interestDuringWithdraw, uint64 interestDuringWithdrawDays);\n  function state() external view returns (IPoolLifeCycleStateDynamic);\n  function depositState() external view returns (IPoolDepositActiveStateDynamic);\n  function withdrawState() external view returns (IPoolWithdrawActiveStateDynamic);\n\n  function activatedAt() external view returns (uint256);\n  function poolAdmin() external view returns (address);\n\n  function borrowerManager() external view returns (address);\n\n  function borrowerWalletAddr() external view returns (address);\n\n  function feeCollectorAddress() external view returns (address);\n\n  function addAdjustmentAmount(address lender, uint256 debit, uint256 credit, IPoolDynamicAdjustmentKind kind) external;\n\n  function setExchangeRateDynamic(uint256 _exchangeRate) external;\n  function setExchangeRateLinear(uint256 _exchangeRate, uint256 exchangeRateChange, int256 interestRate) external;\n  function setExchangeRateCompounding(\n    uint256 _exchangeRate,\n    uint256 exchangeRateCompoundingRate,\n    int256 interestRate\n  ) external;\n  function setExchangeRateAtMaturity(\n    uint256 _exchangeRate,\n    uint256 _exchangeRateAtMaturity,\n    uint256 _exchangeRateMaturityDay,\n    int256 interestRate\n  ) external;\n  function setIndicativeAndCollateralRates(int256 _indicativeInterestRate, uint256 _collateralRate) external;\n  function setPoolTimingSettings(\n    uint256 _closeOfDepositTime,\n    uint256 _closeOfWithdrawTime,\n    uint256 _transferOutDays,\n    bool interestDuringWithdraw_,\n    uint64 interestDuringWithdrawDays_\n  ) external;\n\n  function setBorrowermanager(address _borrowerManager) external;\n  function setPoolAdmin(address _poolAdmin) external;\n  function setFeeCollectorAddress(address _feeCollectorAddress) external;\n  function setBorrowerWalletAddr(address _borrowerWalletAddr) external;\n\n  function pauseDeposits() external;\n\n  function resumeDeposits() external;\n\n  function pauseWithdraws() external;\n  function resumeWithdraws() external;\n\n  function activatePool() external;\n  function closePool() external;\n  function disruptionOrDefault() external;\n  function reactivateAfterDisrution() external;\n}\n"},{"file_path":"contracts/factories/interfaces/IPoolAccessControlFactory.sol","source_code":"//Copyright Open Trade Technology Ltd. 2023. All rights reserved.\n\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.36;\n\n/**\n * @title An interface for a factory that creates PoolAccessControl contracts.\n */\ninterface IPoolAccessControlFactory {\n  /**\n   * @dev Creates a new PoolAccessControl.\n   */\n  function create(address pool) external returns (address);\n}\n"},{"file_path":"contracts/factories/interfaces/IPoolControllerFactoryDynamic.sol","source_code":"//Copyright Open Trade Technology Ltd. 2023. All rights reserved.\n\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.36;\n\nimport \"../../interfaces/IPoolDynamicStructures.sol\";\n\n/**\n * @title Interface for the PoolController factory.\n */\ninterface IPoolControllerFactoryDynamic {\n  /**\n   * @dev Emitted when a pool is created.\n   */\n  event PoolControllerCreated(address indexed pool, address indexed addr);\n\n  /**\n   * @dev Creates a pool's PoolAdmin controller\n   * @dev Emits `PoolControllerCreated` event.\n   */\n  function createController(\n    address pool,\n    address serviceConfiguration,\n    address admin,\n    IPoolConfigurableSettingsDynamic memory poolSettings\n  ) external returns (address);\n}\n"},{"file_path":"contracts/interfaces/IERC4626.sol","source_code":"//Copyright Open Trade Technology Ltd. 2023. All rights reserved.\n\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.36;\n\nimport { IERC20Upgradeable } from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/**\n * @title The interface according to the ERC-4626 standard.\n */\ninterface IERC4626 is IERC20Upgradeable {\n  /**\n   * @dev Emitted when tokens are deposited into the vault via the mint and deposit methods.\n   */\n  event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);\n\n  /**\n   * @dev Emitted when shares are withdrawn from the vault by a depositor in the redeem or withdraw methods.\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 Return the address of the underlying ERC-20 token used for the vault for accounting, depositing, withdrawing.\n   */\n  function asset() external view returns (address);\n\n  /**\n   * @dev Calculate the total amount of underlying assets held by the vault.\n   * NOTE: This method includes assets that are marked for withdrawal.\n   */\n  function totalAssets() external view returns (uint256);\n\n  /**\n   * @dev Calculates the amount of shares that would be exchanged by the vault for the amount of assets provided.\n   * Rounds DOWN per EIP4626.\n   */\n  function convertToShares(uint256 assets) external view returns (uint256);\n\n  /**\n   * @dev Calculates the amount of assets that would be exchanged by the vault for the amount of shares provided.\n   * Rounds DOWN per EIP4626.\n   */\n  function convertToAssets(uint256 shares) external view returns (uint256);\n\n  /**\n   * @dev Calculates the maximum amount of underlying assets that can be deposited in a single deposit call by the receiver.\n   */\n  function maxDeposit(address receiver) external view returns (uint256);\n\n  /**\n   * @dev Allows users to simulate the effects of their deposit at the current block.\n   */\n  function previewDeposit(uint256 assets) external view returns (uint256);\n\n  /**\n   * @dev Deposits assets of underlying tokens into the vault and grants ownership of shares to receiver.\n   * Emits a {Deposit} event.\n   */\n  function deposit(uint256 assets, address receiver) external returns (uint256);\n\n  /**\n   * @dev Returns the maximum amount of shares that can be minted in a single mint call by the receiver.\n   */\n  function maxMint(address receiver) external view returns (uint256);\n\n  /**\n   * @dev Allows users to simulate the effects of their mint at the current block.\n   */\n  function previewMint(uint256 shares) external view returns (uint256);\n\n  /**\n   * @dev Mints exactly shares vault shares to receiver by depositing assets of underlying tokens.\n   * Emits a {Deposit} event.\n   */\n  function mint(uint256 shares, address receiver) external returns (uint256);\n\n  /**\n   * @dev Returns the maximum amount of underlying assets that can be withdrawn from the owner balance with a single withdraw call.\n   */\n  function maxWithdraw(address owner) external view returns (uint256);\n\n  /**\n   * @dev Simulate the effects of their withdrawal at the current block.\n   * Per EIP4626, should round UP on the number of shares required for assets.\n   */\n  function previewWithdraw(uint256 assets) external view returns (uint256);\n\n  /**\n   * @dev Burns shares from owner and send exactly assets token from the vault to receiver.\n   * Emits a {Withdraw} event.\n   * Should round UP for EIP4626.\n   */\n  function withdraw(uint256 assets, address receiver, address owner) external returns (uint256);\n\n  /**\n   * @dev The maximum amount of shares that can be redeemed from the owner balance through a redeem call.\n   */\n  function maxRedeem(address owner) external view returns (uint256);\n\n  /**\n   * @dev Simulates the effects of their redeemption at the current block.\n   * Per EIP4626, should round DOWN.\n   */\n  function previewRedeem(uint256 shares) external view returns (uint256);\n\n  /**\n   * @dev Redeems a specific number of shares from owner and send assets of underlying token from the vault to receiver.\n   * Emits a {Withdraw} event.\n   * Per EIP4626, should round DOWN.\n   */\n  function redeem(uint256 shares, address receiver, address owner) external returns (uint256);\n}\n"},{"file_path":"contracts/interfaces/IPoolAccessControl.sol","source_code":"//Copyright Open Trade Technology Ltd. 2023. All rights reserved.\n\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.36;\n\n/**\n * @title The interface for controlling access to Pools\n */\ninterface IPoolAccessControl {\n  /**\n   * @dev Check if an address is allowed as a participant in the pool\n   * @param addr The address to verify\n   * @return whether the address is allowed as a participant\n   */\n  function isAllowed(address addr) external view returns (bool);\n}\n"},{"file_path":"contracts/interfaces/IPoolBase.sol","source_code":"//Copyright Open Trade Technology Ltd. 2023. All rights reserved.\n\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.36;\n\nimport \"./IRequestWithdrawable.sol\";\n\nimport \"./IServiceConfigurationV5.sol\";\nimport \"./IPoolAccessControl.sol\";\nimport { IERC20Upgradeable } from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nenum IPoolType {\n  TermPool,\n  FlexRatePool,\n  DynamicPool\n}\n\ninterface IPoolBase is IERC20Upgradeable, IRequestWithdrawable {\n  function poolType() external view returns (IPoolType);\n\n  function liquidityAssetAddr() external view returns (address);\n\n  /**\n   * @dev The ServiceConfiguration.\n   */\n  function serviceConfiguration() external view returns (IServiceConfigurationV5);\n\n  /**\n   * @dev The admin for the pool.\n   */\n  function admin() external view returns (address);\n\n  function borrowerManagerAddr() external view returns (address);\n\n  function borrowerWalletAddr() external view returns (address);\n\n  function poolAccessControl() external view returns (IPoolAccessControl);\n\n  function isPermittedLender(address) external view returns (bool);\n}\n"},{"file_path":"contracts/interfaces/IPoolDynamic.sol","source_code":"//Copyright Open Trade Technology Ltd. 2023. All rights reserved.\n\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.36;\n\nimport \"./IERC4626.sol\";\nimport \"./IServiceConfiguration.sol\";\n\nimport \"./IPoolBase.sol\";\n\nimport \"../controllers/interfaces/IPoolControllerDynamic.sol\";\nimport \"../interfaces/IPoolAccessControl.sol\";\nimport \"../interfaces/IPoolDynamicStructures.sol\";\n\n/**\n * @title The interface for liquidity pools.\n */\ninterface IPoolDynamic is IPoolBase {\n  event PoolCreated();\n  event PoolDeposit(\n    address indexed lender,\n    uint256 assets,\n    uint256 shares,\n    IPoolDynamicDepositType depositType,\n    bytes32 transferTxHash\n  );\n  // Off-chain reconciliation reference for an off-chain deposit (e.g. bank wireId,\n  // Solana txid).\n  event PoolDepositPaymentRef(address indexed lender, string paymentId);\n\n  event RedeemRequested(address indexed lender, uint256 assets, uint256 shares, bytes32 uuid);\n  event RedeemAccepted(address indexed lender, uint256 assets, uint256 shares, bytes32 uuid);\n  event RedeemRepay(\n    address indexed lender,\n    uint256 shares,\n    uint256 assets,\n    uint256 fees,\n    bytes32 uuid,\n    uint256 expectedAssets,\n    address fundsDestination\n  );\n  // Records the withdrawn value netted by off-chain accounting.\n  event RedeemRepayRecorded(address indexed lender, bytes32 indexed uuid, uint256 withdrawnValue);\n  event RedeemDestinationChanged(\n    address indexed lender,\n    uint256 assets,\n    uint256 shares,\n    bytes32 uuid,\n    address fundsDestination\n  );\n\n  event AccountDebit(address indexed lender, uint256 amount, uint256 shares);\n  event AccountCredit(address indexed lender, uint256 amount, uint256 shares);\n  event AccountAdjustment(address indexed lender, uint256 debit, uint256 credit, IPoolDynamicAdjustmentKind kind);\n  event TransferAssets(address indexed fundsDestination, uint256 amount);\n  event ExchangeRateSet(\n    uint256 _exchangeRate,\n    int256 interestRate,\n    uint256 typeDependantChangeParam,\n    uint256 exchangeRateMaturityDay\n  );\n\n  function borrowerWalletAddr() external view returns (address);\n\n  function transferToBorrowerWallet(uint256 assets) external;\n  function depositOffChain(uint256 assets, address lender, string calldata paymentId) external returns (uint256 shares);\n  function depositFromTransfer(\n    uint256 assets,\n    address lender,\n    bytes32 transferTxHash\n  ) external returns (uint256 shares);\n  /**\n   * @dev The PoolController contract\n   */\n  function poolControllerDynamic() external view returns (IPoolControllerDynamic);\n\n  function accountings() external view returns (IPoolAccountingsDynamic memory);\n\n  /**\n   * @dev The current configurable pool settings.\n   */\n  function settings() external view returns (IPoolConfigurableSettingsDynamic calldata settings);\n  function setIndicativeAndCollateralRates(int256 _indicativeInterestRate, uint256 _collateralRate) external;\n  function setExchangeRate(\n    uint256 _exchangeRate,\n    uint256 typeDependantChangeParam,\n    uint256 exchangeRateMaturityDay,\n    int256 interestRate\n  ) external;\n  // function setExchangeRateDynamic(uint256 _exchangeRate) external;\n  // function setExchangeRateLinear(uint256 _exchangeRate, uint256 exchangeRateChange, uint256 interestRate) external;\n  // function setExchangeRateCompounding(\n  //   uint256 _exchangeRate,\n  //   uint256 exchangeRateCompoundingRate,\n  //   uint256 interestRate\n  // ) external;\n  // function setExchangeRateAtMaturity(\n  //   uint256 _exchangeRate,\n  //   uint256 _exchangeRateAtMaturity,\n  //   uint256 _exchangeRateMaturityDay,\n  //   uint256 interestRate\n  // ) external;\n\n  function assetBalanceOf(address lender) external view returns (uint256);\n  function addAdjustmentAmount(address lender, uint256 debit, uint256 credit, IPoolDynamicAdjustmentKind kind) external;\n\n  function state() external view returns (IPoolLifeCycleStateDynamic);\n  function asset() external view returns (address);\n  function decimals() external view returns (uint8);\n  function exchangeRate() external view returns (uint256);\n  function convertToShares(uint256 assets) external view returns (uint256 shares);\n  function convertToAssets(uint256 shares) external view returns (uint256 assets);\n  function totalAssets() external view returns (uint256);\n  function totalAvailableAssets() external view returns (uint256 assets);\n\n  function deposit(uint256 assets, address lender) external returns (uint256 shares);\n  /**\n   * @dev Submits a withdrawal request, incurring a fee.\n   */\n  function requestRedeem(uint256 shares) external returns (uint256 assets);\n  function maxRedeemRequest(address owner) external view returns (uint256 maxShares);\n  function unpaidDirectTransferShares(address lender) external view returns (uint256);\n  function changeRedemptionDestination(address lender, bytes32 uuid, address fundsDestination) external;\n  function acceptRedemption(address lender, bytes32 uuid) external;\n  function repayRedemption(address lender, uint256 repayment, uint256 fees, bytes32 uuid) external;\n\n  function getActiveWithdraws() external view returns (IPoolWithdrawDynamic[] memory);\n  function getPoolDynamicConfigurationState() external view returns (IPoolConfigurationStateDynamic memory);\n  function getPoolDynamicOverviewState() external view returns (IPoolOverviewStateDynamic memory);\n  function getPoolDynamicAccountState(address lender) external view returns (IPoolAccountStateDynamic memory);\n}\n"},{"file_path":"contracts/interfaces/IPoolDynamicStructures.sol","source_code":"//Copyright Open Trade Technology Ltd. 2023. All rights reserved.\n\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.36;\n// A calldata parameter of PoolFactoryDynamic.createPool, so its shape is part of that\n// selector, and the factory is its own beacon: the factory's own code can never be\n// replaced. A member added here leaves the deployed factory encoding a selector the\n// upgraded pool no longer has, and every create reverts. Settings that are not needed\n// at creation belong in PoolControllerDynamic as appended storage.\nstruct IPoolConfigurableSettingsDynamic {\n  address borrowerManager;\n  address borrowerWalletAddr;\n  address feeCollectorAddress;\n  // Dead on-chain: nothing reads these, they are only surfaced in the state getters.\n  // transferOutDays drifts from the off-chain copy, which is the value shown to users.\n  uint256 closeOfDepositTime;\n  uint256 closeOfWithdrawTime;\n  uint256 transferOutDays;\n  IPoolDynamicExchangeRateType exchangeRateType;\n}\n\nstruct PoolAddressListDynamic {\n  address liquidityAsset;\n  address poolAdmin;\n  address serviceConfiguration;\n  address poolControllerFactoryDynamic;\n  address poolAccessControlFactory;\n}\nstruct IPoolAccountingsDynamic {\n  uint256 totalAssetsDeposited;\n  uint256 totalAssetsWithdrawn;\n  uint256 exchangeRate;\n  uint256 exchangeRateSetDay;\n  uint256 exchangeRateChangeRate;\n  uint256 exchangeRateCompoundingRate;\n  uint256 exchangeRateAtMaturity;\n  uint256 exchangeRateMaturityDay;\n  int256 interestRate;\n  int256 indicativeInterestRate;\n  uint256 collateralRate;\n}\nenum IPoolDynamicExchangeRateType {\n  Undefined,\n  Dynamic,\n  Linear,\n  Compounding,\n  Term\n}\nenum IPoolLifeCycleStateDynamic {\n  Initialized,\n  Active,\n  Closed,\n  DisruptionOrDefault\n}\nenum IPoolDepositActiveStateDynamic {\n  Active,\n  Inactive\n}\nenum IPoolWithdrawActiveStateDynamic {\n  Active,\n  Inactive\n}\nenum IPoolDynamicWithdrawStage {\n  UndefinedStage,\n  Requested,\n  Accepted,\n  Repaid\n}\n// ContractDeposit: lender approves and calls deposit() directly.\n// OffChainDeposit: client transfers to a company deposit address, ops record it on chain.\n// TransferDeposit: client transfers straight to the pool, admin accepts it.\n// CrossChainDeposit: defined but unused.\n// LYT pools use the same names without CrossChainDeposit, so their numbering differs.\nenum IPoolDynamicDepositType {\n  UndefinedDeposit,\n  ContractDeposit,\n  OffChainDeposit,\n  CrossChainDeposit,\n  TransferDeposit\n}\n// How addAdjustmentAmount moves the accounting totals alongside the share burn/mint.\n// BalanceOnly moves no totals (e.g. fee collection). DepositCorrection: debit reduces\n// deposited, credit increases it. Withdrawal: debit increases withdrawn, credit\n// reduces it.\nenum IPoolDynamicAdjustmentKind {\n  BalanceOnly,\n  DepositCorrection,\n  Withdrawal\n}\nstruct IPoolLenderDataDynamic {\n  uint256 requestedShares;\n  uint256 requestedAssets;\n  uint256 acceptedShares;\n  uint256 acceptedAssets;\n  uint256 assetsDeposited;\n  uint256 assetsWithdrawn;\n  uint256 outstandingRequests;\n  // Shares this lender sent to the pool address to open a redemption, still held\n  // there. They have left balanceOf(lender) and are counted in requestedShares or\n  // acceptedShares, so free shares add them back. At or below the amount the pool\n  // address actually holds for the lender, so free shares can only understate: a\n  // redemption opened before this counter existed has nothing recorded against it.\n  uint256 unpaidDirectTransferShares;\n}\n\nstruct IPoolWithdrawDynamic {\n  bytes32 uuid;\n  address lender;\n  uint256 assets;\n  uint256 shares;\n  IPoolDynamicWithdrawStage stage;\n  address fundsDestination;\n  bool transferRedeem;\n}\nstruct IPoolConfigurationStateDynamic {\n  address poolAddr;\n  string name;\n  string symbol;\n  address poolAccessControl;\n  address poolControllerDynamic;\n  uint256 activatedAt;\n  // PoolControllerDynamic\n  address serviceConfiguration;\n  address liquidityAssetAddr;\n  address poolAdmin;\n  address borrowerManager;\n  address borrowerWalletAddr;\n  address feeCollectorAddress;\n  uint256 closeOfDepositTime;\n  uint256 closeOfWithdrawTime;\n  uint256 transferOutDays;\n  IPoolDynamicExchangeRateType exchangeRateType;\n  bool interestDuringWithdraw;\n  uint64 interestDuringWithdrawDays;\n}\nstruct IPoolOverviewStateDynamic {\n  address poolAddr;\n  uint256 state;\n  // accountings\n  uint256 totalAssetsDeposited;\n  uint256 totalAssetsWithdrawn;\n  uint256 totalAssets;\n  uint256 totalShares;\n  uint256 exchangeRate;\n  uint256 exchangeRateAtSetDay;\n  uint256 exchangeRateSetDay;\n  uint256 exchangeRateChangeRate;\n  uint256 exchangeRateCompoundingRate;\n  uint256 exchangeRateAtMaturity;\n  uint256 exchangeRateMaturityDay;\n  int256 interestRate;\n  int256 indicativeInterestRate;\n  uint256 collateralRate;\n  //\n  IPoolWithdrawDynamic[] activeWithdraws;\n}\n\nstruct IPoolAccountStateDynamic {\n  address poolAddr;\n  address accountAddr;\n  address liquidityAssetAddr;\n  uint256 tokenBalance;\n  uint256 assetBalance;\n  uint256 maxWithdrawRequest;\n  uint256 maxRedeemRequest;\n  // lenderData\n\n  uint256 requestedSharesOf;\n  uint256 requestedAssetsOf;\n  uint256 acceptedShares;\n  uint256 acceptedAssets;\n  uint256 assetsDeposited;\n  uint256 assetsWithdrawn;\n}\n"},{"file_path":"contracts/interfaces/IRequestWithdrawable.sol","source_code":"//Copyright Open Trade Technology Ltd. 2023. All rights reserved.\n\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.36;\n\n/**\n * @title Interface that exposes methods to request withdraws / redeems.\n * @dev Terminology and design informed to complement ERC4626.\n */\ninterface IRequestWithdrawable {\n  /**\n   * @dev Returns the maximum number of `shares` that can be\n   * requested to be redeemed from the owner balance with a single\n   * `requestRedeem` call in the current block.\n   *\n   * Note: This is equivalent of EIP-4626 `maxRedeem`\n   */\n  function maxRedeemRequest(address owner) external view returns (uint256 maxShares);\n\n  /**\n   * @dev Returns the maximum amount of underlying `assets` that can be\n   * requested to be withdrawn from the owner balance with a single\n   * `requestWithdraw` call in the current block.\n   *\n   * Note: This is equivalent of EIP-4626 `maxWithdraw`\n   */\n  function maxWithdrawRequest(address owner) external view returns (uint256 maxAssets);\n\n  /**\n   * @dev Simulate the effects of a redeem request at the current block.\n   * Returns the amount of underlying assets that would be requested if this\n   * entire redeem request were to be processed at the current block.\n   *\n   * Note: This is equivalent of EIP-4626 `previewRedeem`\n   */\n  function previewRedeemRequest(uint256 shares) external view returns (uint256 assets);\n\n  /**\n   * @dev Simulate the effects of a withdrawal request at the current block.\n   * Returns the amount of `shares` that would be burned if this entire\n   * withdrawal request were to be processed at the current block.\n   *\n   * Note: This is equivalent of EIP-4626 `previewWithdraw`\n   */\n  function previewWithdrawRequest(uint256 assets) external view returns (uint256 shares);\n}\n"},{"file_path":"contracts/interfaces/IServiceConfiguration.sol","source_code":"//Copyright Open Trade Technology Ltd. 2023. All rights reserved.\n\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.36;\n\nstruct SerivceAddressList {\n  address[] liquidityAssets;\n  address tosAcceptanceRegistry;\n  address loanFactory;\n  address poolFactoryAddress;\n  address queryLibAddress;\n  address poolLibAddress;\n  address loanLibAddress;\n  address poolControllerFactoryAddress;\n  address withdrawControllerFactoryAddress;\n  address vaultFactoryAddress;\n  address poolAccessControlFactoryAddress;\n}\n\n/**\n * @title The protocol global Service Configuration\n */\ninterface IServiceConfiguration {\n  /**\n   * @dev Emitted when an address is changed.\n   */\n  event AddressSet(bytes32 which, address addr);\n\n  /**\n   * @dev Emitted when a liquidity asset is set.\n   */\n  event LiquidityAssetSet(address addr, bool value);\n\n  /**\n   * @dev Emitted when a parameter is set.\n   */\n  event ParameterSet(bytes32, uint256 value);\n\n  /**\n   * @dev Emitted when the protocol is paused.\n   */\n  event ProtocolPaused(bool paused);\n\n  /**\n   * @dev Emitted when a loan factory is set\n   */\n  event LoanFactorySet(address indexed factory);\n  event PoolFactorySet(address indexed factory);\n  event QueryLibSet(address indexed factory);\n  event LoanLibSet(address indexed factory);\n  event PoolLibSet(address indexed factory);\n  event PoolAdminWalletSet(address indexed factory);\n\n  /**\n   * @dev Emitted when the TermsOfServiceRegistry is set\n   */\n  event TermsOfServiceRegistrySet(address indexed registry);\n\n  /**\n   * @dev checks if a given address has the Operator role\n   */\n  function isOperator(address addr) external view returns (bool);\n\n  /**\n   * @dev checks if a given address has the Deployer role\n   */\n  function isDeployer(address addr) external view returns (bool);\n\n  /**\n   * @dev checks if a given address has the Deployer role\n   */\n  function isPoolAdmin(address addr) external view returns (bool);\n\n  /**\n   * @dev checks if a given address has the Deployer role\n   */\n  function isBorrower(address addr) external view returns (bool);\n\n  /**\n   * @dev Whether the protocol is paused.\n   */\n  function paused() external view returns (bool);\n\n  /**\n   * @dev Whether an address is supported as a liquidity asset.\n   */\n  function isLiquidityAsset(address addr) external view returns (bool);\n\n  /**\n   * @dev Address of the Terms of Service acceptance registry.\n   */\n  function tosAcceptanceRegistry() external view returns (address);\n\n  /**\n   * @dev Sets whether a loan factory is valid\n   * @param addr Address of loan factory\n   */\n  function setLoanFactory(address addr) external;\n\n  function setPoolFactory(address addr) external;\n\n  function setQueryLib(address addr) external;\n\n  function setPoolLib(address addr) external;\n\n  function setLoanLib(address addr) external;\n\n  function getLoanFactory() external view returns (address);\n\n  function getPoolFactory() external view returns (address);\n\n  function getQueryLib() external view returns (address);\n\n  function getLoanLib() external view returns (address);\n\n  function getPoolLib() external view returns (address);\n\n  function setPoolAdminWallet(address addr) external;\n\n  function getPoolAdminWallet() external view returns (address);\n\n  /**\n   * @dev Sets the ToSAcceptanceRegistry for the protocol\n   * @param addr Address of registry\n   */\n  function setToSAcceptanceRegistry(address addr) external;\n\n  /**\n   * @dev Sets supported liquidity assets for the protocol. Callable by the operator.\n   * @param addr Address of liquidity asset\n   * @param value Whether supported or not\n   */\n  function setLiquidityAsset(address addr, bool value) external;\n\n  function getServiceAddressList() external view returns (SerivceAddressList memory setLoanFactoryerivceAddressList);\n}\n"},{"file_path":"contracts/interfaces/IServiceConfigurationV3.sol","source_code":"//Copyright Open Trade Technology Ltd. 2023. All rights reserved.\n\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.36;\n\nimport \"./IServiceConfiguration.sol\";\n\nstruct SerivceAddressListV3 {\n  address[] liquidityAssets;\n  address tosAcceptanceRegistry;\n  address loanFactory;\n  address poolFactoryAddress;\n  address poolFactoryFlexAddress;\n  address queryLibAddress;\n  address poolLibAddress;\n  address poolLibFlexAddress;\n  address loanLibAddress;\n  address poolControllerFactoryAddress;\n  address withdrawControllerFactoryAddress;\n  address vaultFactoryAddress;\n  address poolAccessControlFactoryAddress;\n  address poolControllerFactoryFlexAddress;\n  address withdrawDepositControllerFactoryFlexAddress;\n  address poolRegistryAddress;\n}\n\nenum IFactoryType {\n  PoolFactory,\n  LoanFactory,\n  VaultFactory,\n  PoolFactoryFlex,\n  PoolControllerFactory,\n  PoolLibFlex,\n  PoolControllerFactoryFlex,\n  WithdrawDepositControllerFactoryFlex,\n  WithdrawControllerFactory,\n  PoolAccessControlFactory,\n  PoolFactoryDynamic,\n  FeeCollector\n}\nstruct LegacyFactoryStruct {\n  IFactoryType factoryType;\n  address factoryAddress;\n}\n\n/**\n * @title The protocol global Service Configuration\n */\ninterface IServiceConfigurationV3 is IServiceConfiguration {\n  event PoolFactoryFlexSet(address indexed factory);\n\n  event PoolLibFlexSet(address indexed factory);\n\n  event PoolRegistrySet(address indexed factory);\n\n  function version() external pure returns (uint16);\n\n  function isAutomation(address addr) external view returns (bool);\n\n  function setPoolFactoryFlex(address addr) external;\n\n  function setPoolLibFlex(address addr) external;\n\n  function setPoolRegistry(address addr) external;\n\n  function getPoolRegistry() external view returns (address);\n\n  function getPoolFactoryFlex() external view returns (address);\n\n  function getPoolLibFlex() external view returns (address);\n\n  function getLegacyFactories() external view returns (LegacyFactoryStruct[] memory legacyFactories);\n\n  function getServiceAddressListV3() external view returns (SerivceAddressListV3 memory addressList);\n}\n"},{"file_path":"contracts/interfaces/IServiceConfigurationV5.sol","source_code":"//Copyright Open Trade Technology Ltd. 2023. All rights reserved.\n\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.36;\n\nimport \"./IServiceConfigurationV3.sol\";\n\nstruct SerivceAddressListV5 {\n  address[] liquidityAssets;\n  address tosAcceptanceRegistry;\n  address loanFactory;\n  address poolFactoryAddress;\n  address poolFactoryFlexAddress;\n  address queryLibAddress;\n  address poolLibAddress;\n  address poolLibFlexAddress;\n  address loanLibAddress;\n  address poolControllerFactoryAddress;\n  address withdrawControllerFactoryAddress;\n  address vaultFactoryAddress;\n  address poolAccessControlFactoryAddress;\n  address poolControllerFactoryFlexAddress;\n  address withdrawDepositControllerFactoryFlexAddress;\n  address poolRegistryAddress;\n  address poolFactoryDynamicAddress;\n  address poolControllerFactoryDynamicAddress;\n}\n\n/**\n * @title The protocol global Service Configuration\n */\ninterface IServiceConfigurationV5 is IServiceConfigurationV3 {\n  event PoolFactoryDynamicSet(address indexed factory);\n\n  function isFeeCollector(address addr) external view returns (bool);\n  function isFiatGateway(address addr) external view returns (bool);\n  function getPoolFactoryDynamic() external view returns (address);\n  function setPoolFactoryDynamic(address addr) external;\n\n  function getServiceAddressListV5()\n    external\n    view\n    returns (SerivceAddressListV5 memory setLoanFactoryerivceAddressList);\n}\n"},{"file_path":"contracts/libraries/PoolLibDynamic.sol","source_code":"//Copyright Open Trade Technology Ltd. 2023. All rights reserved.\n\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.36;\n\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\nimport \"../interfaces/IPoolDynamic.sol\";\nimport \"../interfaces/IPoolDynamicStructures.sol\";\n\n/**\n * @title Heavy execution logic for PoolDynamic.\n * @dev Linked into PoolDynamic via delegatecall, so this bytecode does not count\n * toward PoolDynamic's contract size.\n */\nlibrary PoolLibDynamic {\n  using EnumerableSet for EnumerableSet.Bytes32Set;\n\n  error InvalidAccess();\n  error ExchangeRateInvalid();\n  error NotLender();\n  error RedemptionNotFound();\n  error RedeemExceedsBalance();\n  error ZeroAmount();\n  error InvalidRedemptions();\n\n  function exchangeRate(address pool) public view returns (uint256) {\n    return\n      _exchangeRate(\n        IPoolDynamic(pool).accountings(),\n        IPoolDynamic(pool).poolControllerDynamic().settings().exchangeRateType\n      );\n  }\n\n  function _exchangeRate(\n    IPoolAccountingsDynamic memory a,\n    IPoolDynamicExchangeRateType exchangeRateType\n  ) internal view returns (uint256 _rate) {\n    uint256 numberOfDays = (block.timestamp / 1 days) - a.exchangeRateSetDay;\n    if (exchangeRateType == IPoolDynamicExchangeRateType.Dynamic) {\n      _rate = a.exchangeRate;\n    } else if (exchangeRateType == IPoolDynamicExchangeRateType.Linear) {\n      _rate = a.exchangeRate + numberOfDays * (a.exchangeRateChangeRate);\n    } else if (exchangeRateType == IPoolDynamicExchangeRateType.Compounding) {\n      if (numberOfDays > 0) {\n        _rate = a.exchangeRate;\n        if (numberOfDays > 7) {\n          revert ExchangeRateInvalid();\n        }\n        for (uint256 i = 0; i < numberOfDays; i++) {\n          _rate = (_rate * (a.exchangeRateCompoundingRate)) / (1e18);\n        }\n      } else {\n        _rate = a.exchangeRate;\n      }\n    } else if (exchangeRateType == IPoolDynamicExchangeRateType.Term) {\n      uint256 duration = a.exchangeRateMaturityDay - a.exchangeRateSetDay;\n\n      if (numberOfDays >= duration) {\n        _rate = a.exchangeRateAtMaturity;\n      } else {\n        if (a.exchangeRateAtMaturity > a.exchangeRate) {\n          _rate = a.exchangeRate + ((numberOfDays * (a.exchangeRateAtMaturity - a.exchangeRate)) / duration);\n        } else {\n          _rate = a.exchangeRate - (numberOfDays * (a.exchangeRate - a.exchangeRateAtMaturity)) / duration;\n        }\n      }\n    } else {\n      revert ExchangeRateInvalid();\n    }\n  }\n\n  function _convertToAssets(\n    IPoolAccountingsDynamic memory a,\n    IPoolDynamicExchangeRateType exchangeRateType,\n    uint256 shares\n  ) internal view returns (uint256) {\n    return (_exchangeRate(a, exchangeRateType) * shares) / 1e18;\n  }\n\n  function _convertToShares(\n    IPoolAccountingsDynamic memory a,\n    IPoolDynamicExchangeRateType exchangeRateType,\n    uint256 assets\n  ) internal view returns (uint256) {\n    return (assets * 1e18) / _exchangeRate(a, exchangeRateType);\n  }\n\n  /**\n   * @dev Shared body of deposit, depositOffChain and depositFromTransfer.\n   */\n  function executeDeposit(\n    address pool,\n    IPoolAccountingsDynamic storage accountings,\n    mapping(address => IPoolLenderDataDynamic) storage lenderData,\n    uint256 assets,\n    address lender\n  ) public returns (uint256 shares) {\n    if (assets == 0) revert ZeroAmount();\n\n    IPoolDynamicExchangeRateType exchangeRateType = IPoolDynamic(pool)\n      .poolControllerDynamic()\n      .settings()\n      .exchangeRateType;\n    shares = _convertToShares(accountings, exchangeRateType, assets);\n    // At a high enough exchange rate the division floors to 0; the deposit would\n    // otherwise take the lender's assets and mint them nothing.\n    if (shares == 0) revert ZeroAmount();\n\n    accountings.totalAssetsDeposited += assets;\n    lenderData[lender].assetsDeposited += assets;\n  }\n\n  function requestRedeemExecute(\n    address pool,\n    IPoolAccountingsDynamic storage accountings,\n    mapping(address => IPoolLenderDataDynamic) storage lenderData,\n    mapping(bytes32 => IPoolWithdrawDynamic) storage activeWithdraws,\n    EnumerableSet.Bytes32Set storage activeWithdrawKeys,\n    address lender,\n    uint256 shares,\n    bool transferRedeem\n  ) public returns (uint256 assets) {\n    IPoolDynamicExchangeRateType exchangeRateType = IPoolDynamic(pool)\n      .poolControllerDynamic()\n      .settings()\n      .exchangeRateType;\n    assets = _convertToAssets(accountings, exchangeRateType, shares);\n\n    if (shares == 0) {\n      revert ZeroAmount();\n    }\n    // At a low enough exchange rate the division floors to 0; the request would\n    // otherwise burn the lender's shares at repay and record nothing withdrawn.\n    if (assets == 0) {\n      revert ZeroAmount();\n    }\n    if (shares > IPoolDynamic(pool).maxRedeemRequest(lender)) {\n      revert RedeemExceedsBalance();\n    }\n    if (lenderData[lender].outstandingRequests > 100) {\n      revert InvalidRedemptions();\n    }\n\n    lenderData[lender].requestedShares += shares;\n    lenderData[lender].requestedAssets += assets;\n    lenderData[lender].outstandingRequests += 1;\n    if (transferRedeem) {\n      lenderData[lender].unpaidDirectTransferShares += shares;\n    }\n    bytes32 uuid = keccak256(abi.encodePacked(block.timestamp, lender, shares, assets));\n\n    if (activeWithdraws[uuid].lender != address(0)) {\n      revert InvalidRedemptions();\n    }\n\n    activeWithdraws[uuid] = IPoolWithdrawDynamic({\n      uuid: uuid,\n      lender: lender,\n      assets: assets,\n      shares: shares,\n      stage: IPoolDynamicWithdrawStage.Requested,\n      fundsDestination: lender,\n      transferRedeem: transferRedeem\n    });\n    if (!activeWithdrawKeys.add(uuid)) {\n      revert InvalidAccess();\n    }\n    emit IPoolDynamic.RedeemRequested(lender, assets, shares, uuid);\n    return assets;\n  }\n\n  /**\n   * @dev Accept stage. With interestDuringWithdraw on the payout is recomputed at the\n   * accept-time rate and locked; with it off the value locked at request is kept.\n   */\n  function acceptRedemption(\n    address pool,\n    mapping(bytes32 => IPoolWithdrawDynamic) storage activeWithdraws,\n    IPoolAccountingsDynamic storage accountings,\n    mapping(address => IPoolLenderDataDynamic) storage lenderData,\n    address lender,\n    bytes32 uuid\n  ) public {\n    IPoolWithdrawDynamic storage w = activeWithdraws[uuid];\n    if (w.stage != IPoolDynamicWithdrawStage.Requested) {\n      revert RedemptionNotFound();\n    }\n    if (w.lender != lender) {\n      revert NotLender();\n    }\n\n    uint256 shares = w.shares;\n    // Unwind the requested counters by the request-time value, independent of the\n    // value locked below, so requestedAssets does not drift by the interest earned\n    // across the window.\n    uint256 requestAssets = w.assets;\n\n    IPoolControllerDynamic controller = IPoolDynamic(pool).poolControllerDynamic();\n    (bool interestDuringWithdraw, ) = controller.interestDuringWithdrawSettings();\n    // With interestDuringWithdraw on, the locked value is recomputed at the accept-time\n    // rate and can floor to 0 if the rate has fallen since request (negative-yield /\n    // Term-down). That is the settled value, not an error.\n    uint256 lockedAssets = interestDuringWithdraw\n      ? _convertToAssets(accountings, controller.settings().exchangeRateType, shares)\n      : requestAssets;\n\n    w.stage = IPoolDynamicWithdrawStage.Accepted;\n    w.assets = lockedAssets;\n\n    lenderData[lender].acceptedShares += shares;\n    lenderData[lender].acceptedAssets += lockedAssets;\n    lenderData[lender].requestedShares -= shares;\n    lenderData[lender].requestedAssets -= requestAssets;\n    emit IPoolDynamic.RedeemAccepted(lender, lockedAssets, shares, uuid);\n  }\n\n  function executeRepayRedemption(\n    mapping(bytes32 => IPoolWithdrawDynamic) storage activeWithdraws,\n    IPoolAccountingsDynamic storage accountings,\n    mapping(address => IPoolLenderDataDynamic) storage lenderData,\n    EnumerableSet.Bytes32Set storage activeWithdrawKeys,\n    address lender,\n    bytes32 uuid\n  ) public returns (uint256 shares, uint256 assets, address fundsDestination, bool isTransferRedeem) {\n    IPoolWithdrawDynamic storage w = activeWithdraws[uuid];\n    if (w.stage != IPoolDynamicWithdrawStage.Accepted) {\n      revert RedemptionNotFound();\n    }\n    if (w.lender != lender) {\n      revert NotLender();\n    }\n    shares = w.shares;\n    assets = w.assets;\n    fundsDestination = w.fundsDestination;\n    isTransferRedeem = w.transferRedeem;\n\n    lenderData[lender].acceptedShares -= shares;\n    lenderData[lender].acceptedAssets -= assets;\n    lenderData[lender].outstandingRequests -= 1;\n    if (isTransferRedeem) {\n      // Clamped: a redemption requested before this counter existed has nothing\n      // recorded to take off, and its repay must still land.\n      uint256 parked = lenderData[lender].unpaidDirectTransferShares;\n      lenderData[lender].unpaidDirectTransferShares = parked > shares ? parked - shares : 0;\n    }\n\n    // Record the full locked value of the burned redemption, not the cash repayment:\n    // the whole redemption is burned even when the cash paid is partial.\n    lenderData[lender].assetsWithdrawn += assets;\n    accountings.totalAssetsWithdrawn += assets;\n\n    delete activeWithdraws[uuid];\n    if (!activeWithdrawKeys.remove(uuid)) {\n      revert InvalidAccess();\n    }\n\n    // Emit the recorded value so off-chain accounting nets the exact amount.\n    emit IPoolDynamic.RedeemRepayRecorded(lender, uuid, assets);\n  }\n}\n"},{"file_path":"contracts/upgrades/BeaconImplementation.sol","source_code":"//Copyright Open Trade Technology Ltd. 2023. All rights reserved.\n\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.36;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\n/**\n * @title BeaconImplementation base contract\n * @dev Base contract that overrides the constructor to disable initialization.\n */\nabstract contract BeaconImplementation is Initializable {\n  /// @custom:oz-upgrades-unsafe-allow constructor\n  constructor() {\n    _disableInitializers();\n  }\n}\n"}],"is_verified_via_sourcify":true,"can_be_visualized_via_sol2uml":true,"evm_version":"cancun","language":"solidity","is_verified_via_eth_bytecode_db":true,"is_fully_verified":false,"license_type":"none","is_blueprint":false,"name":"PoolDynamic","creation_bytecode":"0x6080604052348015600e575f5ffd5b5060156019565b60d3565b5f54610100900460ff161560835760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b5f5460ff9081161460d1575f805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6159a3806100e05f395ff3fe608060405234801561000f575f5ffd5b506004361061024f575f3560e01c806301e1d1141461025357806303210d3e1461026e57806306b3efd61461028357806306fdde031461029657806307a2d13a146102ab578063095ea7b3146102be57806309dc040c146102e15780631311b7bf146102f657806313b98c0f1461025357806318160ddd1461030757806323b872dd1461030f578063313ce5671461032257806335f3420b1461033c578063374f9a921461035c57806338d52e0f1461036f57806339509351146103805780633ba0b9a9146103935780635214d8ca1461039b57806352633aff146103a357806359d5cd7b146103b65780635f4fc4d6146103c95780636616c6ba146103dc5780636d36daf0146103ef5780636e553f651461040257806370a082311461041557806371253057146104285780637d22ee3e1461043b5780638456ec6e1461036f57806386402701146104505780639569178a1461047b57806395d89b411461048e5780639a11f56a14610496578063a0786081146104a9578063a3f8547714610535578063a457c2d714610548578063a9059cbb1461055b578063aa2f892d1461056e578063b1dd61b614610581578063bf2219d614610590578063c19d93fb146105a3578063c6e6f592146105b8578063c93b6c4a146105cb578063db6b2074146105de578063dd62ed3e146105f1578063def53cf314610604578063e06174e414610617578063e3baa9fe1461062c578063e8af8fa314610641578063ed08299014610654578063ef82207c14610669578063f851a4401461067c575b5f5ffd5b61025b610684565b6040519081526020015b60405180910390f35b610276610696565b6040516102659190614a3c565b61025b610291366004614a67565b610701565b61029e610714565b6040516102659190614ab0565b61025b6102b9366004614ac2565b6107a4565b6102d16102cc366004614ad9565b6107cb565b6040519015158152602001610265565b6102f46102ef366004614b03565b6107e2565b005b6066546001600160a01b0316610276565b60355461025b565b6102d161031d366004614b3b565b610cae565b61032a610cd1565b60405160ff9091168152602001610265565b61034f61034a366004614a67565b610d3c565b6040516102659190614b79565b6102f461036a366004614c26565b610e79565b6067546001600160a01b0316610276565b6102d161038e366004614ad9565b6111ec565b61025b61120d565b610276611285565b6102f46103b1366004614ddc565b6112cc565b61025b6103c4366004614ac2565b61159d565b61025b6103d7366004614eca565b6116e4565b607354610276906001600160a01b031681565b606554610276906001600160a01b031681565b61025b610410366004614eee565b611aa4565b61025b610423366004614a67565b611e8f565b6102f4610436366004614f1c565b611ea9565b61044361200e565b6040516102659190614fd3565b61025b61045e366004614a67565b6001600160a01b03165f9081526074602052604090206007015490565b6102f4610489366004614ac2565b612164565b61029e6122c1565b6102f46104a436600461501b565b6122d0565b6104b16127fa565b60405161026591905f61016082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e083015160e083015261010083015161010083015261012083015161012083015261014083015161014083015292915050565b6102d1610543366004614a67565b6128b5565b6102d1610556366004614ad9565b612924565b6102d1610569366004614ad9565b61299e565b61025b61057c366004614ac2565b6129ab565b60026040516102659190615075565b61025b61059e366004615088565b612c5e565b6105ab612fc4565b604051610265919061510b565b61025b6105c6366004614ac2565b61302f565b6102f46105d9366004614ad9565b61304a565b61025b6105ec366004614a67565b6132a6565b61025b6105ff366004615118565b613342565b61025b610612366004614ac2565b61336c565b61061f613381565b60405161026591906151c0565b610634613431565b60405161026591906151ce565b61025b61064f366004614a67565b6137de565b61065c6137eb565b604051610265919061536e565b6102f4610677366004615443565b6139a2565b6102766139d8565b5f6106916102b960355490565b905090565b60735460408051630190869f60e11b815290515f926001600160a01b0316916303210d3e9160048083019260209291908290030181865afa1580156106dd573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106919190615463565b5f61070e6102b983611e8f565b92915050565b6060603680546107239061547e565b80601f016020809104026020016040519081016040528092919081815260200182805461074f9061547e565b801561079a5780601f106107715761010080835404028352916020019161079a565b820191905f5260205f20905b81548152906001019060200180831161077d57829003601f168201915b5050505050905090565b5f670de0b6b3a7640000826107b761120d565b6107c191906154c4565b61070e91906154db565b5f336107d8818585613a1f565b5060019392505050565b60665f9054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610832573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108569190615509565b15156001036108785760405163146f5dc360e21b815260040160405180910390fd5b60018060735f9054906101000a90046001600160a01b03166001600160a01b031663c19d93fb6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108cb573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108ef9190615522565b600381111561090057610900614f4b565b1461091e576040516367e554d160e01b815260040160405180910390fd5b6073546040805163b782cc4960e01b8152905133926001600160a01b03169163b782cc499160048083019260209291908290030181865afa158015610965573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109899190615463565b6001600160a01b0316146109af5760405162b145b560e31b815260040160405180910390fd5b604051630a3cb6b760e01b8152607560048201526068602482015260746044820152607660648201526001600160a01b038616608482015260a481018390525f908190819081907389a5feb31d5585a30094f698d4b802e45e9520af90630a3cb6b79060c401608060405180830381865af4158015610a30573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a549190615540565b60655460405163babcc53960e01b815294985092965090945092506001600160a01b03169063babcc53990610a8d908c90600401614a3c565b602060405180830381865afa158015610aa8573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610acc9190615509565b610ae957604051638c38000360e01b815260040160405180910390fd5b6073546040805163f108e22560e01b815290515f926001600160a01b03169163f108e2259160048083019260209291908290030181865afa158015610b30573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b549190615463565b60408051878152602081018c90529081018a905260608101899052608081018690526001600160a01b0385811660a0830152919250908b16907f5d88c6df9b9c24282c6d80c289e42a2754047e53bf5faacd7533ae0ca90240dd9060c00160405180910390a28115610bcf57610bca3086613b43565b610bd9565b610bd98a86613b43565b6001600160a01b03831615610c8b5760655460405163babcc53960e01b81526001600160a01b039091169063babcc53990610c18908690600401614a3c565b602060405180830381865afa158015610c33573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c579190615509565b610c7457604051638c38000360e01b815260040160405180910390fd5b606754610c8b906001600160a01b0316848b613c6a565b606754610ca2906001600160a01b0316828a613c6a565b50505050505050505050565b5f33610cbb858285613ccd565b610cc6858585613d45565b506001949350505050565b6067546040805163313ce56760e01b815290515f926001600160a01b03169163313ce5679160048083019260209291908290030181865afa158015610d18573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106919190615586565b610db5604051806101a001604052805f6001600160a01b031681526020015f6001600160a01b031681526020015f6001600160a01b031681526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b604080516101a0810182523081526001600160a01b038481166020830152606754169181019190915260608101610deb84611e8f565b8152602001610df984610701565b8152602001610e07846137de565b8152602001610e15846132a6565b81526001600160a01b039093165f8181526074602081815260408084208054838a01526001810154918901919091526002810154606089015260038101546080890152600481015460a08901529390925290526005015460c0909301929092525090565b60665f9054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ec9573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610eed9190615509565b1515600103610f0f5760405163146f5dc360e21b815260040160405180910390fd5b60018060735f9054906101000a90046001600160a01b03166001600160a01b031663c19d93fb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f62573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f869190615522565b6003811115610f9757610f97614f4b565b14610fb5576040516367e554d160e01b815260040160405180910390fd5b6073546040805163b782cc4960e01b8152905133926001600160a01b03169163b782cc499160048083019260209291908290030181865afa158015610ffc573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110209190615463565b6001600160a01b0316146110465760405162b145b560e31b815260040160405180910390fd5b6001600160a01b038216158015906110ca575060655460405163babcc53960e01b81526001600160a01b039091169063babcc53990611089908590600401614a3c565b602060405180830381865afa1580156110a4573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110c89190615509565b155b156110e857604051638c38000360e01b815260040160405180910390fd5b5f838152607560205260409020600101546001600160a01b0385811691161461112457604051638c38000360e01b815260040160405180910390fd5b5f8381526075602052604081206003015490036111545760405163986a190560e01b815260040160405180910390fd5b5f838152607560209081526040918290206004810180546001600160a01b038781166101008102610100600160a81b031990931692909217909255600383015460029093015485518181529485018490529484018890526060840152909291908716907f142999da1b7c9b15a43b8fb11fb55ab6bae6111cbd90626e5b47e49efd6a47999060800160405180910390a2505050505050565b5f336107d88185856111fe8383613342565b61120891906155a6565b613a1f565b60405163dc3b7c8b60e01b81525f907389a5feb31d5585a30094f698d4b802e45e9520af9063dc3b7c8b90611246903090600401614a3c565b602060405180830381865af4158015611261573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061069191906155b9565b6073546040805163219cbc6d60e01b815290515f926001600160a01b03169163219cbc6d9160048083019260209291908290030181865afa1580156106dd573d5f5f3e3d5ffd5b5f54610100900460ff16158080156112ea57505f54600160ff909116105b8061130a57506112f930613ee6565b15801561130a57505f5460ff166001145b6113725760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b5f805460ff191660011790558015611393575f805461ff0019166101001790555b61139d8383613ef5565b604080860151606680546001600160a01b038084166001600160a01b0319928316179092558851606780549184169190921617905560608801516020890151935163b801c41360e01b815291169263b801c41392611402923092908a906004016155d0565b6020604051808303815f875af115801561141e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114429190615463565b607380546001600160a01b0319166001600160a01b0392831617905560808601516040516313db266360e31b8152911690639ed9331890611487903090600401614a3c565b6020604051808303815f875af11580156114a3573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114c79190615463565b606580546001600160a01b0319166001600160a01b0392909216919091179055670de0b6b3a7640000606a5561150062015180426154db565b606b555f606c55670de0b6b3a7640000606d819055606e5561152562015180426154db565b606f556040517f4196df5545177bff7cc5a8e7d409ae30d345a95b556b2eaf6b727038bef3128e905f90a18015611596575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15b5050505050565b5f815f036115be57604051631f2a200560e01b815260040160405180910390fd5b6115c7826107a4565b9050805f036115e957604051631f2a200560e01b815260040160405180910390fd5b6073546040805163475cb32560e01b815290515f926001600160a01b03169163475cb3259160048083019260209291908290030181865afa158015611630573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116549190615613565b600181111561166557611665614f4b565b14611683576040516367e554d160e01b815260040160405180910390fd5b61168c336132a6565b8211156116ac576040516357ad5d9960e01b815260040160405180910390fd5b335f90815260746020526040902060060154606410156116df576040516364aea42560e11b815260040160405180910390fd5b919050565b60665460408051635c975abb60e01b815290515f926001600160a01b031691635c975abb9160048083019260209291908290030181865afa15801561172b573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061174f9190615509565b15156001036117715760405163146f5dc360e21b815260040160405180910390fd5b60018060735f9054906101000a90046001600160a01b03166001600160a01b031663c19d93fb6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117c4573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906117e89190615522565b60038111156117f9576117f9614f4b565b14611817576040516367e554d160e01b815260040160405180910390fd5b6073546040805163b782cc4960e01b8152905133926001600160a01b03169163b782cc499160048083019260209291908290030181865afa15801561185e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906118829190615463565b6001600160a01b0316146118a85760405162b145b560e31b815260040160405180910390fd5b60655460405163babcc53960e01b81526001600160a01b039091169063babcc539906118d8908790600401614a3c565b602060405180830381865afa1580156118f3573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119179190615509565b61193457604051638c38000360e01b815260040160405180910390fd5b5f83900361195557604051633006171960e21b815260040160405180910390fd5b6040516362fef89d60e11b81527389a5feb31d5585a30094f698d4b802e45e9520af9063c5fdf13a906119969030906068906074908b908b9060040161562e565b602060405180830381865af41580156119b1573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119d591906155b9565b91506119e18483613f29565b60735460408051630190869f60e11b815290515f926001600160a01b0316916303210d3e9160048083019260209291908290030181865afa158015611a28573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a4c9190615463565b606754909150611a66906001600160a01b03168288613c6a565b846001600160a01b03165f51602061594e5f395f51905f528785600488604051611a93949392919061565e565b60405180910390a250509392505050565b60665460408051635c975abb60e01b815290515f926001600160a01b031691635c975abb9160048083019260209291908290030181865afa158015611aeb573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b0f9190615509565b1515600103611b315760405163146f5dc360e21b815260040160405180910390fd5b60018060735f9054906101000a90046001600160a01b03166001600160a01b031663c19d93fb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b84573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611ba89190615522565b6003811115611bb957611bb9614f4b565b14611bd7576040516367e554d160e01b815260040160405180910390fd5b60655460405163babcc53960e01b81526001600160a01b039091169063babcc53990611c07903390600401614a3c565b602060405180830381865afa158015611c22573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c469190615509565b611c6357604051638c38000360e01b815260040160405180910390fd5b6073546040805163c24ba32960e01b815290515f926001600160a01b03169163c24ba3299160048083019260209291908290030181865afa158015611caa573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611cce9190615613565b6001811115611cdf57611cdf614f4b565b14611cfd576040516367e554d160e01b815260040160405180910390fd5b336001600160a01b03841614611d26576040516367e554d160e01b815260040160405180910390fd5b6040516362fef89d60e11b81527389a5feb31d5585a30094f698d4b802e45e9520af9063c5fdf13a90611d679030906068906074908a908a9060040161562e565b602060405180830381865af4158015611d82573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611da691906155b9565b606754909250611dc1906001600160a01b0316333087613fe0565b611dcb8383613f29565b60735460408051630190869f60e11b815290515f926001600160a01b0316916303210d3e9160048083019260209291908290030181865afa158015611e12573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611e369190615463565b606754909150611e50906001600160a01b03168287613c6a565b836001600160a01b03165f51602061594e5f395f51905f52868560015f5f1b604051611e7f949392919061565e565b60405180910390a2505092915050565b6001600160a01b03165f9081526033602052604090205490565b6073546001600160a01b03163314611ed45760405163300863cd60e01b815260040160405180910390fd5b606a849055611ee662015180426154db565b606b556070819055607354604080516338185d3960e21b815290515f926001600160a01b03169163e06174e49160048083019260e09291908290030181865afa158015611f35573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611f599190615687565b60c0015190506002816004811115611f7357611f73614f4b565b03611f8257606c849055611fc9565b6003816004811115611f9657611f96614f4b565b03611fa557606d849055611fc9565b6004816004811115611fb957611fb9614f4b565b03611fc957606e849055606f8390555b6040805186815260208101849052908101859052606081018490527fd1eb4ce4429fc349958a48fa6347b2c14e0ef701a9d2f133cc761d6dab3296139060800161158d565b60605f61201b6076614018565b6001600160401b0381111561203257612032614c65565b60405190808252806020026020018201604052801561206b57816020015b6120586149de565b8152602001906001900390816120505790505b5090505f5b61207a6076614018565b81101561215e5760755f61208f607684614021565b815260208082019290925260409081015f20815160e0810183528154815260018201546001600160a01b03169381019390935260028101549183019190915260038082015460608401526004820154608084019160ff909116908111156120f8576120f8614f4b565b600381111561210957612109614f4b565b81526004919091015461010081046001600160a01b03166020830152600160a81b900460ff161515604090910152825183908390811061214b5761214b61570c565b6020908102919091010152600101612070565b50919050565b6073546040805163b782cc4960e01b8152905133926001600160a01b03169163b782cc499160048083019260209291908290030181865afa1580156121ab573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121cf9190615463565b6001600160a01b0316146121f55760405162b145b560e31b815260040160405180910390fd5b60735460408051630190869f60e11b815290515f926001600160a01b0316916303210d3e9160048083019260209291908290030181865afa15801561223c573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906122609190615463565b60675490915061227a906001600160a01b03168284613c6a565b806001600160a01b03167f44af8fb83a4691f3d7d6eec869030fd2963d5149832666390380522311d40139836040516122b591815260200190565b60405180910390a25050565b6060603780546107239061547e565b60018060735f9054906101000a90046001600160a01b03166001600160a01b031663c19d93fb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612323573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123479190615522565b600381111561235857612358614f4b565b14612376576040516367e554d160e01b815260040160405180910390fd5b6073546001600160a01b031633146123a15760405163300863cd60e01b815260040160405180910390fd5b5f841180156123af57505f83115b156123cd57604051633006171960e21b815260040160405180910390fd5b6001600160a01b03851615806123eb57506001600160a01b03851630145b1561240957604051633006171960e21b815260040160405180910390fd5b60655460405163babcc53960e01b81526001600160a01b039091169063babcc53990612439908890600401614a3c565b602060405180830381865afa158015612454573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906124789190615509565b61249557604051638c38000360e01b815260040160405180910390fd5b831561262c575f6124a58561302f565b90505f6124b18761402c565b9050808211156124d45760405163a38e0aa760e01b815260040160405180910390fd5b6124de8783613b43565b60018460028111156124f2576124f2614f4b565b0361257f576001600160a01b0387165f9081526074602052604090206004015486111561253257604051631777b0a560e01b815260040160405180910390fd5b8560685f015f8282546125459190615720565b90915550506001600160a01b0387165f9081526074602052604081206004018054889290612574908490615720565b909155506125e19050565b600284600281111561259357612593614f4b565b036125e1578560686001015f8282546125ac91906155a6565b90915550506001600160a01b0387165f90815260746020526040812060050180548892906125db9084906155a6565b90915550505b60408051878152602081018490526001600160a01b038916917f8a16e0e94d3e61227e5da91c8fef19e22a0b136b335a7b5ce57e762bf5474d5f910160405180910390a250506127ae565b8215612795575f61263c8461302f565b90506126488682613f29565b600183600281111561265c5761265c614f4b565b036126ae578360685f015f82825461267491906155a6565b90915550506001600160a01b0386165f90815260746020526040812060040180548692906126a39084906155a6565b9091555061274b9050565b60028360028111156126c2576126c2614f4b565b0361274b576001600160a01b0386165f9081526074602052604090206005015484111561270257604051631777b0a560e01b815260040160405180910390fd5b8360686001015f8282546127169190615720565b90915550506001600160a01b0386165f9081526074602052604081206005018054869290612745908490615720565b90915550505b60408051858152602081018390526001600160a01b038816917f7524eb169e6915c6135ef6c25f138896aeb71a34f7e466e2004f6e3809064264910160405180910390a2506127ae565b604051633006171960e21b815260040160405180910390fd5b846001600160a01b03167fe0ba1f7b9ab1ce44306b7c0a5c04982a401d90b491eb18517662e955579746ac8585856040516127eb93929190615733565b60405180910390a25050505050565b61284c6040518061016001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b50604080516101608101825260685481526069546020820152606a5491810191909152606b546060820152606c546080820152606d5460a0820152606e5460c0820152606f5460e082015260705461010082015260715461012082015260725461014082015290565b60655460405163babcc53960e01b81525f916001600160a01b03169063babcc539906128e5908590600401614a3c565b602060405180830381865afa158015612900573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061070e9190615509565b5f33816129318286613342565b9050838110156129915760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401611369565b610cc68286868403613a1f565b5f336107d8818585613d45565b60665460408051635c975abb60e01b815290515f926001600160a01b031691635c975abb9160048083019260209291908290030181865afa1580156129f2573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612a169190615509565b1515600103612a385760405163146f5dc360e21b815260040160405180910390fd5b60018060735f9054906101000a90046001600160a01b03166001600160a01b031663c19d93fb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612a8b573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612aaf9190615522565b6003811115612ac057612ac0614f4b565b14612ade576040516367e554d160e01b815260040160405180910390fd5b60655460405163babcc53960e01b81526001600160a01b039091169063babcc53990612b0e903390600401614a3c565b602060405180830381865afa158015612b29573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612b4d9190615509565b612b6a57604051638c38000360e01b815260040160405180910390fd5b612b7333611e8f565b5f03612b9257604051638c38000360e01b815260040160405180910390fd5b6073546040805163475cb32560e01b815290515f926001600160a01b03169163475cb3259160048083019260209291908290030181865afa158015612bd9573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612bfd9190615613565b6001811115612c0e57612c0e614f4b565b14612c2c576040516367e554d160e01b815260040160405180910390fd5b825f03612c4c57604051631f2a200560e01b815260040160405180910390fd5b612c5733845f6140aa565b9392505050565b60665460408051635c975abb60e01b815290515f926001600160a01b031691635c975abb9160048083019260209291908290030181865afa158015612ca5573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612cc99190615509565b1515600103612ceb5760405163146f5dc360e21b815260040160405180910390fd5b60018060735f9054906101000a90046001600160a01b03166001600160a01b031663c19d93fb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612d3e573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612d629190615522565b6003811115612d7357612d73614f4b565b14612d91576040516367e554d160e01b815260040160405180910390fd5b6073546040805163b782cc4960e01b8152905133926001600160a01b03169163b782cc499160048083019260209291908290030181865afa158015612dd8573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612dfc9190615463565b6001600160a01b031614612e225760405162b145b560e31b815260040160405180910390fd5b60655460405163babcc53960e01b81526001600160a01b039091169063babcc53990612e52908890600401614a3c565b602060405180830381865afa158015612e6d573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612e919190615509565b612eae57604051638c38000360e01b815260040160405180910390fd5b6040516362fef89d60e11b81527389a5feb31d5585a30094f698d4b802e45e9520af9063c5fdf13a90612eef9030906068906074908c908c9060040161562e565b602060405180830381865af4158015612f0a573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612f2e91906155b9565b9150612f3a8583613f29565b846001600160a01b03165f51602061594e5f395f51905f52878460025f5f1b604051612f69949392919061565e565b60405180910390a28215612fbb57846001600160a01b03167f191e16d6a3a6d3f67535002b7d83fbc2c172ea76845d852135a96f46b821c3048585604051612fb2929190615758565b60405180910390a25b50949350505050565b6073546040805163c19d93fb60e01b815290515f926001600160a01b03169163c19d93fb9160048083019260209291908290030181865afa15801561300b573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106919190615522565b5f61303861120d565b6107c183670de0b6b3a76400006154c4565b60665f9054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561309a573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906130be9190615509565b15156001036130e05760405163146f5dc360e21b815260040160405180910390fd5b60018060735f9054906101000a90046001600160a01b03166001600160a01b031663c19d93fb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613133573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906131579190615522565b600381111561316857613168614f4b565b14613186576040516367e554d160e01b815260040160405180910390fd5b6073546040805163219cbc6d60e01b8152905133926001600160a01b03169163219cbc6d9160048083019260209291908290030181865afa1580156131cd573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906131f19190615463565b6001600160a01b031614613218576040516369c7961360e01b815260040160405180910390fd5b604051634aab7a4b60e11b81523060048201526075602482015260686044820152607460648201526001600160a01b038416608482015260a481018390527389a5feb31d5585a30094f698d4b802e45e9520af90639556f4969060c4015f6040518083038186803b15801561328b575f5ffd5b505af415801561329d573d5f5f3e3d5ffd5b50505050505050565b5f8060735f9054906101000a90046001600160a01b03166001600160a01b031663475cb3256040518163ffffffff1660e01b8152600401602060405180830381865afa1580156132f8573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061331c9190615613565b600181111561332d5761332d614f4b565b1461333957505f919050565b61070e8261402c565b6001600160a01b039182165f90815260346020908152604080832093909416825291909152205490565b5f6133768261302f565b905061215e8161159d565b6133bd6040805160e0810182525f80825260208201819052918101829052606081018290526080810182905260a081018290529060c082015290565b60735f9054906101000a90046001600160a01b03166001600160a01b031663e06174e46040518163ffffffff1660e01b815260040160e060405180830381865afa15801561340d573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106919190615687565b60408051610240810182525f8082526060602083018190529282018390529181018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101829052610160810182905261018081018290526101a081018290526101c081018290526101e081018290526102008101829052610220810191909152607354604080516338185d3960e21b815290515f926001600160a01b03169163e06174e49160048083019260e09291908290030181865afa158015613509573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061352d9190615687565b6073546040805163ae47c76d60e01b815281519394505f9384936001600160a01b03169263ae47c76d92600480820193918290030181865afa158015613575573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906135999190615786565b91509150604051806102400160405280306001600160a01b031681526020016135c0610714565b81526020016135cd6122c1565b81526065546001600160a01b039081166020808401919091526073549091166040808401829052805163597be6d160e01b81529051606090940193919263597be6d1926004808401938290030181865afa15801561362d573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061365191906155b9565b815260735460408051631311b7bf60e01b815290516020938401936001600160a01b0390931692631311b7bf92600480820193918290030181865afa15801561369c573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906136c09190615463565b6001600160a01b03908116825260675481166020808401919091526073546040805163b782cc4960e01b815281519190950194919093169263b782cc49926004808401939192918290030181865afa15801561371e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906137429190615463565b6001600160a01b03168152602001845f01516001600160a01b0316815260200184602001516001600160a01b0316815260200184604001516001600160a01b0316815260200184606001518152602001846080015181526020018460a0015181526020018460c0015160048111156137bc576137bc614f4b565b81526020018315158152602001826001600160401b0316815250935050505090565b5f61070e6102b9836132a6565b61386b6040518061022001604052805f6001600160a01b031681526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f8152602001606081525090565b604051806102200160405280306001600160a01b0316815260200160735f9054906101000a90046001600160a01b03166001600160a01b031663c19d93fb6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156138d6573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906138fa9190615522565b600381111561390b5761390b614f4b565b815260685460208201526069546040820152606001613928610684565b815260200161393660355490565b815260200161394361120d565b8152606a546020820152606b546040820152606c546060820152606d546080820152606e5460a0820152606f5460c082015260705460e08201526071546101008201526072546101208201526101400161399b61200e565b9052919050565b6073546001600160a01b031633146139cd5760405163300863cd60e01b815260040160405180910390fd5b607191909155607255565b6073546040805163b782cc4960e01b815290515f926001600160a01b03169163b782cc499160048083019260209291908290030181865afa1580156106dd573d5f5f3e3d5ffd5b6001600160a01b038316613a815760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401611369565b6001600160a01b038216613ae25760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401611369565b6001600160a01b038381165f8181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b038216613ba35760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401611369565b613bae825f836141fb565b6001600160a01b0382165f9081526033602052604090205481811015613c215760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401611369565b6001600160a01b0383165f8181526033602090815260408083208686039055603580548790039055518581529192915f51602061592e5f395f51905f529101613b36565b505050565b6040516001600160a01b038316602482015260448101829052613c6590849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526145c0565b5f613cd88484613342565b90505f198114613d3f5781811015613d325760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401611369565b613d3f8484848403613a1f565b50505050565b6001600160a01b038316613da95760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401611369565b6001600160a01b038216613e0b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401611369565b613e168383836141fb565b6001600160a01b0383165f9081526033602052604090205481811015613e8d5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401611369565b6001600160a01b038085165f8181526033602052604080822086860390559286168082529083902080548601905591515f51602061592e5f395f51905f5290613ed99086815260200190565b60405180910390a3613d3f565b6001600160a01b03163b151590565b5f54610100900460ff16613f1b5760405162461bcd60e51b8152600401611369906157bc565b613f258282614693565b5050565b6001600160a01b038216613f7f5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401611369565b613f8a5f83836141fb565b8060355f828254613f9b91906155a6565b90915550506001600160a01b0382165f818152603360209081526040808320805486019055518481525f51602061592e5f395f51905f52910160405180910390a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052613d3f9085906323b872dd60e01b90608401613c96565b5f61070e825490565b5f612c5783836146d2565b6001600160a01b0381165f90815260746020526040812060070154819061405284611e8f565b61405c91906155a6565b6001600160a01b0384165f90815260746020526040812060028101549054929350909161408991906155a6565b9050808211614098575f6140a2565b6140a28183615720565b949350505050565b5f8060735f9054906101000a90046001600160a01b03166001600160a01b031663475cb3256040518163ffffffff1660e01b8152600401602060405180830381865afa1580156140fc573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906141209190615613565b600181111561413157614131614f4b565b1461414f576040516367e554d160e01b815260040160405180910390fd5b6040516348240bab60e01b8152306004820152606860248201526074604482015260756064820152607660848201526001600160a01b03851660a482015260c4810184905282151560e48201527389a5feb31d5585a30094f698d4b802e45e9520af906348240bab9061010401602060405180830381865af41580156141d7573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906140a291906155b9565b60018060735f9054906101000a90046001600160a01b03166001600160a01b031663c19d93fb6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561424e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906142729190615522565b600381111561428357614283614f4b565b146142a1576040516367e554d160e01b815260040160405180910390fd5b60665f9054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156142f1573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906143159190615509565b15156001036143375760405163146f5dc360e21b815260040160405180910390fd5b60655460405163babcc53960e01b81526001600160a01b039091169063babcc53990614367903390600401614a3c565b602060405180830381865afa158015614382573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906143a69190615509565b1580156143cc57506143b66139d8565b6001600160a01b0316336001600160a01b031614155b80156143f157506143db611285565b6001600160a01b0316336001600160a01b031614155b801561440857506073546001600160a01b03163314155b156144265760405163a24e573d60e01b815260040160405180910390fd5b306001600160a01b0384160361446d576001600160a01b03841661445d57604051631f20988960e21b815260040160405180910390fd5b61446784836146f8565b50613d3f565b6001600160a01b0383161580159061448d57506001600160a01b03841615155b15613d3f5760655460405163babcc53960e01b81526001600160a01b039091169063babcc539906144c2908790600401614a3c565b602060405180830381865afa1580156144dd573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906145019190615509565b1580614579575060655460405163babcc53960e01b81526001600160a01b039091169063babcc53990614538908690600401614a3c565b602060405180830381865afa158015614553573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906145779190615509565b155b156145975760405163a24e573d60e01b815260040160405180910390fd5b816145a1856132a6565b1015613d3f5760405163a24e573d60e01b815260040160405180910390fd5b5f614614826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166148c39092919063ffffffff16565b905080515f14806146345750808060200190518101906146349190615509565b613c655760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401611369565b5f54610100900460ff166146b95760405162461bcd60e51b8152600401611369906157bc565b60366146c5838261585d565b506037613c65828261585d565b5f825f0182815481106146e7576146e761570c565b905f5260205f200154905092915050565b60665460408051635c975abb60e01b815290515f926001600160a01b031691635c975abb9160048083019260209291908290030181865afa15801561473f573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906147639190615509565b15156001036147855760405163146f5dc360e21b815260040160405180910390fd5b60018060735f9054906101000a90046001600160a01b03166001600160a01b031663c19d93fb6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156147d8573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906147fc9190615522565b600381111561480d5761480d614f4b565b1461482b576040516367e554d160e01b815260040160405180910390fd5b60655460405163babcc53960e01b81526001600160a01b039091169063babcc5399061485b908790600401614a3c565b602060405180830381865afa158015614876573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061489a9190615509565b6148b75760405163a24e573d60e01b815260040160405180910390fd5b6140a2848460016140aa565b60606140a284845f85855f5f866001600160a01b031685876040516148e89190615917565b5f6040518083038185875af1925050503d805f8114614922576040519150601f19603f3d011682016040523d82523d5f602084013e614927565b606091505b509150915061493887838387614943565b979650505050505050565b606083156149af5782515f036149a85761495c85613ee6565b6149a85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611369565b50816140a2565b6140a283838151156149c45781518083602001fd5b8060405162461bcd60e51b81526004016113699190614ab0565b6040518060e001604052805f81526020015f6001600160a01b031681526020015f81526020015f81526020015f6003811115614a1c57614a1c614f4b565b81525f6020820181905260409091015290565b6001600160a01b03169052565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114614a64575f5ffd5b50565b5f60208284031215614a77575f5ffd5b8135612c5781614a50565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f612c576020830184614a82565b5f60208284031215614ad2575f5ffd5b5035919050565b5f5f60408385031215614aea575f5ffd5b8235614af581614a50565b946020939093013593505050565b5f5f5f5f60808587031215614b16575f5ffd5b8435614b2181614a50565b966020860135965060408601359560600135945092505050565b5f5f5f60608486031215614b4d575f5ffd5b8335614b5881614a50565b92506020840135614b6881614a50565b929592945050506040919091013590565b5f6101a082019050614b8c828451614a2f565b6020830151614b9e6020840182614a2f565b506040830151614bb16040840182614a2f565b50606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e083015160e083015261010083015161010083015261012083015161012083015261014083015161014083015261016083015161016083015261018083015161018083015292915050565b5f5f5f60608486031215614c38575f5ffd5b8335614c4381614a50565b9250602084013591506040840135614c5a81614a50565b809150509250925092565b634e487b7160e01b5f52604160045260245ffd5b60405160e081016001600160401b0381118282101715614c9b57614c9b614c65565b60405290565b60405160a081016001600160401b0381118282101715614c9b57614c9b614c65565b60058110614a64575f5ffd5b5f60e08284031215614cdf575f5ffd5b614ce7614c79565b90508135614cf481614a50565b81526020820135614d0481614a50565b60208201526040820135614d1781614a50565b6040820152606082810135908201526080808301359082015260a0808301359082015260c0820135614d4881614cc3565b60c082015292915050565b5f82601f830112614d62575f5ffd5b81356001600160401b03811115614d7b57614d7b614c65565b604051601f8201601f19908116603f011681016001600160401b0381118282101715614da957614da9614c65565b604052818152838201602001851015614dc0575f5ffd5b816020850160208301375f918101602001919091529392505050565b5f5f5f5f8486036101c0811215614df1575f5ffd5b60a0811215614dfe575f5ffd5b50614e07614ca1565b8535614e1281614a50565b81526020860135614e2281614a50565b60208201526040860135614e3581614a50565b60408201526060860135614e4881614a50565b60608201526080860135614e5b81614a50565b60808201529350614e6f8660a08701614ccf565b92506101808501356001600160401b03811115614e8a575f5ffd5b614e9687828801614d53565b9250506101a08501356001600160401b03811115614eb2575f5ffd5b614ebe87828801614d53565b91505092959194509250565b5f5f5f60608486031215614edc575f5ffd5b833592506020840135614b6881614a50565b5f5f60408385031215614eff575f5ffd5b823591506020830135614f1181614a50565b809150509250929050565b5f5f5f5f60808587031215614f2f575f5ffd5b5050823594602084013594506040840135936060013592509050565b634e487b7160e01b5f52602160045260245ffd5b60048110614a6457614a64614f4b565b8051825260018060a01b03602082015116602083015260408101516040830152606081015160608301525f6080820151614fa881614f5f565b60808401525060a0818101516001600160a01b03169083015260c09081015115159082015260e00190565b602080825282518282018190525f918401906040840190835b8181101561501057614fff838551614f6f565b602094909401939250600101614fec565b509095945050505050565b5f5f5f5f6080858703121561502e575f5ffd5b843561503981614a50565b9350602085013592506040850135915060608501356003811061505a575f5ffd5b939692955090935050565b60038110614a6457614a64614f4b565b6020810161508283615065565b91905290565b5f5f5f5f6060858703121561509b575f5ffd5b8435935060208501356150ad81614a50565b925060408501356001600160401b038111156150c7575f5ffd5b8501601f810187136150d7575f5ffd5b80356001600160401b038111156150ec575f5ffd5b8760208284010111156150fd575f5ffd5b949793965060200194505050565b6020810161508283614f5f565b5f5f60408385031215615129575f5ffd5b823561513481614a50565b91506020830135614f1181614a50565b60058110614a6457614a64614f4b565b61515d81615144565b9052565b80516001600160a01b03908116835260208083015182169084015260408083015190911690830152606080820151908301526080808201519083015260a0818101519083015260c08101516151b581615144565b8060c0840152505050565b60e0810161070e8284615161565b602081526151e0602082018351614a2f565b5f602083015161024060408401526151fc610260840182614a82565b90506040840151601f198483030160608501526152198282614a82565b915050606084015161522e6080850182614a2f565b50608084015161524160a0850182614a2f565b5060a084015160c084015260c084015161525e60e0850182614a2f565b5060e0840151615272610100850182614a2f565b50610100840151615287610120850182614a2f565b5061012084015161529c610140850182614a2f565b506101408401516152b1610160850182614a2f565b506101608401516152c6610180850182614a2f565b506101808401516101a08401526101a08401516101c08401526101c08401516101e08401526101e08401516152ff610200850182615154565b50610200840151801515610220850152506102208401516001600160401b038116610240850152509392505050565b5f8151808452602084019350602083015f5b8281101561536457615353868351614f6f565b955060209190910190600101615340565b5093949350505050565b60208152615380602082018351614a2f565b602082015160408201526040820151606082015260608201516080820152608082015160a082015260a082015160c082015260c082015160e082015260e08201516101008201526101008201516101208201526101208201516101408201526101408201516101608201526101608201516101808201526101808201516101a08201526101a08201516101c08201526101c08201516101e08201526101e08201516102008201525f610200830151610220808401526140a261024084018261532e565b5f5f60408385031215615454575f5ffd5b50508035926020909101359150565b5f60208284031215615473575f5ffd5b8151612c5781614a50565b600181811c9082168061549257607f821691505b60208210810361215e57634e487b7160e01b5f52602260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b808202811582820484141761070e5761070e6154b0565b5f826154f557634e487b7160e01b5f52601260045260245ffd5b500490565b805180151581146116df575f5ffd5b5f60208284031215615519575f5ffd5b612c57826154fa565b5f60208284031215615532575f5ffd5b815160048110612c57575f5ffd5b5f5f5f5f60808587031215615553575f5ffd5b845160208601516040870151919550935061556d81614a50565b915061557b606086016154fa565b905092959194509250565b5f60208284031215615596575f5ffd5b815160ff81168114612c57575f5ffd5b8082018082111561070e5761070e6154b0565b5f602082840312156155c9575f5ffd5b5051919050565b6001600160a01b03858116825284811660208301528316604082015261014081016155fe6060830184615161565b95945050505050565b60028110614a64575f5ffd5b5f60208284031215615623575f5ffd5b8151612c5781615607565b6001600160a01b039586168152602081019490945260408401929092526060830152909116608082015260a00190565b848152602081018490526080810161567584615144565b60408201939093526060015292915050565b5f60e0828403128015615698575f5ffd5b506156a1614c79565b82516156ac81614a50565b815260208301516156bc81614a50565b602082015260408301516156cf81614a50565b6040820152606083810151908201526080808401519082015260a0808401519082015260c083015161570081614cc3565b60c08201529392505050565b634e487b7160e01b5f52603260045260245ffd5b8181038181111561070e5761070e6154b0565b838152602081018390526060810161574a83615065565b826040830152949350505050565b60208152816020820152818360408301375f818301604090810191909152601f909201601f19160101919050565b5f5f60408385031215615797575f5ffd5b6157a0836154fa565b60208401519092506001600160401b0381168114614f11575f5ffd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b601f821115613c655782821115613c6557805f5260205f20601f840160051c602085101561583257505f5b90810190601f840160051c035f5b81811015615855575f83820155600101615840565b505050505050565b81516001600160401b0381111561587657615876614c65565b61588a81615884845461547e565b84615807565b6020601f8211600181146158bc575f83156158a55750848201515b5f19600385901b1c1916600184901b178455611596565b5f84815260208120601f198516915b828110156158eb57878501518255602094850194600190920191016158cb565b508482101561590857868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b5f82518060208501845e5f92019182525091905056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef43391017a4338e81200734cf186544860d19e6b7e502efff86b0368c93917515a2646970667358221220c022c30b5d5140e5bd1d0469a91d6414882b59f4ff75ebbea90c9445a1353a1564736f6c63430008240033","external_libraries":[{"name":"contracts/PoolDynamic.sol:PoolLibDynamic","address_hash":"0x89a5feb31D5585A30094f698D4B802E45e9520AF"}],"proxy_type":null,"implementations":[],"verified_at":"2026-08-25T22:22:08.143015Z","is_verified_via_verifier_alliance":false,"compiler_version":"0.8.36+commit.8a079791","decoded_constructor_args":null,"sourcify_repo_url":"https://repo.sourcify.dev/1/0x6D11b6D8E71E92d497aC7593277453Df55C89aF1","optimization_runs":10,"compiler_settings":{"evmVersion":"cancun","libraries":{"contracts/PoolDynamic.sol:PoolLibDynamic":"0x89a5feb31d5585a30094f698d4b802e45e9520af"},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":10},"remappings":[]},"is_verified":true,"verified_twin_address_hash":null,"optimization_enabled":true,"deployed_bytecode":"0x608060405234801561000f575f5ffd5b506004361061024f575f3560e01c806301e1d1141461025357806303210d3e1461026e57806306b3efd61461028357806306fdde031461029657806307a2d13a146102ab578063095ea7b3146102be57806309dc040c146102e15780631311b7bf146102f657806313b98c0f1461025357806318160ddd1461030757806323b872dd1461030f578063313ce5671461032257806335f3420b1461033c578063374f9a921461035c57806338d52e0f1461036f57806339509351146103805780633ba0b9a9146103935780635214d8ca1461039b57806352633aff146103a357806359d5cd7b146103b65780635f4fc4d6146103c95780636616c6ba146103dc5780636d36daf0146103ef5780636e553f651461040257806370a082311461041557806371253057146104285780637d22ee3e1461043b5780638456ec6e1461036f57806386402701146104505780639569178a1461047b57806395d89b411461048e5780639a11f56a14610496578063a0786081146104a9578063a3f8547714610535578063a457c2d714610548578063a9059cbb1461055b578063aa2f892d1461056e578063b1dd61b614610581578063bf2219d614610590578063c19d93fb146105a3578063c6e6f592146105b8578063c93b6c4a146105cb578063db6b2074146105de578063dd62ed3e146105f1578063def53cf314610604578063e06174e414610617578063e3baa9fe1461062c578063e8af8fa314610641578063ed08299014610654578063ef82207c14610669578063f851a4401461067c575b5f5ffd5b61025b610684565b6040519081526020015b60405180910390f35b610276610696565b6040516102659190614a3c565b61025b610291366004614a67565b610701565b61029e610714565b6040516102659190614ab0565b61025b6102b9366004614ac2565b6107a4565b6102d16102cc366004614ad9565b6107cb565b6040519015158152602001610265565b6102f46102ef366004614b03565b6107e2565b005b6066546001600160a01b0316610276565b60355461025b565b6102d161031d366004614b3b565b610cae565b61032a610cd1565b60405160ff9091168152602001610265565b61034f61034a366004614a67565b610d3c565b6040516102659190614b79565b6102f461036a366004614c26565b610e79565b6067546001600160a01b0316610276565b6102d161038e366004614ad9565b6111ec565b61025b61120d565b610276611285565b6102f46103b1366004614ddc565b6112cc565b61025b6103c4366004614ac2565b61159d565b61025b6103d7366004614eca565b6116e4565b607354610276906001600160a01b031681565b606554610276906001600160a01b031681565b61025b610410366004614eee565b611aa4565b61025b610423366004614a67565b611e8f565b6102f4610436366004614f1c565b611ea9565b61044361200e565b6040516102659190614fd3565b61025b61045e366004614a67565b6001600160a01b03165f9081526074602052604090206007015490565b6102f4610489366004614ac2565b612164565b61029e6122c1565b6102f46104a436600461501b565b6122d0565b6104b16127fa565b60405161026591905f61016082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e083015160e083015261010083015161010083015261012083015161012083015261014083015161014083015292915050565b6102d1610543366004614a67565b6128b5565b6102d1610556366004614ad9565b612924565b6102d1610569366004614ad9565b61299e565b61025b61057c366004614ac2565b6129ab565b60026040516102659190615075565b61025b61059e366004615088565b612c5e565b6105ab612fc4565b604051610265919061510b565b61025b6105c6366004614ac2565b61302f565b6102f46105d9366004614ad9565b61304a565b61025b6105ec366004614a67565b6132a6565b61025b6105ff366004615118565b613342565b61025b610612366004614ac2565b61336c565b61061f613381565b60405161026591906151c0565b610634613431565b60405161026591906151ce565b61025b61064f366004614a67565b6137de565b61065c6137eb565b604051610265919061536e565b6102f4610677366004615443565b6139a2565b6102766139d8565b5f6106916102b960355490565b905090565b60735460408051630190869f60e11b815290515f926001600160a01b0316916303210d3e9160048083019260209291908290030181865afa1580156106dd573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106919190615463565b5f61070e6102b983611e8f565b92915050565b6060603680546107239061547e565b80601f016020809104026020016040519081016040528092919081815260200182805461074f9061547e565b801561079a5780601f106107715761010080835404028352916020019161079a565b820191905f5260205f20905b81548152906001019060200180831161077d57829003601f168201915b5050505050905090565b5f670de0b6b3a7640000826107b761120d565b6107c191906154c4565b61070e91906154db565b5f336107d8818585613a1f565b5060019392505050565b60665f9054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610832573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108569190615509565b15156001036108785760405163146f5dc360e21b815260040160405180910390fd5b60018060735f9054906101000a90046001600160a01b03166001600160a01b031663c19d93fb6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108cb573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108ef9190615522565b600381111561090057610900614f4b565b1461091e576040516367e554d160e01b815260040160405180910390fd5b6073546040805163b782cc4960e01b8152905133926001600160a01b03169163b782cc499160048083019260209291908290030181865afa158015610965573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109899190615463565b6001600160a01b0316146109af5760405162b145b560e31b815260040160405180910390fd5b604051630a3cb6b760e01b8152607560048201526068602482015260746044820152607660648201526001600160a01b038616608482015260a481018390525f908190819081907389a5feb31d5585a30094f698d4b802e45e9520af90630a3cb6b79060c401608060405180830381865af4158015610a30573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a549190615540565b60655460405163babcc53960e01b815294985092965090945092506001600160a01b03169063babcc53990610a8d908c90600401614a3c565b602060405180830381865afa158015610aa8573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610acc9190615509565b610ae957604051638c38000360e01b815260040160405180910390fd5b6073546040805163f108e22560e01b815290515f926001600160a01b03169163f108e2259160048083019260209291908290030181865afa158015610b30573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b549190615463565b60408051878152602081018c90529081018a905260608101899052608081018690526001600160a01b0385811660a0830152919250908b16907f5d88c6df9b9c24282c6d80c289e42a2754047e53bf5faacd7533ae0ca90240dd9060c00160405180910390a28115610bcf57610bca3086613b43565b610bd9565b610bd98a86613b43565b6001600160a01b03831615610c8b5760655460405163babcc53960e01b81526001600160a01b039091169063babcc53990610c18908690600401614a3c565b602060405180830381865afa158015610c33573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c579190615509565b610c7457604051638c38000360e01b815260040160405180910390fd5b606754610c8b906001600160a01b0316848b613c6a565b606754610ca2906001600160a01b0316828a613c6a565b50505050505050505050565b5f33610cbb858285613ccd565b610cc6858585613d45565b506001949350505050565b6067546040805163313ce56760e01b815290515f926001600160a01b03169163313ce5679160048083019260209291908290030181865afa158015610d18573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106919190615586565b610db5604051806101a001604052805f6001600160a01b031681526020015f6001600160a01b031681526020015f6001600160a01b031681526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b604080516101a0810182523081526001600160a01b038481166020830152606754169181019190915260608101610deb84611e8f565b8152602001610df984610701565b8152602001610e07846137de565b8152602001610e15846132a6565b81526001600160a01b039093165f8181526074602081815260408084208054838a01526001810154918901919091526002810154606089015260038101546080890152600481015460a08901529390925290526005015460c0909301929092525090565b60665f9054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ec9573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610eed9190615509565b1515600103610f0f5760405163146f5dc360e21b815260040160405180910390fd5b60018060735f9054906101000a90046001600160a01b03166001600160a01b031663c19d93fb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f62573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f869190615522565b6003811115610f9757610f97614f4b565b14610fb5576040516367e554d160e01b815260040160405180910390fd5b6073546040805163b782cc4960e01b8152905133926001600160a01b03169163b782cc499160048083019260209291908290030181865afa158015610ffc573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110209190615463565b6001600160a01b0316146110465760405162b145b560e31b815260040160405180910390fd5b6001600160a01b038216158015906110ca575060655460405163babcc53960e01b81526001600160a01b039091169063babcc53990611089908590600401614a3c565b602060405180830381865afa1580156110a4573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110c89190615509565b155b156110e857604051638c38000360e01b815260040160405180910390fd5b5f838152607560205260409020600101546001600160a01b0385811691161461112457604051638c38000360e01b815260040160405180910390fd5b5f8381526075602052604081206003015490036111545760405163986a190560e01b815260040160405180910390fd5b5f838152607560209081526040918290206004810180546001600160a01b038781166101008102610100600160a81b031990931692909217909255600383015460029093015485518181529485018490529484018890526060840152909291908716907f142999da1b7c9b15a43b8fb11fb55ab6bae6111cbd90626e5b47e49efd6a47999060800160405180910390a2505050505050565b5f336107d88185856111fe8383613342565b61120891906155a6565b613a1f565b60405163dc3b7c8b60e01b81525f907389a5feb31d5585a30094f698d4b802e45e9520af9063dc3b7c8b90611246903090600401614a3c565b602060405180830381865af4158015611261573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061069191906155b9565b6073546040805163219cbc6d60e01b815290515f926001600160a01b03169163219cbc6d9160048083019260209291908290030181865afa1580156106dd573d5f5f3e3d5ffd5b5f54610100900460ff16158080156112ea57505f54600160ff909116105b8061130a57506112f930613ee6565b15801561130a57505f5460ff166001145b6113725760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b5f805460ff191660011790558015611393575f805461ff0019166101001790555b61139d8383613ef5565b604080860151606680546001600160a01b038084166001600160a01b0319928316179092558851606780549184169190921617905560608801516020890151935163b801c41360e01b815291169263b801c41392611402923092908a906004016155d0565b6020604051808303815f875af115801561141e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114429190615463565b607380546001600160a01b0319166001600160a01b0392831617905560808601516040516313db266360e31b8152911690639ed9331890611487903090600401614a3c565b6020604051808303815f875af11580156114a3573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114c79190615463565b606580546001600160a01b0319166001600160a01b0392909216919091179055670de0b6b3a7640000606a5561150062015180426154db565b606b555f606c55670de0b6b3a7640000606d819055606e5561152562015180426154db565b606f556040517f4196df5545177bff7cc5a8e7d409ae30d345a95b556b2eaf6b727038bef3128e905f90a18015611596575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15b5050505050565b5f815f036115be57604051631f2a200560e01b815260040160405180910390fd5b6115c7826107a4565b9050805f036115e957604051631f2a200560e01b815260040160405180910390fd5b6073546040805163475cb32560e01b815290515f926001600160a01b03169163475cb3259160048083019260209291908290030181865afa158015611630573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116549190615613565b600181111561166557611665614f4b565b14611683576040516367e554d160e01b815260040160405180910390fd5b61168c336132a6565b8211156116ac576040516357ad5d9960e01b815260040160405180910390fd5b335f90815260746020526040902060060154606410156116df576040516364aea42560e11b815260040160405180910390fd5b919050565b60665460408051635c975abb60e01b815290515f926001600160a01b031691635c975abb9160048083019260209291908290030181865afa15801561172b573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061174f9190615509565b15156001036117715760405163146f5dc360e21b815260040160405180910390fd5b60018060735f9054906101000a90046001600160a01b03166001600160a01b031663c19d93fb6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117c4573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906117e89190615522565b60038111156117f9576117f9614f4b565b14611817576040516367e554d160e01b815260040160405180910390fd5b6073546040805163b782cc4960e01b8152905133926001600160a01b03169163b782cc499160048083019260209291908290030181865afa15801561185e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906118829190615463565b6001600160a01b0316146118a85760405162b145b560e31b815260040160405180910390fd5b60655460405163babcc53960e01b81526001600160a01b039091169063babcc539906118d8908790600401614a3c565b602060405180830381865afa1580156118f3573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119179190615509565b61193457604051638c38000360e01b815260040160405180910390fd5b5f83900361195557604051633006171960e21b815260040160405180910390fd5b6040516362fef89d60e11b81527389a5feb31d5585a30094f698d4b802e45e9520af9063c5fdf13a906119969030906068906074908b908b9060040161562e565b602060405180830381865af41580156119b1573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119d591906155b9565b91506119e18483613f29565b60735460408051630190869f60e11b815290515f926001600160a01b0316916303210d3e9160048083019260209291908290030181865afa158015611a28573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a4c9190615463565b606754909150611a66906001600160a01b03168288613c6a565b846001600160a01b03165f51602061594e5f395f51905f528785600488604051611a93949392919061565e565b60405180910390a250509392505050565b60665460408051635c975abb60e01b815290515f926001600160a01b031691635c975abb9160048083019260209291908290030181865afa158015611aeb573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b0f9190615509565b1515600103611b315760405163146f5dc360e21b815260040160405180910390fd5b60018060735f9054906101000a90046001600160a01b03166001600160a01b031663c19d93fb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b84573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611ba89190615522565b6003811115611bb957611bb9614f4b565b14611bd7576040516367e554d160e01b815260040160405180910390fd5b60655460405163babcc53960e01b81526001600160a01b039091169063babcc53990611c07903390600401614a3c565b602060405180830381865afa158015611c22573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c469190615509565b611c6357604051638c38000360e01b815260040160405180910390fd5b6073546040805163c24ba32960e01b815290515f926001600160a01b03169163c24ba3299160048083019260209291908290030181865afa158015611caa573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611cce9190615613565b6001811115611cdf57611cdf614f4b565b14611cfd576040516367e554d160e01b815260040160405180910390fd5b336001600160a01b03841614611d26576040516367e554d160e01b815260040160405180910390fd5b6040516362fef89d60e11b81527389a5feb31d5585a30094f698d4b802e45e9520af9063c5fdf13a90611d679030906068906074908a908a9060040161562e565b602060405180830381865af4158015611d82573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611da691906155b9565b606754909250611dc1906001600160a01b0316333087613fe0565b611dcb8383613f29565b60735460408051630190869f60e11b815290515f926001600160a01b0316916303210d3e9160048083019260209291908290030181865afa158015611e12573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611e369190615463565b606754909150611e50906001600160a01b03168287613c6a565b836001600160a01b03165f51602061594e5f395f51905f52868560015f5f1b604051611e7f949392919061565e565b60405180910390a2505092915050565b6001600160a01b03165f9081526033602052604090205490565b6073546001600160a01b03163314611ed45760405163300863cd60e01b815260040160405180910390fd5b606a849055611ee662015180426154db565b606b556070819055607354604080516338185d3960e21b815290515f926001600160a01b03169163e06174e49160048083019260e09291908290030181865afa158015611f35573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611f599190615687565b60c0015190506002816004811115611f7357611f73614f4b565b03611f8257606c849055611fc9565b6003816004811115611f9657611f96614f4b565b03611fa557606d849055611fc9565b6004816004811115611fb957611fb9614f4b565b03611fc957606e849055606f8390555b6040805186815260208101849052908101859052606081018490527fd1eb4ce4429fc349958a48fa6347b2c14e0ef701a9d2f133cc761d6dab3296139060800161158d565b60605f61201b6076614018565b6001600160401b0381111561203257612032614c65565b60405190808252806020026020018201604052801561206b57816020015b6120586149de565b8152602001906001900390816120505790505b5090505f5b61207a6076614018565b81101561215e5760755f61208f607684614021565b815260208082019290925260409081015f20815160e0810183528154815260018201546001600160a01b03169381019390935260028101549183019190915260038082015460608401526004820154608084019160ff909116908111156120f8576120f8614f4b565b600381111561210957612109614f4b565b81526004919091015461010081046001600160a01b03166020830152600160a81b900460ff161515604090910152825183908390811061214b5761214b61570c565b6020908102919091010152600101612070565b50919050565b6073546040805163b782cc4960e01b8152905133926001600160a01b03169163b782cc499160048083019260209291908290030181865afa1580156121ab573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121cf9190615463565b6001600160a01b0316146121f55760405162b145b560e31b815260040160405180910390fd5b60735460408051630190869f60e11b815290515f926001600160a01b0316916303210d3e9160048083019260209291908290030181865afa15801561223c573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906122609190615463565b60675490915061227a906001600160a01b03168284613c6a565b806001600160a01b03167f44af8fb83a4691f3d7d6eec869030fd2963d5149832666390380522311d40139836040516122b591815260200190565b60405180910390a25050565b6060603780546107239061547e565b60018060735f9054906101000a90046001600160a01b03166001600160a01b031663c19d93fb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612323573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123479190615522565b600381111561235857612358614f4b565b14612376576040516367e554d160e01b815260040160405180910390fd5b6073546001600160a01b031633146123a15760405163300863cd60e01b815260040160405180910390fd5b5f841180156123af57505f83115b156123cd57604051633006171960e21b815260040160405180910390fd5b6001600160a01b03851615806123eb57506001600160a01b03851630145b1561240957604051633006171960e21b815260040160405180910390fd5b60655460405163babcc53960e01b81526001600160a01b039091169063babcc53990612439908890600401614a3c565b602060405180830381865afa158015612454573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906124789190615509565b61249557604051638c38000360e01b815260040160405180910390fd5b831561262c575f6124a58561302f565b90505f6124b18761402c565b9050808211156124d45760405163a38e0aa760e01b815260040160405180910390fd5b6124de8783613b43565b60018460028111156124f2576124f2614f4b565b0361257f576001600160a01b0387165f9081526074602052604090206004015486111561253257604051631777b0a560e01b815260040160405180910390fd5b8560685f015f8282546125459190615720565b90915550506001600160a01b0387165f9081526074602052604081206004018054889290612574908490615720565b909155506125e19050565b600284600281111561259357612593614f4b565b036125e1578560686001015f8282546125ac91906155a6565b90915550506001600160a01b0387165f90815260746020526040812060050180548892906125db9084906155a6565b90915550505b60408051878152602081018490526001600160a01b038916917f8a16e0e94d3e61227e5da91c8fef19e22a0b136b335a7b5ce57e762bf5474d5f910160405180910390a250506127ae565b8215612795575f61263c8461302f565b90506126488682613f29565b600183600281111561265c5761265c614f4b565b036126ae578360685f015f82825461267491906155a6565b90915550506001600160a01b0386165f90815260746020526040812060040180548692906126a39084906155a6565b9091555061274b9050565b60028360028111156126c2576126c2614f4b565b0361274b576001600160a01b0386165f9081526074602052604090206005015484111561270257604051631777b0a560e01b815260040160405180910390fd5b8360686001015f8282546127169190615720565b90915550506001600160a01b0386165f9081526074602052604081206005018054869290612745908490615720565b90915550505b60408051858152602081018390526001600160a01b038816917f7524eb169e6915c6135ef6c25f138896aeb71a34f7e466e2004f6e3809064264910160405180910390a2506127ae565b604051633006171960e21b815260040160405180910390fd5b846001600160a01b03167fe0ba1f7b9ab1ce44306b7c0a5c04982a401d90b491eb18517662e955579746ac8585856040516127eb93929190615733565b60405180910390a25050505050565b61284c6040518061016001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b50604080516101608101825260685481526069546020820152606a5491810191909152606b546060820152606c546080820152606d5460a0820152606e5460c0820152606f5460e082015260705461010082015260715461012082015260725461014082015290565b60655460405163babcc53960e01b81525f916001600160a01b03169063babcc539906128e5908590600401614a3c565b602060405180830381865afa158015612900573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061070e9190615509565b5f33816129318286613342565b9050838110156129915760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401611369565b610cc68286868403613a1f565b5f336107d8818585613d45565b60665460408051635c975abb60e01b815290515f926001600160a01b031691635c975abb9160048083019260209291908290030181865afa1580156129f2573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612a169190615509565b1515600103612a385760405163146f5dc360e21b815260040160405180910390fd5b60018060735f9054906101000a90046001600160a01b03166001600160a01b031663c19d93fb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612a8b573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612aaf9190615522565b6003811115612ac057612ac0614f4b565b14612ade576040516367e554d160e01b815260040160405180910390fd5b60655460405163babcc53960e01b81526001600160a01b039091169063babcc53990612b0e903390600401614a3c565b602060405180830381865afa158015612b29573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612b4d9190615509565b612b6a57604051638c38000360e01b815260040160405180910390fd5b612b7333611e8f565b5f03612b9257604051638c38000360e01b815260040160405180910390fd5b6073546040805163475cb32560e01b815290515f926001600160a01b03169163475cb3259160048083019260209291908290030181865afa158015612bd9573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612bfd9190615613565b6001811115612c0e57612c0e614f4b565b14612c2c576040516367e554d160e01b815260040160405180910390fd5b825f03612c4c57604051631f2a200560e01b815260040160405180910390fd5b612c5733845f6140aa565b9392505050565b60665460408051635c975abb60e01b815290515f926001600160a01b031691635c975abb9160048083019260209291908290030181865afa158015612ca5573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612cc99190615509565b1515600103612ceb5760405163146f5dc360e21b815260040160405180910390fd5b60018060735f9054906101000a90046001600160a01b03166001600160a01b031663c19d93fb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612d3e573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612d629190615522565b6003811115612d7357612d73614f4b565b14612d91576040516367e554d160e01b815260040160405180910390fd5b6073546040805163b782cc4960e01b8152905133926001600160a01b03169163b782cc499160048083019260209291908290030181865afa158015612dd8573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612dfc9190615463565b6001600160a01b031614612e225760405162b145b560e31b815260040160405180910390fd5b60655460405163babcc53960e01b81526001600160a01b039091169063babcc53990612e52908890600401614a3c565b602060405180830381865afa158015612e6d573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612e919190615509565b612eae57604051638c38000360e01b815260040160405180910390fd5b6040516362fef89d60e11b81527389a5feb31d5585a30094f698d4b802e45e9520af9063c5fdf13a90612eef9030906068906074908c908c9060040161562e565b602060405180830381865af4158015612f0a573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612f2e91906155b9565b9150612f3a8583613f29565b846001600160a01b03165f51602061594e5f395f51905f52878460025f5f1b604051612f69949392919061565e565b60405180910390a28215612fbb57846001600160a01b03167f191e16d6a3a6d3f67535002b7d83fbc2c172ea76845d852135a96f46b821c3048585604051612fb2929190615758565b60405180910390a25b50949350505050565b6073546040805163c19d93fb60e01b815290515f926001600160a01b03169163c19d93fb9160048083019260209291908290030181865afa15801561300b573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106919190615522565b5f61303861120d565b6107c183670de0b6b3a76400006154c4565b60665f9054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561309a573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906130be9190615509565b15156001036130e05760405163146f5dc360e21b815260040160405180910390fd5b60018060735f9054906101000a90046001600160a01b03166001600160a01b031663c19d93fb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613133573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906131579190615522565b600381111561316857613168614f4b565b14613186576040516367e554d160e01b815260040160405180910390fd5b6073546040805163219cbc6d60e01b8152905133926001600160a01b03169163219cbc6d9160048083019260209291908290030181865afa1580156131cd573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906131f19190615463565b6001600160a01b031614613218576040516369c7961360e01b815260040160405180910390fd5b604051634aab7a4b60e11b81523060048201526075602482015260686044820152607460648201526001600160a01b038416608482015260a481018390527389a5feb31d5585a30094f698d4b802e45e9520af90639556f4969060c4015f6040518083038186803b15801561328b575f5ffd5b505af415801561329d573d5f5f3e3d5ffd5b50505050505050565b5f8060735f9054906101000a90046001600160a01b03166001600160a01b031663475cb3256040518163ffffffff1660e01b8152600401602060405180830381865afa1580156132f8573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061331c9190615613565b600181111561332d5761332d614f4b565b1461333957505f919050565b61070e8261402c565b6001600160a01b039182165f90815260346020908152604080832093909416825291909152205490565b5f6133768261302f565b905061215e8161159d565b6133bd6040805160e0810182525f80825260208201819052918101829052606081018290526080810182905260a081018290529060c082015290565b60735f9054906101000a90046001600160a01b03166001600160a01b031663e06174e46040518163ffffffff1660e01b815260040160e060405180830381865afa15801561340d573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106919190615687565b60408051610240810182525f8082526060602083018190529282018390529181018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101829052610160810182905261018081018290526101a081018290526101c081018290526101e081018290526102008101829052610220810191909152607354604080516338185d3960e21b815290515f926001600160a01b03169163e06174e49160048083019260e09291908290030181865afa158015613509573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061352d9190615687565b6073546040805163ae47c76d60e01b815281519394505f9384936001600160a01b03169263ae47c76d92600480820193918290030181865afa158015613575573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906135999190615786565b91509150604051806102400160405280306001600160a01b031681526020016135c0610714565b81526020016135cd6122c1565b81526065546001600160a01b039081166020808401919091526073549091166040808401829052805163597be6d160e01b81529051606090940193919263597be6d1926004808401938290030181865afa15801561362d573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061365191906155b9565b815260735460408051631311b7bf60e01b815290516020938401936001600160a01b0390931692631311b7bf92600480820193918290030181865afa15801561369c573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906136c09190615463565b6001600160a01b03908116825260675481166020808401919091526073546040805163b782cc4960e01b815281519190950194919093169263b782cc49926004808401939192918290030181865afa15801561371e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906137429190615463565b6001600160a01b03168152602001845f01516001600160a01b0316815260200184602001516001600160a01b0316815260200184604001516001600160a01b0316815260200184606001518152602001846080015181526020018460a0015181526020018460c0015160048111156137bc576137bc614f4b565b81526020018315158152602001826001600160401b0316815250935050505090565b5f61070e6102b9836132a6565b61386b6040518061022001604052805f6001600160a01b031681526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f8152602001606081525090565b604051806102200160405280306001600160a01b0316815260200160735f9054906101000a90046001600160a01b03166001600160a01b031663c19d93fb6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156138d6573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906138fa9190615522565b600381111561390b5761390b614f4b565b815260685460208201526069546040820152606001613928610684565b815260200161393660355490565b815260200161394361120d565b8152606a546020820152606b546040820152606c546060820152606d546080820152606e5460a0820152606f5460c082015260705460e08201526071546101008201526072546101208201526101400161399b61200e565b9052919050565b6073546001600160a01b031633146139cd5760405163300863cd60e01b815260040160405180910390fd5b607191909155607255565b6073546040805163b782cc4960e01b815290515f926001600160a01b03169163b782cc499160048083019260209291908290030181865afa1580156106dd573d5f5f3e3d5ffd5b6001600160a01b038316613a815760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401611369565b6001600160a01b038216613ae25760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401611369565b6001600160a01b038381165f8181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b038216613ba35760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401611369565b613bae825f836141fb565b6001600160a01b0382165f9081526033602052604090205481811015613c215760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401611369565b6001600160a01b0383165f8181526033602090815260408083208686039055603580548790039055518581529192915f51602061592e5f395f51905f529101613b36565b505050565b6040516001600160a01b038316602482015260448101829052613c6590849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526145c0565b5f613cd88484613342565b90505f198114613d3f5781811015613d325760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401611369565b613d3f8484848403613a1f565b50505050565b6001600160a01b038316613da95760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401611369565b6001600160a01b038216613e0b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401611369565b613e168383836141fb565b6001600160a01b0383165f9081526033602052604090205481811015613e8d5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401611369565b6001600160a01b038085165f8181526033602052604080822086860390559286168082529083902080548601905591515f51602061592e5f395f51905f5290613ed99086815260200190565b60405180910390a3613d3f565b6001600160a01b03163b151590565b5f54610100900460ff16613f1b5760405162461bcd60e51b8152600401611369906157bc565b613f258282614693565b5050565b6001600160a01b038216613f7f5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401611369565b613f8a5f83836141fb565b8060355f828254613f9b91906155a6565b90915550506001600160a01b0382165f818152603360209081526040808320805486019055518481525f51602061592e5f395f51905f52910160405180910390a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052613d3f9085906323b872dd60e01b90608401613c96565b5f61070e825490565b5f612c5783836146d2565b6001600160a01b0381165f90815260746020526040812060070154819061405284611e8f565b61405c91906155a6565b6001600160a01b0384165f90815260746020526040812060028101549054929350909161408991906155a6565b9050808211614098575f6140a2565b6140a28183615720565b949350505050565b5f8060735f9054906101000a90046001600160a01b03166001600160a01b031663475cb3256040518163ffffffff1660e01b8152600401602060405180830381865afa1580156140fc573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906141209190615613565b600181111561413157614131614f4b565b1461414f576040516367e554d160e01b815260040160405180910390fd5b6040516348240bab60e01b8152306004820152606860248201526074604482015260756064820152607660848201526001600160a01b03851660a482015260c4810184905282151560e48201527389a5feb31d5585a30094f698d4b802e45e9520af906348240bab9061010401602060405180830381865af41580156141d7573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906140a291906155b9565b60018060735f9054906101000a90046001600160a01b03166001600160a01b031663c19d93fb6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561424e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906142729190615522565b600381111561428357614283614f4b565b146142a1576040516367e554d160e01b815260040160405180910390fd5b60665f9054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156142f1573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906143159190615509565b15156001036143375760405163146f5dc360e21b815260040160405180910390fd5b60655460405163babcc53960e01b81526001600160a01b039091169063babcc53990614367903390600401614a3c565b602060405180830381865afa158015614382573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906143a69190615509565b1580156143cc57506143b66139d8565b6001600160a01b0316336001600160a01b031614155b80156143f157506143db611285565b6001600160a01b0316336001600160a01b031614155b801561440857506073546001600160a01b03163314155b156144265760405163a24e573d60e01b815260040160405180910390fd5b306001600160a01b0384160361446d576001600160a01b03841661445d57604051631f20988960e21b815260040160405180910390fd5b61446784836146f8565b50613d3f565b6001600160a01b0383161580159061448d57506001600160a01b03841615155b15613d3f5760655460405163babcc53960e01b81526001600160a01b039091169063babcc539906144c2908790600401614a3c565b602060405180830381865afa1580156144dd573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906145019190615509565b1580614579575060655460405163babcc53960e01b81526001600160a01b039091169063babcc53990614538908690600401614a3c565b602060405180830381865afa158015614553573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906145779190615509565b155b156145975760405163a24e573d60e01b815260040160405180910390fd5b816145a1856132a6565b1015613d3f5760405163a24e573d60e01b815260040160405180910390fd5b5f614614826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166148c39092919063ffffffff16565b905080515f14806146345750808060200190518101906146349190615509565b613c655760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401611369565b5f54610100900460ff166146b95760405162461bcd60e51b8152600401611369906157bc565b60366146c5838261585d565b506037613c65828261585d565b5f825f0182815481106146e7576146e761570c565b905f5260205f200154905092915050565b60665460408051635c975abb60e01b815290515f926001600160a01b031691635c975abb9160048083019260209291908290030181865afa15801561473f573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906147639190615509565b15156001036147855760405163146f5dc360e21b815260040160405180910390fd5b60018060735f9054906101000a90046001600160a01b03166001600160a01b031663c19d93fb6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156147d8573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906147fc9190615522565b600381111561480d5761480d614f4b565b1461482b576040516367e554d160e01b815260040160405180910390fd5b60655460405163babcc53960e01b81526001600160a01b039091169063babcc5399061485b908790600401614a3c565b602060405180830381865afa158015614876573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061489a9190615509565b6148b75760405163a24e573d60e01b815260040160405180910390fd5b6140a2848460016140aa565b60606140a284845f85855f5f866001600160a01b031685876040516148e89190615917565b5f6040518083038185875af1925050503d805f8114614922576040519150601f19603f3d011682016040523d82523d5f602084013e614927565b606091505b509150915061493887838387614943565b979650505050505050565b606083156149af5782515f036149a85761495c85613ee6565b6149a85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611369565b50816140a2565b6140a283838151156149c45781518083602001fd5b8060405162461bcd60e51b81526004016113699190614ab0565b6040518060e001604052805f81526020015f6001600160a01b031681526020015f81526020015f81526020015f6003811115614a1c57614a1c614f4b565b81525f6020820181905260409091015290565b6001600160a01b03169052565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114614a64575f5ffd5b50565b5f60208284031215614a77575f5ffd5b8135612c5781614a50565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f612c576020830184614a82565b5f60208284031215614ad2575f5ffd5b5035919050565b5f5f60408385031215614aea575f5ffd5b8235614af581614a50565b946020939093013593505050565b5f5f5f5f60808587031215614b16575f5ffd5b8435614b2181614a50565b966020860135965060408601359560600135945092505050565b5f5f5f60608486031215614b4d575f5ffd5b8335614b5881614a50565b92506020840135614b6881614a50565b929592945050506040919091013590565b5f6101a082019050614b8c828451614a2f565b6020830151614b9e6020840182614a2f565b506040830151614bb16040840182614a2f565b50606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e083015160e083015261010083015161010083015261012083015161012083015261014083015161014083015261016083015161016083015261018083015161018083015292915050565b5f5f5f60608486031215614c38575f5ffd5b8335614c4381614a50565b9250602084013591506040840135614c5a81614a50565b809150509250925092565b634e487b7160e01b5f52604160045260245ffd5b60405160e081016001600160401b0381118282101715614c9b57614c9b614c65565b60405290565b60405160a081016001600160401b0381118282101715614c9b57614c9b614c65565b60058110614a64575f5ffd5b5f60e08284031215614cdf575f5ffd5b614ce7614c79565b90508135614cf481614a50565b81526020820135614d0481614a50565b60208201526040820135614d1781614a50565b6040820152606082810135908201526080808301359082015260a0808301359082015260c0820135614d4881614cc3565b60c082015292915050565b5f82601f830112614d62575f5ffd5b81356001600160401b03811115614d7b57614d7b614c65565b604051601f8201601f19908116603f011681016001600160401b0381118282101715614da957614da9614c65565b604052818152838201602001851015614dc0575f5ffd5b816020850160208301375f918101602001919091529392505050565b5f5f5f5f8486036101c0811215614df1575f5ffd5b60a0811215614dfe575f5ffd5b50614e07614ca1565b8535614e1281614a50565b81526020860135614e2281614a50565b60208201526040860135614e3581614a50565b60408201526060860135614e4881614a50565b60608201526080860135614e5b81614a50565b60808201529350614e6f8660a08701614ccf565b92506101808501356001600160401b03811115614e8a575f5ffd5b614e9687828801614d53565b9250506101a08501356001600160401b03811115614eb2575f5ffd5b614ebe87828801614d53565b91505092959194509250565b5f5f5f60608486031215614edc575f5ffd5b833592506020840135614b6881614a50565b5f5f60408385031215614eff575f5ffd5b823591506020830135614f1181614a50565b809150509250929050565b5f5f5f5f60808587031215614f2f575f5ffd5b5050823594602084013594506040840135936060013592509050565b634e487b7160e01b5f52602160045260245ffd5b60048110614a6457614a64614f4b565b8051825260018060a01b03602082015116602083015260408101516040830152606081015160608301525f6080820151614fa881614f5f565b60808401525060a0818101516001600160a01b03169083015260c09081015115159082015260e00190565b602080825282518282018190525f918401906040840190835b8181101561501057614fff838551614f6f565b602094909401939250600101614fec565b509095945050505050565b5f5f5f5f6080858703121561502e575f5ffd5b843561503981614a50565b9350602085013592506040850135915060608501356003811061505a575f5ffd5b939692955090935050565b60038110614a6457614a64614f4b565b6020810161508283615065565b91905290565b5f5f5f5f6060858703121561509b575f5ffd5b8435935060208501356150ad81614a50565b925060408501356001600160401b038111156150c7575f5ffd5b8501601f810187136150d7575f5ffd5b80356001600160401b038111156150ec575f5ffd5b8760208284010111156150fd575f5ffd5b949793965060200194505050565b6020810161508283614f5f565b5f5f60408385031215615129575f5ffd5b823561513481614a50565b91506020830135614f1181614a50565b60058110614a6457614a64614f4b565b61515d81615144565b9052565b80516001600160a01b03908116835260208083015182169084015260408083015190911690830152606080820151908301526080808201519083015260a0818101519083015260c08101516151b581615144565b8060c0840152505050565b60e0810161070e8284615161565b602081526151e0602082018351614a2f565b5f602083015161024060408401526151fc610260840182614a82565b90506040840151601f198483030160608501526152198282614a82565b915050606084015161522e6080850182614a2f565b50608084015161524160a0850182614a2f565b5060a084015160c084015260c084015161525e60e0850182614a2f565b5060e0840151615272610100850182614a2f565b50610100840151615287610120850182614a2f565b5061012084015161529c610140850182614a2f565b506101408401516152b1610160850182614a2f565b506101608401516152c6610180850182614a2f565b506101808401516101a08401526101a08401516101c08401526101c08401516101e08401526101e08401516152ff610200850182615154565b50610200840151801515610220850152506102208401516001600160401b038116610240850152509392505050565b5f8151808452602084019350602083015f5b8281101561536457615353868351614f6f565b955060209190910190600101615340565b5093949350505050565b60208152615380602082018351614a2f565b602082015160408201526040820151606082015260608201516080820152608082015160a082015260a082015160c082015260c082015160e082015260e08201516101008201526101008201516101208201526101208201516101408201526101408201516101608201526101608201516101808201526101808201516101a08201526101a08201516101c08201526101c08201516101e08201526101e08201516102008201525f610200830151610220808401526140a261024084018261532e565b5f5f60408385031215615454575f5ffd5b50508035926020909101359150565b5f60208284031215615473575f5ffd5b8151612c5781614a50565b600181811c9082168061549257607f821691505b60208210810361215e57634e487b7160e01b5f52602260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b808202811582820484141761070e5761070e6154b0565b5f826154f557634e487b7160e01b5f52601260045260245ffd5b500490565b805180151581146116df575f5ffd5b5f60208284031215615519575f5ffd5b612c57826154fa565b5f60208284031215615532575f5ffd5b815160048110612c57575f5ffd5b5f5f5f5f60808587031215615553575f5ffd5b845160208601516040870151919550935061556d81614a50565b915061557b606086016154fa565b905092959194509250565b5f60208284031215615596575f5ffd5b815160ff81168114612c57575f5ffd5b8082018082111561070e5761070e6154b0565b5f602082840312156155c9575f5ffd5b5051919050565b6001600160a01b03858116825284811660208301528316604082015261014081016155fe6060830184615161565b95945050505050565b60028110614a64575f5ffd5b5f60208284031215615623575f5ffd5b8151612c5781615607565b6001600160a01b039586168152602081019490945260408401929092526060830152909116608082015260a00190565b848152602081018490526080810161567584615144565b60408201939093526060015292915050565b5f60e0828403128015615698575f5ffd5b506156a1614c79565b82516156ac81614a50565b815260208301516156bc81614a50565b602082015260408301516156cf81614a50565b6040820152606083810151908201526080808401519082015260a0808401519082015260c083015161570081614cc3565b60c08201529392505050565b634e487b7160e01b5f52603260045260245ffd5b8181038181111561070e5761070e6154b0565b838152602081018390526060810161574a83615065565b826040830152949350505050565b60208152816020820152818360408301375f818301604090810191909152601f909201601f19160101919050565b5f5f60408385031215615797575f5ffd5b6157a0836154fa565b60208401519092506001600160401b0381168114614f11575f5ffd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b601f821115613c655782821115613c6557805f5260205f20601f840160051c602085101561583257505f5b90810190601f840160051c035f5b81811015615855575f83820155600101615840565b505050505050565b81516001600160401b0381111561587657615876614c65565b61588a81615884845461547e565b84615807565b6020601f8211600181146158bc575f83156158a55750848201515b5f19600385901b1c1916600184901b178455611596565b5f84815260208120601f198516915b828110156158eb57878501518255602094850194600190920191016158cb565b508482101561590857868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b5f82518060208501845e5f92019182525091905056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef43391017a4338e81200734cf186544860d19e6b7e502efff86b0368c93917515a2646970667358221220c022c30b5d5140e5bd1d0469a91d6414882b59f4ff75ebbea90c9445a1353a1564736f6c63430008240033","source_code":"//Copyright Open Trade Technology Ltd. 2023. All rights reserved.\n\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.36;\n\nimport { ERC20Upgradeable } from \"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol\";\nimport { IERC20Upgradeable } from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\nimport { SafeERC20Upgradeable } from \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport { IERC20MetadataUpgradeable } from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\n\nimport { SafeCast } from \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\nimport \"./upgrades/BeaconImplementation.sol\";\n\nimport \"./libraries/PoolLibDynamic.sol\";\n\nimport \"./interfaces/IPoolDynamic.sol\";\nimport \"./factories/interfaces/IPoolControllerFactoryDynamic.sol\";\n\nimport \"./factories/interfaces/IPoolAccessControlFactory.sol\";\n\n/**\n * @title Liquidity pool for Perimeter.\n * @dev Used through a beacon proxy.\n */\n\ncontract PoolDynamic is IPoolDynamic, ERC20Upgradeable, BeaconImplementation {\n  using SafeERC20Upgradeable for IERC20Upgradeable;\n  using EnumerableSet for EnumerableSet.Bytes32Set;\n\n  using SafeCast for uint256;\n\n  /**\n   * @dev The reference to the access control contract\n   */\n  IPoolAccessControl public poolAccessControl;\n\n  /**\n   * @dev Reference to the global service configuration.\n   */\n  IServiceConfigurationV5 private _serviceConfiguration;\n\n  /**\n   * @dev Reference to the underlying liquidity asset for the pool.\n   */\n  IERC20Upgradeable private _liquidityAsset;\n\n  /**\n   * @dev Various accounting statistics updated throughout the pool lifetime.\n   */\n  IPoolAccountingsDynamic private _accountings;\n\n  /**\n   * @dev Reference to the admin's controller for the pool.\n   */\n  IPoolControllerDynamic public poolControllerDynamic;\n\n  mapping(address => IPoolLenderDataDynamic) private _lenderData;\n  mapping(bytes32 => IPoolWithdrawDynamic) private _activeWithdraws;\n  EnumerableSet.Bytes32Set private activeWithdrawKeys;\n\n  error RedemptionDoesNotCoverDeposits();\n  error NotPoolController();\n  error NotLender();\n  error NotBorrowerManager();\n  error NotPoolAdmin();\n  error PoolNotActive();\n  error InvalidAccess();\n  error InvalidLoan();\n  error PoolInvalidState();\n  error PoolPaused();\n  error TransferDisabled();\n  error CrossChainError();\n  error RedeemExceedsBalance();\n  error NoAdjustmentsToZeroBalance();\n  error DebitGreaterThanAssets();\n  error RedemptionNotFound();\n  error MintingToPool();\n  error ZeroAmount();\n  error InvalidRedemptions();\n  error ExchangeRateInvalid();\n  // A DepositCorrection debit / Withdrawal credit cannot reduce a total below zero.\n  error AdjustmentExceedsRecordedTotal();\n\n  /**\n   * @dev Modifier to ensure only the PoolController calls a method.\n   */\n  modifier onlyPoolController() {\n    if (msg.sender != address(poolControllerDynamic)) revert NotPoolController();\n    _;\n  }\n\n  /**\n   * @dev Modifier that checks that the caller is a pool lender\n   */\n  modifier onlyLenderWithPPT() {\n    if (balanceOf(msg.sender) == 0) revert NotLender();\n\n    _;\n  }\n\n  modifier depositStateActive() {\n    if (poolControllerDynamic.depositState() != IPoolDepositActiveStateDynamic.Active) revert PoolInvalidState();\n    _;\n  }\n  modifier withdrawStateActive() {\n    if (poolControllerDynamic.withdrawState() != IPoolWithdrawActiveStateDynamic.Active) revert PoolInvalidState();\n    _;\n  }\n\n  modifier atState(IPoolLifeCycleStateDynamic state_) {\n    if (poolControllerDynamic.state() != state_) revert PoolInvalidState();\n    _;\n  }\n  /**\n   * @dev Modifier to check that the protocol is not paused\n   */\n  modifier onlyNotPaused() {\n    if (_serviceConfiguration.paused() == true) revert PoolPaused();\n    _;\n  }\n\n  function decimals() public view override(ERC20Upgradeable, IPoolDynamic) returns (uint8) {\n    return IERC20MetadataUpgradeable(address(_liquidityAsset)).decimals();\n  }\n\n  modifier onlyPermittedLender() {\n    if (!poolAccessControl.isAllowed(msg.sender)) revert NotLender();\n\n    _;\n  }\n  modifier onlyBorrowerManager() {\n    if (IPoolControllerDynamic(poolControllerDynamic).borrowerManager() != msg.sender) revert NotBorrowerManager();\n\n    _;\n  }\n  modifier onlyPoolAdmin() {\n    if (IPoolControllerDynamic(poolControllerDynamic).poolAdmin() != msg.sender) revert NotPoolAdmin();\n\n    _;\n  }\n\n  function isPermittedLender(address receiver) public view returns (bool) {\n    return poolAccessControl.isAllowed(receiver);\n  }\n\n  /**\n     * @dev Initializer for Pool\n\n     * @param poolSettings configurable settings for the pool\n     * @param tokenName Name used for issued pool tokens\n     * @param tokenSymbol Symbol used for issued pool tokens\n     */\n  function initialize(\n    PoolAddressListDynamic memory poolAddressList,\n    IPoolConfigurableSettingsDynamic memory poolSettings,\n    string memory tokenName,\n    string memory tokenSymbol\n  ) public initializer {\n    __ERC20_init(tokenName, tokenSymbol);\n    _serviceConfiguration = IServiceConfigurationV5(poolAddressList.serviceConfiguration);\n\n    _liquidityAsset = IERC20Upgradeable(poolAddressList.liquidityAsset);\n\n    // Build the admin controller\n    poolControllerDynamic = IPoolControllerDynamic(\n      IPoolControllerFactoryDynamic(poolAddressList.poolControllerFactoryDynamic).createController(\n        address(this),\n        poolAddressList.serviceConfiguration,\n        poolAddressList.poolAdmin,\n        poolSettings\n      )\n    );\n    poolAccessControl = IPoolAccessControl(\n      IPoolAccessControlFactory(poolAddressList.poolAccessControlFactory).create(address(this))\n    );\n\n    _accountings.exchangeRate = 1e18;\n    _accountings.exchangeRateSetDay = block.timestamp / 1 days;\n    _accountings.exchangeRateChangeRate = 0;\n    _accountings.exchangeRateCompoundingRate = 1e18;\n    _accountings.exchangeRateAtMaturity = 1e18;\n    _accountings.exchangeRateMaturityDay = (block.timestamp / 1 days);\n\n    emit PoolCreated();\n  }\n\n  /**\n   * @inheritdoc IPoolBase\n   */\n  function serviceConfiguration() public view returns (IServiceConfigurationV5) {\n    return _serviceConfiguration;\n  }\n\n  function settings() public view returns (IPoolConfigurableSettingsDynamic memory poolSettings) {\n    return poolControllerDynamic.settings();\n  }\n\n  function state() public view returns (IPoolLifeCycleStateDynamic) {\n    return poolControllerDynamic.state();\n  }\n\n  function getActiveWithdraws() public view returns (IPoolWithdrawDynamic[] memory) {\n    IPoolWithdrawDynamic[] memory withdraws = new IPoolWithdrawDynamic[](activeWithdrawKeys.length());\n    for (uint256 i = 0; i < activeWithdrawKeys.length(); i++) {\n      withdraws[i] = _activeWithdraws[activeWithdrawKeys.at(i)];\n    }\n    return withdraws;\n  }\n  function admin() public view override returns (address) {\n    return poolControllerDynamic.poolAdmin();\n  }\n\n  function borrowerManagerAddr() public view override returns (address) {\n    return poolControllerDynamic.borrowerManager();\n  }\n\n  function borrowerWalletAddr() external view override returns (address) {\n    return poolControllerDynamic.borrowerWalletAddr();\n  }\n\n  function accountings() external view returns (IPoolAccountingsDynamic memory) {\n    return _accountings;\n  }\n\n  function liquidityAssetAddr() public view returns (address) {\n    return address(_liquidityAsset);\n  }\n\n  function asset() public view returns (address) {\n    return address(_liquidityAsset);\n  }\n\n  function totalAvailableAssets() public view returns (uint256 assets) {\n    return convertToAssets(totalSupply());\n  }\n\n  /**\n   * @inheritdoc IRequestWithdrawable\n   */\n  function previewRedeemRequest(uint256 shares) public view returns (uint256 assets) {\n    if (shares == 0) {\n      revert ZeroAmount();\n    }\n    assets = convertToAssets(shares);\n    // At a low enough exchange rate the division floors to 0.\n    if (assets == 0) {\n      revert ZeroAmount();\n    }\n    // maxRedeemRequest returns 0 while withdrawals are paused, which would otherwise\n    // surface below as a misleading RedeemExceedsBalance.\n    if (poolControllerDynamic.withdrawState() != IPoolWithdrawActiveStateDynamic.Active) {\n      revert PoolInvalidState();\n    }\n    if (shares > maxRedeemRequest(msg.sender)) {\n      revert RedeemExceedsBalance();\n    }\n    if (_lenderData[msg.sender].outstandingRequests > 100) {\n      revert InvalidRedemptions();\n    }\n  }\n\n  /**\n   * @inheritdoc IRequestWithdrawable\n   */\n  function previewWithdrawRequest(uint256 assets) external view returns (uint256 shares) {\n    shares = convertToShares(assets);\n    previewRedeemRequest(shares);\n  }\n\n  function requestRedeem(\n    uint256 shares\n  )\n    public\n    onlyNotPaused\n    atState(IPoolLifeCycleStateDynamic.Active)\n    onlyPermittedLender\n    onlyLenderWithPPT\n    withdrawStateActive\n    returns (uint256 assets)\n  {\n    if (shares == 0) {\n      revert ZeroAmount();\n    }\n    assets = requestRedeemExecute(msg.sender, shares, false);\n  }\n\n  /**\n   * @inheritdoc IRequestWithdrawable\n   */\n  function maxRedeemRequest(address owner) public view returns (uint256 maxShares) {\n    if (poolControllerDynamic.withdrawState() != IPoolWithdrawActiveStateDynamic.Active) {\n      return 0;\n    }\n    return _freeShares(owner);\n  }\n\n  /**\n   * @dev Shares the owner can still redeem, move or have debited: what they hold,\n   * plus what a transfer-route redemption of theirs is holding at the pool address,\n   * less what redemptions already requested or accepted reserve.\n   */\n  function _freeShares(address owner) private view returns (uint256) {\n    uint256 held = balanceOf(owner) + _lenderData[owner].unpaidDirectTransferShares;\n    uint256 reserved = _lenderData[owner].requestedShares + _lenderData[owner].acceptedShares;\n    return held > reserved ? held - reserved : 0;\n  }\n\n  function unpaidDirectTransferShares(address lender) external view returns (uint256) {\n    return _lenderData[lender].unpaidDirectTransferShares;\n  }\n\n  function changeRedemptionDestination(\n    address lender,\n    bytes32 uuid,\n    address fundsDestination\n  ) external onlyNotPaused atState(IPoolLifeCycleStateDynamic.Active) onlyPoolAdmin {\n    if (fundsDestination != address(0) && !poolAccessControl.isAllowed(fundsDestination)) revert NotLender();\n    if (lender != _activeWithdraws[uuid].lender) revert NotLender();\n    if (_activeWithdraws[uuid].shares == 0) {\n      revert RedemptionNotFound();\n    }\n    _activeWithdraws[uuid].fundsDestination = fundsDestination;\n    uint256 shares = _activeWithdraws[uuid].shares;\n    uint256 assets = _activeWithdraws[uuid].assets;\n    emit RedeemDestinationChanged(lender, assets, shares, uuid, fundsDestination);\n  }\n  function acceptRedemption(\n    address lender,\n    bytes32 uuid\n  ) external onlyNotPaused atState(IPoolLifeCycleStateDynamic.Active) onlyBorrowerManager {\n    PoolLibDynamic.acceptRedemption(address(this), _activeWithdraws, _accountings, _lenderData, lender, uuid);\n  }\n\n  function repayRedemption(\n    address lender,\n    uint256 repayment,\n    uint256 fees,\n    bytes32 uuid\n  ) external onlyNotPaused atState(IPoolLifeCycleStateDynamic.Active) onlyPoolAdmin {\n    // The full accepted redemption is always burned and its locked value recorded as\n    // withdrawn; the cash `repayment` is operator-provided and can be partial.\n    (uint256 shares, uint256 assets, address fundsDestination, bool isTransferRedeem) = PoolLibDynamic\n      .executeRepayRedemption(_activeWithdraws, _accountings, _lenderData, activeWithdrawKeys, lender, uuid);\n\n    if (!poolAccessControl.isAllowed(lender)) revert NotLender();\n\n    address feeCollectorAddress = poolControllerDynamic.feeCollectorAddress();\n\n    emit RedeemRepay(lender, shares, repayment, fees, uuid, assets, fundsDestination);\n\n    if (isTransferRedeem) {\n      _burn(address(this), shares);\n    } else {\n      _burn(lender, shares);\n    }\n\n    if (fundsDestination != address(0)) {\n      if (!poolAccessControl.isAllowed(fundsDestination)) revert NotLender();\n\n      _liquidityAsset.safeTransfer(fundsDestination, repayment);\n    }\n\n    _liquidityAsset.safeTransfer(feeCollectorAddress, fees);\n  }\n\n  /**\n   * @inheritdoc IRequestWithdrawable\n   */\n  function maxWithdrawRequest(address owner) public view returns (uint256 maxAssets) {\n    maxAssets = convertToAssets(maxRedeemRequest(owner));\n  }\n\n  function setIndicativeAndCollateralRates(\n    int256 _indicativeInterestRate,\n    uint256 _collateralRate\n  ) public onlyPoolController {\n    _accountings.indicativeInterestRate = _indicativeInterestRate;\n    _accountings.collateralRate = _collateralRate;\n  }\n\n  function setExchangeRate(\n    uint256 _exchangeRate,\n    uint256 _typeDependantChangeParam,\n    uint256 _exchangeRateMaturityDay,\n    int256 _interestRate\n  ) public onlyPoolController {\n    _accountings.exchangeRate = _exchangeRate;\n    _accountings.exchangeRateSetDay = block.timestamp / 1 days;\n    _accountings.interestRate = _interestRate;\n    IPoolDynamicExchangeRateType exchangeRateType = poolControllerDynamic.settings().exchangeRateType;\n    if (exchangeRateType == IPoolDynamicExchangeRateType.Linear) {\n      _accountings.exchangeRateChangeRate = _typeDependantChangeParam;\n    } else if (exchangeRateType == IPoolDynamicExchangeRateType.Compounding) {\n      _accountings.exchangeRateCompoundingRate = _typeDependantChangeParam;\n    } else if (exchangeRateType == IPoolDynamicExchangeRateType.Term) {\n      _accountings.exchangeRateAtMaturity = _typeDependantChangeParam;\n      _accountings.exchangeRateMaturityDay = _exchangeRateMaturityDay;\n    }\n    emit ExchangeRateSet(_exchangeRate, _interestRate, _typeDependantChangeParam, _exchangeRateMaturityDay);\n  }\n\n  function exchangeRate() public view returns (uint256 _exchangeRate) {\n    return PoolLibDynamic.exchangeRate(address(this));\n  }\n  /*//////////////////////////////////////////////////////////////\n                        ERC-4626 Methods\n    //////////////////////////////////////////////////////////////*/\n\n  function totalAssets() public view returns (uint256) {\n    return convertToAssets(totalSupply());\n  }\n\n  function convertToShares(uint256 assets) public view returns (uint256 shares) {\n    shares = (assets * (1e18)) / (exchangeRate());\n  }\n\n  function convertToAssets(uint256 shares) public view returns (uint256 assets) {\n    assets = (exchangeRate() * (shares)) / (1e18);\n  }\n\n  function addAdjustmentAmount(\n    address lender,\n    uint256 debit,\n    uint256 credit,\n    IPoolDynamicAdjustmentKind kind\n  ) public atState(IPoolLifeCycleStateDynamic.Active) onlyPoolController {\n    if (debit > 0 && credit > 0) {\n      revert InvalidAccess();\n    }\n    if (lender == address(0) || lender == address(this)) {\n      revert InvalidAccess();\n    }\n\n    if (!poolAccessControl.isAllowed(lender)) revert NotLender();\n    if (debit > 0) {\n      uint256 shares = convertToShares(debit);\n      // Not maxRedeemRequest: it returns 0 whenever withdrawals are paused, which\n      // would block every admin debit.\n      uint256 free = _freeShares(lender);\n      if (shares > free) {\n        revert DebitGreaterThanAssets();\n      }\n      _burn(lender, shares);\n      if (kind == IPoolDynamicAdjustmentKind.DepositCorrection) {\n        if (debit > _lenderData[lender].assetsDeposited) revert AdjustmentExceedsRecordedTotal();\n        _accountings.totalAssetsDeposited -= debit;\n        _lenderData[lender].assetsDeposited -= debit;\n      } else if (kind == IPoolDynamicAdjustmentKind.Withdrawal) {\n        _accountings.totalAssetsWithdrawn += debit;\n        _lenderData[lender].assetsWithdrawn += debit;\n      }\n      emit AccountDebit(lender, debit, shares);\n    } else if (credit > 0) {\n      uint256 shares = convertToShares(credit);\n      _mint(lender, shares);\n      if (kind == IPoolDynamicAdjustmentKind.DepositCorrection) {\n        _accountings.totalAssetsDeposited += credit;\n        _lenderData[lender].assetsDeposited += credit;\n      } else if (kind == IPoolDynamicAdjustmentKind.Withdrawal) {\n        if (credit > _lenderData[lender].assetsWithdrawn) revert AdjustmentExceedsRecordedTotal();\n        _accountings.totalAssetsWithdrawn -= credit;\n        _lenderData[lender].assetsWithdrawn -= credit;\n      }\n      emit AccountCredit(lender, credit, shares);\n    } else {\n      revert InvalidAccess();\n    }\n    emit AccountAdjustment(lender, debit, credit, kind);\n  }\n\n  function assetBalanceOf(address lender) public view returns (uint256) {\n    return convertToAssets(balanceOf(lender));\n  }\n\n  function depositOffChain(\n    uint256 assets,\n    address lender,\n    string calldata paymentId\n  ) public virtual onlyNotPaused atState(IPoolLifeCycleStateDynamic.Active) onlyPoolAdmin returns (uint256 shares) {\n    if (!poolAccessControl.isAllowed(lender)) revert NotLender();\n\n    shares = PoolLibDynamic.executeDeposit(address(this), _accountings, _lenderData, assets, lender);\n\n    _mint(lender, shares);\n\n    emit PoolDeposit(lender, assets, shares, IPoolDynamicDepositType.OffChainDeposit, bytes32(0));\n    // Off-chain deposits have no on-chain funding tx.\n    if (bytes(paymentId).length > 0) {\n      emit PoolDepositPaymentRef(lender, paymentId);\n    }\n  }\n\n  function deposit(\n    uint256 assets,\n    address lender\n  )\n    public\n    virtual\n    onlyNotPaused\n    atState(IPoolLifeCycleStateDynamic.Active)\n    onlyPermittedLender\n    depositStateActive\n    returns (uint256 shares)\n  {\n    // lender parameter could be msg.sender, but we choose to keep it as a parameter\n    // to keep the interface compatible with previous versions.\n    if (msg.sender != lender) revert PoolInvalidState();\n\n    shares = PoolLibDynamic.executeDeposit(address(this), _accountings, _lenderData, assets, lender);\n\n    _liquidityAsset.safeTransferFrom(msg.sender, address(this), assets);\n    _mint(lender, shares);\n\n    address borrowerWalletAddr_ = poolControllerDynamic.borrowerWalletAddr();\n    _liquidityAsset.safeTransfer(borrowerWalletAddr_, assets);\n\n    emit PoolDeposit(lender, assets, shares, IPoolDynamicDepositType.ContractDeposit, bytes32(0));\n  }\n\n  // Gated by onlyPoolAdmin only. The destination is the borrower wallet fixed in\n  // settings, not caller-supplied, so paying the borrower stays available while\n  // paused or not Active.\n  function transferToBorrowerWallet(uint256 assets) public onlyPoolAdmin {\n    address borrowerWalletAddr_ = poolControllerDynamic.borrowerWalletAddr();\n    _liquidityAsset.safeTransfer(borrowerWalletAddr_, assets);\n    emit TransferAssets(borrowerWalletAddr_, assets);\n  }\n\n  function depositFromTransfer(\n    uint256 assets,\n    address lender,\n    bytes32 transferTxHash\n  ) public virtual onlyNotPaused atState(IPoolLifeCycleStateDynamic.Active) onlyPoolAdmin returns (uint256 shares) {\n    if (!poolAccessControl.isAllowed(lender)) revert NotLender();\n    if (transferTxHash == 0) revert InvalidAccess();\n\n    shares = PoolLibDynamic.executeDeposit(address(this), _accountings, _lenderData, assets, lender);\n\n    _mint(lender, shares);\n\n    address borrowerWalletAddr_ = poolControllerDynamic.borrowerWalletAddr();\n    _liquidityAsset.safeTransfer(borrowerWalletAddr_, assets);\n\n    emit PoolDeposit(lender, assets, shares, IPoolDynamicDepositType.TransferDeposit, transferTxHash);\n  }\n\n  /*//////////////////////////////////////////////////////////////\n                            ERC-20 Overrides\n    //////////////////////////////////////////////////////////////*/\n\n  function requestRedeemViaTransfer(\n    address lender,\n    uint256 shares\n  ) internal onlyNotPaused atState(IPoolLifeCycleStateDynamic.Active) returns (uint256 assets) {\n    if (!poolAccessControl.isAllowed(lender)) {\n      revert TransferDisabled();\n    }\n\n    return requestRedeemExecute(lender, shares, true);\n  }\n\n  function requestRedeemExecute(\n    address lender,\n    uint256 shares,\n    bool transferRedeem\n  ) internal withdrawStateActive returns (uint256 assets) {\n    return\n      PoolLibDynamic.requestRedeemExecute(\n        address(this),\n        _accountings,\n        _lenderData,\n        _activeWithdraws,\n        activeWithdrawKeys,\n        lender,\n        shares,\n        transferRedeem\n      );\n  }\n\n  /**\n   * @dev Runs before every Perimeter Pool Token transfer. Reverts transfers from senders that are\n   * not allowed. A transfer to the pool address is routed to requestRedeemViaTransfer as a redeem\n   * request.\n   */\n  function _beforeTokenTransfer(\n    address from,\n    address to,\n    uint256 amount\n  ) internal virtual override atState(IPoolLifeCycleStateDynamic.Active) onlyNotPaused {\n    super._beforeTokenTransfer(from, to, amount);\n\n    if (\n      !poolAccessControl.isAllowed(msg.sender) &&\n      msg.sender != admin() &&\n      msg.sender != borrowerManagerAddr() &&\n      msg.sender != address(poolControllerDynamic)\n    ) {\n      revert TransferDisabled();\n    }\n\n    if (to == address(this)) {\n      if (from == address(0)) revert MintingToPool();\n      requestRedeemViaTransfer(from, amount);\n    } else {\n      if (to != address(0) && from != address(0)) {\n        if (!poolAccessControl.isAllowed(from) || !poolAccessControl.isAllowed(to)) {\n          revert TransferDisabled();\n        }\n        if (maxRedeemRequest(from) < amount) {\n          revert TransferDisabled();\n        }\n      }\n    }\n  }\n\n  function poolType() external pure returns (IPoolType) {\n    return IPoolType.DynamicPool;\n  }\n\n  function getPoolDynamicConfigurationState()\n    public\n    view\n    returns (IPoolConfigurationStateDynamic memory _poolConfigutationState)\n  {\n    IPoolConfigurableSettingsDynamic memory _settings = poolControllerDynamic.settings();\n    (bool interestDuringWithdraw, uint64 interestDuringWithdrawDays) = poolControllerDynamic\n      .interestDuringWithdrawSettings();\n    return\n      IPoolConfigurationStateDynamic({\n        poolAddr: address(this),\n        name: name(),\n        symbol: symbol(),\n        poolAccessControl: address(poolAccessControl),\n        poolControllerDynamic: address(poolControllerDynamic),\n        activatedAt: poolControllerDynamic.activatedAt(),\n        // PoolControllerDynamic\n        serviceConfiguration: poolControllerDynamic.serviceConfiguration(),\n        liquidityAssetAddr: address(_liquidityAsset),\n        poolAdmin: poolControllerDynamic.poolAdmin(),\n        borrowerManager: _settings.borrowerManager,\n        borrowerWalletAddr: _settings.borrowerWalletAddr,\n        feeCollectorAddress: _settings.feeCollectorAddress,\n        closeOfDepositTime: _settings.closeOfDepositTime,\n        closeOfWithdrawTime: _settings.closeOfWithdrawTime,\n        transferOutDays: _settings.transferOutDays,\n        exchangeRateType: _settings.exchangeRateType,\n        interestDuringWithdraw: interestDuringWithdraw,\n        interestDuringWithdrawDays: interestDuringWithdrawDays\n      });\n  }\n  function getPoolDynamicOverviewState() public view returns (IPoolOverviewStateDynamic memory _poolOverviewState) {\n    return\n      IPoolOverviewStateDynamic({\n        poolAddr: address(this),\n        state: uint256(poolControllerDynamic.state()),\n        // accountings\n        totalAssetsDeposited: _accountings.totalAssetsDeposited,\n        totalAssetsWithdrawn: _accountings.totalAssetsWithdrawn,\n        exchangeRate: exchangeRate(),\n        exchangeRateAtSetDay: _accountings.exchangeRate,\n        exchangeRateSetDay: _accountings.exchangeRateSetDay,\n        exchangeRateChangeRate: _accountings.exchangeRateChangeRate,\n        exchangeRateCompoundingRate: _accountings.exchangeRateCompoundingRate,\n        exchangeRateAtMaturity: _accountings.exchangeRateAtMaturity,\n        exchangeRateMaturityDay: _accountings.exchangeRateMaturityDay,\n        interestRate: _accountings.interestRate,\n        indicativeInterestRate: _accountings.indicativeInterestRate,\n        collateralRate: _accountings.collateralRate,\n        activeWithdraws: getActiveWithdraws(),\n        totalShares: totalSupply(),\n        totalAssets: totalAvailableAssets()\n      });\n  }\n\n  function getPoolDynamicAccountState(\n    address lender\n  ) public view returns (IPoolAccountStateDynamic memory _poolAccountState) {\n    return\n      IPoolAccountStateDynamic({\n        poolAddr: address(this),\n        accountAddr: lender,\n        liquidityAssetAddr: address(_liquidityAsset),\n        tokenBalance: balanceOf(lender),\n        assetBalance: assetBalanceOf(lender),\n        maxWithdrawRequest: maxWithdrawRequest(lender),\n        maxRedeemRequest: maxRedeemRequest(lender),\n        requestedSharesOf: _lenderData[lender].requestedShares,\n        requestedAssetsOf: _lenderData[lender].requestedAssets,\n        acceptedShares: _lenderData[lender].acceptedShares,\n        acceptedAssets: _lenderData[lender].acceptedAssets,\n        assetsDeposited: _lenderData[lender].assetsDeposited,\n        assetsWithdrawn: _lenderData[lender].assetsWithdrawn\n      });\n  }\n}\n","creation_status":"success","file_path":"contracts/PoolDynamic.sol"}